diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 82cf90f5c126..6618822ce39a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -811,6 +811,8 @@ "google-cloud-speech-v1p1beta1+FILLER": "0.0.0", "google-cloud-speech-v2": "1.8.0", "google-cloud-speech-v2+FILLER": "0.0.0", + "google-cloud-sql-v1": "0.0.1", + "google-cloud-sql-v1+FILLER": "0.0.0", "google-cloud-storage": "1.61.0", "google-cloud-storage+FILLER": "0.0.0", "google-cloud-storage-control": "1.4.0", diff --git a/google-cloud-sql-v1/.OwlBot.yaml b/google-cloud-sql-v1/.OwlBot.yaml new file mode 100644 index 000000000000..da00e85faa8d --- /dev/null +++ b/google-cloud-sql-v1/.OwlBot.yaml @@ -0,0 +1,3 @@ +deep-copy-regex: + - source: /google/cloud/sql/v1/[^/]+-ruby/(.*) + dest: /owl-bot-staging/google-cloud-sql-v1/$1 diff --git a/google-cloud-sql-v1/.gitignore b/google-cloud-sql-v1/.gitignore new file mode 100644 index 000000000000..0135b6bc6cfc --- /dev/null +++ b/google-cloud-sql-v1/.gitignore @@ -0,0 +1,22 @@ +# Ignore bundler lockfiles +Gemfile.lock +gems.locked + +# Ignore documentation output +doc/* +.yardoc/* + +# Ignore test output +coverage/* + +# Ignore build artifacts +pkg/* + +# Ignore files commonly present in certain dev environments +.vagrant +.DS_STORE +.idea +*.iml + +# Ignore synth output +__pycache__ diff --git a/google-cloud-sql-v1/.owlbot-manifest.json b/google-cloud-sql-v1/.owlbot-manifest.json new file mode 100644 index 000000000000..bb5009162bc8 --- /dev/null +++ b/google-cloud-sql-v1/.owlbot-manifest.json @@ -0,0 +1,243 @@ +{ + "generated": [ + ".gitignore", + ".repo-metadata.json", + ".rubocop.yml", + ".toys.rb", + ".yardopts", + "AUTHENTICATION.md", + "CHANGELOG.md", + "Gemfile", + "LICENSE.md", + "README.md", + "Rakefile", + "gapic_metadata.json", + "google-cloud-sql-v1.gemspec", + "lib/google-cloud-sql-v1.rb", + "lib/google/cloud/sql/v1.rb", + "lib/google/cloud/sql/v1/cloud_sql_available_database_versions_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_available_database_versions_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_backup_runs_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_backup_runs_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_backups_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_backups_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_connect_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_connect_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_databases_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_databases_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_events_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_events_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_feature_eligibility_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_feature_eligibility_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_flags_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_flags_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_iam_policies_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_iam_policies_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_instance_names_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_instance_names_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_instances_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_instances_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_operations_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_operations_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_regions_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_regions_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_resources_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_ssl_certs_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_ssl_certs_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_tiers_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_tiers_services_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_users_pb.rb", + "lib/google/cloud/sql/v1/cloud_sql_users_services_pb.rb", + "lib/google/cloud/sql/v1/rest.rb", + "lib/google/cloud/sql/v1/sql_backup_runs_service.rb", + "lib/google/cloud/sql/v1/sql_backup_runs_service/client.rb", + "lib/google/cloud/sql/v1/sql_backup_runs_service/credentials.rb", + "lib/google/cloud/sql/v1/sql_backup_runs_service/rest.rb", + "lib/google/cloud/sql/v1/sql_backup_runs_service/rest/client.rb", + "lib/google/cloud/sql/v1/sql_backup_runs_service/rest/service_stub.rb", + "lib/google/cloud/sql/v1/sql_backups_service.rb", + "lib/google/cloud/sql/v1/sql_backups_service/client.rb", + "lib/google/cloud/sql/v1/sql_backups_service/credentials.rb", + "lib/google/cloud/sql/v1/sql_backups_service/paths.rb", + "lib/google/cloud/sql/v1/sql_backups_service/rest.rb", + "lib/google/cloud/sql/v1/sql_backups_service/rest/client.rb", + "lib/google/cloud/sql/v1/sql_backups_service/rest/service_stub.rb", + "lib/google/cloud/sql/v1/sql_connect_service.rb", + "lib/google/cloud/sql/v1/sql_connect_service/client.rb", + "lib/google/cloud/sql/v1/sql_connect_service/credentials.rb", + "lib/google/cloud/sql/v1/sql_connect_service/rest.rb", + "lib/google/cloud/sql/v1/sql_connect_service/rest/client.rb", + "lib/google/cloud/sql/v1/sql_connect_service/rest/service_stub.rb", + "lib/google/cloud/sql/v1/sql_databases_service.rb", + "lib/google/cloud/sql/v1/sql_databases_service/client.rb", + "lib/google/cloud/sql/v1/sql_databases_service/credentials.rb", + "lib/google/cloud/sql/v1/sql_databases_service/rest.rb", + "lib/google/cloud/sql/v1/sql_databases_service/rest/client.rb", + "lib/google/cloud/sql/v1/sql_databases_service/rest/service_stub.rb", + "lib/google/cloud/sql/v1/sql_flags_service.rb", + "lib/google/cloud/sql/v1/sql_flags_service/client.rb", + "lib/google/cloud/sql/v1/sql_flags_service/credentials.rb", + "lib/google/cloud/sql/v1/sql_flags_service/rest.rb", + "lib/google/cloud/sql/v1/sql_flags_service/rest/client.rb", + "lib/google/cloud/sql/v1/sql_flags_service/rest/service_stub.rb", + "lib/google/cloud/sql/v1/sql_instances_service.rb", + "lib/google/cloud/sql/v1/sql_instances_service/client.rb", + "lib/google/cloud/sql/v1/sql_instances_service/credentials.rb", + "lib/google/cloud/sql/v1/sql_instances_service/paths.rb", + "lib/google/cloud/sql/v1/sql_instances_service/rest.rb", + "lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb", + "lib/google/cloud/sql/v1/sql_instances_service/rest/service_stub.rb", + "lib/google/cloud/sql/v1/sql_operations_service.rb", + "lib/google/cloud/sql/v1/sql_operations_service/client.rb", + "lib/google/cloud/sql/v1/sql_operations_service/credentials.rb", + "lib/google/cloud/sql/v1/sql_operations_service/rest.rb", + "lib/google/cloud/sql/v1/sql_operations_service/rest/client.rb", + "lib/google/cloud/sql/v1/sql_operations_service/rest/service_stub.rb", + "lib/google/cloud/sql/v1/sql_ssl_certs_service.rb", + "lib/google/cloud/sql/v1/sql_ssl_certs_service/client.rb", + "lib/google/cloud/sql/v1/sql_ssl_certs_service/credentials.rb", + "lib/google/cloud/sql/v1/sql_ssl_certs_service/rest.rb", + "lib/google/cloud/sql/v1/sql_ssl_certs_service/rest/client.rb", + "lib/google/cloud/sql/v1/sql_ssl_certs_service/rest/service_stub.rb", + "lib/google/cloud/sql/v1/sql_tiers_service.rb", + "lib/google/cloud/sql/v1/sql_tiers_service/client.rb", + "lib/google/cloud/sql/v1/sql_tiers_service/credentials.rb", + "lib/google/cloud/sql/v1/sql_tiers_service/rest.rb", + "lib/google/cloud/sql/v1/sql_tiers_service/rest/client.rb", + "lib/google/cloud/sql/v1/sql_tiers_service/rest/service_stub.rb", + "lib/google/cloud/sql/v1/sql_users_service.rb", + "lib/google/cloud/sql/v1/sql_users_service/client.rb", + "lib/google/cloud/sql/v1/sql_users_service/credentials.rb", + "lib/google/cloud/sql/v1/sql_users_service/rest.rb", + "lib/google/cloud/sql/v1/sql_users_service/rest/client.rb", + "lib/google/cloud/sql/v1/sql_users_service/rest/service_stub.rb", + "lib/google/cloud/sql/v1/version.rb", + "proto_docs/README.md", + "proto_docs/google/api/client.rb", + "proto_docs/google/api/field_behavior.rb", + "proto_docs/google/api/field_info.rb", + "proto_docs/google/api/launch_stage.rb", + "proto_docs/google/api/resource.rb", + "proto_docs/google/cloud/sql/v1/cloud_sql_backup_runs.rb", + "proto_docs/google/cloud/sql/v1/cloud_sql_backups.rb", + "proto_docs/google/cloud/sql/v1/cloud_sql_connect.rb", + "proto_docs/google/cloud/sql/v1/cloud_sql_databases.rb", + "proto_docs/google/cloud/sql/v1/cloud_sql_flags.rb", + "proto_docs/google/cloud/sql/v1/cloud_sql_instances.rb", + "proto_docs/google/cloud/sql/v1/cloud_sql_operations.rb", + "proto_docs/google/cloud/sql/v1/cloud_sql_resources.rb", + "proto_docs/google/cloud/sql/v1/cloud_sql_ssl_certs.rb", + "proto_docs/google/cloud/sql/v1/cloud_sql_tiers.rb", + "proto_docs/google/cloud/sql/v1/cloud_sql_users.rb", + "proto_docs/google/protobuf/any.rb", + "proto_docs/google/protobuf/duration.rb", + "proto_docs/google/protobuf/empty.rb", + "proto_docs/google/protobuf/field_mask.rb", + "proto_docs/google/protobuf/timestamp.rb", + "proto_docs/google/protobuf/wrappers.rb", + "proto_docs/google/rpc/status.rb", + "proto_docs/google/type/interval.rb", + "snippets/Gemfile", + "snippets/snippet_metadata_google.cloud.sql.v1.json", + "snippets/sql_backup_runs_service/delete.rb", + "snippets/sql_backup_runs_service/get.rb", + "snippets/sql_backup_runs_service/insert.rb", + "snippets/sql_backup_runs_service/list.rb", + "snippets/sql_backups_service/create_backup.rb", + "snippets/sql_backups_service/delete_backup.rb", + "snippets/sql_backups_service/get_backup.rb", + "snippets/sql_backups_service/list_backups.rb", + "snippets/sql_backups_service/update_backup.rb", + "snippets/sql_connect_service/generate_ephemeral_cert.rb", + "snippets/sql_connect_service/get_connect_settings.rb", + "snippets/sql_databases_service/delete.rb", + "snippets/sql_databases_service/get.rb", + "snippets/sql_databases_service/insert.rb", + "snippets/sql_databases_service/list.rb", + "snippets/sql_databases_service/patch.rb", + "snippets/sql_databases_service/update.rb", + "snippets/sql_flags_service/list.rb", + "snippets/sql_instances_service/acquire_ssrs_lease.rb", + "snippets/sql_instances_service/add_entra_id_certificate.rb", + "snippets/sql_instances_service/add_server_ca.rb", + "snippets/sql_instances_service/add_server_certificate.rb", + "snippets/sql_instances_service/call_clone.rb", + "snippets/sql_instances_service/create_ephemeral.rb", + "snippets/sql_instances_service/delete.rb", + "snippets/sql_instances_service/demote.rb", + "snippets/sql_instances_service/demote_master.rb", + "snippets/sql_instances_service/execute_sql.rb", + "snippets/sql_instances_service/export.rb", + "snippets/sql_instances_service/failover.rb", + "snippets/sql_instances_service/get.rb", + "snippets/sql_instances_service/get_disk_shrink_config.rb", + "snippets/sql_instances_service/get_latest_recovery_time.rb", + "snippets/sql_instances_service/import.rb", + "snippets/sql_instances_service/insert.rb", + "snippets/sql_instances_service/list.rb", + "snippets/sql_instances_service/list_entra_id_certificates.rb", + "snippets/sql_instances_service/list_server_cas.rb", + "snippets/sql_instances_service/list_server_certificates.rb", + "snippets/sql_instances_service/patch.rb", + "snippets/sql_instances_service/perform_disk_shrink.rb", + "snippets/sql_instances_service/point_in_time_restore.rb", + "snippets/sql_instances_service/pre_check_major_version_upgrade.rb", + "snippets/sql_instances_service/promote_replica.rb", + "snippets/sql_instances_service/reencrypt.rb", + "snippets/sql_instances_service/release_ssrs_lease.rb", + "snippets/sql_instances_service/reschedule_maintenance.rb", + "snippets/sql_instances_service/reset_replica_size.rb", + "snippets/sql_instances_service/reset_ssl_config.rb", + "snippets/sql_instances_service/restart.rb", + "snippets/sql_instances_service/restore_backup.rb", + "snippets/sql_instances_service/rotate_entra_id_certificate.rb", + "snippets/sql_instances_service/rotate_server_ca.rb", + "snippets/sql_instances_service/rotate_server_certificate.rb", + "snippets/sql_instances_service/start_external_sync.rb", + "snippets/sql_instances_service/start_replica.rb", + "snippets/sql_instances_service/stop_replica.rb", + "snippets/sql_instances_service/switchover.rb", + "snippets/sql_instances_service/truncate_log.rb", + "snippets/sql_instances_service/update.rb", + "snippets/sql_instances_service/verify_external_sync_settings.rb", + "snippets/sql_operations_service/cancel.rb", + "snippets/sql_operations_service/get.rb", + "snippets/sql_operations_service/list.rb", + "snippets/sql_ssl_certs_service/delete.rb", + "snippets/sql_ssl_certs_service/get.rb", + "snippets/sql_ssl_certs_service/insert.rb", + "snippets/sql_ssl_certs_service/list.rb", + "snippets/sql_tiers_service/list.rb", + "snippets/sql_users_service/delete.rb", + "snippets/sql_users_service/get.rb", + "snippets/sql_users_service/insert.rb", + "snippets/sql_users_service/list.rb", + "snippets/sql_users_service/update.rb", + "test/google/cloud/sql/v1/sql_backup_runs_service_rest_test.rb", + "test/google/cloud/sql/v1/sql_backup_runs_service_test.rb", + "test/google/cloud/sql/v1/sql_backups_service_paths_test.rb", + "test/google/cloud/sql/v1/sql_backups_service_rest_test.rb", + "test/google/cloud/sql/v1/sql_backups_service_test.rb", + "test/google/cloud/sql/v1/sql_connect_service_rest_test.rb", + "test/google/cloud/sql/v1/sql_connect_service_test.rb", + "test/google/cloud/sql/v1/sql_databases_service_rest_test.rb", + "test/google/cloud/sql/v1/sql_databases_service_test.rb", + "test/google/cloud/sql/v1/sql_flags_service_rest_test.rb", + "test/google/cloud/sql/v1/sql_flags_service_test.rb", + "test/google/cloud/sql/v1/sql_instances_service_paths_test.rb", + "test/google/cloud/sql/v1/sql_instances_service_rest_test.rb", + "test/google/cloud/sql/v1/sql_instances_service_test.rb", + "test/google/cloud/sql/v1/sql_operations_service_rest_test.rb", + "test/google/cloud/sql/v1/sql_operations_service_test.rb", + "test/google/cloud/sql/v1/sql_ssl_certs_service_rest_test.rb", + "test/google/cloud/sql/v1/sql_ssl_certs_service_test.rb", + "test/google/cloud/sql/v1/sql_tiers_service_rest_test.rb", + "test/google/cloud/sql/v1/sql_tiers_service_test.rb", + "test/google/cloud/sql/v1/sql_users_service_rest_test.rb", + "test/google/cloud/sql/v1/sql_users_service_test.rb", + "test/helper.rb" + ], + "static": [ + ".OwlBot.yaml" + ] +} diff --git a/google-cloud-sql-v1/.repo-metadata.json b/google-cloud-sql-v1/.repo-metadata.json new file mode 100644 index 000000000000..796f86976db6 --- /dev/null +++ b/google-cloud-sql-v1/.repo-metadata.json @@ -0,0 +1,15 @@ +{ + "api_id": "sqladmin.googleapis.com", + "api_shortname": "sqladmin", + "client_documentation": "https://cloud.google.com/ruby/docs/reference/google-cloud-sql-v1/latest", + "distribution_name": "google-cloud-sql-v1", + "is_cloud": true, + "language": "ruby", + "name": "sqladmin", + "name_pretty": "Cloud SQL Admin V1 API", + "release_level": "unreleased", + "repo": "googleapis/google-cloud-ruby", + "requires_billing": true, + "ruby-cloud-description": "API for Cloud SQL database instance management. Note that google-cloud-sql-v1 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-sql instead. See the readme for more details.", + "library_type": "GAPIC_AUTO" +} diff --git a/google-cloud-sql-v1/.rubocop.yml b/google-cloud-sql-v1/.rubocop.yml new file mode 100644 index 000000000000..0e09cab1349f --- /dev/null +++ b/google-cloud-sql-v1/.rubocop.yml @@ -0,0 +1,33 @@ +inherit_gem: + google-style: google-style.yml + +AllCops: + Exclude: + - "google-cloud-sql-v1.gemspec" + - "lib/**/*_pb.rb" + - "proto_docs/**/*" + - "test/**/*" + - "acceptance/**/*" + - "samples/acceptance/**/*" + - "Rakefile" + +Layout/LineLength: + Enabled: false +Metrics/AbcSize: + Enabled: false +Metrics/ClassLength: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false +Metrics/MethodLength: + Enabled: false +Metrics/ModuleLength: + Enabled: false +Metrics/PerceivedComplexity: + Enabled: false +Naming/AccessorMethodName: + Exclude: + - "snippets/**/*.rb" +Naming/FileName: + Exclude: + - "lib/google-cloud-sql-v1.rb" diff --git a/google-cloud-sql-v1/.toys.rb b/google-cloud-sql-v1/.toys.rb new file mode 100644 index 000000000000..177e22456e8a --- /dev/null +++ b/google-cloud-sql-v1/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +toys_version! ">= 0.15.3" + +if ENV["RUBY_COMMON_TOOLS"] + common_tools_dir = File.expand_path ENV["RUBY_COMMON_TOOLS"] + load File.join(common_tools_dir, "toys", "gapic") +else + load_git remote: "https://github.com/googleapis/ruby-common-tools.git", + path: "toys/gapic", + update: true +end diff --git a/google-cloud-sql-v1/.yardopts b/google-cloud-sql-v1/.yardopts new file mode 100644 index 000000000000..c95d1bbddf31 --- /dev/null +++ b/google-cloud-sql-v1/.yardopts @@ -0,0 +1,12 @@ +--no-private +--title="Cloud SQL Admin V1 API" +--exclude _pb\.rb$ +--markup markdown +--markup-provider redcarpet + +./lib/**/*.rb +./proto_docs/**/*.rb +- +README.md +LICENSE.md +AUTHENTICATION.md diff --git a/google-cloud-sql-v1/AUTHENTICATION.md b/google-cloud-sql-v1/AUTHENTICATION.md new file mode 100644 index 000000000000..5e1b2b9fb4ce --- /dev/null +++ b/google-cloud-sql-v1/AUTHENTICATION.md @@ -0,0 +1,122 @@ +# Authentication + +The recommended way to authenticate to the google-cloud-sql-v1 library is to use +[Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/application-default-credentials). +To review all of your authentication options, see [Credentials lookup](#credential-lookup). + +## Quickstart + +The following example shows how to set up authentication for a local development +environment with your user credentials. + +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. + +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: + +```sh +gcloud auth application-default login +``` + +3. Write code as if already authenticated. + +For more information about setting up authentication for a local development environment, see +[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev). + +## Credential Lookup + +The google-cloud-sql-v1 library provides several mechanisms to configure your system. +Generally, using Application Default Credentials to facilitate automatic +credentials discovery is the easist method. But if you need to explicitly specify +credentials, there are several methods available to you. + +Credentials are accepted in the following ways, in the following order or precedence: + +1. Credentials specified in method arguments +2. Credentials specified in configuration +3. Credentials pointed to or included in environment variables +4. Credentials found in local ADC file +5. Credentials returned by the metadata server for the attached service account (GCP) + +### Configuration + +You can configure a path to a JSON credentials file, either for an individual client object or +globally, for all client objects. The JSON file can contain credentials created for +[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), +[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a +[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). + +Note: Service account keys are a security risk if not managed correctly. You should +[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) +whenever possible. + +To configure a credentials file for an individual client initialization: + +```ruby +require "google/cloud/sql/v1" + +client = ::Google::Cloud::Sql::V1::SqlAvailableDatabaseVersionsService::Client.new do |config| + config.credentials = "path/to/credentialfile.json" +end +``` + +To configure a credentials file globally for all clients: + +```ruby +require "google/cloud/sql/v1" + +::Google::Cloud::Sql::V1::SqlAvailableDatabaseVersionsService::Client.configure do |config| + config.credentials = "path/to/credentialfile.json" +end + +client = ::Google::Cloud::Sql::V1::SqlAvailableDatabaseVersionsService::Client.new +``` + +### Environment Variables + +You can also use an environment variable to provide a JSON credentials file. +The environment variable can contain a path to the credentials file or, for +environments such as Docker containers where writing files is not encouraged, +you can include the credentials file itself. + +The JSON file can contain credentials created for +[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), +[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a +[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). + +Note: Service account keys are a security risk if not managed correctly. You should +[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) +whenever possible. + +The environment variables that google-cloud-sql-v1 +checks for credentials are: + +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file + +```ruby +require "google/cloud/sql/v1" + +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" + +client = ::Google::Cloud::Sql::V1::SqlAvailableDatabaseVersionsService::Client.new +``` + +### Local ADC file + +You can set up a local ADC file with your user credentials for authentication during +development. If credentials are not provided in code or in environment variables, +then the local ADC credentials are discovered. + +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. + +### Google Cloud Platform environments + +When running on Google Cloud Platform (GCP), including Google Compute Engine +(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud +Functions (GCF) and Cloud Run, credentials are retrieved from the attached +service account automatically. Code should be written as if already authenticated. + +For more information, see +[Set up ADC for Google Cloud services](https://cloud.google.com/docs/authentication/provide-credentials-adc#attached-sa). diff --git a/google-cloud-sql-v1/CHANGELOG.md b/google-cloud-sql-v1/CHANGELOG.md new file mode 100644 index 000000000000..f88957a62ba2 --- /dev/null +++ b/google-cloud-sql-v1/CHANGELOG.md @@ -0,0 +1,2 @@ +# Release History + diff --git a/google-cloud-sql-v1/Gemfile b/google-cloud-sql-v1/Gemfile new file mode 100644 index 000000000000..1d08558908d8 --- /dev/null +++ b/google-cloud-sql-v1/Gemfile @@ -0,0 +1,14 @@ +source "https://rubygems.org" + +gemspec + +gem "google-style", "~> 1.32.0" +gem "irb", "~> 1.17" +gem "minitest", "~> 6.0.2" +gem "minitest-focus", "~> 1.4" +gem "minitest-mock", "~> 5.27" +gem "minitest-rg", "~> 5.3" +gem "ostruct", "~> 0.5.5" +gem "rake", ">= 13.0" +gem "redcarpet", "~> 3.6" +gem "yard", "~> 0.9" diff --git a/google-cloud-sql-v1/LICENSE.md b/google-cloud-sql-v1/LICENSE.md new file mode 100644 index 000000000000..c261857ba6ad --- /dev/null +++ b/google-cloud-sql-v1/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/google-cloud-sql-v1/README.md b/google-cloud-sql-v1/README.md new file mode 100644 index 000000000000..d9199c18374d --- /dev/null +++ b/google-cloud-sql-v1/README.md @@ -0,0 +1,146 @@ +# Ruby Client for the Cloud SQL Admin V1 API + +API for Cloud SQL database instance management. + + +https://github.com/googleapis/google-cloud-ruby + +This gem is a _versioned_ client. It provides basic client classes for a +specific version of the Cloud SQL Admin V1 API. Most users should consider using +the main client gem, +[google-cloud-sql](https://rubygems.org/gems/google-cloud-sql). +See the section below titled *Which client should I use?* for more information. + +## Installation + +``` +$ gem install google-cloud-sql-v1 +``` + +## Before You Begin + +In order to use this library, you first need to go through the following steps: + +1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project) +1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project) +1. [Enable the API.](https://console.cloud.google.com/apis/library/sqladmin.googleapis.com) +1. [Set up authentication.](AUTHENTICATION.md) + +## Quick Start + +```ruby +require "google/cloud/sql/v1" +``` + +View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-sql-v1/latest) +for class and method documentation. + +## Debug Logging + +This library comes with opt-in Debug Logging that can help you troubleshoot +your application's integration with the API. When logging is activated, key +events such as requests and responses, along with data payloads and metadata +such as headers and client configuration, are logged to the standard error +stream. + +**WARNING:** Client Library Debug Logging includes your data payloads in +plaintext, which could include sensitive data such as PII for yourself or your +customers, private keys, or other security data that could be compromising if +leaked. Always practice good data hygiene with your application logs, and follow +the principle of least access. Google also recommends that Client Library Debug +Logging be enabled only temporarily during active debugging, and not used +permanently in production. + +To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS` +to the value `all`. Alternatively, you can set the value to a comma-delimited +list of client library gem names. This will select the default logging behavior, +which writes logs to the standard error stream. On a local workstation, this may +result in logs appearing on the console. When running on a Google Cloud hosting +service such as [Google Cloud Run](https://cloud.google.com/run), this generally +results in logs appearing alongside your application logs in the +[Google Cloud Logging](https://cloud.google.com/logging/) service. + +You can customize logging by modifying the `logger` configuration when +constructing a client object. For example: + +```ruby +require "google/cloud/sql/v1" +require "logger" + +client = ::Google::Cloud::Sql::V1::SqlAvailableDatabaseVersionsService::Client.new do |config| + config.logger = Logger.new "my-app.log" +end +``` + +## Google Cloud Samples + +To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples). + +## Supported Ruby Versions + +This library is supported on Ruby 3.2+. + +Google provides official support for Ruby versions that are actively supported +by Ruby Core—that is, Ruby versions that are either in normal maintenance or +in security maintenance, and not end of life. Older versions of Ruby _may_ +still work, but are unsupported and not recommended. See +https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby +support schedule. + +## Which client should I use? + +Most modern Ruby client libraries for Google APIs come in two flavors: the main +client library with a name such as `google-cloud-sql`, +and lower-level _versioned_ client libraries with names such as +`google-cloud-sql-v1`. +_In most cases, you should install the main client._ + +### What's the difference between the main client and a versioned client? + +A _versioned client_ provides a basic set of data types and client classes for +a _single version_ of a specific service. (That is, for a service with multiple +versions, there might be a separate versioned client for each service version.) +Most versioned clients are written and maintained by a code generator. + +The _main client_ is designed to provide you with the _recommended_ client +interfaces for the service. There will be only one main client for any given +service, even a service with multiple versions. The main client includes +factory methods for constructing the client objects we recommend for most +users. In some cases, those will be classes provided by an underlying versioned +client; in other cases, they will be handwritten higher-level client objects +with additional capabilities, convenience methods, or best practices built in. +Generally, the main client will default to a recommended service version, +although in some cases you can override this if you need to talk to a specific +service version. + +### Why would I want to use the main client? + +We recommend that most users install the main client gem for a service. You can +identify this gem as the one _without_ a version in its name, e.g. +`google-cloud-sql`. +The main client is recommended because it will embody the best practices for +accessing the service, and may also provide more convenient interfaces or +tighter integration into frameworks and third-party libraries. In addition, the +documentation and samples published by Google will generally demonstrate use of +the main client. + +### Why would I want to use a versioned client? + +You can use a versioned client if you are content with a possibly lower-level +class interface, you explicitly want to avoid features provided by the main +client, or you want to access a specific service version not be covered by the +main client. You can identify versioned client gems because the service version +is part of the name, e.g. `google-cloud-sql-v1`. + +### What about the google-apis- clients? + +Client library gems with names that begin with `google-apis-` are based on an +older code generation technology. They talk to a REST/JSON backend (whereas +most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may +not offer the same performance, features, and ease of use provided by more +modern clients. + +The `google-apis-` clients have wide coverage across Google services, so you +might need to use one if there is no modern client available for the service. +However, if a modern client is available, we generally recommend it over the +older `google-apis-` clients. diff --git a/google-cloud-sql-v1/Rakefile b/google-cloud-sql-v1/Rakefile new file mode 100644 index 000000000000..d415b9bc315b --- /dev/null +++ b/google-cloud-sql-v1/Rakefile @@ -0,0 +1,169 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "bundler/setup" +require "bundler/gem_tasks" + +require "rubocop/rake_task" +RuboCop::RakeTask.new + +require "rake/testtask" +desc "Run tests." +Rake::TestTask.new do |t| + t.libs << "test" + t.test_files = FileList["test/**/*_test.rb"] + t.warning = false +end + +desc "Runs the smoke tests." +Rake::TestTask.new :smoke_test do |t| + t.test_files = FileList["acceptance/**/*smoke_test.rb"] + t.warning = false +end + +# Acceptance tests +desc "Run the google-cloud-sql-v1 acceptance tests." +task :acceptance, :project, :keyfile do |t, args| + project = args[:project] + project ||= + ENV["GOOGLE_CLOUD_TEST_PROJECT"] || + ENV["GCLOUD_TEST_PROJECT"] + keyfile = args[:keyfile] + keyfile ||= + ENV["GOOGLE_CLOUD_TEST_KEYFILE"] || + ENV["GCLOUD_TEST_KEYFILE"] + if keyfile + keyfile = File.read keyfile + else + keyfile ||= + ENV["GOOGLE_CLOUD_TEST_KEYFILE_JSON"] || + ENV["GCLOUD_TEST_KEYFILE_JSON"] + end + if project.nil? || keyfile.nil? + fail "You must provide a project and keyfile. e.g. rake acceptance[test123, /path/to/keyfile.json] or GOOGLE_CLOUD_TEST_PROJECT=test123 GOOGLE_CLOUD_TEST_KEYFILE=/path/to/keyfile.json rake acceptance" + end + require "google/cloud/sql/v1/sql_available_database_versions_service/credentials" + ::Google::Cloud::Sql::V1::SqlAvailableDatabaseVersionsService::Credentials.env_vars.each do |path| + ENV[path] = nil + end + ENV["GOOGLE_CLOUD_PROJECT"] = project + ENV["GOOGLE_CLOUD_TEST_PROJECT"] = project + ENV["GOOGLE_CLOUD_KEYFILE_JSON"] = keyfile + + Rake::Task["acceptance:run"].invoke +end + +namespace :acceptance do + task :run do + if File.directory? "acceptance" + Rake::Task[:smoke_test].invoke + else + puts "The google-cloud-sql-v1 gem has no acceptance tests." + end + end + + desc "Run acceptance cleanup." + task :cleanup do + end +end + +task :samples do + Rake::Task["samples:latest"].invoke +end + +namespace :samples do + task :latest do + if File.directory? "samples" + Dir.chdir "samples" do + Bundler.with_clean_env do + ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "not_master" + sh "bundle update" + sh "bundle exec rake test" + end + end + else + puts "The google-cloud-sql-v1 gem has no samples to test." + end + end + + task :master do + if File.directory? "samples" + Dir.chdir "samples" do + Bundler.with_clean_env do + ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "master" + sh "bundle update" + sh "bundle exec rake test" + end + end + else + puts "The google-cloud-sql-v1 gem has no samples to test." + end + end +end + +require "yard" +require "yard/rake/yardoc_task" +YARD::Rake::YardocTask.new do |y| + y.options << "--fail-on-warning" +end + +desc "Run yard-doctest example tests." +task :doctest do + puts "The google-cloud-sql-v1 gem does not have doctest tests." +end + +desc "Run the CI build" +task :ci do + header "BUILDING google-cloud-sql-v1" + header "google-cloud-sql-v1 rubocop", "*" + Rake::Task[:rubocop].invoke + header "google-cloud-sql-v1 yard", "*" + Rake::Task[:yard].invoke + header "google-cloud-sql-v1 test", "*" + Rake::Task[:test].invoke +end + +namespace :ci do + desc "Run the CI build, with smoke tests." + task :smoke_test do + Rake::Task[:ci].invoke + header "google-cloud-sql-v1 smoke_test", "*" + Rake::Task[:smoke_test].invoke + end + desc "Run the CI build, with acceptance tests." + task :acceptance do + Rake::Task[:ci].invoke + header "google-cloud-sql-v1 acceptance", "*" + Rake::Task[:acceptance].invoke + end + task :a do + # This is a handy shortcut to save typing + Rake::Task["ci:acceptance"].invoke + end +end + +task default: :test + +def header str, token = "#" + line_length = str.length + 8 + puts "" + puts token * line_length + puts "#{token * 3} #{str} #{token * 3}" + puts token * line_length + puts "" +end diff --git a/google-cloud-sql-v1/gapic_metadata.json b/google-cloud-sql-v1/gapic_metadata.json new file mode 100644 index 000000000000..8ca0f4a9b0d8 --- /dev/null +++ b/google-cloud-sql-v1/gapic_metadata.json @@ -0,0 +1,517 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "ruby", + "protoPackage": "google.cloud.sql.v1", + "libraryPackage": "::Google::Cloud::Sql::V1", + "services": { + "SqlAvailableDatabaseVersionsService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlAvailableDatabaseVersionsService::Client", + "rpcs": {} + } + } + }, + "SqlBackupRunsService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlBackupRunsService::Client", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + } + } + } + } + }, + "SqlInstancesService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlInstancesService::Client", + "rpcs": { + "AddServerCa": { + "methods": [ + "add_server_ca" + ] + }, + "AddServerCertificate": { + "methods": [ + "add_server_certificate" + ] + }, + "AddEntraIdCertificate": { + "methods": [ + "add_entra_id_certificate" + ] + }, + "Clone": { + "methods": [ + "call_clone" + ] + }, + "Delete": { + "methods": [ + "delete" + ] + }, + "DemoteMaster": { + "methods": [ + "demote_master" + ] + }, + "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": [ + "list_server_cas" + ] + }, + "ListServerCertificates": { + "methods": [ + "list_server_certificates" + ] + }, + "ListEntraIdCertificates": { + "methods": [ + "list_entra_id_certificates" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + }, + "PromoteReplica": { + "methods": [ + "promote_replica" + ] + }, + "Switchover": { + "methods": [ + "switchover" + ] + }, + "ResetSslConfig": { + "methods": [ + "reset_ssl_config" + ] + }, + "Restart": { + "methods": [ + "restart" + ] + }, + "RestoreBackup": { + "methods": [ + "restore_backup" + ] + }, + "RotateServerCa": { + "methods": [ + "rotate_server_ca" + ] + }, + "RotateServerCertificate": { + "methods": [ + "rotate_server_certificate" + ] + }, + "RotateEntraIdCertificate": { + "methods": [ + "rotate_entra_id_certificate" + ] + }, + "StartReplica": { + "methods": [ + "start_replica" + ] + }, + "StopReplica": { + "methods": [ + "stop_replica" + ] + }, + "TruncateLog": { + "methods": [ + "truncate_log" + ] + }, + "Update": { + "methods": [ + "update" + ] + }, + "CreateEphemeral": { + "methods": [ + "create_ephemeral" + ] + }, + "RescheduleMaintenance": { + "methods": [ + "reschedule_maintenance" + ] + }, + "VerifyExternalSyncSettings": { + "methods": [ + "verify_external_sync_settings" + ] + }, + "StartExternalSync": { + "methods": [ + "start_external_sync" + ] + }, + "PerformDiskShrink": { + "methods": [ + "perform_disk_shrink" + ] + }, + "GetDiskShrinkConfig": { + "methods": [ + "get_disk_shrink_config" + ] + }, + "ResetReplicaSize": { + "methods": [ + "reset_replica_size" + ] + }, + "GetLatestRecoveryTime": { + "methods": [ + "get_latest_recovery_time" + ] + }, + "ExecuteSql": { + "methods": [ + "execute_sql" + ] + }, + "AcquireSsrsLease": { + "methods": [ + "acquire_ssrs_lease" + ] + }, + "ReleaseSsrsLease": { + "methods": [ + "release_ssrs_lease" + ] + }, + "PreCheckMajorVersionUpgrade": { + "methods": [ + "pre_check_major_version_upgrade" + ] + }, + "PointInTimeRestore": { + "methods": [ + "point_in_time_restore" + ] + } + } + } + } + }, + "SqlBackupsService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlBackupsService::Client", + "rpcs": { + "CreateBackup": { + "methods": [ + "create_backup" + ] + }, + "GetBackup": { + "methods": [ + "get_backup" + ] + }, + "ListBackups": { + "methods": [ + "list_backups" + ] + }, + "UpdateBackup": { + "methods": [ + "update_backup" + ] + }, + "DeleteBackup": { + "methods": [ + "delete_backup" + ] + } + } + } + } + }, + "SqlConnectService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlConnectService::Client", + "rpcs": { + "GetConnectSettings": { + "methods": [ + "get_connect_settings" + ] + }, + "GenerateEphemeralCert": { + "methods": [ + "generate_ephemeral_cert" + ] + } + } + } + } + }, + "SqlDatabasesService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + }, + "Update": { + "methods": [ + "update" + ] + } + } + } + } + }, + "SqlEventsService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlEventsService::Client", + "rpcs": {} + } + } + }, + "SqlFeatureEligibilityService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlFeatureEligibilityService::Client", + "rpcs": {} + } + } + }, + "SqlFlagsService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlFlagsService::Client", + "rpcs": { + "List": { + "methods": [ + "list" + ] + } + } + } + } + }, + "SqlIamPoliciesService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlIamPoliciesService::Client", + "rpcs": {} + } + } + }, + "SqlInstanceNamesService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlInstanceNamesService::Client", + "rpcs": {} + } + } + }, + "SqlOperationsService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlOperationsService::Client", + "rpcs": { + "Get": { + "methods": [ + "get" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Cancel": { + "methods": [ + "cancel" + ] + } + } + } + } + }, + "SqlRegionsService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlRegionsService::Client", + "rpcs": {} + } + } + }, + "SqlSslCertsService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlSslCertsService::Client", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + } + } + } + } + }, + "SqlTiersService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlTiersService::Client", + "rpcs": { + "List": { + "methods": [ + "list" + ] + } + } + } + } + }, + "SqlUsersService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Sql::V1::SqlUsersService::Client", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Update": { + "methods": [ + "update" + ] + } + } + } + } + } + } +} diff --git a/google-cloud-sql-v1/google-cloud-sql-v1.gemspec b/google-cloud-sql-v1/google-cloud-sql-v1.gemspec new file mode 100644 index 000000000000..7c24849b239f --- /dev/null +++ b/google-cloud-sql-v1/google-cloud-sql-v1.gemspec @@ -0,0 +1,29 @@ +# -*- ruby -*- +# encoding: utf-8 + +require File.expand_path("lib/google/cloud/sql/v1/version", __dir__) + +Gem::Specification.new do |gem| + gem.name = "google-cloud-sql-v1" + gem.version = Google::Cloud::Sql::V1::VERSION + + gem.authors = ["Google LLC"] + gem.email = "googleapis-packages@google.com" + gem.description = "API for Cloud SQL database instance management. Note that google-cloud-sql-v1 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-sql instead. See the readme for more details." + gem.summary = "API for Cloud SQL database instance management." + gem.homepage = "https://github.com/googleapis/google-cloud-ruby" + gem.license = "Apache-2.0" + + gem.platform = Gem::Platform::RUBY + + gem.files = `git ls-files -- lib/*`.split("\n") + + `git ls-files -- proto_docs/*`.split("\n") + + ["README.md", "LICENSE.md", "AUTHENTICATION.md", ".yardopts"] + gem.require_paths = ["lib"] + + gem.required_ruby_version = ">= 3.2" + + gem.add_dependency "gapic-common", "~> 1.3" + gem.add_dependency "google-cloud-errors", "~> 1.0" + gem.add_dependency "google-cloud-location", "~> 1.0" +end diff --git a/google-cloud-sql-v1/lib/google-cloud-sql-v1.rb b/google-cloud-sql-v1/lib/google-cloud-sql-v1.rb new file mode 100644 index 000000000000..053f24d4d435 --- /dev/null +++ b/google-cloud-sql-v1/lib/google-cloud-sql-v1.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# This gem does not autoload during Bundler.require. To load this gem, +# issue explicit require statements for the packages desired, e.g.: +# require "google/cloud/sql/v1" diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1.rb new file mode 100644 index 000000000000..ff793eff6630 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/sql/v1/sql_available_database_versions_service" +require "google/cloud/sql/v1/sql_backup_runs_service" +require "google/cloud/sql/v1/sql_instances_service" +require "google/cloud/sql/v1/sql_backups_service" +require "google/cloud/sql/v1/sql_connect_service" +require "google/cloud/sql/v1/sql_databases_service" +require "google/cloud/sql/v1/sql_events_service" +require "google/cloud/sql/v1/sql_feature_eligibility_service" +require "google/cloud/sql/v1/sql_flags_service" +require "google/cloud/sql/v1/sql_iam_policies_service" +require "google/cloud/sql/v1/sql_instance_names_service" +require "google/cloud/sql/v1/sql_operations_service" +require "google/cloud/sql/v1/sql_regions_service" +require "google/cloud/sql/v1/sql_ssl_certs_service" +require "google/cloud/sql/v1/sql_tiers_service" +require "google/cloud/sql/v1/sql_users_service" +require "google/cloud/sql/v1/version" + +module Google + module Cloud + module Sql + ## + # API client module. + # + # @example Load this package, including all its services, and instantiate a gRPC client + # + # require "google/cloud/sql/v1" + # client = ::Google::Cloud::Sql::V1::SqlAvailableDatabaseVersionsService::Client.new + # + # @example Load this package, including all its services, and instantiate a REST client + # + # require "google/cloud/sql/v1" + # client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new + # + module V1 + end + end + end +end + +helper_path = ::File.join __dir__, "v1", "_helpers.rb" +require "google/cloud/sql/v1/_helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_available_database_versions_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_available_database_versions_pb.rb new file mode 100644 index 000000000000..b0507bd74cf1 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_available_database_versions_pb.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_available_database_versions.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' + + +descriptor_data = "\n?google/cloud/sql/v1/cloud_sql_available_database_versions.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto2A\n#SqlAvailableDatabaseVersionsService\x1a\x1a\xca\x41\x17sqladmin.googleapis.comBn\n\x17\x63om.google.cloud.sql.v1B&CloudSqlAvailableDatabaseVersionsProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_available_database_versions_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_available_database_versions_services_pb.rb new file mode 100644 index 000000000000..81effb75104b --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_available_database_versions_services_pb.rb @@ -0,0 +1,29 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_available_database_versions.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_available_database_versions_pb' + +module Google + module Cloud + module Sql + module V1 + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_backup_runs_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_backup_runs_pb.rb new file mode 100644 index 000000000000..24627a738dca --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_backup_runs_pb.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_backup_runs.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/cloud/sql/v1/cloud_sql_resources_pb' +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n/google/cloud/sql/v1/cloud_sql_backup_runs.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a-google/cloud/sql/v1/cloud_sql_resources.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"K\n\x1aSqlBackupRunsDeleteRequest\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x10\n\x08instance\x18\x02 \x01(\t\x12\x0f\n\x07project\x18\x03 \x01(\t\"H\n\x17SqlBackupRunsGetRequest\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x10\n\x08instance\x18\x02 \x01(\t\x12\x0f\n\x07project\x18\x03 \x01(\t\"m\n\x1aSqlBackupRunsInsertRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12,\n\x04\x62ody\x18\x64 \x01(\x0b\x32\x1e.google.cloud.sql.v1.BackupRun\"f\n\x18SqlBackupRunsListRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x13\n\x0bmax_results\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\x12\x0f\n\x07project\x18\x04 \x01(\t\"\xd4\x06\n\tBackupRun\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x37\n\x06status\x18\x02 \x01(\x0e\x32\'.google.cloud.sql.v1.SqlBackupRunStatus\x12\x31\n\renqueued_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\n\n\x02id\x18\x04 \x01(\x03\x12.\n\nstart_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x32\n\x05\x65rror\x18\x07 \x01(\x0b\x32#.google.cloud.sql.v1.OperationError\x12\x33\n\x04type\x18\x08 \x01(\x0e\x32%.google.cloud.sql.v1.SqlBackupRunType\x12\x13\n\x0b\x64\x65scription\x18\t \x01(\t\x12\x35\n\x11window_start_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x10\n\x08instance\x18\x0b \x01(\t\x12\x11\n\tself_link\x18\x0c \x01(\t\x12\x10\n\x08location\x18\r \x01(\t\x12\x46\n\x10\x64\x61tabase_version\x18\x0f \x01(\x0e\x32\'.google.cloud.sql.v1.SqlDatabaseVersionB\x03\xe0\x41\x03\x12W\n\x1d\x64isk_encryption_configuration\x18\x10 \x01(\x0b\x32\x30.google.cloud.sql.v1.DiskEncryptionConfiguration\x12I\n\x16\x64isk_encryption_status\x18\x11 \x01(\x0b\x32).google.cloud.sql.v1.DiskEncryptionStatus\x12\x37\n\x0b\x62\x61\x63kup_kind\x18\x13 \x01(\x0e\x32\".google.cloud.sql.v1.SqlBackupKind\x12\x11\n\ttime_zone\x18\x17 \x01(\t\x12&\n\x14max_chargeable_bytes\x18\x18 \x01(\x03\x42\x03\xe0\x41\x03H\x00\x88\x01\x01\x42\x17\n\x15_max_chargeable_bytes\"n\n\x16\x42\x61\x63kupRunsListResponse\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12-\n\x05items\x18\x02 \x03(\x0b\x32\x1e.google.cloud.sql.v1.BackupRun\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\t*\xc4\x01\n\x12SqlBackupRunStatus\x12%\n!SQL_BACKUP_RUN_STATUS_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x45NQUEUED\x10\x01\x12\x0b\n\x07OVERDUE\x10\x02\x12\x0b\n\x07RUNNING\x10\x03\x12\n\n\x06\x46\x41ILED\x10\x04\x12\x0e\n\nSUCCESSFUL\x10\x05\x12\x0b\n\x07SKIPPED\x10\x06\x12\x14\n\x10\x44\x45LETION_PENDING\x10\x07\x12\x13\n\x0f\x44\x45LETION_FAILED\x10\x08\x12\x0b\n\x07\x44\x45LETED\x10\t*L\n\rSqlBackupKind\x12\x1f\n\x1bSQL_BACKUP_KIND_UNSPECIFIED\x10\x00\x12\x0c\n\x08SNAPSHOT\x10\x01\x12\x0c\n\x08PHYSICAL\x10\x02*U\n\x10SqlBackupRunType\x12#\n\x1fSQL_BACKUP_RUN_TYPE_UNSPECIFIED\x10\x00\x12\r\n\tAUTOMATED\x10\x01\x12\r\n\tON_DEMAND\x10\x02\x32\x97\x06\n\x14SqlBackupRunsService\x12\x9e\x01\n\x06\x44\x65lete\x12/.google.cloud.sql.v1.SqlBackupRunsDeleteRequest\x1a\x1e.google.cloud.sql.v1.Operation\"C\x82\xd3\xe4\x93\x02=*;/v1/projects/{project}/instances/{instance}/backupRuns/{id}\x12\x98\x01\n\x03Get\x12,.google.cloud.sql.v1.SqlBackupRunsGetRequest\x1a\x1e.google.cloud.sql.v1.BackupRun\"C\x82\xd3\xe4\x93\x02=\x12;/v1/projects/{project}/instances/{instance}/backupRuns/{id}\x12\x9f\x01\n\x06Insert\x12/.google.cloud.sql.v1.SqlBackupRunsInsertRequest\x1a\x1e.google.cloud.sql.v1.Operation\"D\x82\xd3\xe4\x93\x02>\"6/v1/projects/{project}/instances/{instance}/backupRuns:\x04\x62ody\x12\xa2\x01\n\x04List\x12-.google.cloud.sql.v1.SqlBackupRunsListRequest\x1a+.google.cloud.sql.v1.BackupRunsListResponse\">\x82\xd3\xe4\x93\x02\x38\x12\x36/v1/projects/{project}/instances/{instance}/backupRuns\x1a|\xca\x41\x17sqladmin.googleapis.com\xd2\x41_https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.adminB_\n\x17\x63om.google.cloud.sql.v1B\x17\x43loudSqlBackupRunsProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + SqlBackupRunsDeleteRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlBackupRunsDeleteRequest").msgclass + SqlBackupRunsGetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlBackupRunsGetRequest").msgclass + SqlBackupRunsInsertRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlBackupRunsInsertRequest").msgclass + SqlBackupRunsListRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlBackupRunsListRequest").msgclass + BackupRun = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.BackupRun").msgclass + BackupRunsListResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.BackupRunsListResponse").msgclass + SqlBackupRunStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlBackupRunStatus").enummodule + SqlBackupKind = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlBackupKind").enummodule + SqlBackupRunType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlBackupRunType").enummodule + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_backup_runs_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_backup_runs_services_pb.rb new file mode 100644 index 000000000000..a418b54a9534 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_backup_runs_services_pb.rb @@ -0,0 +1,53 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_backup_runs.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_backup_runs_pb' + +module Google + module Cloud + module Sql + module V1 + module SqlBackupRunsService + # Service for managing database backups. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.sql.v1.SqlBackupRunsService' + + # Deletes the backup taken by a backup run. + rpc :Delete, ::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest, ::Google::Cloud::Sql::V1::Operation + # Retrieves a resource containing information about a backup run. + rpc :Get, ::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest, ::Google::Cloud::Sql::V1::BackupRun + # Creates a new backup run on demand. + rpc :Insert, ::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest, ::Google::Cloud::Sql::V1::Operation + # 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, ::Google::Cloud::Sql::V1::SqlBackupRunsListRequest, ::Google::Cloud::Sql::V1::BackupRunsListResponse + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_backups_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_backups_pb.rb new file mode 100644 index 000000000000..43d8d516abe7 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_backups_pb.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_backups.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/sql/v1/cloud_sql_backup_runs_pb' +require 'google/cloud/sql/v1/cloud_sql_instances_pb' +require 'google/cloud/sql/v1/cloud_sql_resources_pb' +require 'google/protobuf/field_mask_pb' +require 'google/protobuf/timestamp_pb' +require 'google/protobuf/wrappers_pb' +require 'google/type/interval_pb' + + +descriptor_data = "\n+google/cloud/sql/v1/cloud_sql_backups.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a/google/cloud/sql/v1/cloud_sql_backup_runs.proto\x1a-google/cloud/sql/v1/cloud_sql_instances.proto\x1a-google/cloud/sql/v1/cloud_sql_resources.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1agoogle/type/interval.proto\"\x7f\n\x13\x43reateBackupRequest\x12\x36\n\x06parent\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \x12\x1esqladmin.googleapis.com/Backup\x12\x30\n\x06\x62\x61\x63kup\x18\x02 \x01(\x0b\x32\x1b.google.cloud.sql.v1.BackupB\x03\xe0\x41\x02\"H\n\x10GetBackupRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1esqladmin.googleapis.com/Backup\"\x83\x01\n\x12ListBackupsRequest\x12\x36\n\x06parent\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \x12\x1esqladmin.googleapis.com/Backup\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x04 \x01(\t\"\x8f\x01\n\x13ListBackupsResponse\x12,\n\x07\x62\x61\x63kups\x18\x01 \x03(\x0b\x32\x1b.google.cloud.sql.v1.Backup\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12\x31\n\x08warnings\x18\x03 \x03(\x0b\x32\x1f.google.cloud.sql.v1.ApiWarning\"x\n\x13UpdateBackupRequest\x12\x30\n\x06\x62\x61\x63kup\x18\x01 \x01(\x0b\x32\x1b.google.cloud.sql.v1.BackupB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"K\n\x13\x44\x65leteBackupRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1esqladmin.googleapis.com/Backup\"\xa3\n\n\x06\x42\x61\x63kup\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x11\n\x04kind\x18\x02 \x01(\tB\x03\xe0\x41\x03\x12\x16\n\tself_link\x18\x03 \x01(\tB\x03\xe0\x41\x03\x12<\n\x04type\x18\x04 \x01(\x0e\x32).google.cloud.sql.v1.Backup.SqlBackupTypeB\x03\xe0\x41\x03\x12\x13\n\x0b\x64\x65scription\x18\x05 \x01(\t\x12\x10\n\x08instance\x18\x06 \x01(\t\x12\x10\n\x08location\x18\x07 \x01(\t\x12\x33\n\x0f\x62\x61\x63kup_interval\x18\x08 \x01(\x0b\x32\x15.google.type.IntervalB\x03\xe0\x41\x03\x12>\n\x05state\x18\t \x01(\x0e\x32*.google.cloud.sql.v1.Backup.SqlBackupStateB\x03\xe0\x41\x03\x12\x37\n\x05\x65rror\x18\n \x01(\x0b\x32#.google.cloud.sql.v1.OperationErrorB\x03\xe0\x41\x03\x12\x14\n\x07kms_key\x18\x0b \x01(\tB\x03\xe0\x41\x03\x12\x1c\n\x0fkms_key_version\x18\x0c \x01(\tB\x03\xe0\x41\x03\x12<\n\x0b\x62\x61\x63kup_kind\x18\r \x01(\x0e\x32\".google.cloud.sql.v1.SqlBackupKindB\x03\xe0\x41\x03\x12\x16\n\ttime_zone\x18\x0f \x01(\tB\x03\xe0\x41\x03\x12\x17\n\x08ttl_days\x18\x10 \x01(\x03\x42\x03\xe0\x41\x04H\x00\x12\x31\n\x0b\x65xpiry_time\x18\x11 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x12\x46\n\x10\x64\x61tabase_version\x18\x14 \x01(\x0e\x32\'.google.cloud.sql.v1.SqlDatabaseVersionB\x03\xe0\x41\x03\x12&\n\x14max_chargeable_bytes\x18\x17 \x01(\x03\x42\x03\xe0\x41\x03H\x01\x88\x01\x01\x12\x42\n\x16instance_deletion_time\x18\x18 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x06\xe0\x41\x01\xe0\x41\x03\x12H\n\x11instance_settings\x18\x19 \x01(\x0b\x32%.google.cloud.sql.v1.DatabaseInstanceB\x06\xe0\x41\x01\xe0\x41\x03\x12\x17\n\nbackup_run\x18\x1a \x01(\tB\x03\xe0\x41\x03\x12\x36\n\rsatisfies_pzs\x18\x1b \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x03\x12\x36\n\rsatisfies_pzi\x18\x1c \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x03\"Y\n\rSqlBackupType\x12\x1f\n\x1bSQL_BACKUP_TYPE_UNSPECIFIED\x10\x00\x12\r\n\tAUTOMATED\x10\x01\x12\r\n\tON_DEMAND\x10\x02\x12\t\n\x05\x46INAL\x10\x03\"\x8c\x01\n\x0eSqlBackupState\x12 \n\x1cSQL_BACKUP_STATE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x45NQUEUED\x10\x01\x12\x0b\n\x07RUNNING\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nSUCCESSFUL\x10\x04\x12\x0c\n\x08\x44\x45LETING\x10\x05\x12\x13\n\x0f\x44\x45LETION_FAILED\x10\x06:H\xea\x41\x45\n\x1esqladmin.googleapis.com/Backup\x12#projects/{project}/backups/{backup}B\x0c\n\nexpirationB\x17\n\x15_max_chargeable_bytes2\xf8\x06\n\x11SqlBackupsService\x12\x9a\x01\n\x0c\x43reateBackup\x12(.google.cloud.sql.v1.CreateBackupRequest\x1a\x1e.google.cloud.sql.v1.Operation\"@\xda\x41\x0eparent, backup\x82\xd3\xe4\x93\x02)\"\x1f/v1/{parent=projects/*}/backups:\x06\x62\x61\x63kup\x12\x7f\n\tGetBackup\x12%.google.cloud.sql.v1.GetBackupRequest\x1a\x1b.google.cloud.sql.v1.Backup\".\xda\x41\x04name\x82\xd3\xe4\x93\x02!\x12\x1f/v1/{name=projects/*/backups/*}\x12\x92\x01\n\x0bListBackups\x12\'.google.cloud.sql.v1.ListBackupsRequest\x1a(.google.cloud.sql.v1.ListBackupsResponse\"0\xda\x41\x06parent\x82\xd3\xe4\x93\x02!\x12\x1f/v1/{parent=projects/*}/backups\x12\xa6\x01\n\x0cUpdateBackup\x12(.google.cloud.sql.v1.UpdateBackupRequest\x1a\x1e.google.cloud.sql.v1.Operation\"L\xda\x41\x13\x62\x61\x63kup, update_mask\x82\xd3\xe4\x93\x02\x30\x32&/v1/{backup.name=projects/*/backups/*}:\x06\x62\x61\x63kup\x12\x88\x01\n\x0c\x44\x65leteBackup\x12(.google.cloud.sql.v1.DeleteBackupRequest\x1a\x1e.google.cloud.sql.v1.Operation\".\xda\x41\x04name\x82\xd3\xe4\x93\x02!*\x1f/v1/{name=projects/*/backups/*}\x1a|\xca\x41\x17sqladmin.googleapis.com\xd2\x41_https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.adminB\\\n\x17\x63om.google.cloud.sql.v1B\x14\x43loudSqlBackupsProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + CreateBackupRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.CreateBackupRequest").msgclass + GetBackupRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.GetBackupRequest").msgclass + ListBackupsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ListBackupsRequest").msgclass + ListBackupsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ListBackupsResponse").msgclass + UpdateBackupRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.UpdateBackupRequest").msgclass + DeleteBackupRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DeleteBackupRequest").msgclass + Backup = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Backup").msgclass + Backup::SqlBackupType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Backup.SqlBackupType").enummodule + Backup::SqlBackupState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Backup.SqlBackupState").enummodule + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_backups_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_backups_services_pb.rb new file mode 100644 index 000000000000..5554af0680cf --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_backups_services_pb.rb @@ -0,0 +1,54 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_backups.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_backups_pb' + +module Google + module Cloud + module Sql + module V1 + module SqlBackupsService + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.sql.v1.SqlBackupsService' + + # Creates a backup for a Cloud SQL instance. This API can be used only to + # create on-demand backups. + rpc :CreateBackup, ::Google::Cloud::Sql::V1::CreateBackupRequest, ::Google::Cloud::Sql::V1::Operation + # Retrieves a resource containing information about a backup. + rpc :GetBackup, ::Google::Cloud::Sql::V1::GetBackupRequest, ::Google::Cloud::Sql::V1::Backup + # Lists all backups associated with the project. + rpc :ListBackups, ::Google::Cloud::Sql::V1::ListBackupsRequest, ::Google::Cloud::Sql::V1::ListBackupsResponse + # Updates the retention period and description of the backup. You can use + # this API to update final backups only. + rpc :UpdateBackup, ::Google::Cloud::Sql::V1::UpdateBackupRequest, ::Google::Cloud::Sql::V1::Operation + # Deletes the backup. + rpc :DeleteBackup, ::Google::Cloud::Sql::V1::DeleteBackupRequest, ::Google::Cloud::Sql::V1::Operation + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_connect_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_connect_pb.rb new file mode 100644 index 000000000000..3015fa4fec02 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_connect_pb.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_connect.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/cloud/sql/v1/cloud_sql_resources_pb' +require 'google/protobuf/duration_pb' +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n+google/cloud/sql/v1/cloud_sql_connect.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a-google/cloud/sql/v1/cloud_sql_resources.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"r\n\x19GetConnectSettingsRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x32\n\tread_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x01\"\xf0\x08\n\x0f\x43onnectSettings\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x34\n\x0eserver_ca_cert\x18\x02 \x01(\x0b\x32\x1c.google.cloud.sql.v1.SslCert\x12\x34\n\x0cip_addresses\x18\x03 \x03(\x0b\x32\x1e.google.cloud.sql.v1.IpMapping\x12\x0e\n\x06region\x18\x04 \x01(\t\x12\x41\n\x10\x64\x61tabase_version\x18\x1f \x01(\x0e\x32\'.google.cloud.sql.v1.SqlDatabaseVersion\x12\x39\n\x0c\x62\x61\x63kend_type\x18 \x01(\x0e\x32#.google.cloud.sql.v1.SqlBackendType\x12\x13\n\x0bpsc_enabled\x18! \x01(\x08\x12\x10\n\x08\x64ns_name\x18\" \x01(\t\x12\x43\n\x0eserver_ca_mode\x18# \x01(\x0e\x32+.google.cloud.sql.v1.ConnectSettings.CaMode\x12(\n custom_subject_alternative_names\x18% \x03(\t\x12;\n\tdns_names\x18& \x03(\x0b\x32#.google.cloud.sql.v1.DnsNameMappingB\x03\xe0\x41\x03\x12\x17\n\nnode_count\x18? \x01(\x05H\x00\x88\x01\x01\x12N\n\x05nodes\x18@ \x03(\x0b\x32:.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfigB\x03\xe0\x41\x03\x12]\n\x14mdx_protocol_support\x18\' \x03(\x0e\x32\x37.google.cloud.sql.v1.ConnectSettings.MdxProtocolSupportB\x06\xe0\x41\x03\xe0\x41\x01\x1a\xd9\x01\n\x15\x43onnectPoolNodeConfig\x12\x16\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03H\x00\x88\x01\x01\x12\x39\n\x0cip_addresses\x18\x02 \x03(\x0b\x32\x1e.google.cloud.sql.v1.IpMappingB\x03\xe0\x41\x03\x12\x1a\n\x08\x64ns_name\x18\x03 \x01(\tB\x03\xe0\x41\x03H\x01\x88\x01\x01\x12;\n\tdns_names\x18\x04 \x03(\x0b\x32#.google.cloud.sql.v1.DnsNameMappingB\x03\xe0\x41\x03\x42\x07\n\x05_nameB\x0b\n\t_dns_name\"y\n\x06\x43\x61Mode\x12\x17\n\x13\x43\x41_MODE_UNSPECIFIED\x10\x00\x12\x1e\n\x1aGOOGLE_MANAGED_INTERNAL_CA\x10\x01\x12\x19\n\x15GOOGLE_MANAGED_CAS_CA\x10\x02\x12\x1b\n\x17\x43USTOMER_MANAGED_CAS_CA\x10\x03\"T\n\x12MdxProtocolSupport\x12$\n MDX_PROTOCOL_SUPPORT_UNSPECIFIED\x10\x00\x12\x18\n\x14\x43LIENT_PROTOCOL_TYPE\x10\x01\x42\r\n\x0b_node_count\"\xf6\x01\n\x1cGenerateEphemeralCertRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x1e\n\npublic_key\x18\x03 \x01(\tR\npublic_key\x12\'\n\x0c\x61\x63\x63\x65ss_token\x18\x04 \x01(\tB\x03\xe0\x41\x01R\x0c\x61\x63\x63\x65ss_token\x12\x32\n\tread_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x01\x12\x36\n\x0evalid_duration\x18\x0c \x01(\x0b\x32\x19.google.protobuf.DurationB\x03\xe0\x41\x01\"U\n\x1dGenerateEphemeralCertResponse\x12\x34\n\x0e\x65phemeral_cert\x18\x01 \x01(\x0b\x32\x1c.google.cloud.sql.v1.SslCert2\x92\x04\n\x11SqlConnectService\x12\xaf\x01\n\x12GetConnectSettings\x12..google.cloud.sql.v1.GetConnectSettingsRequest\x1a$.google.cloud.sql.v1.ConnectSettings\"C\x82\xd3\xe4\x93\x02=\x12;/v1/projects/{project}/instances/{instance}/connectSettings\x12\xcc\x01\n\x15GenerateEphemeralCert\x12\x31.google.cloud.sql.v1.GenerateEphemeralCertRequest\x1a\x32.google.cloud.sql.v1.GenerateEphemeralCertResponse\"L\x82\xd3\xe4\x93\x02\x46\"A/v1/projects/{project}/instances/{instance}:generateEphemeralCert:\x01*\x1a|\xca\x41\x17sqladmin.googleapis.com\xd2\x41_https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.adminB\\\n\x17\x63om.google.cloud.sql.v1B\x14\x43loudSqlConnectProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + GetConnectSettingsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.GetConnectSettingsRequest").msgclass + ConnectSettings = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ConnectSettings").msgclass + ConnectSettings::ConnectPoolNodeConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig").msgclass + ConnectSettings::CaMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ConnectSettings.CaMode").enummodule + ConnectSettings::MdxProtocolSupport = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ConnectSettings.MdxProtocolSupport").enummodule + GenerateEphemeralCertRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.GenerateEphemeralCertRequest").msgclass + GenerateEphemeralCertResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.GenerateEphemeralCertResponse").msgclass + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_connect_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_connect_services_pb.rb new file mode 100644 index 000000000000..b91a9c30ab52 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_connect_services_pb.rb @@ -0,0 +1,50 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_connect.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_connect_pb' + +module Google + module Cloud + module Sql + module V1 + module SqlConnectService + # Cloud SQL connect service. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.sql.v1.SqlConnectService' + + # Retrieves connect settings about a Cloud SQL instance. + rpc :GetConnectSettings, ::Google::Cloud::Sql::V1::GetConnectSettingsRequest, ::Google::Cloud::Sql::V1::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, ::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest, ::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_databases_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_databases_pb.rb new file mode 100644 index 000000000000..cc162122dd97 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_databases_pb.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_databases.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/cloud/sql/v1/cloud_sql_resources_pb' + + +descriptor_data = "\n-google/cloud/sql/v1/cloud_sql_databases.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a-google/cloud/sql/v1/cloud_sql_resources.proto\"P\n\x19SqlDatabasesDeleteRequest\x12\x10\n\x08\x64\x61tabase\x18\x01 \x01(\t\x12\x10\n\x08instance\x18\x02 \x01(\t\x12\x0f\n\x07project\x18\x03 \x01(\t\"M\n\x16SqlDatabasesGetRequest\x12\x10\n\x08\x64\x61tabase\x18\x01 \x01(\t\x12\x10\n\x08instance\x18\x02 \x01(\t\x12\x0f\n\x07project\x18\x03 \x01(\t\"k\n\x19SqlDatabasesInsertRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12+\n\x04\x62ody\x18\x64 \x01(\x0b\x32\x1d.google.cloud.sql.v1.Database\"<\n\x17SqlDatabasesListRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\"}\n\x19SqlDatabasesUpdateRequest\x12\x10\n\x08\x64\x61tabase\x18\x01 \x01(\t\x12\x10\n\x08instance\x18\x02 \x01(\t\x12\x0f\n\x07project\x18\x03 \x01(\t\x12+\n\x04\x62ody\x18\x64 \x01(\x0b\x32\x1d.google.cloud.sql.v1.Database\"S\n\x15\x44\x61tabasesListResponse\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12,\n\x05items\x18\x02 \x03(\x0b\x32\x1d.google.cloud.sql.v1.Database2\xed\x08\n\x13SqlDatabasesService\x12\xa2\x01\n\x06\x44\x65lete\x12..google.cloud.sql.v1.SqlDatabasesDeleteRequest\x1a\x1e.google.cloud.sql.v1.Operation\"H\x82\xd3\xe4\x93\x02\x42*@/v1/projects/{project}/instances/{instance}/databases/{database}\x12\x9b\x01\n\x03Get\x12+.google.cloud.sql.v1.SqlDatabasesGetRequest\x1a\x1d.google.cloud.sql.v1.Database\"H\x82\xd3\xe4\x93\x02\x42\x12@/v1/projects/{project}/instances/{instance}/databases/{database}\x12\x9d\x01\n\x06Insert\x12..google.cloud.sql.v1.SqlDatabasesInsertRequest\x1a\x1e.google.cloud.sql.v1.Operation\"C\x82\xd3\xe4\x93\x02=\"5/v1/projects/{project}/instances/{instance}/databases:\x04\x62ody\x12\x9f\x01\n\x04List\x12,.google.cloud.sql.v1.SqlDatabasesListRequest\x1a*.google.cloud.sql.v1.DatabasesListResponse\"=\x82\xd3\xe4\x93\x02\x37\x12\x35/v1/projects/{project}/instances/{instance}/databases\x12\xa7\x01\n\x05Patch\x12..google.cloud.sql.v1.SqlDatabasesUpdateRequest\x1a\x1e.google.cloud.sql.v1.Operation\"N\x82\xd3\xe4\x93\x02H2@/v1/projects/{project}/instances/{instance}/databases/{database}:\x04\x62ody\x12\xa8\x01\n\x06Update\x12..google.cloud.sql.v1.SqlDatabasesUpdateRequest\x1a\x1e.google.cloud.sql.v1.Operation\"N\x82\xd3\xe4\x93\x02H\x1a@/v1/projects/{project}/instances/{instance}/databases/{database}:\x04\x62ody\x1a|\xca\x41\x17sqladmin.googleapis.com\xd2\x41_https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.adminB^\n\x17\x63om.google.cloud.sql.v1B\x16\x43loudSqlDatabasesProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + SqlDatabasesDeleteRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlDatabasesDeleteRequest").msgclass + SqlDatabasesGetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlDatabasesGetRequest").msgclass + SqlDatabasesInsertRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlDatabasesInsertRequest").msgclass + SqlDatabasesListRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlDatabasesListRequest").msgclass + SqlDatabasesUpdateRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlDatabasesUpdateRequest").msgclass + DatabasesListResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DatabasesListResponse").msgclass + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_databases_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_databases_services_pb.rb new file mode 100644 index 000000000000..1b245d142ea2 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_databases_services_pb.rb @@ -0,0 +1,61 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_databases.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_databases_pb' + +module Google + module Cloud + module Sql + module V1 + module SqlDatabasesService + # Service to manage databases. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.sql.v1.SqlDatabasesService' + + # Deletes a database from a Cloud SQL instance. + rpc :Delete, ::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest, ::Google::Cloud::Sql::V1::Operation + # Retrieves a resource containing information about a database inside a Cloud + # SQL instance. + rpc :Get, ::Google::Cloud::Sql::V1::SqlDatabasesGetRequest, ::Google::Cloud::Sql::V1::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, ::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest, ::Google::Cloud::Sql::V1::Operation + # Lists databases in the specified Cloud SQL instance. + rpc :List, ::Google::Cloud::Sql::V1::SqlDatabasesListRequest, ::Google::Cloud::Sql::V1::DatabasesListResponse + # Partially updates a resource containing information about a database inside + # a Cloud SQL instance. This method supports patch semantics. + rpc :Patch, ::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest, ::Google::Cloud::Sql::V1::Operation + # Updates a resource containing information about a database inside a Cloud + # SQL instance. + rpc :Update, ::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest, ::Google::Cloud::Sql::V1::Operation + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_events_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_events_pb.rb new file mode 100644 index 000000000000..1eb013f78162 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_events_pb.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_events.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' + + +descriptor_data = "\n*google/cloud/sql/v1/cloud_sql_events.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto2.\n\x10SqlEventsService\x1a\x1a\xca\x41\x17sqladmin.googleapis.comB[\n\x17\x63om.google.cloud.sql.v1B\x13\x43loudSqlEventsProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_events_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_events_services_pb.rb new file mode 100644 index 000000000000..ee155d20ac34 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_events_services_pb.rb @@ -0,0 +1,29 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_events.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_events_pb' + +module Google + module Cloud + module Sql + module V1 + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_feature_eligibility_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_feature_eligibility_pb.rb new file mode 100644 index 000000000000..65714c9092ed --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_feature_eligibility_pb.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_feature_eligibility.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' + + +descriptor_data = "\n7google/cloud/sql/v1/cloud_sql_feature_eligibility.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto2:\n\x1cSqlFeatureEligibilityService\x1a\x1a\xca\x41\x17sqladmin.googleapis.comBg\n\x17\x63om.google.cloud.sql.v1B\x1f\x43loudSqlFeatureEligibilityProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_feature_eligibility_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_feature_eligibility_services_pb.rb new file mode 100644 index 000000000000..f1339f6ced5b --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_feature_eligibility_services_pb.rb @@ -0,0 +1,29 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_feature_eligibility.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_feature_eligibility_pb' + +module Google + module Cloud + module Sql + module V1 + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_flags_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_flags_pb.rb new file mode 100644 index 000000000000..7747fba9de8d --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_flags_pb.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_flags.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/cloud/sql/v1/cloud_sql_resources_pb' +require 'google/protobuf/wrappers_pb' + + +descriptor_data = "\n)google/cloud/sql/v1/cloud_sql_flags.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a-google/cloud/sql/v1/cloud_sql_resources.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\x7f\n\x13SqlFlagsListRequest\x12\x18\n\x10\x64\x61tabase_version\x18\x01 \x01(\t\x12?\n\nflag_scope\x18\x03 \x01(\x0e\x32!.google.cloud.sql.v1.SqlFlagScopeB\x03\xe0\x41\x01H\x00\x88\x01\x01\x42\r\n\x0b_flag_scope\"K\n\x11\x46lagsListResponse\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12(\n\x05items\x18\x02 \x03(\x0b\x32\x19.google.cloud.sql.v1.Flag\"\xbb\x04\n\x04\x46lag\x12\x0c\n\x04name\x18\x01 \x01(\t\x12.\n\x04type\x18\x02 \x01(\x0e\x32 .google.cloud.sql.v1.SqlFlagType\x12;\n\napplies_to\x18\x03 \x03(\x0e\x32\'.google.cloud.sql.v1.SqlDatabaseVersion\x12\x1d\n\x15\x61llowed_string_values\x18\x04 \x03(\t\x12.\n\tmin_value\x18\x05 \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12.\n\tmax_value\x18\x06 \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x34\n\x10requires_restart\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x0c\n\x04kind\x18\x08 \x01(\t\x12+\n\x07in_beta\x18\t \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x1a\n\x12\x61llowed_int_values\x18\n \x03(\x03\x12\x35\n\nflag_scope\x18\x0f \x01(\x0e\x32!.google.cloud.sql.v1.SqlFlagScope\x12\"\n\x18recommended_string_value\x18\x10 \x01(\tH\x00\x12<\n\x15recommended_int_value\x18\x11 \x01(\x0b\x32\x1b.google.protobuf.Int64ValueH\x00\x42\x13\n\x11recommended_value*\x97\x01\n\x0bSqlFlagType\x12\x1d\n\x19SQL_FLAG_TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x42OOLEAN\x10\x01\x12\n\n\x06STRING\x10\x02\x12\x0b\n\x07INTEGER\x10\x03\x12\x08\n\x04NONE\x10\x04\x12\x19\n\x15MYSQL_TIMEZONE_OFFSET\x10\x05\x12\t\n\x05\x46LOAT\x10\x06\x12\x13\n\x0fREPEATED_STRING\x10\x07*o\n\x0cSqlFlagScope\x12\x1e\n\x1aSQL_FLAG_SCOPE_UNSPECIFIED\x10\x00\x12\x1b\n\x17SQL_FLAG_SCOPE_DATABASE\x10\x01\x12\"\n\x1eSQL_FLAG_SCOPE_CONNECTION_POOL\x10\x02\x32\xfc\x01\n\x0fSqlFlagsService\x12k\n\x04List\x12(.google.cloud.sql.v1.SqlFlagsListRequest\x1a&.google.cloud.sql.v1.FlagsListResponse\"\x11\x82\xd3\xe4\x93\x02\x0b\x12\t/v1/flags\x1a|\xca\x41\x17sqladmin.googleapis.com\xd2\x41_https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.adminBZ\n\x17\x63om.google.cloud.sql.v1B\x12\x43loudSqlFlagsProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + SqlFlagsListRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlFlagsListRequest").msgclass + FlagsListResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.FlagsListResponse").msgclass + Flag = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Flag").msgclass + SqlFlagType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlFlagType").enummodule + SqlFlagScope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlFlagScope").enummodule + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_flags_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_flags_services_pb.rb new file mode 100644 index 000000000000..172f4521eebe --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_flags_services_pb.rb @@ -0,0 +1,45 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_flags.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_flags_pb' + +module Google + module Cloud + module Sql + module V1 + module SqlFlagsService + # Service to manage database flags for Cloud SQL instances. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.sql.v1.SqlFlagsService' + + # Lists all available database flags for Cloud SQL instances. + rpc :List, ::Google::Cloud::Sql::V1::SqlFlagsListRequest, ::Google::Cloud::Sql::V1::FlagsListResponse + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_iam_policies_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_iam_policies_pb.rb new file mode 100644 index 000000000000..0431f1a719bd --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_iam_policies_pb.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_iam_policies.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' + + +descriptor_data = "\n0google/cloud/sql/v1/cloud_sql_iam_policies.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto23\n\x15SqlIamPoliciesService\x1a\x1a\xca\x41\x17sqladmin.googleapis.comB`\n\x17\x63om.google.cloud.sql.v1B\x18\x43loudSqlIamPoliciesProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_iam_policies_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_iam_policies_services_pb.rb new file mode 100644 index 000000000000..cff47e6dbc32 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_iam_policies_services_pb.rb @@ -0,0 +1,29 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_iam_policies.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_iam_policies_pb' + +module Google + module Cloud + module Sql + module V1 + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_instance_names_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_instance_names_pb.rb new file mode 100644 index 000000000000..7796e848e445 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_instance_names_pb.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_instance_names.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' + + +descriptor_data = "\n2google/cloud/sql/v1/cloud_sql_instance_names.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto25\n\x17SqlInstanceNamesService\x1a\x1a\xca\x41\x17sqladmin.googleapis.comBi\n\x17\x63om.google.cloud.sql.v1B!CloudSqlInstanceNamesServiceProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_instance_names_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_instance_names_services_pb.rb new file mode 100644 index 000000000000..eaea8bffb063 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_instance_names_services_pb.rb @@ -0,0 +1,29 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_instance_names.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_instance_names_pb' + +module Google + module Cloud + module Sql + module V1 + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_instances_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_instances_pb.rb new file mode 100644 index 000000000000..63a97e5140f7 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_instances_pb.rb @@ -0,0 +1,146 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_instances.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/sql/v1/cloud_sql_resources_pb' +require 'google/protobuf/duration_pb' +require 'google/protobuf/timestamp_pb' +require 'google/protobuf/wrappers_pb' +require 'google/rpc/status_pb' + + +descriptor_data = "\n-google/cloud/sql/v1/cloud_sql_instances.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a-google/cloud/sql/v1/cloud_sql_resources.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x17google/rpc/status.proto\"C\n\x1eSqlInstancesAddServerCaRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\"L\n\'SqlInstancesAddServerCertificateRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\"W\n(SqlInstancesAddEntraIdCertificateRequest\x12\x15\n\x08instance\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07project\x18\x02 \x01(\tB\x03\xe0\x41\x02\"\x86\x01\n\x18SqlInstancesCloneRequest\x12\x15\n\x08instance\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07project\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12=\n\x04\x62ody\x18\x64 \x01(\x0b\x32*.google.cloud.sql.v1.InstancesCloneRequestB\x03\xe0\x41\x02\"\x98\x02\n\x19SqlInstancesDeleteRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12 \n\x13\x65nable_final_backup\x18\x07 \x01(\x08H\x01\x88\x01\x01\x12$\n\x15\x66inal_backup_ttl_days\x18\x04 \x01(\x03\x42\x03\xe0\x41\x01H\x00\x12\x43\n\x18\x66inal_backup_expiry_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x01H\x00\x12%\n\x18\x66inal_backup_description\x18\x05 \x01(\tB\x03\xe0\x41\x01\x42\x0c\n\nexpirationB\x16\n\x14_enable_final_backup\"\x85\x01\n\x1fSqlInstancesDemoteMasterRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12?\n\x04\x62ody\x18\x64 \x01(\x0b\x32\x31.google.cloud.sql.v1.InstancesDemoteMasterRequest\"\x88\x01\n\x19SqlInstancesDemoteRequest\x12\x15\n\x08instance\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07project\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12>\n\x04\x62ody\x18\x64 \x01(\x0b\x32+.google.cloud.sql.v1.InstancesDemoteRequestB\x03\xe0\x41\x02\"y\n\x19SqlInstancesExportRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x39\n\x04\x62ody\x18\x64 \x01(\x0b\x32+.google.cloud.sql.v1.InstancesExportRequest\"}\n\x1bSqlInstancesFailoverRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12;\n\x04\x62ody\x18\x64 \x01(\x0b\x32-.google.cloud.sql.v1.InstancesFailoverRequest\"E\n\x16SqlInstancesGetRequest\x12\x15\n\x08instance\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07project\x18\x02 \x01(\tB\x03\xe0\x41\x02\"y\n\x19SqlInstancesImportRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x39\n\x04\x62ody\x18\x64 \x01(\x0b\x32+.google.cloud.sql.v1.InstancesImportRequest\"a\n\x19SqlInstancesInsertRequest\x12\x0f\n\x07project\x18\x01 \x01(\t\x12\x33\n\x04\x62ody\x18\x64 \x01(\x0b\x32%.google.cloud.sql.v1.DatabaseInstance\"c\n\x17SqlInstancesListRequest\x12\x0e\n\x06\x66ilter\x18\x01 \x01(\t\x12\x13\n\x0bmax_results\x18\x02 \x01(\r\x12\x12\n\npage_token\x18\x03 \x01(\t\x12\x0f\n\x07project\x18\x04 \x01(\t\"E\n SqlInstancesListServerCasRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\"X\n)SqlInstancesListServerCertificatesRequest\x12\x15\n\x08instance\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07project\x18\x02 \x01(\tB\x03\xe0\x41\x02\"Y\n*SqlInstancesListEntraIdCertificatesRequest\x12\x15\n\x08instance\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07project\x18\x02 \x01(\tB\x03\xe0\x41\x02\"r\n\x18SqlInstancesPatchRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x33\n\x04\x62ody\x18\x64 \x01(\x0b\x32%.google.cloud.sql.v1.DatabaseInstance\"X\n!SqlInstancesPromoteReplicaRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x10\n\x08\x66\x61ilover\x18\x03 \x01(\x08\"v\n\x1dSqlInstancesSwitchoverRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x32\n\ndb_timeout\x18\x03 \x01(\x0b\x32\x19.google.protobuf.DurationB\x03\xe0\x41\x01\"\xee\x01\n!SqlInstancesResetSslConfigRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12V\n\x04mode\x18\x03 \x01(\x0e\x32\x43.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslModeB\x03\xe0\x41\x01\"N\n\x0cResetSslMode\x12\x1e\n\x1aRESET_SSL_MODE_UNSPECIFIED\x10\x00\x12\x07\n\x03\x41LL\x10\x01\x12\x15\n\x11SYNC_FROM_PRIMARY\x10\x02\"?\n\x1aSqlInstancesRestartRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\"\x87\x01\n SqlInstancesRestoreBackupRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12@\n\x04\x62ody\x18\x64 \x01(\x0b\x32\x32.google.cloud.sql.v1.InstancesRestoreBackupRequest\"\x89\x01\n!SqlInstancesRotateServerCaRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x41\n\x04\x62ody\x18\x64 \x01(\x0b\x32\x33.google.cloud.sql.v1.InstancesRotateServerCaRequest\"\xaa\x01\n*SqlInstancesRotateServerCertificateRequest\x12\x15\n\x08instance\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07project\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12O\n\x04\x62ody\x18\x64 \x01(\x0b\x32<.google.cloud.sql.v1.InstancesRotateServerCertificateRequestB\x03\xe0\x41\x01\"\xac\x01\n+SqlInstancesRotateEntraIdCertificateRequest\x12\x15\n\x08instance\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07project\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12P\n\x04\x62ody\x18\x64 \x01(\x0b\x32=.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequestB\x03\xe0\x41\x01\"D\n\x1fSqlInstancesStartReplicaRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\"C\n\x1eSqlInstancesStopReplicaRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\"\x83\x01\n\x1eSqlInstancesTruncateLogRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12>\n\x04\x62ody\x18\x64 \x01(\x0b\x32\x30.google.cloud.sql.v1.InstancesTruncateLogRequest\"\x86\x01\n$SqlInstancesPerformDiskShrinkRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12;\n\x04\x62ody\x18\x64 \x01(\x0b\x32-.google.cloud.sql.v1.PerformDiskShrinkContext\"s\n\x19SqlInstancesUpdateRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x33\n\x04\x62ody\x18\x64 \x01(\x0b\x32%.google.cloud.sql.v1.DatabaseInstance\"\x9e\x01\n(SqlInstancesRescheduleMaintenanceRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12O\n\x04\x62ody\x18\x64 \x01(\x0b\x32\x41.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody\"\x7f\n\x1cSqlInstancesReencryptRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12<\n\x04\x62ody\x18\x03 \x01(\x0b\x32..google.cloud.sql.v1.InstancesReencryptRequest\"\x92\x01\n\x19InstancesReencryptRequest\x12V\n\x1a\x62\x61\x63kup_reencryption_config\x18\x01 \x01(\x0b\x32-.google.cloud.sql.v1.BackupReencryptionConfigH\x00\x88\x01\x01\x42\x1d\n\x1b_backup_reencryption_config\"\xf3\x01\n\x18\x42\x61\x63kupReencryptionConfig\x12\x19\n\x0c\x62\x61\x63kup_limit\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12R\n\x0b\x62\x61\x63kup_type\x18\x02 \x01(\x0e\x32\x38.google.cloud.sql.v1.BackupReencryptionConfig.BackupTypeH\x01\x88\x01\x01\"G\n\nBackupType\x12\x1b\n\x17\x42\x41\x43KUP_TYPE_UNSPECIFIED\x10\x00\x12\r\n\tAUTOMATED\x10\x01\x12\r\n\tON_DEMAND\x10\x02\x42\x0f\n\r_backup_limitB\x0e\n\x0c_backup_type\".\n\x1a\x45xternalSyncSelectedObject\x12\x10\n\x08\x64\x61tabase\x18\x01 \x01(\t\"K\n&SqlInstancesGetDiskShrinkConfigRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\"\x85\x06\n-SqlInstancesVerifyExternalSyncSettingsRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x1e\n\x16verify_connection_only\x18\x03 \x01(\x08\x12\x66\n\tsync_mode\x18\x04 \x01(\x0e\x32S.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode\x12$\n\x17verify_replication_only\x18\x05 \x01(\x08\x42\x03\xe0\x41\x01\x12\x46\n\x11mysql_sync_config\x18\x06 \x01(\x0b\x32$.google.cloud.sql.v1.MySqlSyncConfigB\x03\xe0\x41\x01H\x00\x12m\n\x0emigration_type\x18\x07 \x01(\x0e\x32P.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationTypeB\x03\xe0\x41\x01\x12P\n\x13sync_parallel_level\x18\x08 \x01(\x0e\x32..google.cloud.sql.v1.ExternalSyncParallelLevelB\x03\xe0\x41\x01\x12N\n\x10selected_objects\x18\t \x03(\x0b\x32/.google.cloud.sql.v1.ExternalSyncSelectedObjectB\x03\xe0\x41\x01\"O\n\x10\x45xternalSyncMode\x12\"\n\x1e\x45XTERNAL_SYNC_MODE_UNSPECIFIED\x10\x00\x12\n\n\x06ONLINE\x10\x01\x12\x0b\n\x07OFFLINE\x10\x02\"J\n\rMigrationType\x12\x1e\n\x1aMIGRATION_TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07LOGICAL\x10\x01\x12\x0c\n\x08PHYSICAL\x10\x02\x42\r\n\x0bsync_config\"\x87\x04\n$SqlInstancesStartExternalSyncRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x66\n\tsync_mode\x18\x03 \x01(\x0e\x32S.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode\x12\x19\n\x11skip_verification\x18\x04 \x01(\x08\x12\x41\n\x11mysql_sync_config\x18\x06 \x01(\x0b\x32$.google.cloud.sql.v1.MySqlSyncConfigH\x00\x12P\n\x13sync_parallel_level\x18\x07 \x01(\x0e\x32..google.cloud.sql.v1.ExternalSyncParallelLevelB\x03\xe0\x41\x01\x12m\n\x0emigration_type\x18\x08 \x01(\x0e\x32P.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationTypeB\x03\xe0\x41\x01\x12&\n\x19replica_overwrite_enabled\x18\t \x01(\x08\x42\x03\xe0\x41\x01\x42\r\n\x0bsync_config\"H\n#SqlInstancesResetReplicaSizeRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\"\x8e\x01\n&SqlInstancesCreateEphemeralCertRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x41\n\x04\x62ody\x18\x64 \x01(\x0b\x32\x33.google.cloud.sql.v1.SslCertsCreateEphemeralRequest\"V\n\x15InstancesCloneRequest\x12=\n\rclone_context\x18\x01 \x01(\x0b\x32!.google.cloud.sql.v1.CloneContextB\x03\xe0\x41\x02\"g\n\x1cInstancesDemoteMasterRequest\x12G\n\x15\x64\x65mote_master_context\x18\x01 \x01(\x0b\x32(.google.cloud.sql.v1.DemoteMasterContext\"Y\n\x16InstancesDemoteRequest\x12?\n\x0e\x64\x65mote_context\x18\x01 \x01(\x0b\x32\".google.cloud.sql.v1.DemoteContextB\x03\xe0\x41\x02\"T\n\x16InstancesExportRequest\x12:\n\x0e\x65xport_context\x18\x01 \x01(\x0b\x32\".google.cloud.sql.v1.ExportContext\"Z\n\x18InstancesFailoverRequest\x12>\n\x10\x66\x61ilover_context\x18\x01 \x01(\x0b\x32$.google.cloud.sql.v1.FailoverContext\"d\n\x1eSslCertsCreateEphemeralRequest\x12\x1e\n\npublic_key\x18\x01 \x01(\tR\npublic_key\x12\"\n\x0c\x61\x63\x63\x65ss_token\x18\x02 \x01(\tR\x0c\x61\x63\x63\x65ss_token\"T\n\x16InstancesImportRequest\x12:\n\x0eimport_context\x18\x01 \x01(\x0b\x32\".google.cloud.sql.v1.ImportContext\"\x9c\x01\n+InstancesPreCheckMajorVersionUpgradeRequest\x12m\n\'pre_check_major_version_upgrade_context\x18\x01 \x01(\x0b\x32\x37.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContextB\x03\xe0\x41\x02\"\xa7\x01\n\x15InstancesListResponse\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x31\n\x08warnings\x18\x02 \x03(\x0b\x32\x1f.google.cloud.sql.v1.ApiWarning\x12\x34\n\x05items\x18\x03 \x03(\x0b\x32%.google.cloud.sql.v1.DatabaseInstance\x12\x17\n\x0fnext_page_token\x18\x04 \x01(\t\"s\n\x1eInstancesListServerCasResponse\x12+\n\x05\x63\x65rts\x18\x01 \x03(\x0b\x32\x1c.google.cloud.sql.v1.SslCert\x12\x16\n\x0e\x61\x63tive_version\x18\x02 \x01(\t\x12\x0c\n\x04kind\x18\x03 \x01(\t\"\xb3\x01\n\'InstancesListServerCertificatesResponse\x12.\n\x08\x63\x61_certs\x18\x01 \x03(\x0b\x32\x1c.google.cloud.sql.v1.SslCert\x12\x32\n\x0cserver_certs\x18\x02 \x03(\x0b\x32\x1c.google.cloud.sql.v1.SslCert\x12\x16\n\x0e\x61\x63tive_version\x18\x03 \x01(\t\x12\x0c\n\x04kind\x18\x04 \x01(\t\"}\n(InstancesListEntraIdCertificatesResponse\x12+\n\x05\x63\x65rts\x18\x01 \x03(\x0b\x32\x1c.google.cloud.sql.v1.SslCert\x12\x16\n\x0e\x61\x63tive_version\x18\x02 \x01(\t\x12\x0c\n\x04kind\x18\x03 \x01(\t\"\xe7\x02\n\x1dInstancesRestoreBackupRequest\x12I\n\x16restore_backup_context\x18\x01 \x01(\x0b\x32).google.cloud.sql.v1.RestoreBackupContext\x12\x33\n\x06\x62\x61\x63kup\x18\x02 \x01(\tB#\xfa\x41 \n\x1esqladmin.googleapis.com/Backup\x12<\n\x0f\x62\x61\x63kupdr_backup\x18\x04 \x01(\tB#\xfa\x41 \n\x1e\x62\x61\x63kupdr.googleapis.com/Backup\x12M\n\x19restore_instance_settings\x18\x03 \x01(\x0b\x32%.google.cloud.sql.v1.DatabaseInstanceB\x03\xe0\x41\x01\x12\x39\n,restore_instance_clear_overrides_field_names\x18\x05 \x03(\tB\x03\xe0\x41\x01\"n\n\x1eInstancesRotateServerCaRequest\x12L\n\x18rotate_server_ca_context\x18\x01 \x01(\x0b\x32*.google.cloud.sql.v1.RotateServerCaContext\"\x8e\x01\n\'InstancesRotateServerCertificateRequest\x12\x63\n!rotate_server_certificate_context\x18\x01 \x01(\x0b\x32\x33.google.cloud.sql.v1.RotateServerCertificateContextB\x03\xe0\x41\x01\"\x92\x01\n(InstancesRotateEntraIdCertificateRequest\x12\x66\n#rotate_entra_id_certificate_context\x18\x01 \x01(\x0b\x32\x34.google.cloud.sql.v1.RotateEntraIdCertificateContextB\x03\xe0\x41\x01\"d\n\x1bInstancesTruncateLogRequest\x12\x45\n\x14truncate_log_context\x18\x01 \x01(\x0b\x32\'.google.cloud.sql.v1.TruncateLogContext\"t\n InstancesAcquireSsrsLeaseRequest\x12P\n\x1a\x61\x63quire_ssrs_lease_context\x18\x01 \x01(\x0b\x32,.google.cloud.sql.v1.AcquireSsrsLeaseContext\"\xb2\x01\n.SqlInstancesPreCheckMajorVersionUpgradeRequest\x12\x15\n\x08instance\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07project\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12S\n\x04\x62ody\x18\x03 \x01(\x0b\x32@.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequestB\x03\xe0\x41\x02\"\xc4\x01\n.SqlInstancesVerifyExternalSyncSettingsResponse\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12@\n\x06\x65rrors\x18\x02 \x03(\x0b\x32\x30.google.cloud.sql.v1.SqlExternalSyncSettingError\x12\x42\n\x08warnings\x18\x03 \x03(\x0b\x32\x30.google.cloud.sql.v1.SqlExternalSyncSettingError\"h\n\'SqlInstancesGetDiskShrinkConfigResponse\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x1e\n\x16minimal_target_size_gb\x18\x02 \x01(\x03\x12\x0f\n\x07message\x18\x03 \x01(\t\"\xb7\x01\n(SqlInstancesGetLatestRecoveryTimeRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x46\n\x1dsource_instance_deletion_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x88\x01\x01\x42 \n\x1e_source_instance_deletion_time\"\xaf\x01\n)SqlInstancesGetLatestRecoveryTimeResponse\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x38\n\x14latest_recovery_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12:\n\x16\x65\x61rliest_recovery_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x94\x05\n\x0c\x43loneContext\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x19\n\x11pitr_timestamp_ms\x18\x02 \x01(\x03\x12&\n\x19\x64\x65stination_instance_name\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x43\n\x13\x62in_log_coordinates\x18\x04 \x01(\x0b\x32&.google.cloud.sql.v1.BinLogCoordinates\x12\x31\n\rpoint_in_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1a\n\x12\x61llocated_ip_range\x18\x06 \x01(\t\x12\x16\n\x0e\x64\x61tabase_names\x18\t \x03(\t\x12 \n\x0epreferred_zone\x18\n \x01(\tB\x03\xe0\x41\x01H\x00\x88\x01\x01\x12*\n\x18preferred_secondary_zone\x18\x0b \x01(\tB\x03\xe0\x41\x01H\x01\x88\x01\x01\x12\x46\n\x1dsource_instance_deletion_time\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x02\x88\x01\x01\x12%\n\x13\x64\x65stination_project\x18\r \x01(\tB\x03\xe0\x41\x01H\x03\x88\x01\x01\x12H\n\x13\x64\x65stination_network\x18\x0e \x01(\tB&\xe0\x41\x01\xfa\x41 \n\x1e\x63ompute.googleapis.com/NetworkH\x04\x88\x01\x01\x42\x11\n\x0f_preferred_zoneB\x1b\n\x19_preferred_secondary_zoneB \n\x1e_source_instance_deletion_timeB\x16\n\x14_destination_projectB\x16\n\x14_destination_network\"\xcb\x04\n\x19PointInTimeRestoreContext\x12\x17\n\ndatasource\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x36\n\rpoint_in_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x02\x12\x1c\n\x0ftarget_instance\x18\x03 \x01(\tH\x01\x88\x01\x01\x12!\n\x0fprivate_network\x18\x04 \x01(\tB\x03\xe0\x41\x01H\x02\x88\x01\x01\x12$\n\x12\x61llocated_ip_range\x18\x05 \x01(\tB\x03\xe0\x41\x01H\x03\x88\x01\x01\x12 \n\x0epreferred_zone\x18\x06 \x01(\tB\x03\xe0\x41\x01H\x04\x88\x01\x01\x12*\n\x18preferred_secondary_zone\x18\t \x01(\tB\x03\xe0\x41\x01H\x05\x88\x01\x01\x12L\n\x18target_instance_settings\x18\x0b \x01(\x0b\x32%.google.cloud.sql.v1.DatabaseInstanceB\x03\xe0\x41\x01\x12\x37\n*target_instance_clear_settings_field_names\x18\x0c \x03(\tB\x03\xe0\x41\x01\x12\x18\n\x06region\x18\r \x01(\tB\x03\xe0\x41\x01H\x06\x88\x01\x01\x42\r\n\x0b_datasourceB\x12\n\x10_target_instanceB\x12\n\x10_private_networkB\x15\n\x13_allocated_ip_rangeB\x11\n\x0f_preferred_zoneB\x1b\n\x19_preferred_secondary_zoneB\t\n\x07_region\"V\n\x11\x42inLogCoordinates\x12\x19\n\x11\x62in_log_file_name\x18\x01 \x01(\t\x12\x18\n\x10\x62in_log_position\x18\x02 \x01(\x03\x12\x0c\n\x04kind\x18\x03 \x01(\t\"\x80#\n\x10\x44\x61tabaseInstance\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x45\n\x05state\x18\x02 \x01(\x0e\x32\x36.google.cloud.sql.v1.DatabaseInstance.SqlInstanceState\x12\x41\n\x10\x64\x61tabase_version\x18\x03 \x01(\x0e\x32\'.google.cloud.sql.v1.SqlDatabaseVersion\x12/\n\x08settings\x18\x04 \x01(\x0b\x32\x1d.google.cloud.sql.v1.Settings\x12\x0c\n\x04\x65tag\x18\x05 \x01(\t\x12R\n\x10\x66\x61ilover_replica\x18\x06 \x01(\x0b\x32\x38.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica\x12\x1c\n\x14master_instance_name\x18\x07 \x01(\t\x12\x15\n\rreplica_names\x18\x08 \x03(\t\x12\x36\n\rmax_disk_size\x18\t \x01(\x0b\x32\x1b.google.protobuf.Int64ValueB\x02\x18\x01\x12:\n\x11\x63urrent_disk_size\x18\n \x01(\x0b\x32\x1b.google.protobuf.Int64ValueB\x02\x18\x01\x12\x34\n\x0cip_addresses\x18\x0b \x03(\x0b\x32\x1e.google.cloud.sql.v1.IpMapping\x12\x34\n\x0eserver_ca_cert\x18\x0c \x01(\x0b\x32\x1c.google.cloud.sql.v1.SslCert\x12;\n\rinstance_type\x18\r \x01(\x0e\x32$.google.cloud.sql.v1.SqlInstanceType\x12\x0f\n\x07project\x18\x0e \x01(\t\x12\x18\n\x0cipv6_address\x18\x0f \x01(\tB\x02\x18\x01\x12%\n\x1dservice_account_email_address\x18\x10 \x01(\t\x12O\n\x19on_premises_configuration\x18\x11 \x01(\x0b\x32,.google.cloud.sql.v1.OnPremisesConfiguration\x12H\n\x15replica_configuration\x18\x12 \x01(\x0b\x32).google.cloud.sql.v1.ReplicaConfiguration\x12\x39\n\x0c\x62\x61\x63kend_type\x18\x13 \x01(\x0e\x32#.google.cloud.sql.v1.SqlBackendType\x12\x11\n\tself_link\x18\x14 \x01(\t\x12\x43\n\x11suspension_reason\x18\x15 \x03(\x0e\x32(.google.cloud.sql.v1.SqlSuspensionReason\x12\x17\n\x0f\x63onnection_name\x18\x16 \x01(\t\x12\x0c\n\x04name\x18\x17 \x01(\t\x12\x0e\n\x06region\x18\x18 \x01(\t\x12\x10\n\x08gce_zone\x18\x19 \x01(\t\x12\x1a\n\x12secondary_gce_zone\x18\" \x01(\t\x12W\n\x1d\x64isk_encryption_configuration\x18\x1a \x01(\x0b\x32\x30.google.cloud.sql.v1.DiskEncryptionConfiguration\x12I\n\x16\x64isk_encryption_status\x18\x1b \x01(\x0b\x32).google.cloud.sql.v1.DiskEncryptionStatus\x12\x15\n\rroot_password\x18\x1d \x01(\t\x12\\\n\x15scheduled_maintenance\x18\x1e \x01(\x0b\x32=.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance\x12\x31\n\rsatisfies_pzs\x18# \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\'\n\x1a\x64\x61tabase_installed_version\x18( \x01(\tB\x03\xe0\x41\x03\x12Y\n\x12out_of_disk_report\x18& \x01(\x0b\x32\x38.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReportH\x00\x88\x01\x01\x12\x34\n\x0b\x63reate_time\x18\' \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12+\n\x1e\x61vailable_maintenance_versions\x18) \x03(\tB\x03\xe0\x41\x03\x12\x1b\n\x13maintenance_version\x18* \x01(\t\x12X\n\x1cupgradable_database_versions\x18- \x03(\x0b\x32-.google.cloud.sql.v1.AvailableDatabaseVersionB\x03\xe0\x41\x03\x12\x63\n\x18sql_network_architecture\x18/ \x01(\x0e\x32<.google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitectureH\x01\x88\x01\x01\x12-\n\x1bpsc_service_attachment_link\x18\x30 \x01(\tB\x03\xe0\x41\x03H\x02\x88\x01\x01\x12\x1a\n\x08\x64ns_name\x18\x31 \x01(\tB\x03\xe0\x41\x03H\x03\x88\x01\x01\x12$\n\x10primary_dns_name\x18\x33 \x01(\tB\x05\x18\x01\xe0\x41\x03H\x04\x88\x01\x01\x12 \n\x0ewrite_endpoint\x18\x34 \x01(\tB\x03\xe0\x41\x03H\x05\x88\x01\x01\x12I\n\x13replication_cluster\x18\x36 \x01(\x0b\x32\'.google.cloud.sql.v1.ReplicationClusterB\x03\xe0\x41\x01\x12\x45\n\rgemini_config\x18\x37 \x01(\x0b\x32).google.cloud.sql.v1.GeminiInstanceConfigH\x06\x88\x01\x01\x12\x36\n\rsatisfies_pzi\x18\x38 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x03\x12^\n0switch_transaction_logs_to_cloud_storage_enabled\x18\x39 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x04H\x07\x88\x01\x01\x12X\n*include_replicas_for_major_version_upgrade\x18; \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x04H\x08\x88\x01\x01\x12H\n\x04tags\x18< \x03(\x0b\x32/.google.cloud.sql.v1.DatabaseInstance.TagsEntryB\t\xe0\x41\x04\xe0\x41\x05\xe0\x41\x01\x12\x17\n\nnode_count\x18? \x01(\x05H\t\x88\x01\x01\x12H\n\x05nodes\x18@ \x03(\x0b\x32\x34.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfigB\x03\xe0\x41\x03\x12;\n\tdns_names\x18\x43 \x03(\x0b\x32#.google.cloud.sql.v1.DnsNameMappingB\x03\xe0\x41\x03\x1aQ\n\x12SqlFailoverReplica\x12\x0c\n\x04name\x18\x01 \x01(\t\x12-\n\tavailable\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x1a\xd4\x01\n\x17SqlScheduledMaintenance\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\tcan_defer\x18\x02 \x01(\x08\x42\x02\x18\x01\x12\x16\n\x0e\x63\x61n_reschedule\x18\x03 \x01(\x08\x12?\n\x16schedule_deadline_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x88\x01\x01\x42\x19\n\x17_schedule_deadline_time\x1a\xd5\x02\n\x12SqlOutOfDiskReport\x12n\n\x15sql_out_of_disk_state\x18\x01 \x01(\x0e\x32J.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskStateH\x00\x88\x01\x01\x12\x31\n$sql_min_recommended_increase_size_gb\x18\x02 \x01(\x05H\x01\x88\x01\x01\"Y\n\x11SqlOutOfDiskState\x12%\n!SQL_OUT_OF_DISK_STATE_UNSPECIFIED\x10\x00\x12\n\n\x06NORMAL\x10\x01\x12\x11\n\rSOFT_SHUTDOWN\x10\x02\x42\x18\n\x16_sql_out_of_disk_stateB\'\n%_sql_min_recommended_increase_size_gb\x1a\xf6\x03\n\x0ePoolNodeConfig\x12\x16\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03H\x00\x88\x01\x01\x12\x1a\n\x08gce_zone\x18\x02 \x01(\tB\x03\xe0\x41\x03H\x01\x88\x01\x01\x12\x39\n\x0cip_addresses\x18\x03 \x03(\x0b\x32\x1e.google.cloud.sql.v1.IpMappingB\x03\xe0\x41\x03\x12\x1a\n\x08\x64ns_name\x18\x04 \x01(\tB\x03\xe0\x41\x03H\x02\x88\x01\x01\x12O\n\x05state\x18\x05 \x01(\x0e\x32\x36.google.cloud.sql.v1.DatabaseInstance.SqlInstanceStateB\x03\xe0\x41\x03H\x03\x88\x01\x01\x12;\n\tdns_names\x18\x06 \x03(\x0b\x32#.google.cloud.sql.v1.DnsNameMappingB\x03\xe0\x41\x03\x12-\n\x1bpsc_service_attachment_link\x18\x07 \x01(\tB\x03\xe0\x41\x03H\x04\x88\x01\x01\x12O\n\x14psc_auto_connections\x18\x08 \x03(\x0b\x32,.google.cloud.sql.v1.PscAutoConnectionConfigB\x03\xe0\x41\x03\x42\x07\n\x05_nameB\x0b\n\t_gce_zoneB\x0b\n\t_dns_nameB\x08\n\x06_stateB\x1e\n\x1c_psc_service_attachment_link\x1a+\n\tTagsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xc3\x01\n\x10SqlInstanceState\x12\"\n\x1eSQL_INSTANCE_STATE_UNSPECIFIED\x10\x00\x12\x0c\n\x08RUNNABLE\x10\x01\x12\r\n\tSUSPENDED\x10\x02\x12\x12\n\x0ePENDING_DELETE\x10\x03\x12\x12\n\x0ePENDING_CREATE\x10\x04\x12\x0f\n\x0bMAINTENANCE\x10\x05\x12\n\n\x06\x46\x41ILED\x10\x06\x12\x1a\n\x12ONLINE_MAINTENANCE\x10\x07\x1a\x02\x08\x01\x12\r\n\tREPAIRING\x10\x08\"~\n\x16SqlNetworkArchitecture\x12(\n$SQL_NETWORK_ARCHITECTURE_UNSPECIFIED\x10\x00\x12\x1c\n\x18NEW_NETWORK_ARCHITECTURE\x10\x01\x12\x1c\n\x18OLD_NETWORK_ARCHITECTURE\x10\x02\x42\x15\n\x13_out_of_disk_reportB\x1b\n\x19_sql_network_architectureB\x1e\n\x1c_psc_service_attachment_linkB\x0b\n\t_dns_nameB\x13\n\x11_primary_dns_nameB\x11\n\x0f_write_endpointB\x10\n\x0e_gemini_configB3\n1_switch_transaction_logs_to_cloud_storage_enabledB-\n+_include_replicas_for_major_version_upgradeB\r\n\x0b_node_count\"\xa6\x03\n\x14GeminiInstanceConfig\x12\x1a\n\x08\x65ntitled\x18\x01 \x01(\x08\x42\x03\xe0\x41\x03H\x00\x88\x01\x01\x12,\n\x1agoogle_vacuum_mgmt_enabled\x18\x02 \x01(\x08\x42\x03\xe0\x41\x03H\x01\x88\x01\x01\x12,\n\x1aoom_session_cancel_enabled\x18\x03 \x01(\x08\x42\x03\xe0\x41\x03H\x02\x88\x01\x01\x12&\n\x14\x61\x63tive_query_enabled\x18\x04 \x01(\x08\x42\x03\xe0\x41\x03H\x03\x88\x01\x01\x12\'\n\x15index_advisor_enabled\x18\x05 \x01(\x08\x42\x03\xe0\x41\x03H\x04\x88\x01\x01\x12*\n\x18\x66lag_recommender_enabled\x18\x06 \x01(\x08\x42\x03\xe0\x41\x03H\x05\x88\x01\x01\x42\x0b\n\t_entitledB\x1d\n\x1b_google_vacuum_mgmt_enabledB\x1d\n\x1b_oom_session_cancel_enabledB\x17\n\x15_active_query_enabledB\x18\n\x16_index_advisor_enabledB\x1b\n\x19_flag_recommender_enabled\"u\n\x12ReplicationCluster\x12\x1f\n\x12psa_write_endpoint\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12%\n\x18\x66\x61ilover_dr_replica_name\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x17\n\ndr_replica\x18\x04 \x01(\x08\x42\x03\xe0\x41\x03\"\x90\x01\n\x18\x41vailableDatabaseVersion\x12\x1a\n\rmajor_version\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x08 \x01(\tH\x01\x88\x01\x01\x12\x19\n\x0c\x64isplay_name\x18\t \x01(\tH\x02\x88\x01\x01\x42\x10\n\x0e_major_versionB\x07\n\x05_nameB\x0f\n\r_display_name\"\xb2\x03\n,SqlInstancesRescheduleMaintenanceRequestBody\x12`\n\nreschedule\x18\x03 \x01(\x0b\x32L.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule\x1a\xaf\x01\n\nReschedule\x12i\n\x0freschedule_type\x18\x01 \x01(\x0e\x32P.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType\x12\x36\n\rschedule_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x01\"n\n\x0eRescheduleType\x12\x1f\n\x1bRESCHEDULE_TYPE_UNSPECIFIED\x10\x00\x12\r\n\tIMMEDIATE\x10\x01\x12\x19\n\x15NEXT_AVAILABLE_WINDOW\x10\x02\x12\x11\n\rSPECIFIC_TIME\x10\x03\"\xed\x01\n\x13\x44\x65moteMasterContext\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12;\n\x17verify_gtid_consistency\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x1c\n\x14master_instance_name\x18\x03 \x01(\t\x12M\n\x15replica_configuration\x18\x04 \x01(\x0b\x32..google.cloud.sql.v1.DemoteMasterConfiguration\x12\x1e\n\x16skip_replication_setup\x18\x05 \x01(\x08\"O\n\rDemoteContext\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x30\n#source_representative_instance_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\"9\n\x0f\x46\x61iloverContext\x12\x18\n\x10settings_version\x18\x01 \x01(\x03\x12\x0c\n\x04kind\x18\x02 \x01(\t\"a\n\x14RestoreBackupContext\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x15\n\rbackup_run_id\x18\x02 \x01(\x03\x12\x13\n\x0binstance_id\x18\x03 \x01(\t\x12\x0f\n\x07project\x18\x04 \x01(\t\";\n\x15RotateServerCaContext\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x14\n\x0cnext_version\x18\x02 \x01(\t\"I\n\x1eRotateServerCertificateContext\x12\x11\n\x04kind\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x14\n\x0cnext_version\x18\x02 \x01(\t\"O\n\x1fRotateEntraIdCertificateContext\x12\x11\n\x04kind\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x19\n\x0cnext_version\x18\x02 \x01(\tB\x03\xe0\x41\x01\"4\n\x12TruncateLogContext\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x10\n\x08log_type\x18\x02 \x01(\t\"\xdf\x10\n\x1bSqlExternalSyncSettingError\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12^\n\x04type\x18\x02 \x01(\x0e\x32P.google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType\x12\x0e\n\x06\x64\x65tail\x18\x03 \x01(\t\"\xc1\x0f\n\x1fSqlExternalSyncSettingErrorType\x12\x34\n0SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED\x10\x00\x12\x16\n\x12\x43ONNECTION_FAILURE\x10\x01\x12\x16\n\x12\x42INLOG_NOT_ENABLED\x10\x02\x12!\n\x1dINCOMPATIBLE_DATABASE_VERSION\x10\x03\x12\x19\n\x15REPLICA_ALREADY_SETUP\x10\x04\x12\x1a\n\x16INSUFFICIENT_PRIVILEGE\x10\x05\x12\x1e\n\x1aUNSUPPORTED_MIGRATION_TYPE\x10\x06\x12\x1a\n\x16NO_PGLOGICAL_INSTALLED\x10\x07\x12!\n\x1dPGLOGICAL_NODE_ALREADY_EXISTS\x10\x08\x12\x15\n\x11INVALID_WAL_LEVEL\x10\t\x12\"\n\x1eINVALID_SHARED_PRELOAD_LIBRARY\x10\n\x12&\n\"INSUFFICIENT_MAX_REPLICATION_SLOTS\x10\x0b\x12 \n\x1cINSUFFICIENT_MAX_WAL_SENDERS\x10\x0c\x12%\n!INSUFFICIENT_MAX_WORKER_PROCESSES\x10\r\x12\x1a\n\x16UNSUPPORTED_EXTENSIONS\x10\x0e\x12#\n\x1fINVALID_RDS_LOGICAL_REPLICATION\x10\x0f\x12\x19\n\x15INVALID_LOGGING_SETUP\x10\x10\x12\x14\n\x10INVALID_DB_PARAM\x10\x11\x12\x19\n\x15UNSUPPORTED_GTID_MODE\x10\x12\x12\x1f\n\x1bSQLSERVER_AGENT_NOT_RUNNING\x10\x13\x12 \n\x1cUNSUPPORTED_TABLE_DEFINITION\x10\x14\x12\x17\n\x13UNSUPPORTED_DEFINER\x10\x15\x12!\n\x1dSQLSERVER_SERVERNAME_MISMATCH\x10\x16\x12\x19\n\x15PRIMARY_ALREADY_SETUP\x10\x17\x12\x1d\n\x19UNSUPPORTED_BINLOG_FORMAT\x10\x18\x12\x1c\n\x18\x42INLOG_RETENTION_SETTING\x10\x19\x12\x1e\n\x1aUNSUPPORTED_STORAGE_ENGINE\x10\x1a\x12\x1a\n\x16LIMITED_SUPPORT_TABLES\x10\x1b\x12\x1c\n\x18\x45XISTING_DATA_IN_REPLICA\x10\x1c\x12\x1f\n\x1bMISSING_OPTIONAL_PRIVILEGES\x10\x1d\x12 \n\x1cRISKY_BACKUP_ADMIN_PRIVILEGE\x10\x1e\x12 \n\x1cINSUFFICIENT_GCS_PERMISSIONS\x10\x1f\x12\x15\n\x11INVALID_FILE_INFO\x10 \x12!\n\x1dUNSUPPORTED_DATABASE_SETTINGS\x10!\x12\x30\n,MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE\x10\"\x12\x14\n\x10LOCAL_INFILE_OFF\x10#\x12\x1e\n\x1aTURN_ON_PITR_AFTER_PROMOTE\x10$\x12\'\n#INCOMPATIBLE_DATABASE_MINOR_VERSION\x10%\x12\x1c\n\x18SOURCE_MAX_SUBSCRIPTIONS\x10&\x12\x1d\n\x19UNABLE_TO_VERIFY_DEFINERS\x10\'\x12#\n\x1fSUBSCRIPTION_CALCULATION_STATUS\x10(\x12\x19\n\x15PG_SUBSCRIPTION_COUNT\x10)\x12\x1a\n\x16PG_SYNC_PARALLEL_LEVEL\x10*\x12\x1a\n\x16INSUFFICIENT_DISK_SIZE\x10+\x12\x1d\n\x19INSUFFICIENT_MACHINE_TIER\x10,\x12\'\n#UNSUPPORTED_EXTENSIONS_NOT_MIGRATED\x10-\x12\x1b\n\x17\x45XTENSIONS_NOT_MIGRATED\x10.\x12#\n\x1fPG_CRON_FLAG_ENABLED_IN_REPLICA\x10/\x12%\n!EXTENSIONS_NOT_ENABLED_IN_REPLICA\x10\x30\x12\x17\n\x13UNSUPPORTED_COLUMNS\x10\x31\x12 \n\x1cUSERS_NOT_CREATED_IN_REPLICA\x10\x32\x12\x1e\n\x1aUNSUPPORTED_SYSTEM_OBJECTS\x10\x33\x12,\n(UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY\x10\x34\x12(\n$SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE\x10\x35\x12\x34\n0PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI\x10\x36\x12\x31\n-SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS\x10\x37\x12\x1a\n\x16PROMPT_DELETE_EXISTING\x10\x38\x12\x18\n\x14WILL_DELETE_EXISTING\x10\x39\x12-\n)PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE\x10:\"(\n\x0fSelectedObjects\x12\x15\n\x08\x64\x61tabase\x18\x01 \x01(\tB\x03\xe0\x41\x02\"\xe7\x03\n\x17OnPremisesConfiguration\x12\x11\n\thost_port\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\x12\x10\n\x08username\x18\x03 \x01(\t\x12\x10\n\x08password\x18\x04 \x01(\t\x12\x16\n\x0e\x63\x61_certificate\x18\x05 \x01(\t\x12\x1a\n\x12\x63lient_certificate\x18\x06 \x01(\t\x12\x12\n\nclient_key\x18\x07 \x01(\t\x12\x16\n\x0e\x64ump_file_path\x18\x08 \x01(\t\x12?\n\x0fsource_instance\x18\x0f \x01(\x0b\x32&.google.cloud.sql.v1.InstanceReference\x12\x43\n\x10selected_objects\x18\x10 \x03(\x0b\x32$.google.cloud.sql.v1.SelectedObjectsB\x03\xe0\x41\x01\x12O\n\nssl_option\x18\x12 \x01(\x0e\x32\x36.google.cloud.sql.v1.OnPremisesConfiguration.SslOptionB\x03\xe0\x41\x01\"P\n\tSslOption\x12\x1a\n\x16SSL_OPTION_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x44ISABLE\x10\x01\x12\x0b\n\x07REQUIRE\x10\x02\x12\r\n\tVERIFY_CA\x10\x03\"\xeb\x01\n\x14ReplicaConfiguration\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12S\n\x1bmysql_replica_configuration\x18\x02 \x01(\x0b\x32..google.cloud.sql.v1.MySqlReplicaConfiguration\x12\x33\n\x0f\x66\x61ilover_target\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12;\n\x12\x63\x61scadable_replica\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\"\x82\x01\n\x1dSqlInstancesExecuteSqlRequest\x12\x15\n\x08instance\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07project\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x34\n\x04\x62ody\x18\x64 \x01(\x0b\x32&.google.cloud.sql.v1.ExecuteSqlPayload\"\x84\x03\n\x11\x45xecuteSqlPayload\x12\x11\n\x04user\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x1a\n\rsql_statement\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x15\n\x08\x64\x61tabase\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x1d\n\x0e\x61uto_iam_authn\x18\x0b \x01(\x08\x42\x03\xe0\x41\x01H\x00\x12\x16\n\trow_limit\x18\n \x01(\x03\x42\x03\xe0\x41\x01\x12Z\n\x13partial_result_mode\x18\r \x01(\x0e\x32\x38.google.cloud.sql.v1.ExecuteSqlPayload.PartialResultModeB\x03\xe0\x41\x01\x12\x18\n\x0b\x61pplication\x18\x10 \x01(\tB\x03\xe0\x41\x01\"k\n\x11PartialResultMode\x12#\n\x1fPARTIAL_RESULT_MODE_UNSPECIFIED\x10\x00\x12\x17\n\x13\x46\x41IL_PARTIAL_RESULT\x10\x01\x12\x18\n\x14\x41LLOW_PARTIAL_RESULT\x10\x02\x42\x0f\n\ruser_password\"\xc8\x02\n\x1eSqlInstancesExecuteSqlResponse\x12M\n\x08messages\x18\t \x03(\x0b\x32;.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message\x12/\n\x08metadata\x18\x06 \x01(\x0b\x32\x1d.google.cloud.sql.v1.Metadata\x12\x31\n\x07results\x18\x07 \x03(\x0b\x32 .google.cloud.sql.v1.QueryResult\x12\"\n\x06status\x18\x08 \x01(\x0b\x32\x12.google.rpc.Status\x1aO\n\x07Message\x12\x14\n\x07message\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08severity\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\n\n\x08_messageB\x0b\n\t_severity\"\xb0\x01\n\x0bQueryResult\x12,\n\x07\x63olumns\x18\x01 \x03(\x0b\x32\x1b.google.cloud.sql.v1.Column\x12&\n\x04rows\x18\x02 \x03(\x0b\x32\x18.google.cloud.sql.v1.Row\x12\x0f\n\x07message\x18\x03 \x01(\t\x12\x16\n\x0epartial_result\x18\x04 \x01(\x08\x12\"\n\x06status\x18\x08 \x01(\x0b\x32\x12.google.rpc.Status\"$\n\x06\x43olumn\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\"1\n\x03Row\x12*\n\x06values\x18\x01 \x03(\x0b\x32\x1a.google.cloud.sql.v1.Value\"*\n\x05Value\x12\r\n\x05value\x18\x01 \x01(\t\x12\x12\n\nnull_value\x18\x02 \x01(\x08\"K\n\x08Metadata\x12?\n\x1csql_statement_execution_time\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\"\x9c\x01\n#SqlInstancesAcquireSsrsLeaseRequest\x12\x15\n\x08instance\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07project\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12H\n\x04\x62ody\x18\x64 \x01(\x0b\x32\x35.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequestB\x03\xe0\x41\x02\"<\n$SqlInstancesAcquireSsrsLeaseResponse\x12\x14\n\x0coperation_id\x18\x01 \x01(\t\"R\n#SqlInstancesReleaseSsrsLeaseRequest\x12\x15\n\x08instance\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07project\x18\x02 \x01(\tB\x03\xe0\x41\x02\"<\n$SqlInstancesReleaseSsrsLeaseResponse\x12\x14\n\x0coperation_id\x18\x01 \x01(\t\"\x82\x01\n%SqlInstancesPointInTimeRestoreRequest\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x44\n\x07\x63ontext\x18\x64 \x01(\x0b\x32..google.cloud.sql.v1.PointInTimeRestoreContextB\x03\xe0\x41\x02*h\n\x19\x45xternalSyncParallelLevel\x12,\n(EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED\x10\x00\x12\x07\n\x03MIN\x10\x01\x12\x0b\n\x07OPTIMAL\x10\x02\x12\x07\n\x03MAX\x10\x03*\x99\x01\n\x0fSqlInstanceType\x12!\n\x1dSQL_INSTANCE_TYPE_UNSPECIFIED\x10\x00\x12\x16\n\x12\x43LOUD_SQL_INSTANCE\x10\x01\x12\x18\n\x14ON_PREMISES_INSTANCE\x10\x02\x12\x19\n\x15READ_REPLICA_INSTANCE\x10\x03\x12\x16\n\x12READ_POOL_INSTANCE\x10\x05*\x9d\x01\n\x13SqlSuspensionReason\x12%\n!SQL_SUSPENSION_REASON_UNSPECIFIED\x10\x00\x12\x11\n\rBILLING_ISSUE\x10\x02\x12\x0f\n\x0bLEGAL_ISSUE\x10\x03\x12\x15\n\x11OPERATIONAL_ISSUE\x10\x04\x12\x11\n\rKMS_KEY_ISSUE\x10\x05\x12\x11\n\rPROJECT_ABUSE\x10\x08\x32\x99>\n\x13SqlInstancesService\x12\xa3\x01\n\x0b\x41\x64\x64ServerCa\x12\x33.google.cloud.sql.v1.SqlInstancesAddServerCaRequest\x1a\x1e.google.cloud.sql.v1.Operation\"?\x82\xd3\xe4\x93\x02\x39\"7/v1/projects/{project}/instances/{instance}/addServerCa\x12\xbe\x01\n\x14\x41\x64\x64ServerCertificate\x12<.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest\x1a\x1e.google.cloud.sql.v1.Operation\"H\x82\xd3\xe4\x93\x02\x42\"@/v1/projects/{project}/instances/{instance}/addServerCertificate\x12\xc1\x01\n\x15\x41\x64\x64\x45ntraIdCertificate\x12=.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest\x1a\x1e.google.cloud.sql.v1.Operation\"I\x82\xd3\xe4\x93\x02\x43\"A/v1/projects/{project}/instances/{instance}/addEntraIdCertificate\x12\x97\x01\n\x05\x43lone\x12-.google.cloud.sql.v1.SqlInstancesCloneRequest\x1a\x1e.google.cloud.sql.v1.Operation\"?\x82\xd3\xe4\x93\x02\x39\"1/v1/projects/{project}/instances/{instance}/clone:\x04\x62ody\x12\x8d\x01\n\x06\x44\x65lete\x12..google.cloud.sql.v1.SqlInstancesDeleteRequest\x1a\x1e.google.cloud.sql.v1.Operation\"3\x82\xd3\xe4\x93\x02-*+/v1/projects/{project}/instances/{instance}\x12\xac\x01\n\x0c\x44\x65moteMaster\x12\x34.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest\x1a\x1e.google.cloud.sql.v1.Operation\"F\x82\xd3\xe4\x93\x02@\"8/v1/projects/{project}/instances/{instance}/demoteMaster:\x04\x62ody\x12\x9a\x01\n\x06\x44\x65mote\x12..google.cloud.sql.v1.SqlInstancesDemoteRequest\x1a\x1e.google.cloud.sql.v1.Operation\"@\x82\xd3\xe4\x93\x02:\"2/v1/projects/{project}/instances/{instance}/demote:\x04\x62ody\x12\x9a\x01\n\x06\x45xport\x12..google.cloud.sql.v1.SqlInstancesExportRequest\x1a\x1e.google.cloud.sql.v1.Operation\"@\x82\xd3\xe4\x93\x02:\"2/v1/projects/{project}/instances/{instance}/export:\x04\x62ody\x12\xa0\x01\n\x08\x46\x61ilover\x12\x30.google.cloud.sql.v1.SqlInstancesFailoverRequest\x1a\x1e.google.cloud.sql.v1.Operation\"B\x82\xd3\xe4\x93\x02<\"4/v1/projects/{project}/instances/{instance}/failover:\x04\x62ody\x12\xa3\x01\n\tReencrypt\x12\x31.google.cloud.sql.v1.SqlInstancesReencryptRequest\x1a\x1e.google.cloud.sql.v1.Operation\"C\x82\xd3\xe4\x93\x02=\"5/v1/projects/{project}/instances/{instance}/reencrypt:\x04\x62ody\x12\x8e\x01\n\x03Get\x12+.google.cloud.sql.v1.SqlInstancesGetRequest\x1a%.google.cloud.sql.v1.DatabaseInstance\"3\x82\xd3\xe4\x93\x02-\x12+/v1/projects/{project}/instances/{instance}\x12\x9a\x01\n\x06Import\x12..google.cloud.sql.v1.SqlInstancesImportRequest\x1a\x1e.google.cloud.sql.v1.Operation\"@\x82\xd3\xe4\x93\x02:\"2/v1/projects/{project}/instances/{instance}/import:\x04\x62ody\x12\x88\x01\n\x06Insert\x12..google.cloud.sql.v1.SqlInstancesInsertRequest\x1a\x1e.google.cloud.sql.v1.Operation\".\x82\xd3\xe4\x93\x02(\" /v1/projects/{project}/instances:\x04\x62ody\x12\x8a\x01\n\x04List\x12,.google.cloud.sql.v1.SqlInstancesListRequest\x1a*.google.cloud.sql.v1.InstancesListResponse\"(\x82\xd3\xe4\x93\x02\"\x12 /v1/projects/{project}/instances\x12\xbe\x01\n\rListServerCas\x12\x35.google.cloud.sql.v1.SqlInstancesListServerCasRequest\x1a\x33.google.cloud.sql.v1.InstancesListServerCasResponse\"A\x82\xd3\xe4\x93\x02;\x12\x39/v1/projects/{project}/instances/{instance}/listServerCas\x12\xe2\x01\n\x16ListServerCertificates\x12>.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest\x1a<.google.cloud.sql.v1.InstancesListServerCertificatesResponse\"J\x82\xd3\xe4\x93\x02\x44\x12\x42/v1/projects/{project}/instances/{instance}/listServerCertificates\x12\xe6\x01\n\x17ListEntraIdCertificates\x12?.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest\x1a=.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse\"K\x82\xd3\xe4\x93\x02\x45\x12\x43/v1/projects/{project}/instances/{instance}/listEntraIdCertificates\x12\x91\x01\n\x05Patch\x12-.google.cloud.sql.v1.SqlInstancesPatchRequest\x1a\x1e.google.cloud.sql.v1.Operation\"9\x82\xd3\xe4\x93\x02\x33\x32+/v1/projects/{project}/instances/{instance}:\x04\x62ody\x12\xac\x01\n\x0ePromoteReplica\x12\x36.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest\x1a\x1e.google.cloud.sql.v1.Operation\"B\x82\xd3\xe4\x93\x02<\":/v1/projects/{project}/instances/{instance}/promoteReplica\x12\xa0\x01\n\nSwitchover\x12\x32.google.cloud.sql.v1.SqlInstancesSwitchoverRequest\x1a\x1e.google.cloud.sql.v1.Operation\">\x82\xd3\xe4\x93\x02\x38\"6/v1/projects/{project}/instances/{instance}/switchover\x12\xac\x01\n\x0eResetSslConfig\x12\x36.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest\x1a\x1e.google.cloud.sql.v1.Operation\"B\x82\xd3\xe4\x93\x02<\":/v1/projects/{project}/instances/{instance}/resetSslConfig\x12\x97\x01\n\x07Restart\x12/.google.cloud.sql.v1.SqlInstancesRestartRequest\x1a\x1e.google.cloud.sql.v1.Operation\";\x82\xd3\xe4\x93\x02\x35\"3/v1/projects/{project}/instances/{instance}/restart\x12\xaf\x01\n\rRestoreBackup\x12\x35.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest\x1a\x1e.google.cloud.sql.v1.Operation\"G\x82\xd3\xe4\x93\x02\x41\"9/v1/projects/{project}/instances/{instance}/restoreBackup:\x04\x62ody\x12\xb2\x01\n\x0eRotateServerCa\x12\x36.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest\x1a\x1e.google.cloud.sql.v1.Operation\"H\x82\xd3\xe4\x93\x02\x42\":/v1/projects/{project}/instances/{instance}/rotateServerCa:\x04\x62ody\x12\xcd\x01\n\x17RotateServerCertificate\x12?.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest\x1a\x1e.google.cloud.sql.v1.Operation\"Q\x82\xd3\xe4\x93\x02K\"C/v1/projects/{project}/instances/{instance}/rotateServerCertificate:\x04\x62ody\x12\xd0\x01\n\x18RotateEntraIdCertificate\x12@.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest\x1a\x1e.google.cloud.sql.v1.Operation\"R\x82\xd3\xe4\x93\x02L\"D/v1/projects/{project}/instances/{instance}/rotateEntraIdCertificate:\x04\x62ody\x12\xa6\x01\n\x0cStartReplica\x12\x34.google.cloud.sql.v1.SqlInstancesStartReplicaRequest\x1a\x1e.google.cloud.sql.v1.Operation\"@\x82\xd3\xe4\x93\x02:\"8/v1/projects/{project}/instances/{instance}/startReplica\x12\xa3\x01\n\x0bStopReplica\x12\x33.google.cloud.sql.v1.SqlInstancesStopReplicaRequest\x1a\x1e.google.cloud.sql.v1.Operation\"?\x82\xd3\xe4\x93\x02\x39\"7/v1/projects/{project}/instances/{instance}/stopReplica\x12\xa9\x01\n\x0bTruncateLog\x12\x33.google.cloud.sql.v1.SqlInstancesTruncateLogRequest\x1a\x1e.google.cloud.sql.v1.Operation\"E\x82\xd3\xe4\x93\x02?\"7/v1/projects/{project}/instances/{instance}/truncateLog:\x04\x62ody\x12\x93\x01\n\x06Update\x12..google.cloud.sql.v1.SqlInstancesUpdateRequest\x1a\x1e.google.cloud.sql.v1.Operation\"9\x82\xd3\xe4\x93\x02\x33\x1a+/v1/projects/{project}/instances/{instance}:\x04\x62ody\x12\xb7\x01\n\x0f\x43reateEphemeral\x12;.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest\x1a\x1c.google.cloud.sql.v1.SslCert\"I\x82\xd3\xe4\x93\x02\x43\";/v1/projects/{project}/instances/{instance}/createEphemeral:\x04\x62ody\x12\xc7\x01\n\x15RescheduleMaintenance\x12=.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest\x1a\x1e.google.cloud.sql.v1.Operation\"O\x82\xd3\xe4\x93\x02I\"A/v1/projects/{project}/instances/{instance}/rescheduleMaintenance:\x04\x62ody\x12\xf8\x01\n\x1aVerifyExternalSyncSettings\x12\x42.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest\x1a\x43.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse\"Q\x82\xd3\xe4\x93\x02K\"F/v1/projects/{project}/instances/{instance}/verifyExternalSyncSettings:\x01*\x12\xb8\x01\n\x11StartExternalSync\x12\x39.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest\x1a\x1e.google.cloud.sql.v1.Operation\"H\x82\xd3\xe4\x93\x02\x42\"=/v1/projects/{project}/instances/{instance}/startExternalSync:\x01*\x12\xbb\x01\n\x11PerformDiskShrink\x12\x39.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest\x1a\x1e.google.cloud.sql.v1.Operation\"K\x82\xd3\xe4\x93\x02\x45\"=/v1/projects/{project}/instances/{instance}/performDiskShrink:\x04\x62ody\x12\xd9\x01\n\x13GetDiskShrinkConfig\x12;.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest\x1a<.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse\"G\x82\xd3\xe4\x93\x02\x41\x12?/v1/projects/{project}/instances/{instance}/getDiskShrinkConfig\x12\xb5\x01\n\x10ResetReplicaSize\x12\x38.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest\x1a\x1e.google.cloud.sql.v1.Operation\"G\x82\xd3\xe4\x93\x02\x41\".google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse\"I\x82\xd3\xe4\x93\x02\x43\x12\x41/v1/projects/{project}/instances/{instance}/getLatestRecoveryTime\x12\xbb\x01\n\nExecuteSql\x12\x32.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest\x1a\x33.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse\"D\x82\xd3\xe4\x93\x02>\"6/v1/projects/{project}/instances/{instance}/executeSql:\x04\x62ody\x12\xd3\x01\n\x10\x41\x63quireSsrsLease\x12\x38.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest\x1a\x39.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse\"J\x82\xd3\xe4\x93\x02\x44\"\"\n\rBackupContext\x12\x11\n\tbackup_id\x18\x01 \x01(\x03\x12\x0c\n\x04kind\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\"\xf7\x01\n\x08\x44\x61tabase\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x0f\n\x07\x63harset\x18\x02 \x01(\t\x12\x11\n\tcollation\x18\x03 \x01(\t\x12\x0c\n\x04\x65tag\x18\x04 \x01(\t\x12\x0c\n\x04name\x18\x05 \x01(\t\x12\x10\n\x08instance\x18\x06 \x01(\t\x12\x11\n\tself_link\x18\x07 \x01(\t\x12\x0f\n\x07project\x18\x08 \x01(\t\x12S\n\x1asqlserver_database_details\x18\t \x01(\x0b\x32-.google.cloud.sql.v1.SqlServerDatabaseDetailsH\x00\x42\x12\n\x10\x64\x61tabase_details\"O\n\x18SqlServerDatabaseDetails\x12\x1b\n\x13\x63ompatibility_level\x18\x01 \x01(\x05\x12\x16\n\x0erecovery_model\x18\x02 \x01(\t\",\n\rDatabaseFlags\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"M\n\x0fMySqlSyncConfig\x12:\n\x12initial_sync_flags\x18\x01 \x03(\x0b\x32\x1e.google.cloud.sql.v1.SyncFlags\"(\n\tSyncFlags\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"B\n\x11InstanceReference\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06region\x18\x02 \x01(\t\x12\x0f\n\x07project\x18\x03 \x01(\t\"\x8a\x01\n\x19\x44\x65moteMasterConfiguration\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12_\n\x1bmysql_replica_configuration\x18\x02 \x01(\x0b\x32:.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration\"\xa1\x01\n%DemoteMasterMySqlReplicaConfiguration\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x10\n\x08username\x18\x02 \x01(\t\x12\x10\n\x08password\x18\x03 \x01(\t\x12\x12\n\nclient_key\x18\x04 \x01(\t\x12\x1a\n\x12\x63lient_certificate\x18\x05 \x01(\t\x12\x16\n\x0e\x63\x61_certificate\x18\x06 \x01(\t\"\x81\x0e\n\rExportContext\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12\x11\n\tdatabases\x18\x02 \x03(\t\x12\x0c\n\x04kind\x18\x03 \x01(\t\x12O\n\x12sql_export_options\x18\x04 \x01(\x0b\x32\x33.google.cloud.sql.v1.ExportContext.SqlExportOptions\x12R\n\x12\x63sv_export_options\x18\x05 \x01(\x0b\x32\x36.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions\x12\x33\n\tfile_type\x18\x06 \x01(\x0e\x32 .google.cloud.sql.v1.SqlFileType\x12+\n\x07offload\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12R\n\x12\x62\x61k_export_options\x18\t \x01(\x0b\x32\x36.google.cloud.sql.v1.ExportContext.SqlBakExportOptions\x12W\n\x12tde_export_options\x18\n \x01(\x0b\x32\x36.google.cloud.sql.v1.ExportContext.SqlTdeExportOptionsB\x03\xe0\x41\x01\x1a\x99\x01\n\x13SqlCsvExportOptions\x12\x14\n\x0cselect_query\x18\x01 \x01(\t\x12\x18\n\x10\x65scape_character\x18\x02 \x01(\t\x12\x17\n\x0fquote_character\x18\x03 \x01(\t\x12\x1c\n\x14\x66ields_terminated_by\x18\x04 \x01(\t\x12\x1b\n\x13lines_terminated_by\x18\x06 \x01(\t\x1a\xd5\x04\n\x10SqlExportOptions\x12\x0e\n\x06tables\x18\x01 \x03(\t\x12/\n\x0bschema_only\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x64\n\x14mysql_export_options\x18\x03 \x01(\x0b\x32\x46.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions\x12\x31\n\x07threads\x18\x04 \x01(\x0b\x32\x1b.google.protobuf.Int32ValueB\x03\xe0\x41\x01\x12\x31\n\x08parallel\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\x12o\n\x17postgres_export_options\x18\x06 \x01(\x0b\x32I.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptionsB\x03\xe0\x41\x01\x1a\x46\n\x12MysqlExportOptions\x12\x30\n\x0bmaster_data\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x1a{\n\x15PostgresExportOptions\x12.\n\x05\x63lean\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\x12\x32\n\tif_exists\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\x1a\x8d\x03\n\x13SqlBakExportOptions\x12+\n\x07striped\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x31\n\x0cstripe_count\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12.\n\x08\x62\x61k_type\x18\x04 \x01(\x0e\x32\x1c.google.cloud.sql.v1.BakType\x12\x31\n\tcopy_only\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x02\x18\x01\x12\x35\n\x11\x64ifferential_base\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12>\n\x15\x65xport_log_start_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x01\x12<\n\x13\x65xport_log_end_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x01\x1a\x89\x01\n\x13SqlTdeExportOptions\x12\x1d\n\x10\x63\x65rtificate_path\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x1d\n\x10private_key_path\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12!\n\x14private_key_password\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x11\n\x04name\x18\x05 \x01(\tB\x03\xe0\x41\x02\"\x8e\r\n\rImportContext\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12\x10\n\x08\x64\x61tabase\x18\x02 \x01(\t\x12\x0c\n\x04kind\x18\x03 \x01(\t\x12\x33\n\tfile_type\x18\x04 \x01(\x0e\x32 .google.cloud.sql.v1.SqlFileType\x12R\n\x12\x63sv_import_options\x18\x05 \x01(\x0b\x32\x36.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions\x12\x13\n\x0bimport_user\x18\x06 \x01(\t\x12R\n\x12\x62\x61k_import_options\x18\x07 \x01(\x0b\x32\x36.google.cloud.sql.v1.ImportContext.SqlBakImportOptions\x12T\n\x12sql_import_options\x18\x08 \x01(\x0b\x32\x33.google.cloud.sql.v1.ImportContext.SqlImportOptionsB\x03\xe0\x41\x01\x12W\n\x12tde_import_options\x18\t \x01(\x0b\x32\x36.google.cloud.sql.v1.ImportContext.SqlTdeImportOptionsB\x03\xe0\x41\x01\x1a\xe6\x02\n\x10SqlImportOptions\x12\x31\n\x07threads\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.Int32ValueB\x03\xe0\x41\x01\x12\x31\n\x08parallel\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\x12o\n\x17postgres_import_options\x18\x03 \x01(\x0b\x32I.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptionsB\x03\xe0\x41\x01\x1a{\n\x15PostgresImportOptions\x12.\n\x05\x63lean\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\x12\x32\n\tif_exists\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\x1a\xa3\x01\n\x13SqlCsvImportOptions\x12\r\n\x05table\x18\x01 \x01(\t\x12\x0f\n\x07\x63olumns\x18\x02 \x03(\t\x12\x18\n\x10\x65scape_character\x18\x04 \x01(\t\x12\x17\n\x0fquote_character\x18\x05 \x01(\t\x12\x1c\n\x14\x66ields_terminated_by\x18\x06 \x01(\t\x12\x1b\n\x13lines_terminated_by\x18\x08 \x01(\t\x1a\x93\x04\n\x13SqlBakImportOptions\x12\x64\n\x12\x65ncryption_options\x18\x01 \x01(\x0b\x32H.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions\x12+\n\x07striped\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12/\n\x0bno_recovery\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x31\n\rrecovery_only\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12.\n\x08\x62\x61k_type\x18\x06 \x01(\x0e\x32\x1c.google.cloud.sql.v1.BakType\x12\x30\n\x07stop_at\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x01\x12\x19\n\x0cstop_at_mark\x18\x08 \x01(\tB\x03\xe0\x41\x01\x1a\x87\x01\n\x11\x45ncryptionOptions\x12\x11\n\tcert_path\x18\x01 \x01(\t\x12\x10\n\x08pvk_path\x18\x02 \x01(\t\x12\x14\n\x0cpvk_password\x18\x03 \x01(\t\x12\x37\n\x0ekeep_encrypted\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\x1a\x89\x01\n\x13SqlTdeImportOptions\x12\x1d\n\x10\x63\x65rtificate_path\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x1d\n\x10private_key_path\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12!\n\x14private_key_password\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x11\n\x04name\x18\x05 \x01(\tB\x03\xe0\x41\x02\"\xbb\t\n\x0fIpConfiguration\x12\x30\n\x0cipv4_enabled\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x17\n\x0fprivate_network\x18\x02 \x01(\t\x12/\n\x0brequire_ssl\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12:\n\x13\x61uthorized_networks\x18\x04 \x03(\x0b\x32\x1d.google.cloud.sql.v1.AclEntry\x12\x1a\n\x12\x61llocated_ip_range\x18\x06 \x01(\t\x12Q\n-enable_private_path_for_google_cloud_services\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12>\n\x08ssl_mode\x18\x08 \x01(\x0e\x32,.google.cloud.sql.v1.IpConfiguration.SslMode\x12\x37\n\npsc_config\x18\t \x01(\x0b\x32\x1e.google.cloud.sql.v1.PscConfigH\x00\x88\x01\x01\x12H\n\x0eserver_ca_mode\x18\n \x01(\x0e\x32+.google.cloud.sql.v1.IpConfiguration.CaModeH\x01\x88\x01\x01\x12-\n custom_subject_alternative_names\x18\x0b \x03(\tB\x03\xe0\x41\x01\x12 \n\x0eserver_ca_pool\x18\x0c \x01(\tB\x03\xe0\x41\x01H\x02\x88\x01\x01\x12v\n server_certificate_rotation_mode\x18\x10 \x01(\x0e\x32\x42.google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationModeB\x03\xe0\x41\x01H\x03\x88\x01\x01\"\x85\x01\n\x07SslMode\x12\x18\n\x14SSL_MODE_UNSPECIFIED\x10\x00\x12#\n\x1f\x41LLOW_UNENCRYPTED_AND_ENCRYPTED\x10\x01\x12\x12\n\x0e\x45NCRYPTED_ONLY\x10\x02\x12\'\n#TRUSTED_CLIENT_CERTIFICATE_REQUIRED\x10\x03\"y\n\x06\x43\x61Mode\x12\x17\n\x13\x43\x41_MODE_UNSPECIFIED\x10\x00\x12\x1e\n\x1aGOOGLE_MANAGED_INTERNAL_CA\x10\x01\x12\x19\n\x15GOOGLE_MANAGED_CAS_CA\x10\x02\x12\x1b\n\x17\x43USTOMER_MANAGED_CAS_CA\x10\x03\"\x97\x01\n\x1dServerCertificateRotationMode\x12\x30\n,SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED\x10\x00\x12\x19\n\x15NO_AUTOMATIC_ROTATION\x10\x01\x12)\n%AUTOMATIC_ROTATION_DURING_MAINTENANCE\x10\x02\x42\r\n\x0b_psc_configB\x11\n\x0f_server_ca_modeB\x11\n\x0f_server_ca_poolB#\n!_server_certificate_rotation_mode\"\xe9\x02\n\tPscConfig\x12\x18\n\x0bpsc_enabled\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12&\n\x19\x61llowed_consumer_projects\x18\x02 \x03(\tB\x03\xe0\x41\x01\x12O\n\x14psc_auto_connections\x18\x03 \x03(\x0b\x32,.google.cloud.sql.v1.PscAutoConnectionConfigB\x03\xe0\x41\x01\x12#\n\x16network_attachment_uri\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12&\n\x14psc_auto_dns_enabled\x18\x05 \x01(\x08\x42\x03\xe0\x41\x01H\x01\x88\x01\x01\x12\x30\n\x1epsc_write_endpoint_dns_enabled\x18\x06 \x01(\x08\x42\x03\xe0\x41\x01H\x02\x88\x01\x01\x42\x0e\n\x0c_psc_enabledB\x17\n\x15_psc_auto_dns_enabledB!\n\x1f_psc_write_endpoint_dns_enabled\"\xeb\x01\n\x17PscAutoConnectionConfig\x12\x1d\n\x10\x63onsumer_project\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x1d\n\x10\x63onsumer_network\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12!\n\nip_address\x18\x03 \x01(\tB\x08\xe2\x8c\xcf\xd7\x08\x02\x08\x04H\x00\x88\x01\x01\x12\x13\n\x06status\x18\x04 \x01(\tH\x01\x88\x01\x01\x12$\n\x17\x63onsumer_network_status\x18\x05 \x01(\tH\x02\x88\x01\x01\x42\r\n\x0b_ip_addressB\t\n\x07_statusB\x1a\n\x18_consumer_network_status\"l\n\x12LocationPreference\x12\"\n\x16\x66ollow_gae_application\x18\x01 \x01(\tB\x02\x18\x01\x12\x0c\n\x04zone\x18\x02 \x01(\t\x12\x16\n\x0esecondary_zone\x18\x04 \x01(\t\x12\x0c\n\x04kind\x18\x03 \x01(\t\"\xb1\x01\n\x11MaintenanceWindow\x12)\n\x04hour\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12(\n\x03\x64\x61y\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x39\n\x0cupdate_track\x18\x03 \x01(\x0e\x32#.google.cloud.sql.v1.SqlUpdateTrack\x12\x0c\n\x04kind\x18\x04 \x01(\t\"K\n\x15\x44\x65nyMaintenancePeriod\x12\x12\n\nstart_date\x18\x01 \x01(\t\x12\x10\n\x08\x65nd_date\x18\x02 \x01(\t\x12\x0c\n\x04time\x18\x03 \x01(\t\"\xb1\x02\n\x0eInsightsConfig\x12\x1e\n\x16query_insights_enabled\x18\x01 \x01(\x08\x12\x1d\n\x15record_client_address\x18\x02 \x01(\x08\x12\x1f\n\x17record_application_tags\x18\x03 \x01(\x08\x12\x38\n\x13query_string_length\x18\x04 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12;\n\x16query_plans_per_minute\x18\x05 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12H\n\x1f\x65nhanced_query_insights_enabled\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\"\xfb\x02\n\x19MySqlReplicaConfiguration\x12\x16\n\x0e\x64ump_file_path\x18\x01 \x01(\t\x12\x10\n\x08username\x18\x02 \x01(\t\x12\x10\n\x08password\x18\x03 \x01(\t\x12;\n\x16\x63onnect_retry_interval\x18\x04 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12<\n\x17master_heartbeat_period\x18\x05 \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x16\n\x0e\x63\x61_certificate\x18\x06 \x01(\t\x12\x1a\n\x12\x63lient_certificate\x18\x07 \x01(\t\x12\x12\n\nclient_key\x18\x08 \x01(\t\x12\x12\n\nssl_cipher\x18\t \x01(\t\x12=\n\x19verify_server_certificate\x18\n \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x0c\n\x04kind\x18\x0b \x01(\t\"A\n\x1b\x44iskEncryptionConfiguration\x12\x14\n\x0ckms_key_name\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\"B\n\x14\x44iskEncryptionStatus\x12\x1c\n\x14kms_key_version_name\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\"\x88\x01\n\tIpMapping\x12\x33\n\x04type\x18\x01 \x01(\x0e\x32%.google.cloud.sql.v1.SqlIpAddressType\x12\x12\n\nip_address\x18\x02 \x01(\t\x12\x32\n\x0etime_to_retire\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"s\n\x13SqlSubOperationType\x12\x43\n\x10maintenance_type\x18\x01 \x01(\x0e\x32\'.google.cloud.sql.v1.SqlMaintenanceTypeH\x00\x42\x17\n\x15sub_operation_details\"\xfa\x10\n\tOperation\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x13\n\x0btarget_link\x18\x02 \x01(\t\x12\x41\n\x06status\x18\x03 \x01(\x0e\x32\x31.google.cloud.sql.v1.Operation.SqlOperationStatus\x12\x0c\n\x04user\x18\x04 \x01(\t\x12/\n\x0binsert_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nstart_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x33\n\x05\x65rror\x18\x08 \x01(\x0b\x32$.google.cloud.sql.v1.OperationErrors\x12\x34\n\x0b\x61pi_warning\x18\x13 \x01(\x0b\x32\x1f.google.cloud.sql.v1.ApiWarning\x12G\n\x0eoperation_type\x18\t \x01(\x0e\x32/.google.cloud.sql.v1.Operation.SqlOperationType\x12:\n\x0eimport_context\x18\n \x01(\x0b\x32\".google.cloud.sql.v1.ImportContext\x12:\n\x0e\x65xport_context\x18\x0b \x01(\x0b\x32\".google.cloud.sql.v1.ExportContext\x12:\n\x0e\x62\x61\x63kup_context\x18\x11 \x01(\x0b\x32\".google.cloud.sql.v1.BackupContext\x12h\n\'pre_check_major_version_upgrade_context\x18\x32 \x01(\x0b\x32\x37.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext\x12\x0c\n\x04name\x18\x0c \x01(\t\x12\x11\n\ttarget_id\x18\r \x01(\t\x12\x11\n\tself_link\x18\x0e \x01(\t\x12\x16\n\x0etarget_project\x18\x0f \x01(\t\x12P\n\x1a\x61\x63quire_ssrs_lease_context\x18\x14 \x01(\x0b\x32,.google.cloud.sql.v1.AcquireSsrsLeaseContext\x12I\n\x12sub_operation_type\x18\x30 \x01(\x0b\x32(.google.cloud.sql.v1.SqlSubOperationTypeB\x03\xe0\x41\x01\"\xce\x08\n\x10SqlOperationType\x12\"\n\x1eSQL_OPERATION_TYPE_UNSPECIFIED\x10\x00\x12\n\n\x06IMPORT\x10\x01\x12\n\n\x06\x45XPORT\x10\x02\x12\n\n\x06\x43REATE\x10\x03\x12\n\n\x06UPDATE\x10\x04\x12\n\n\x06\x44\x45LETE\x10\x05\x12\x0b\n\x07RESTART\x10\x06\x12\x0e\n\x06\x42\x41\x43KUP\x10\x07\x1a\x02\x08\x01\x12\x10\n\x08SNAPSHOT\x10\x08\x1a\x02\x08\x01\x12\x11\n\rBACKUP_VOLUME\x10\t\x12\x11\n\rDELETE_VOLUME\x10\n\x12\x12\n\x0eRESTORE_VOLUME\x10\x0b\x12\x0f\n\x0bINJECT_USER\x10\x0c\x12\t\n\x05\x43LONE\x10\x0e\x12\x10\n\x0cSTOP_REPLICA\x10\x0f\x12\x11\n\rSTART_REPLICA\x10\x10\x12\x13\n\x0fPROMOTE_REPLICA\x10\x11\x12\x12\n\x0e\x43REATE_REPLICA\x10\x12\x12\x0f\n\x0b\x43REATE_USER\x10\x13\x12\x0f\n\x0b\x44\x45LETE_USER\x10\x14\x12\x0f\n\x0bUPDATE_USER\x10\x15\x12\x13\n\x0f\x43REATE_DATABASE\x10\x16\x12\x13\n\x0f\x44\x45LETE_DATABASE\x10\x17\x12\x13\n\x0fUPDATE_DATABASE\x10\x18\x12\x0c\n\x08\x46\x41ILOVER\x10\x19\x12\x11\n\rDELETE_BACKUP\x10\x1a\x12\x14\n\x10RECREATE_REPLICA\x10\x1b\x12\x10\n\x0cTRUNCATE_LOG\x10\x1c\x12\x11\n\rDEMOTE_MASTER\x10\x1d\x12\x0f\n\x0bMAINTENANCE\x10\x1e\x12\x19\n\x11\x45NABLE_PRIVATE_IP\x10\x1f\x1a\x02\x08\x01\x12\x19\n\x11\x44\x45\x46\x45R_MAINTENANCE\x10 \x1a\x02\x08\x01\x12\x14\n\x0c\x43REATE_CLONE\x10!\x1a\x02\x08\x01\x12\x1a\n\x16RESCHEDULE_MAINTENANCE\x10\"\x12\x17\n\x13START_EXTERNAL_SYNC\x10#\x12\x0f\n\x0bLOG_CLEANUP\x10$\x12\x10\n\x0c\x41UTO_RESTART\x10%\x12\r\n\tREENCRYPT\x10&\x12\x0e\n\nSWITCHOVER\x10\'\x12\x11\n\rUPDATE_BACKUP\x10(\x12\x16\n\x12\x41\x43QUIRE_SSRS_LEASE\x10*\x12\x16\n\x12RELEASE_SSRS_LEASE\x10+\x12\x1b\n\x17RECONFIGURE_OLD_PRIMARY\x10,\x12\x1b\n\x13\x43LUSTER_MAINTENANCE\x10-\x1a\x02\x08\x01\x12 \n\x18SELF_SERVICE_MAINTENANCE\x10.\x1a\x02\x08\x01\x12\x19\n\x15SWITCHOVER_TO_REPLICA\x10/\x12\x19\n\x15MAJOR_VERSION_UPGRADE\x10\x30\x12\x17\n\x0f\x41\x44VANCED_BACKUP\x10\x31\x1a\x02\x08\x01\x12\x11\n\rMANAGE_BACKUP\x10\x32\x12\x13\n\x0f\x45NHANCED_BACKUP\x10\x33\x12\x14\n\x10REPAIR_READ_POOL\x10\x34\x12\x14\n\x10\x43REATE_READ_POOL\x10\x35\x12#\n\x1fPRE_CHECK_MAJOR_VERSION_UPGRADE\x10\x36\"^\n\x12SqlOperationStatus\x12$\n SQL_OPERATION_STATUS_UNSPECIFIED\x10\x00\x12\x0b\n\x07PENDING\x10\x01\x12\x0b\n\x07RUNNING\x10\x02\x12\x08\n\x04\x44ONE\x10\x03\"=\n\x0eOperationError\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x0c\n\x04\x63ode\x18\x02 \x01(\t\x12\x0f\n\x07message\x18\x03 \x01(\t\"T\n\x0fOperationErrors\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x33\n\x06\x65rrors\x18\x02 \x03(\x0b\x32#.google.cloud.sql.v1.OperationError\"\x94\x04\n\x18PasswordValidationPolicy\x12/\n\nmin_length\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12L\n\ncomplexity\x18\x02 \x01(\x0e\x32\x38.google.cloud.sql.v1.PasswordValidationPolicy.Complexity\x12\x33\n\x0ereuse_interval\x18\x03 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12?\n\x1b\x64isallow_username_substring\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12;\n\x18password_change_interval\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x12:\n\x16\x65nable_password_policy\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12H\n disallow_compromised_credentials\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x02\x18\x01\"@\n\nComplexity\x12\x1a\n\x16\x43OMPLEXITY_UNSPECIFIED\x10\x00\x12\x16\n\x12\x43OMPLEXITY_DEFAULT\x10\x01\"-\n\x0f\x44\x61taCacheConfig\x12\x1a\n\x12\x64\x61ta_cache_enabled\x18\x01 \x01(\x08\"e\n\x11\x46inalBackupConfig\x12\x14\n\x07\x65nabled\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1b\n\x0eretention_days\x18\x03 \x01(\x05H\x01\x88\x01\x01\x42\n\n\x08_enabledB\x11\n\x0f_retention_days\"\xe0\x1b\n\x08Settings\x12\x35\n\x10settings_version\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\'\n\x1b\x61uthorized_gae_applications\x18\x02 \x03(\tB\x02\x18\x01\x12\x0c\n\x04tier\x18\x03 \x01(\t\x12\x0c\n\x04kind\x18\x04 \x01(\t\x12\x42\n\x0buser_labels\x18\x05 \x03(\x0b\x32-.google.cloud.sql.v1.Settings.UserLabelsEntry\x12\x43\n\x11\x61vailability_type\x18\x06 \x01(\x0e\x32(.google.cloud.sql.v1.SqlAvailabilityType\x12\x39\n\x0cpricing_plan\x18\x07 \x01(\x0e\x32#.google.cloud.sql.v1.SqlPricingPlan\x12\x45\n\x10replication_type\x18\x08 \x01(\x0e\x32\'.google.cloud.sql.v1.SqlReplicationTypeB\x02\x18\x01\x12>\n\x19storage_auto_resize_limit\x18\t \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12L\n\x11\x61\x63tivation_policy\x18\n \x01(\x0e\x32\x31.google.cloud.sql.v1.Settings.SqlActivationPolicy\x12>\n\x10ip_configuration\x18\x0b \x01(\x0b\x32$.google.cloud.sql.v1.IpConfiguration\x12\x37\n\x13storage_auto_resize\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x44\n\x13location_preference\x18\r \x01(\x0b\x32\'.google.cloud.sql.v1.LocationPreference\x12:\n\x0e\x64\x61tabase_flags\x18\x0e \x03(\x0b\x32\".google.cloud.sql.v1.DatabaseFlags\x12<\n\x0e\x64\x61ta_disk_type\x18\x0f \x01(\x0e\x32$.google.cloud.sql.v1.SqlDataDiskType\x12\x42\n\x12maintenance_window\x18\x10 \x01(\x0b\x32&.google.cloud.sql.v1.MaintenanceWindow\x12\x46\n\x14\x62\x61\x63kup_configuration\x18\x11 \x01(\x0b\x32(.google.cloud.sql.v1.BackupConfiguration\x12@\n\x1c\x64\x61tabase_replication_enabled\x18\x12 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x46\n\x1e\x63rash_safe_replication_enabled\x18\x13 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x02\x18\x01\x12\x36\n\x11\x64\x61ta_disk_size_gb\x18\x14 \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12N\n\x17\x61\x63tive_directory_config\x18\x16 \x01(\x0b\x32-.google.cloud.sql.v1.SqlActiveDirectoryConfig\x12\x11\n\tcollation\x18\x17 \x01(\t\x12L\n\x18\x64\x65ny_maintenance_periods\x18\x18 \x03(\x0b\x32*.google.cloud.sql.v1.DenyMaintenancePeriod\x12<\n\x0finsights_config\x18\x19 \x01(\x0b\x32#.google.cloud.sql.v1.InsightsConfig\x12Q\n\x1apassword_validation_policy\x18\x1b \x01(\x0b\x32-.google.cloud.sql.v1.PasswordValidationPolicy\x12J\n\x17sql_server_audit_config\x18\x1d \x01(\x0b\x32).google.cloud.sql.v1.SqlServerAuditConfig\x12;\n\x07\x65\x64ition\x18& \x01(\x0e\x32%.google.cloud.sql.v1.Settings.EditionB\x03\xe0\x41\x01\x12Q\n\x15\x63onnector_enforcement\x18 \x01(\x0e\x32\x32.google.cloud.sql.v1.Settings.ConnectorEnforcement\x12?\n\x1b\x64\x65letion_protection_enabled\x18! \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x11\n\ttime_zone\x18\" \x01(\t\x12O\n\x19\x61\x64vanced_machine_features\x18# \x01(\x0b\x32,.google.cloud.sql.v1.AdvancedMachineFeatures\x12?\n\x11\x64\x61ta_cache_config\x18% \x01(\x0b\x32$.google.cloud.sql.v1.DataCacheConfig\x12\x45\n\x1breplication_lag_max_seconds\x18\' \x01(\x0b\x32\x1b.google.protobuf.Int32ValueB\x03\xe0\x41\x01\x12\x45\n\x1c\x65nable_google_ml_integration\x18( \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\x12\x44\n\x1b\x65nable_dataplex_integration\x18) \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\x12\x41\n\x18retain_backups_on_delete\x18* \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\x12,\n\x1a\x64\x61ta_disk_provisioned_iops\x18+ \x01(\x03\x42\x03\xe0\x41\x01H\x00\x88\x01\x01\x12\x32\n data_disk_provisioned_throughput\x18, \x01(\x03\x42\x03\xe0\x41\x01H\x01\x88\x01\x01\x12S\n\x16\x63onnection_pool_config\x18- \x01(\x0b\x32).google.cloud.sql.v1.ConnectionPoolConfigB\x03\xe0\x41\x01H\x02\x88\x01\x01\x12M\n\x13\x66inal_backup_config\x18/ \x01(\x0b\x32&.google.cloud.sql.v1.FinalBackupConfigB\x03\xe0\x41\x01H\x03\x88\x01\x01\x12[\n\x1bread_pool_auto_scale_config\x18\x30 \x01(\x0b\x32,.google.cloud.sql.v1.ReadPoolAutoScaleConfigB\x03\xe0\x41\x01H\x04\x88\x01\x01\x12\x41\n\x18\x61\x63\x63\x65lerated_replica_mode\x18\x31 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x01\x12&\n\x14\x61uto_upgrade_enabled\x18\x32 \x01(\x08\x42\x03\xe0\x41\x01H\x05\x88\x01\x01\x12H\n\x0e\x65ntraid_config\x18\x34 \x01(\x0b\x32+.google.cloud.sql.v1.SqlServerEntraIdConfigB\x03\xe0\x41\x01\x12I\n\x0f\x64\x61ta_api_access\x18\x35 \x01(\x0e\x32+.google.cloud.sql.v1.Settings.DataApiAccessH\x06\x88\x01\x01\x12V\n\x1aperformance_capture_config\x18\x36 \x01(\x0b\x32-.google.cloud.sql.v1.PerformanceCaptureConfigB\x03\xe0\x41\x01\x1a\x31\n\x0fUserLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"f\n\x13SqlActivationPolicy\x12%\n!SQL_ACTIVATION_POLICY_UNSPECIFIED\x10\x00\x12\n\n\x06\x41LWAYS\x10\x01\x12\t\n\x05NEVER\x10\x02\x12\x11\n\tON_DEMAND\x10\x03\x1a\x02\x08\x01\"G\n\x07\x45\x64ition\x12\x17\n\x13\x45\x44ITION_UNSPECIFIED\x10\x00\x12\x0e\n\nENTERPRISE\x10\x02\x12\x13\n\x0f\x45NTERPRISE_PLUS\x10\x03\"]\n\x14\x43onnectorEnforcement\x12%\n!CONNECTOR_ENFORCEMENT_UNSPECIFIED\x10\x00\x12\x10\n\x0cNOT_REQUIRED\x10\x01\x12\x0c\n\x08REQUIRED\x10\x02\"[\n\rDataApiAccess\x12\x1f\n\x1b\x44\x41TA_API_ACCESS_UNSPECIFIED\x10\x00\x12\x15\n\x11\x44ISALLOW_DATA_API\x10\x01\x12\x12\n\x0e\x41LLOW_DATA_API\x10\x02\x42\x1d\n\x1b_data_disk_provisioned_iopsB#\n!_data_disk_provisioned_throughputB\x19\n\x17_connection_pool_configB\x16\n\x14_final_backup_configB\x1e\n\x1c_read_pool_auto_scale_configB\x17\n\x15_auto_upgrade_enabledB\x12\n\x10_data_api_access\"\xb8\x03\n\x18PerformanceCaptureConfig\x12\x19\n\x07\x65nabled\x18\x01 \x01(\x08\x42\x03\xe0\x41\x01H\x00\x88\x01\x01\x12*\n\x18probing_interval_seconds\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01H\x01\x88\x01\x01\x12!\n\x0fprobe_threshold\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01H\x02\x88\x01\x01\x12+\n\x19running_threads_threshold\x18\x04 \x01(\x05\x42\x03\xe0\x41\x01H\x03\x88\x01\x01\x12\x31\n\x1fseconds_behind_source_threshold\x18\x05 \x01(\x05\x42\x03\xe0\x41\x01H\x04\x88\x01\x01\x12\x30\n\x1etransaction_duration_threshold\x18\x08 \x01(\x05\x42\x03\xe0\x41\x01H\x05\x88\x01\x01\x42\n\n\x08_enabledB\x1b\n\x19_probing_interval_secondsB\x12\n\x10_probe_thresholdB\x1c\n\x1a_running_threads_thresholdB\"\n _seconds_behind_source_thresholdB!\n\x1f_transaction_duration_threshold\"<\n\x13\x43onnectionPoolFlags\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\x05value\x18\x02 \x01(\tB\x03\xe0\x41\x02\"\xcd\x01\n\x14\x43onnectionPoolConfig\x12\'\n\x1a\x63onnection_pooling_enabled\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12<\n\x05\x66lags\x18\x08 \x03(\x0b\x32(.google.cloud.sql.v1.ConnectionPoolFlagsB\x03\xe0\x41\x01\x12\x1e\n\x0cpooler_count\x18\t \x01(\x05\x42\x03\xe0\x41\x03H\x01\x88\x01\x01\x42\x1d\n\x1b_connection_pooling_enabledB\x0f\n\r_pooler_count\"\x91\x04\n\x17ReadPoolAutoScaleConfig\x12\x14\n\x07\x65nabled\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1b\n\x0emin_node_count\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x1b\n\x0emax_node_count\x18\x03 \x01(\x05H\x02\x88\x01\x01\x12V\n\x0etarget_metrics\x18\x04 \x03(\x0b\x32\x39.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetricB\x03\xe0\x41\x01\x12\x1d\n\x10\x64isable_scale_in\x18\x05 \x01(\x08H\x03\x88\x01\x01\x12&\n\x19scale_in_cooldown_seconds\x18\x06 \x01(\x05H\x04\x88\x01\x01\x12\'\n\x1ascale_out_cooldown_seconds\x18\x07 \x01(\x05H\x05\x88\x01\x01\x1aZ\n\x0cTargetMetric\x12\x13\n\x06metric\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0ctarget_value\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\t\n\x07_metricB\x0f\n\r_target_valueB\n\n\x08_enabledB\x11\n\x0f_min_node_countB\x11\n\x0f_max_node_countB\x13\n\x11_disable_scale_inB\x1c\n\x1a_scale_in_cooldown_secondsB\x1d\n\x1b_scale_out_cooldown_seconds\"3\n\x17\x41\x64vancedMachineFeatures\x12\x18\n\x10threads_per_core\x18\x01 \x01(\x05\"\xfb\x01\n\x07SslCert\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x1a\n\x12\x63\x65rt_serial_number\x18\x02 \x01(\t\x12\x0c\n\x04\x63\x65rt\x18\x03 \x01(\t\x12/\n\x0b\x63reate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x13\n\x0b\x63ommon_name\x18\x05 \x01(\t\x12\x33\n\x0f\x65xpiration_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x18\n\x10sha1_fingerprint\x18\x07 \x01(\t\x12\x10\n\x08instance\x18\x08 \x01(\t\x12\x11\n\tself_link\x18\t \x01(\t\"Z\n\rSslCertDetail\x12/\n\tcert_info\x18\x01 \x01(\x0b\x32\x1c.google.cloud.sql.v1.SslCert\x12\x18\n\x10\x63\x65rt_private_key\x18\x02 \x01(\t\"\xa8\x03\n\x18SqlActiveDirectoryConfig\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x0e\n\x06\x64omain\x18\x02 \x01(\t\x12T\n\x04mode\x18\x03 \x01(\x0e\x32\x41.google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryModeB\x03\xe0\x41\x01\x12 \n\x0b\x64ns_servers\x18\x04 \x03(\tB\x0b\xe0\x41\x01\xe2\x8c\xcf\xd7\x08\x02\x08\x02\x12)\n\x1c\x61\x64min_credential_secret_name\x18\x05 \x01(\tB\x03\xe0\x41\x01\x12 \n\x13organizational_unit\x18\x06 \x01(\tB\x03\xe0\x41\x01\"\xa8\x01\n\x13\x41\x63tiveDirectoryMode\x12%\n!ACTIVE_DIRECTORY_MODE_UNSPECIFIED\x10\x00\x12\x1c\n\x18MANAGED_ACTIVE_DIRECTORY\x10\x01\x12%\n\x1dSELF_MANAGED_ACTIVE_DIRECTORY\x10\x02\x1a\x02\x08\x01\x12%\n!CUSTOMER_MANAGED_ACTIVE_DIRECTORY\x10\x03\"\x9f\x01\n\x14SqlServerAuditConfig\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x0e\n\x06\x62ucket\x18\x02 \x01(\t\x12\x35\n\x12retention_interval\x18\x03 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x32\n\x0fupload_interval\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\"`\n\x16SqlServerEntraIdConfig\x12\x11\n\x04kind\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x16\n\ttenant_id\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x1b\n\x0e\x61pplication_id\x18\x03 \x01(\tB\x03\xe0\x41\x01\"\xe2\x01\n\x17\x41\x63quireSsrsLeaseContext\x12\x18\n\x0bsetup_login\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rservice_login\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1c\n\x0freport_database\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x30\n\x08\x64uration\x18\x04 \x01(\x0b\x32\x19.google.protobuf.DurationH\x03\x88\x01\x01\x42\x0e\n\x0c_setup_loginB\x10\n\x0e_service_loginB\x12\n\x10_report_databaseB\x0b\n\t_duration\"\x9f\x04\n\x0e\x44nsNameMapping\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12P\n\x0f\x63onnection_type\x18\x02 \x01(\x0e\x32\x32.google.cloud.sql.v1.DnsNameMapping.ConnectionTypeB\x03\xe0\x41\x03\x12\x44\n\tdns_scope\x18\x03 \x01(\x0e\x32,.google.cloud.sql.v1.DnsNameMapping.DnsScopeB\x03\xe0\x41\x03\x12N\n\x0erecord_manager\x18\x04 \x01(\x0e\x32\x31.google.cloud.sql.v1.DnsNameMapping.RecordManagerB\x03\xe0\x41\x03\"w\n\x0e\x43onnectionType\x12\x1f\n\x1b\x43ONNECTION_TYPE_UNSPECIFIED\x10\x00\x12\n\n\x06PUBLIC\x10\x01\x12\x1b\n\x17PRIVATE_SERVICES_ACCESS\x10\x02\x12\x1b\n\x17PRIVATE_SERVICE_CONNECT\x10\x03\"@\n\x08\x44nsScope\x12\x19\n\x15\x44NS_SCOPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08INSTANCE\x10\x01\x12\x0b\n\x07\x43LUSTER\x10\x02\"W\n\rRecordManager\x12\x1e\n\x1aRECORD_MANAGER_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x43USTOMER\x10\x01\x12\x18\n\x14\x43LOUD_SQL_AUTOMATION\x10\x02*P\n\x0bSqlFileType\x12\x1d\n\x19SQL_FILE_TYPE_UNSPECIFIED\x10\x00\x12\x07\n\x03SQL\x10\x01\x12\x07\n\x03\x43SV\x10\x02\x12\x07\n\x03\x42\x41K\x10\x04\x12\x07\n\x03TDE\x10\x08*A\n\x07\x42\x61kType\x12\x18\n\x14\x42\x41K_TYPE_UNSPECIFIED\x10\x00\x12\x08\n\x04\x46ULL\x10\x01\x12\x08\n\x04\x44IFF\x10\x02\x12\x08\n\x04TLOG\x10\x03*\xcc\x01\n\x12SqlMaintenanceType\x12$\n SQL_MAINTENANCE_TYPE_UNSPECIFIED\x10\x00\x12\x18\n\x14INSTANCE_MAINTENANCE\x10\x01\x12 \n\x1cREPLICA_INCLUDED_MAINTENANCE\x10\x02\x12%\n!INSTANCE_SELF_SERVICE_MAINTENANCE\x10\x03\x12-\n)REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE\x10\x04*c\n\x0eSqlBackendType\x12 \n\x1cSQL_BACKEND_TYPE_UNSPECIFIED\x10\x00\x12\x11\n\tFIRST_GEN\x10\x01\x1a\x02\x08\x01\x12\x0e\n\nSECOND_GEN\x10\x02\x12\x0c\n\x08\x45XTERNAL\x10\x03*u\n\x10SqlIpAddressType\x12#\n\x1fSQL_IP_ADDRESS_TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07PRIMARY\x10\x01\x12\x0c\n\x08OUTGOING\x10\x02\x12\x0b\n\x07PRIVATE\x10\x03\x12\x14\n\x10MIGRATED_1ST_GEN\x10\x04*\xad\t\n\x12SqlDatabaseVersion\x12$\n SQL_DATABASE_VERSION_UNSPECIFIED\x10\x00\x12\x11\n\tMYSQL_5_1\x10\x02\x1a\x02\x08\x01\x12\x11\n\tMYSQL_5_5\x10\x03\x1a\x02\x08\x01\x12\r\n\tMYSQL_5_6\x10\x05\x12\r\n\tMYSQL_5_7\x10\x06\x12\r\n\tMYSQL_8_0\x10\x14\x12\x10\n\x0cMYSQL_8_0_18\x10)\x12\x10\n\x0cMYSQL_8_0_26\x10U\x12\x10\n\x0cMYSQL_8_0_27\x10o\x12\x11\n\x0cMYSQL_8_0_28\x10\x84\x01\x12\x15\n\x0cMYSQL_8_0_29\x10\x94\x01\x1a\x02\x08\x01\x12\x11\n\x0cMYSQL_8_0_30\x10\xae\x01\x12\x11\n\x0cMYSQL_8_0_31\x10\xc5\x01\x12\x11\n\x0cMYSQL_8_0_32\x10\xd5\x01\x12\x11\n\x0cMYSQL_8_0_33\x10\xee\x01\x12\x11\n\x0cMYSQL_8_0_34\x10\xef\x01\x12\x11\n\x0cMYSQL_8_0_35\x10\xf0\x01\x12\x11\n\x0cMYSQL_8_0_36\x10\xf1\x01\x12\x11\n\x0cMYSQL_8_0_37\x10\xe3\x02\x12\x11\n\x0cMYSQL_8_0_39\x10\xe5\x02\x12\x11\n\x0cMYSQL_8_0_40\x10\xe6\x02\x12\x11\n\x0cMYSQL_8_0_41\x10\xe8\x03\x12\x11\n\x0cMYSQL_8_0_42\x10\xe9\x03\x12\x11\n\x0cMYSQL_8_0_43\x10\xa9\x04\x12\x11\n\x0cMYSQL_8_0_44\x10\xaa\x04\x12\x11\n\x0cMYSQL_8_0_45\x10\xab\x04\x12\x11\n\x0cMYSQL_8_0_46\x10\xac\x04\x12\x0e\n\tMYSQL_8_4\x10\x8e\x03\x12\x0e\n\tMYSQL_9_7\x10\x8e\x05\x12\x1b\n\x17SQLSERVER_2017_STANDARD\x10\x0b\x12\x1d\n\x19SQLSERVER_2017_ENTERPRISE\x10\x0e\x12\x1a\n\x16SQLSERVER_2017_EXPRESS\x10\x0f\x12\x16\n\x12SQLSERVER_2017_WEB\x10\x10\x12\x10\n\x0cPOSTGRES_9_6\x10\t\x12\x0f\n\x0bPOSTGRES_10\x10\x12\x12\x0f\n\x0bPOSTGRES_11\x10\n\x12\x0f\n\x0bPOSTGRES_12\x10\x13\x12\x0f\n\x0bPOSTGRES_13\x10\x17\x12\x0f\n\x0bPOSTGRES_14\x10n\x12\x10\n\x0bPOSTGRES_15\x10\xac\x01\x12\x10\n\x0bPOSTGRES_16\x10\x90\x02\x12\x10\n\x0bPOSTGRES_17\x10\x98\x03\x12\x10\n\x0bPOSTGRES_18\x10\xad\x04\x12\x10\n\x0bPOSTGRES_19\x10\xac\x05\x12\x1b\n\x17SQLSERVER_2019_STANDARD\x10\x1a\x12\x1d\n\x19SQLSERVER_2019_ENTERPRISE\x10\x1b\x12\x1a\n\x16SQLSERVER_2019_EXPRESS\x10\x1c\x12\x16\n\x12SQLSERVER_2019_WEB\x10\x1d\x12\x1c\n\x17SQLSERVER_2022_STANDARD\x10\xc7\x01\x12\x1e\n\x19SQLSERVER_2022_ENTERPRISE\x10\xc8\x01\x12\x1b\n\x16SQLSERVER_2022_EXPRESS\x10\xc9\x01\x12\x17\n\x12SQLSERVER_2022_WEB\x10\xca\x01\x12\x1c\n\x17SQLSERVER_2025_STANDARD\x10\xa5\x04\x12\x1e\n\x19SQLSERVER_2025_ENTERPRISE\x10\xa6\x04\x12\x1b\n\x16SQLSERVER_2025_EXPRESS\x10\xa7\x04*L\n\x0eSqlPricingPlan\x12 \n\x1cSQL_PRICING_PLAN_UNSPECIFIED\x10\x00\x12\x0b\n\x07PACKAGE\x10\x01\x12\x0b\n\x07PER_USE\x10\x02*]\n\x12SqlReplicationType\x12$\n SQL_REPLICATION_TYPE_UNSPECIFIED\x10\x00\x12\x0f\n\x0bSYNCHRONOUS\x10\x01\x12\x10\n\x0c\x41SYNCHRONOUS\x10\x02*\x81\x01\n\x0fSqlDataDiskType\x12\"\n\x1eSQL_DATA_DISK_TYPE_UNSPECIFIED\x10\x00\x12\n\n\x06PD_SSD\x10\x01\x12\n\n\x06PD_HDD\x10\x02\x12\x1a\n\x12OBSOLETE_LOCAL_SSD\x10\x03\x1a\x02\x08\x01\x12\x16\n\x12HYPERDISK_BALANCED\x10\x04*U\n\x13SqlAvailabilityType\x12%\n!SQL_AVAILABILITY_TYPE_UNSPECIFIED\x10\x00\x12\t\n\x05ZONAL\x10\x01\x12\x0c\n\x08REGIONAL\x10\x02*U\n\x0eSqlUpdateTrack\x12 \n\x1cSQL_UPDATE_TRACK_UNSPECIFIED\x10\x00\x12\n\n\x06\x63\x61nary\x10\x01\x12\n\n\x06stable\x10\x02\x12\t\n\x05week5\x10\x03\x42^\n\x17\x63om.google.cloud.sql.v1B\x16\x43loudSqlResourcesProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + AclEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.AclEntry").msgclass + ApiWarning = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ApiWarning").msgclass + ApiWarning::SqlApiWarningCode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ApiWarning.SqlApiWarningCode").enummodule + BackupRetentionSettings = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.BackupRetentionSettings").msgclass + BackupRetentionSettings::RetentionUnit = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit").enummodule + BackupConfiguration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.BackupConfiguration").msgclass + BackupConfiguration::TransactionalLogStorageState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState").enummodule + BackupConfiguration::BackupTier = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.BackupConfiguration.BackupTier").enummodule + PerformDiskShrinkContext = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.PerformDiskShrinkContext").msgclass + PreCheckResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.PreCheckResponse").msgclass + PreCheckResponse::MessageType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.PreCheckResponse.MessageType").enummodule + PreCheckMajorVersionUpgradeContext = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext").msgclass + BackupContext = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.BackupContext").msgclass + Database = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Database").msgclass + SqlServerDatabaseDetails = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlServerDatabaseDetails").msgclass + DatabaseFlags = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DatabaseFlags").msgclass + MySqlSyncConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.MySqlSyncConfig").msgclass + SyncFlags = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SyncFlags").msgclass + InstanceReference = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.InstanceReference").msgclass + DemoteMasterConfiguration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DemoteMasterConfiguration").msgclass + DemoteMasterMySqlReplicaConfiguration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration").msgclass + ExportContext = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ExportContext").msgclass + ExportContext::SqlCsvExportOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ExportContext.SqlCsvExportOptions").msgclass + ExportContext::SqlExportOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ExportContext.SqlExportOptions").msgclass + ExportContext::SqlExportOptions::MysqlExportOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions").msgclass + ExportContext::SqlExportOptions::PostgresExportOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions").msgclass + ExportContext::SqlBakExportOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ExportContext.SqlBakExportOptions").msgclass + ExportContext::SqlTdeExportOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ExportContext.SqlTdeExportOptions").msgclass + ImportContext = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ImportContext").msgclass + ImportContext::SqlImportOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ImportContext.SqlImportOptions").msgclass + ImportContext::SqlImportOptions::PostgresImportOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions").msgclass + ImportContext::SqlCsvImportOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ImportContext.SqlCsvImportOptions").msgclass + ImportContext::SqlBakImportOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ImportContext.SqlBakImportOptions").msgclass + ImportContext::SqlBakImportOptions::EncryptionOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions").msgclass + ImportContext::SqlTdeImportOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ImportContext.SqlTdeImportOptions").msgclass + IpConfiguration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.IpConfiguration").msgclass + IpConfiguration::SslMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.IpConfiguration.SslMode").enummodule + IpConfiguration::CaMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.IpConfiguration.CaMode").enummodule + IpConfiguration::ServerCertificateRotationMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode").enummodule + PscConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.PscConfig").msgclass + PscAutoConnectionConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.PscAutoConnectionConfig").msgclass + LocationPreference = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.LocationPreference").msgclass + MaintenanceWindow = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.MaintenanceWindow").msgclass + DenyMaintenancePeriod = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DenyMaintenancePeriod").msgclass + InsightsConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.InsightsConfig").msgclass + MySqlReplicaConfiguration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.MySqlReplicaConfiguration").msgclass + DiskEncryptionConfiguration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DiskEncryptionConfiguration").msgclass + DiskEncryptionStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DiskEncryptionStatus").msgclass + IpMapping = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.IpMapping").msgclass + SqlSubOperationType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlSubOperationType").msgclass + Operation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Operation").msgclass + Operation::SqlOperationType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Operation.SqlOperationType").enummodule + Operation::SqlOperationStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Operation.SqlOperationStatus").enummodule + OperationError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.OperationError").msgclass + OperationErrors = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.OperationErrors").msgclass + PasswordValidationPolicy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.PasswordValidationPolicy").msgclass + PasswordValidationPolicy::Complexity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.PasswordValidationPolicy.Complexity").enummodule + DataCacheConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DataCacheConfig").msgclass + FinalBackupConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.FinalBackupConfig").msgclass + Settings = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Settings").msgclass + Settings::SqlActivationPolicy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Settings.SqlActivationPolicy").enummodule + Settings::Edition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Settings.Edition").enummodule + Settings::ConnectorEnforcement = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Settings.ConnectorEnforcement").enummodule + Settings::DataApiAccess = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Settings.DataApiAccess").enummodule + PerformanceCaptureConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.PerformanceCaptureConfig").msgclass + ConnectionPoolFlags = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ConnectionPoolFlags").msgclass + ConnectionPoolConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ConnectionPoolConfig").msgclass + ReadPoolAutoScaleConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ReadPoolAutoScaleConfig").msgclass + ReadPoolAutoScaleConfig::TargetMetric = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric").msgclass + AdvancedMachineFeatures = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.AdvancedMachineFeatures").msgclass + SslCert = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SslCert").msgclass + SslCertDetail = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SslCertDetail").msgclass + SqlActiveDirectoryConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlActiveDirectoryConfig").msgclass + SqlActiveDirectoryConfig::ActiveDirectoryMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode").enummodule + SqlServerAuditConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlServerAuditConfig").msgclass + SqlServerEntraIdConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlServerEntraIdConfig").msgclass + AcquireSsrsLeaseContext = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.AcquireSsrsLeaseContext").msgclass + DnsNameMapping = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DnsNameMapping").msgclass + DnsNameMapping::ConnectionType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DnsNameMapping.ConnectionType").enummodule + DnsNameMapping::DnsScope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DnsNameMapping.DnsScope").enummodule + DnsNameMapping::RecordManager = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.DnsNameMapping.RecordManager").enummodule + SqlFileType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlFileType").enummodule + BakType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.BakType").enummodule + SqlMaintenanceType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlMaintenanceType").enummodule + SqlBackendType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlBackendType").enummodule + SqlIpAddressType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlIpAddressType").enummodule + SqlDatabaseVersion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlDatabaseVersion").enummodule + SqlPricingPlan = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlPricingPlan").enummodule + SqlReplicationType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlReplicationType").enummodule + SqlDataDiskType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlDataDiskType").enummodule + SqlAvailabilityType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlAvailabilityType").enummodule + SqlUpdateTrack = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlUpdateTrack").enummodule + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_ssl_certs_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_ssl_certs_pb.rb new file mode 100644 index 000000000000..9eea16ee33e7 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_ssl_certs_pb.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_ssl_certs.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/cloud/sql/v1/cloud_sql_resources_pb' + + +descriptor_data = "\n-google/cloud/sql/v1/cloud_sql_ssl_certs.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a-google/cloud/sql/v1/cloud_sql_resources.proto\"W\n\x18SqlSslCertsDeleteRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x18\n\x10sha1_fingerprint\x18\x03 \x01(\t\"T\n\x15SqlSslCertsGetRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x18\n\x10sha1_fingerprint\x18\x03 \x01(\t\"w\n\x18SqlSslCertsInsertRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\x38\n\x04\x62ody\x18\x64 \x01(\x0b\x32*.google.cloud.sql.v1.SslCertsInsertRequest\";\n\x16SqlSslCertsListRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\",\n\x15SslCertsInsertRequest\x12\x13\n\x0b\x63ommon_name\x18\x01 \x01(\t\"\xc8\x01\n\x16SslCertsInsertResponse\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x31\n\toperation\x18\x02 \x01(\x0b\x32\x1e.google.cloud.sql.v1.Operation\x12\x34\n\x0eserver_ca_cert\x18\x03 \x01(\x0b\x32\x1c.google.cloud.sql.v1.SslCert\x12\x37\n\x0b\x63lient_cert\x18\x04 \x01(\x0b\x32\".google.cloud.sql.v1.SslCertDetail\"Q\n\x14SslCertsListResponse\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12+\n\x05items\x18\x02 \x03(\x0b\x32\x1c.google.cloud.sql.v1.SslCert2\xaa\x06\n\x12SqlSslCertsService\x12\xa8\x01\n\x06\x44\x65lete\x12-.google.cloud.sql.v1.SqlSslCertsDeleteRequest\x1a\x1e.google.cloud.sql.v1.Operation\"O\x82\xd3\xe4\x93\x02I*G/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}\x12\xa0\x01\n\x03Get\x12*.google.cloud.sql.v1.SqlSslCertsGetRequest\x1a\x1c.google.cloud.sql.v1.SslCert\"O\x82\xd3\xe4\x93\x02I\x12G/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}\x12\xa8\x01\n\x06Insert\x12-.google.cloud.sql.v1.SqlSslCertsInsertRequest\x1a+.google.cloud.sql.v1.SslCertsInsertResponse\"B\x82\xd3\xe4\x93\x02<\"4/v1/projects/{project}/instances/{instance}/sslCerts:\x04\x62ody\x12\x9c\x01\n\x04List\x12+.google.cloud.sql.v1.SqlSslCertsListRequest\x1a).google.cloud.sql.v1.SslCertsListResponse\"<\x82\xd3\xe4\x93\x02\x36\x12\x34/v1/projects/{project}/instances/{instance}/sslCerts\x1a|\xca\x41\x17sqladmin.googleapis.com\xd2\x41_https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.adminB]\n\x17\x63om.google.cloud.sql.v1B\x15\x43loudSqlSslCertsProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + SqlSslCertsDeleteRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlSslCertsDeleteRequest").msgclass + SqlSslCertsGetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlSslCertsGetRequest").msgclass + SqlSslCertsInsertRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlSslCertsInsertRequest").msgclass + SqlSslCertsListRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlSslCertsListRequest").msgclass + SslCertsInsertRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SslCertsInsertRequest").msgclass + SslCertsInsertResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SslCertsInsertResponse").msgclass + SslCertsListResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SslCertsListResponse").msgclass + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_ssl_certs_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_ssl_certs_services_pb.rb new file mode 100644 index 000000000000..71558bd1b746 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_ssl_certs_services_pb.rb @@ -0,0 +1,56 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_ssl_certs.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_ssl_certs_pb' + +module Google + module Cloud + module Sql + module V1 + module SqlSslCertsService + # Service to manage SSL certs for Cloud SQL instances. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.sql.v1.SqlSslCertsService' + + # Deletes the SSL certificate. For First Generation instances, the + # certificate remains valid until the instance is restarted. + rpc :Delete, ::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest, ::Google::Cloud::Sql::V1::Operation + # 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, ::Google::Cloud::Sql::V1::SqlSslCertsGetRequest, ::Google::Cloud::Sql::V1::SslCert + # 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, ::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest, ::Google::Cloud::Sql::V1::SslCertsInsertResponse + # Lists all of the current SSL certificates for the instance. + rpc :List, ::Google::Cloud::Sql::V1::SqlSslCertsListRequest, ::Google::Cloud::Sql::V1::SslCertsListResponse + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_tiers_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_tiers_pb.rb new file mode 100644 index 000000000000..7afca74f6196 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_tiers_pb.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_tiers.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' + + +descriptor_data = "\n)google/cloud/sql/v1/cloud_sql_tiers.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\"&\n\x13SqlTiersListRequest\x12\x0f\n\x07project\x18\x01 \x01(\t\"K\n\x11TiersListResponse\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12(\n\x05items\x18\x02 \x03(\x0b\x32\x19.google.cloud.sql.v1.Tier\"c\n\x04Tier\x12\x0c\n\x04tier\x18\x01 \x01(\t\x12\x10\n\x03RAM\x18\x02 \x01(\x03R\x03RAM\x12\x0c\n\x04kind\x18\x03 \x01(\t\x12\x1d\n\nDisk_Quota\x18\x04 \x01(\x03R\tDiskQuota\x12\x0e\n\x06region\x18\x05 \x03(\t2\x8f\x02\n\x0fSqlTiersService\x12~\n\x04List\x12(.google.cloud.sql.v1.SqlTiersListRequest\x1a&.google.cloud.sql.v1.TiersListResponse\"$\x82\xd3\xe4\x93\x02\x1e\x12\x1c/v1/projects/{project}/tiers\x1a|\xca\x41\x17sqladmin.googleapis.com\xd2\x41_https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.adminBZ\n\x17\x63om.google.cloud.sql.v1B\x12\x43loudSqlTiersProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + SqlTiersListRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlTiersListRequest").msgclass + TiersListResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.TiersListResponse").msgclass + Tier = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.Tier").msgclass + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_tiers_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_tiers_services_pb.rb new file mode 100644 index 000000000000..8c251149b508 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_tiers_services_pb.rb @@ -0,0 +1,47 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_tiers.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_tiers_pb' + +module Google + module Cloud + module Sql + module V1 + module SqlTiersService + # Service for providing machine types (tiers) for Cloud SQL instances. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.sql.v1.SqlTiersService' + + # 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, ::Google::Cloud::Sql::V1::SqlTiersListRequest, ::Google::Cloud::Sql::V1::TiersListResponse + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_users_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_users_pb.rb new file mode 100644 index 000000000000..c384d7e4cf82 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_users_pb.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/sql/v1/cloud_sql_users.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/sql/v1/cloud_sql_resources_pb' +require 'google/protobuf/duration_pb' +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n)google/cloud/sql/v1/cloud_sql_users.proto\x12\x13google.cloud.sql.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a-google/cloud/sql/v1/cloud_sql_resources.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"V\n\x15SqlUsersDeleteRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x10\n\x08instance\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x0f\n\x07project\x18\x04 \x01(\t\"S\n\x12SqlUsersGetRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0f\n\x07project\x18\x03 \x01(\t\x12\x0c\n\x04host\x18\x04 \x01(\t\"c\n\x15SqlUsersInsertRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\x12\'\n\x04\x62ody\x18\x64 \x01(\x0b\x32\x19.google.cloud.sql.v1.User\"8\n\x13SqlUsersListRequest\x12\x10\n\x08instance\x18\x01 \x01(\t\x12\x0f\n\x07project\x18\x02 \x01(\t\"\xe4\x01\n\x15SqlUsersUpdateRequest\x12\x11\n\x04host\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x10\n\x08instance\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x0f\n\x07project\x18\x04 \x01(\t\x12\x1b\n\x0e\x64\x61tabase_roles\x18\x05 \x03(\tB\x03\xe0\x41\x01\x12\'\n\x15revoke_existing_roles\x18\x06 \x01(\x08\x42\x03\xe0\x41\x01H\x00\x88\x01\x01\x12\'\n\x04\x62ody\x18\x64 \x01(\x0b\x32\x19.google.cloud.sql.v1.UserB\x18\n\x16_revoke_existing_roles\"\x86\x02\n\x1cUserPasswordValidationPolicy\x12\x1f\n\x17\x61llowed_failed_attempts\x18\x01 \x01(\x05\x12?\n\x1cpassword_expiration_duration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12$\n\x1c\x65nable_failed_attempts_check\x18\x03 \x01(\x08\x12\x38\n\x06status\x18\x04 \x01(\x0b\x32#.google.cloud.sql.v1.PasswordStatusB\x03\xe0\x41\x03\x12$\n\x1c\x65nable_password_verification\x18\x05 \x01(\x08\"^\n\x0ePasswordStatus\x12\x0e\n\x06locked\x18\x01 \x01(\x08\x12<\n\x18password_expiration_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xb4\x07\n\x04User\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\x12\x0c\n\x04\x65tag\x18\x03 \x01(\t\x12\x0c\n\x04name\x18\x04 \x01(\t\x12\x11\n\x04host\x18\x05 \x01(\tB\x03\xe0\x41\x01\x12\x10\n\x08instance\x18\x06 \x01(\t\x12\x0f\n\x07project\x18\x07 \x01(\t\x12\x33\n\x04type\x18\x08 \x01(\x0e\x32%.google.cloud.sql.v1.User.SqlUserType\x12K\n\x16sqlserver_user_details\x18\t \x01(\x0b\x32).google.cloud.sql.v1.SqlServerUserDetailsH\x00\x12\x16\n\tiam_email\x18\x0b \x01(\tB\x03\xe0\x41\x01\x12J\n\x0fpassword_policy\x18\x0c \x01(\x0b\x32\x31.google.cloud.sql.v1.UserPasswordValidationPolicy\x12K\n\x12\x64ual_password_type\x18\r \x01(\x0e\x32*.google.cloud.sql.v1.User.DualPasswordTypeH\x01\x88\x01\x01\x12<\n\niam_status\x18\x0e \x01(\x0e\x32#.google.cloud.sql.v1.User.IamStatusH\x02\x88\x01\x01\x12\x1b\n\x0e\x64\x61tabase_roles\x18\x0f \x03(\tB\x03\xe0\x41\x01\"\xb4\x01\n\x0bSqlUserType\x12\x0c\n\x08\x42UILT_IN\x10\x00\x12\x12\n\x0e\x43LOUD_IAM_USER\x10\x01\x12\x1d\n\x19\x43LOUD_IAM_SERVICE_ACCOUNT\x10\x02\x12\x13\n\x0f\x43LOUD_IAM_GROUP\x10\x03\x12\x18\n\x14\x43LOUD_IAM_GROUP_USER\x10\x04\x12#\n\x1f\x43LOUD_IAM_GROUP_SERVICE_ACCOUNT\x10\x05\x12\x10\n\x0c\x45NTRAID_USER\x10\x07\"|\n\x10\x44ualPasswordType\x12\"\n\x1e\x44UAL_PASSWORD_TYPE_UNSPECIFIED\x10\x00\x12\x1b\n\x17NO_MODIFY_DUAL_PASSWORD\x10\x01\x12\x14\n\x10NO_DUAL_PASSWORD\x10\x02\x12\x11\n\rDUAL_PASSWORD\x10\x03\"A\n\tIamStatus\x12\x1a\n\x16IAM_STATUS_UNSPECIFIED\x10\x00\x12\x0c\n\x08INACTIVE\x10\x01\x12\n\n\x06\x41\x43TIVE\x10\x02\x42\x0e\n\x0cuser_detailsB\x15\n\x13_dual_password_typeB\r\n\x0b_iam_status\">\n\x14SqlServerUserDetails\x12\x10\n\x08\x64isabled\x18\x01 \x01(\x08\x12\x14\n\x0cserver_roles\x18\x02 \x03(\t\"h\n\x11UsersListResponse\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12(\n\x05items\x18\x02 \x03(\x0b\x32\x19.google.cloud.sql.v1.User\x12\x1b\n\x0fnext_page_token\x18\x03 \x01(\tB\x02\x18\x01\x32\xf5\x06\n\x0fSqlUsersService\x12\x8f\x01\n\x06\x44\x65lete\x12*.google.cloud.sql.v1.SqlUsersDeleteRequest\x1a\x1e.google.cloud.sql.v1.Operation\"9\x82\xd3\xe4\x93\x02\x33*1/v1/projects/{project}/instances/{instance}/users\x12\x8b\x01\n\x03Get\x12\'.google.cloud.sql.v1.SqlUsersGetRequest\x1a\x19.google.cloud.sql.v1.User\"@\x82\xd3\xe4\x93\x02:\x12\x38/v1/projects/{project}/instances/{instance}/users/{name}\x12\x95\x01\n\x06Insert\x12*.google.cloud.sql.v1.SqlUsersInsertRequest\x1a\x1e.google.cloud.sql.v1.Operation\"?\x82\xd3\xe4\x93\x02\x39\"1/v1/projects/{project}/instances/{instance}/users:\x04\x62ody\x12\x93\x01\n\x04List\x12(.google.cloud.sql.v1.SqlUsersListRequest\x1a&.google.cloud.sql.v1.UsersListResponse\"9\x82\xd3\xe4\x93\x02\x33\x12\x31/v1/projects/{project}/instances/{instance}/users\x12\x95\x01\n\x06Update\x12*.google.cloud.sql.v1.SqlUsersUpdateRequest\x1a\x1e.google.cloud.sql.v1.Operation\"?\x82\xd3\xe4\x93\x02\x39\x1a\x31/v1/projects/{project}/instances/{instance}/users:\x04\x62ody\x1a|\xca\x41\x17sqladmin.googleapis.com\xd2\x41_https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.adminBZ\n\x17\x63om.google.cloud.sql.v1B\x12\x43loudSqlUsersProtoP\x01Z)cloud.google.com/go/sql/apiv1/sqlpb;sqlpbb\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Sql + module V1 + SqlUsersDeleteRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlUsersDeleteRequest").msgclass + SqlUsersGetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlUsersGetRequest").msgclass + SqlUsersInsertRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlUsersInsertRequest").msgclass + SqlUsersListRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlUsersListRequest").msgclass + SqlUsersUpdateRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlUsersUpdateRequest").msgclass + UserPasswordValidationPolicy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.UserPasswordValidationPolicy").msgclass + PasswordStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.PasswordStatus").msgclass + User = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.User").msgclass + User::SqlUserType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.User.SqlUserType").enummodule + User::DualPasswordType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.User.DualPasswordType").enummodule + User::IamStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.User.IamStatus").enummodule + SqlServerUserDetails = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.SqlServerUserDetails").msgclass + UsersListResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.sql.v1.UsersListResponse").msgclass + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_users_services_pb.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_users_services_pb.rb new file mode 100644 index 000000000000..87d6fd028e1a --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/cloud_sql_users_services_pb.rb @@ -0,0 +1,53 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/sql/v1/cloud_sql_users.proto for package 'google.cloud.sql.v1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# + +require 'grpc' +require 'google/cloud/sql/v1/cloud_sql_users_pb' + +module Google + module Cloud + module Sql + module V1 + module SqlUsersService + # Cloud SQL users service. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.sql.v1.SqlUsersService' + + # Deletes a user from a Cloud SQL instance. + rpc :Delete, ::Google::Cloud::Sql::V1::SqlUsersDeleteRequest, ::Google::Cloud::Sql::V1::Operation + # Retrieves a resource containing information about a user. + rpc :Get, ::Google::Cloud::Sql::V1::SqlUsersGetRequest, ::Google::Cloud::Sql::V1::User + # Creates a new user in a Cloud SQL instance. + rpc :Insert, ::Google::Cloud::Sql::V1::SqlUsersInsertRequest, ::Google::Cloud::Sql::V1::Operation + # Lists users in the specified Cloud SQL instance. + rpc :List, ::Google::Cloud::Sql::V1::SqlUsersListRequest, ::Google::Cloud::Sql::V1::UsersListResponse + # Updates an existing user in a Cloud SQL instance. + rpc :Update, ::Google::Cloud::Sql::V1::SqlUsersUpdateRequest, ::Google::Cloud::Sql::V1::Operation + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/rest.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/rest.rb new file mode 100644 index 000000000000..d58bf603433d --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/rest.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/sql/v1/sql_backup_runs_service/rest" +require "google/cloud/sql/v1/sql_instances_service/rest" +require "google/cloud/sql/v1/sql_backups_service/rest" +require "google/cloud/sql/v1/sql_connect_service/rest" +require "google/cloud/sql/v1/sql_databases_service/rest" +require "google/cloud/sql/v1/sql_flags_service/rest" +require "google/cloud/sql/v1/sql_operations_service/rest" +require "google/cloud/sql/v1/sql_ssl_certs_service/rest" +require "google/cloud/sql/v1/sql_tiers_service/rest" +require "google/cloud/sql/v1/sql_users_service/rest" +require "google/cloud/sql/v1/version" + +module Google + module Cloud + module Sql + ## + # To load just the REST part of this package, including all its services, and instantiate a REST client: + # + # @example + # + # require "google/cloud/sql/v1/rest" + # client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new + # + module V1 + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service.rb new file mode 100644 index 000000000000..dc7ace2867ff --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_backup_runs_service/credentials" +require "google/cloud/sql/v1/sql_backup_runs_service/client" +require "google/cloud/sql/v1/sql_backup_runs_service/rest" + +module Google + module Cloud + module Sql + module V1 + ## + # Service for managing database backups. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/sql/v1/sql_backup_runs_service" + # client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/sql/v1/sql_backup_runs_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new + # + module SqlBackupRunsService + end + end + end + end +end + +helper_path = ::File.join __dir__, "sql_backup_runs_service", "helpers.rb" +require "google/cloud/sql/v1/sql_backup_runs_service/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/client.rb new file mode 100644 index 000000000000..b40ccf7e3af9 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/client.rb @@ -0,0 +1,809 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_backup_runs_pb" +require "google/cloud/location" + +module Google + module Cloud + module Sql + module V1 + module SqlBackupRunsService + ## + # Client for the SqlBackupRunsService service. + # + # Service for managing database backups. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_backup_runs_service_stub + + ## + # Configure the SqlBackupRunsService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlBackupRunsService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlBackupRunsService clients + # ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlBackupRunsService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlBackupRunsService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_backup_runs_service_stub.universe_domain + end + + ## + # Create a new SqlBackupRunsService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlBackupRunsService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/sql/v1/cloud_sql_backup_runs_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_backup_runs_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Sql::V1::SqlBackupRunsService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @sql_backup_runs_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_backup_runs_service_stub.endpoint + config.universe_domain = @sql_backup_runs_service_stub.universe_domain + config.logger = @sql_backup_runs_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_backup_runs_service_stub.logger + end + + # Service calls + + ## + # Deletes the backup taken by a backup run. + # + # @overload delete(request, options = nil) + # Pass arguments to `delete` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete(id: nil, instance: nil, project: nil) + # Pass arguments to `delete` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param id [::Integer] + # 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 instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest.new + # + # # Call the delete method. + # result = client.delete request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def delete request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + if request.id + header_params["id"] = request.id + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backup_runs_service_stub.call_rpc :delete, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Retrieves a resource containing information about a backup run. + # + # @overload get(request, options = nil) + # Pass arguments to `get` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get(id: nil, instance: nil, project: nil) + # Pass arguments to `get` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param id [::Integer] + # The ID of this backup run. + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::BackupRun] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::BackupRun] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlBackupRunsGetRequest.new + # + # # Call the get method. + # result = client.get request + # + # # The returned object is of type Google::Cloud::Sql::V1::BackupRun. + # p result + # + def get request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + if request.id + header_params["id"] = request.id + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backup_runs_service_stub.call_rpc :get, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a new backup run on demand. + # + # @overload insert(request, options = nil) + # Pass arguments to `insert` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload insert(instance: nil, project: nil, body: nil) + # Pass arguments to `insert` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::BackupRun, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest.new + # + # # Call the insert method. + # result = client.insert request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def insert request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.insert.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.insert.timeout, + metadata: metadata, + retry_policy: @config.rpcs.insert.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backup_runs_service_stub.call_rpc :insert, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all backup runs associated with the project or a given instance + # and configuration in the reverse chronological order of the backup + # initiation time. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlBackupRunsListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlBackupRunsListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list(instance: nil, max_results: nil, page_token: nil, project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID, or "-" for all instances. This does not include + # the project ID. + # @param max_results [::Integer] + # Maximum number of backup runs per response. + # @param page_token [::String] + # A previously-returned page token representing part of the larger set of + # results to view. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::BackupRunsListResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::BackupRunsListResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlBackupRunsListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::BackupRunsListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlBackupRunsListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backup_runs_service_stub.call_rpc :list, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlBackupRunsService API. + # + # This class represents the configuration for SqlBackupRunsService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlBackupRunsService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # delete to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the SqlBackupRunsService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `delete` + # @return [::Gapic::Config::Method] + # + attr_reader :delete + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `insert` + # @return [::Gapic::Config::Method] + # + attr_reader :insert + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + + # @private + def initialize parent_rpcs = nil + delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete + @delete = ::Gapic::Config::Method.new delete_config + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert + @insert = ::Gapic::Config::Method.new insert_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/credentials.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/credentials.rb new file mode 100644 index 000000000000..2bb54cba51ab --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/credentials.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Sql + module V1 + module SqlBackupRunsService + # Credentials for the SqlBackupRunsService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/sqlservice.admin" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/rest.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/rest.rb new file mode 100644 index 000000000000..1e706b760d65 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/rest.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_backup_runs_service/credentials" +require "google/cloud/sql/v1/sql_backup_runs_service/rest/client" + +module Google + module Cloud + module Sql + module V1 + ## + # Service for managing database backups. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/sql/v1/sql_backup_runs_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new + # + module SqlBackupRunsService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/sql/v1/sql_backup_runs_service/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/rest/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/rest/client.rb new file mode 100644 index 000000000000..59f0701db95f --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/rest/client.rb @@ -0,0 +1,720 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_backup_runs_pb" +require "google/cloud/sql/v1/sql_backup_runs_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Sql + module V1 + module SqlBackupRunsService + module Rest + ## + # REST client for the SqlBackupRunsService service. + # + # Service for managing database backups. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_backup_runs_service_stub + + ## + # Configure the SqlBackupRunsService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlBackupRunsService clients + # ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlBackupRunsService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_backup_runs_service_stub.universe_domain + end + + ## + # Create a new SqlBackupRunsService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlBackupRunsService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_backup_runs_service_stub = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @sql_backup_runs_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_backup_runs_service_stub.endpoint + config.universe_domain = @sql_backup_runs_service_stub.universe_domain + config.logger = @sql_backup_runs_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_backup_runs_service_stub.logger + end + + # Service calls + + ## + # Deletes the backup taken by a backup run. + # + # @overload delete(request, options = nil) + # Pass arguments to `delete` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete(id: nil, instance: nil, project: nil) + # Pass arguments to `delete` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param id [::Integer] + # 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 instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest.new + # + # # Call the delete method. + # result = client.delete request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def delete request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backup_runs_service_stub.delete request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Retrieves a resource containing information about a backup run. + # + # @overload get(request, options = nil) + # Pass arguments to `get` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get(id: nil, instance: nil, project: nil) + # Pass arguments to `get` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param id [::Integer] + # The ID of this backup run. + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::BackupRun] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::BackupRun] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlBackupRunsGetRequest.new + # + # # Call the get method. + # result = client.get request + # + # # The returned object is of type Google::Cloud::Sql::V1::BackupRun. + # p result + # + def get request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backup_runs_service_stub.get request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a new backup run on demand. + # + # @overload insert(request, options = nil) + # Pass arguments to `insert` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload insert(instance: nil, project: nil, body: nil) + # Pass arguments to `insert` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::BackupRun, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest.new + # + # # Call the insert method. + # result = client.insert request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def insert request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.insert.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.insert.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.insert.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backup_runs_service_stub.insert request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all backup runs associated with the project or a given instance + # and configuration in the reverse chronological order of the backup + # initiation time. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlBackupRunsListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlBackupRunsListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list(instance: nil, max_results: nil, page_token: nil, project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID, or "-" for all instances. This does not include + # the project ID. + # @param max_results [::Integer] + # Maximum number of backup runs per response. + # @param page_token [::String] + # A previously-returned page token representing part of the larger set of + # results to view. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::BackupRunsListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::BackupRunsListResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlBackupRunsListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::BackupRunsListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlBackupRunsListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backup_runs_service_stub.list request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlBackupRunsService REST API. + # + # This class represents the configuration for SqlBackupRunsService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # delete to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the SqlBackupRunsService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `delete` + # @return [::Gapic::Config::Method] + # + attr_reader :delete + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `insert` + # @return [::Gapic::Config::Method] + # + attr_reader :insert + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + + # @private + def initialize parent_rpcs = nil + delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete + @delete = ::Gapic::Config::Method.new delete_config + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert + @insert = ::Gapic::Config::Method.new insert_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/rest/service_stub.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/rest/service_stub.rb new file mode 100644 index 000000000000..7d677acfee10 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backup_runs_service/rest/service_stub.rb @@ -0,0 +1,332 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/sql/v1/cloud_sql_backup_runs_pb" + +module Google + module Cloud + module Sql + module V1 + module SqlBackupRunsService + module Rest + ## + # REST service stub for the SqlBackupRunsService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the delete REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def delete request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::BackupRun] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::BackupRun] + # A result object deserialized from the server's reply + def get request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::BackupRun.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the insert REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def insert request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_insert_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "insert", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlBackupRunsListRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::BackupRunsListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::BackupRunsListResponse] + # A result object deserialized from the server's reply + def list request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::BackupRunsListResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the delete REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/projects/{project}/instances/{instance}/backupRuns/{id}", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false], + ["id", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/backupRuns/{id}", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false], + ["id", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the insert REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_insert_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/backupRuns", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlBackupRunsListRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/backupRuns", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service.rb new file mode 100644 index 000000000000..3ed884188ba7 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_backups_service/credentials" +require "google/cloud/sql/v1/sql_backups_service/paths" +require "google/cloud/sql/v1/sql_backups_service/client" +require "google/cloud/sql/v1/sql_backups_service/rest" + +module Google + module Cloud + module Sql + module V1 + ## + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/sql/v1/sql_backups_service" + # client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/sql/v1/sql_backups_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new + # + module SqlBackupsService + end + end + end + end +end + +helper_path = ::File.join __dir__, "sql_backups_service", "helpers.rb" +require "google/cloud/sql/v1/sql_backups_service/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/client.rb new file mode 100644 index 000000000000..30c29efcdc38 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/client.rb @@ -0,0 +1,896 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_backups_pb" +require "google/cloud/location" + +module Google + module Cloud + module Sql + module V1 + module SqlBackupsService + ## + # Client for the SqlBackupsService service. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :sql_backups_service_stub + + ## + # Configure the SqlBackupsService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlBackupsService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlBackupsService clients + # ::Google::Cloud::Sql::V1::SqlBackupsService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlBackupsService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlBackupsService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_backups_service_stub.universe_domain + end + + ## + # Create a new SqlBackupsService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlBackupsService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/sql/v1/cloud_sql_backups_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_backups_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Sql::V1::SqlBackupsService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @sql_backups_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_backups_service_stub.endpoint + config.universe_domain = @sql_backups_service_stub.universe_domain + config.logger = @sql_backups_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_backups_service_stub.logger + end + + # Service calls + + ## + # Creates a backup for a Cloud SQL instance. This API can be used only to + # create on-demand backups. + # + # @overload create_backup(request, options = nil) + # Pass arguments to `create_backup` via a request object, either of type + # {::Google::Cloud::Sql::V1::CreateBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::CreateBackupRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_backup(parent: nil, backup: nil) + # Pass arguments to `create_backup` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent resource where this backup is created. + # Format: projects/\\{project} + # @param backup [::Google::Cloud::Sql::V1::Backup, ::Hash] + # Required. The Backup to create. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::CreateBackupRequest.new + # + # # Call the create_backup method. + # result = client.create_backup request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def create_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::CreateBackupRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_backup.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backups_service_stub.call_rpc :create_backup, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Retrieves a resource containing information about a backup. + # + # @overload get_backup(request, options = nil) + # Pass arguments to `get_backup` via a request object, either of type + # {::Google::Cloud::Sql::V1::GetBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::GetBackupRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_backup(name: nil) + # Pass arguments to `get_backup` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the backup to retrieve. + # Format: projects/\\{project}/backups/\\{backup} + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Backup] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Backup] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::GetBackupRequest.new + # + # # Call the get_backup method. + # result = client.get_backup request + # + # # The returned object is of type Google::Cloud::Sql::V1::Backup. + # p result + # + def get_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::GetBackupRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_backup.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backups_service_stub.call_rpc :get_backup, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all backups associated with the project. + # + # @overload list_backups(request, options = nil) + # Pass arguments to `list_backups` via a request object, either of type + # {::Google::Cloud::Sql::V1::ListBackupsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::ListBackupsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_backups` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent that owns this collection of backups. + # Format: projects/\\{project} + # @param page_size [::Integer] + # 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 page_token [::String] + # 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 filter [::String] + # 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. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Sql::V1::Backup>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Sql::V1::Backup>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::ListBackupsRequest.new + # + # # Call the list_backups method. + # result = client.list_backups request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Sql::V1::Backup. + # p item + # end + # + def list_backups request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::ListBackupsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_backups.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_backups.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_backups.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backups_service_stub.call_rpc :list_backups, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @sql_backups_service_stub, :list_backups, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates the retention period and description of the backup. You can use + # this API to update final backups only. + # + # @overload update_backup(request, options = nil) + # Pass arguments to `update_backup` via a request object, either of type + # {::Google::Cloud::Sql::V1::UpdateBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::UpdateBackupRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_backup(backup: nil, update_mask: nil) + # Pass arguments to `update_backup` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param backup [::Google::Cloud::Sql::V1::Backup, ::Hash] + # Required. The backup to update. + # The backup’s `name` field is used to identify the backup to update. + # Format: projects/\\{project}/backups/\\{backup} + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # The list of fields that you can update. You can update only the description + # and retention period of the final backup. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::UpdateBackupRequest.new + # + # # Call the update_backup method. + # result = client.update_backup request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def update_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::UpdateBackupRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.backup&.name + header_params["backup.name"] = request.backup.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_backup.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backups_service_stub.call_rpc :update_backup, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes the backup. + # + # @overload delete_backup(request, options = nil) + # Pass arguments to `delete_backup` via a request object, either of type + # {::Google::Cloud::Sql::V1::DeleteBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::DeleteBackupRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_backup(name: nil) + # Pass arguments to `delete_backup` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the backup to delete. + # Format: projects/\\{project}/backups/\\{backup} + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::DeleteBackupRequest.new + # + # # Call the delete_backup method. + # result = client.delete_backup request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def delete_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::DeleteBackupRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_backup.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backups_service_stub.call_rpc :delete_backup, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlBackupsService API. + # + # This class represents the configuration for SqlBackupsService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlBackupsService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # create_backup to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlBackupsService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_backup.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_backup.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the SqlBackupsService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `create_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :create_backup + ## + # RPC-specific configuration for `get_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :get_backup + ## + # RPC-specific configuration for `list_backups` + # @return [::Gapic::Config::Method] + # + attr_reader :list_backups + ## + # RPC-specific configuration for `update_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :update_backup + ## + # RPC-specific configuration for `delete_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_backup + + # @private + def initialize parent_rpcs = nil + create_backup_config = parent_rpcs.create_backup if parent_rpcs.respond_to? :create_backup + @create_backup = ::Gapic::Config::Method.new create_backup_config + get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup + @get_backup = ::Gapic::Config::Method.new get_backup_config + list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups + @list_backups = ::Gapic::Config::Method.new list_backups_config + update_backup_config = parent_rpcs.update_backup if parent_rpcs.respond_to? :update_backup + @update_backup = ::Gapic::Config::Method.new update_backup_config + delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup + @delete_backup = ::Gapic::Config::Method.new delete_backup_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/credentials.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/credentials.rb new file mode 100644 index 000000000000..ec088f3fc913 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/credentials.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Sql + module V1 + module SqlBackupsService + # Credentials for the SqlBackupsService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/sqlservice.admin" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/paths.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/paths.rb new file mode 100644 index 000000000000..3e83dcbbaa21 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/paths.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + module SqlBackupsService + # Path helper methods for the SqlBackupsService API. + module Paths + ## + # Create a fully-qualified Backup resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/backups/{backup}` + # + # @param project [String] + # @param backup [String] + # + # @return [::String] + def backup_path project:, backup: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + + "projects/#{project}/backups/#{backup}" + end + + ## + # Create a fully-qualified Project resource string. + # + # The resource will be in the following format: + # + # `projects/{project}` + # + # @param project [String] + # + # @return [::String] + def project_path project: + "projects/#{project}" + end + + extend self + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/rest.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/rest.rb new file mode 100644 index 000000000000..1c6e0f7b597f --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/rest.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_backups_service/credentials" +require "google/cloud/sql/v1/sql_backups_service/paths" +require "google/cloud/sql/v1/sql_backups_service/rest/client" + +module Google + module Cloud + module Sql + module V1 + ## + # To load this service and instantiate a REST client: + # + # require "google/cloud/sql/v1/sql_backups_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new + # + module SqlBackupsService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/sql/v1/sql_backups_service/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/rest/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/rest/client.rb new file mode 100644 index 000000000000..07561b1d68b6 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/rest/client.rb @@ -0,0 +1,818 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_backups_pb" +require "google/cloud/sql/v1/sql_backups_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Sql + module V1 + module SqlBackupsService + module Rest + ## + # REST client for the SqlBackupsService service. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :sql_backups_service_stub + + ## + # Configure the SqlBackupsService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlBackupsService clients + # ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlBackupsService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_backups_service_stub.universe_domain + end + + ## + # Create a new SqlBackupsService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlBackupsService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_backups_service_stub = ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @sql_backups_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_backups_service_stub.endpoint + config.universe_domain = @sql_backups_service_stub.universe_domain + config.logger = @sql_backups_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_backups_service_stub.logger + end + + # Service calls + + ## + # Creates a backup for a Cloud SQL instance. This API can be used only to + # create on-demand backups. + # + # @overload create_backup(request, options = nil) + # Pass arguments to `create_backup` via a request object, either of type + # {::Google::Cloud::Sql::V1::CreateBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::CreateBackupRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_backup(parent: nil, backup: nil) + # Pass arguments to `create_backup` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent resource where this backup is created. + # Format: projects/\\{project} + # @param backup [::Google::Cloud::Sql::V1::Backup, ::Hash] + # Required. The Backup to create. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::CreateBackupRequest.new + # + # # Call the create_backup method. + # result = client.create_backup request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def create_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::CreateBackupRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_backup.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backups_service_stub.create_backup request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Retrieves a resource containing information about a backup. + # + # @overload get_backup(request, options = nil) + # Pass arguments to `get_backup` via a request object, either of type + # {::Google::Cloud::Sql::V1::GetBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::GetBackupRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_backup(name: nil) + # Pass arguments to `get_backup` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the backup to retrieve. + # Format: projects/\\{project}/backups/\\{backup} + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Backup] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Backup] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::GetBackupRequest.new + # + # # Call the get_backup method. + # result = client.get_backup request + # + # # The returned object is of type Google::Cloud::Sql::V1::Backup. + # p result + # + def get_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::GetBackupRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_backup.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backups_service_stub.get_backup request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all backups associated with the project. + # + # @overload list_backups(request, options = nil) + # Pass arguments to `list_backups` via a request object, either of type + # {::Google::Cloud::Sql::V1::ListBackupsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::ListBackupsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_backups` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent that owns this collection of backups. + # Format: projects/\\{project} + # @param page_size [::Integer] + # 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 page_token [::String] + # 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 filter [::String] + # 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. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Sql::V1::Backup>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Sql::V1::Backup>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::ListBackupsRequest.new + # + # # Call the list_backups method. + # result = client.list_backups request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Sql::V1::Backup. + # p item + # end + # + def list_backups request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::ListBackupsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_backups.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_backups.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_backups.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backups_service_stub.list_backups request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @sql_backups_service_stub, :list_backups, "backups", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates the retention period and description of the backup. You can use + # this API to update final backups only. + # + # @overload update_backup(request, options = nil) + # Pass arguments to `update_backup` via a request object, either of type + # {::Google::Cloud::Sql::V1::UpdateBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::UpdateBackupRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_backup(backup: nil, update_mask: nil) + # Pass arguments to `update_backup` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param backup [::Google::Cloud::Sql::V1::Backup, ::Hash] + # Required. The backup to update. + # The backup’s `name` field is used to identify the backup to update. + # Format: projects/\\{project}/backups/\\{backup} + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # The list of fields that you can update. You can update only the description + # and retention period of the final backup. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::UpdateBackupRequest.new + # + # # Call the update_backup method. + # result = client.update_backup request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def update_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::UpdateBackupRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_backup.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backups_service_stub.update_backup request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes the backup. + # + # @overload delete_backup(request, options = nil) + # Pass arguments to `delete_backup` via a request object, either of type + # {::Google::Cloud::Sql::V1::DeleteBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::DeleteBackupRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_backup(name: nil) + # Pass arguments to `delete_backup` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the backup to delete. + # Format: projects/\\{project}/backups/\\{backup} + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::DeleteBackupRequest.new + # + # # Call the delete_backup method. + # result = client.delete_backup request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def delete_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::DeleteBackupRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_backup.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_backups_service_stub.delete_backup request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlBackupsService REST API. + # + # This class represents the configuration for SqlBackupsService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # create_backup to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_backup.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_backup.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the SqlBackupsService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `create_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :create_backup + ## + # RPC-specific configuration for `get_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :get_backup + ## + # RPC-specific configuration for `list_backups` + # @return [::Gapic::Config::Method] + # + attr_reader :list_backups + ## + # RPC-specific configuration for `update_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :update_backup + ## + # RPC-specific configuration for `delete_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_backup + + # @private + def initialize parent_rpcs = nil + create_backup_config = parent_rpcs.create_backup if parent_rpcs.respond_to? :create_backup + @create_backup = ::Gapic::Config::Method.new create_backup_config + get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup + @get_backup = ::Gapic::Config::Method.new get_backup_config + list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups + @list_backups = ::Gapic::Config::Method.new list_backups_config + update_backup_config = parent_rpcs.update_backup if parent_rpcs.respond_to? :update_backup + @update_backup = ::Gapic::Config::Method.new update_backup_config + delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup + @delete_backup = ::Gapic::Config::Method.new delete_backup_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/rest/service_stub.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/rest/service_stub.rb new file mode 100644 index 000000000000..770fe120af9e --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_backups_service/rest/service_stub.rb @@ -0,0 +1,388 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/sql/v1/cloud_sql_backups_pb" + +module Google + module Cloud + module Sql + module V1 + module SqlBackupsService + module Rest + ## + # REST service stub for the SqlBackupsService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the create_backup REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::CreateBackupRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def create_backup request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_backup_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_backup", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_backup REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::GetBackupRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Backup] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Backup] + # A result object deserialized from the server's reply + def get_backup request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_backup_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_backup", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Backup.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_backups REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::ListBackupsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::ListBackupsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::ListBackupsResponse] + # A result object deserialized from the server's reply + def list_backups request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_backups_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_backups", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::ListBackupsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_backup REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::UpdateBackupRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def update_backup request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_backup_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_backup", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_backup REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::DeleteBackupRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def delete_backup request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_backup_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_backup", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the create_backup REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::CreateBackupRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_backup_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{parent}/backups", + body: "backup", + matches: [ + ["parent", %r{^projects/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_backup REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::GetBackupRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_backup_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/backups/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_backups REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::ListBackupsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_backups_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/backups", + matches: [ + ["parent", %r{^projects/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_backup REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::UpdateBackupRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_backup_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1/{backup.name}", + body: "backup", + matches: [ + ["backup.name", %r{^projects/[^/]+/backups/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_backup REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::DeleteBackupRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_backup_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/backups/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service.rb new file mode 100644 index 000000000000..895e21a93caa --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_connect_service/credentials" +require "google/cloud/sql/v1/sql_connect_service/client" +require "google/cloud/sql/v1/sql_connect_service/rest" + +module Google + module Cloud + module Sql + module V1 + ## + # Cloud SQL connect service. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/sql/v1/sql_connect_service" + # client = ::Google::Cloud::Sql::V1::SqlConnectService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/sql/v1/sql_connect_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new + # + module SqlConnectService + end + end + end + end +end + +helper_path = ::File.join __dir__, "sql_connect_service", "helpers.rb" +require "google/cloud/sql/v1/sql_connect_service/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/client.rb new file mode 100644 index 000000000000..029b2c3ff675 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/client.rb @@ -0,0 +1,607 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_connect_pb" +require "google/cloud/location" + +module Google + module Cloud + module Sql + module V1 + module SqlConnectService + ## + # Client for the SqlConnectService service. + # + # Cloud SQL connect service. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_connect_service_stub + + ## + # Configure the SqlConnectService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlConnectService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlConnectService clients + # ::Google::Cloud::Sql::V1::SqlConnectService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlConnectService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlConnectService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_connect_service_stub.universe_domain + end + + ## + # Create a new SqlConnectService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlConnectService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlConnectService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlConnectService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/sql/v1/cloud_sql_connect_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_connect_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Sql::V1::SqlConnectService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @sql_connect_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_connect_service_stub.endpoint + config.universe_domain = @sql_connect_service_stub.universe_domain + config.logger = @sql_connect_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_connect_service_stub.logger + end + + # Service calls + + ## + # Retrieves connect settings about a Cloud SQL instance. + # + # @overload get_connect_settings(request, options = nil) + # Pass arguments to `get_connect_settings` via a request object, either of type + # {::Google::Cloud::Sql::V1::GetConnectSettingsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::GetConnectSettingsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_connect_settings(instance: nil, project: nil, read_time: nil) + # Pass arguments to `get_connect_settings` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param read_time [::Google::Protobuf::Timestamp, ::Hash] + # Optional. Optional snapshot read timestamp to trade freshness for + # performance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::ConnectSettings] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::ConnectSettings] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlConnectService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::GetConnectSettingsRequest.new + # + # # Call the get_connect_settings method. + # result = client.get_connect_settings request + # + # # The returned object is of type Google::Cloud::Sql::V1::ConnectSettings. + # p result + # + def get_connect_settings request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::GetConnectSettingsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_connect_settings.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_connect_settings.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_connect_settings.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_connect_service_stub.call_rpc :get_connect_settings, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload generate_ephemeral_cert(request, options = nil) + # Pass arguments to `generate_ephemeral_cert` via a request object, either of type + # {::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload generate_ephemeral_cert(instance: nil, project: nil, public_key: nil, access_token: nil, read_time: nil, valid_duration: nil) + # Pass arguments to `generate_ephemeral_cert` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param public_key [::String] + # PEM encoded public key to include in the signed certificate. + # @param access_token [::String] + # Optional. Access token to include in the signed certificate. + # @param read_time [::Google::Protobuf::Timestamp, ::Hash] + # Optional. Optional snapshot read timestamp to trade freshness for + # performance. + # @param valid_duration [::Google::Protobuf::Duration, ::Hash] + # Optional. If set, it will contain the cert valid duration. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlConnectService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::GenerateEphemeralCertRequest.new + # + # # Call the generate_ephemeral_cert method. + # result = client.generate_ephemeral_cert request + # + # # The returned object is of type Google::Cloud::Sql::V1::GenerateEphemeralCertResponse. + # p result + # + def generate_ephemeral_cert request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.generate_ephemeral_cert.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.generate_ephemeral_cert.timeout, + metadata: metadata, + retry_policy: @config.rpcs.generate_ephemeral_cert.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_connect_service_stub.call_rpc :generate_ephemeral_cert, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlConnectService API. + # + # This class represents the configuration for SqlConnectService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlConnectService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # get_connect_settings to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlConnectService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.get_connect_settings.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlConnectService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.get_connect_settings.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Sql::V1::SqlConnectService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the SqlConnectService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `get_connect_settings` + # @return [::Gapic::Config::Method] + # + attr_reader :get_connect_settings + ## + # RPC-specific configuration for `generate_ephemeral_cert` + # @return [::Gapic::Config::Method] + # + attr_reader :generate_ephemeral_cert + + # @private + def initialize parent_rpcs = nil + get_connect_settings_config = parent_rpcs.get_connect_settings if parent_rpcs.respond_to? :get_connect_settings + @get_connect_settings = ::Gapic::Config::Method.new get_connect_settings_config + generate_ephemeral_cert_config = parent_rpcs.generate_ephemeral_cert if parent_rpcs.respond_to? :generate_ephemeral_cert + @generate_ephemeral_cert = ::Gapic::Config::Method.new generate_ephemeral_cert_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/credentials.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/credentials.rb new file mode 100644 index 000000000000..d93e11386c9a --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/credentials.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Sql + module V1 + module SqlConnectService + # Credentials for the SqlConnectService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/sqlservice.admin" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/rest.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/rest.rb new file mode 100644 index 000000000000..dc56583c55f5 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/rest.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_connect_service/credentials" +require "google/cloud/sql/v1/sql_connect_service/rest/client" + +module Google + module Cloud + module Sql + module V1 + ## + # Cloud SQL connect service. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/sql/v1/sql_connect_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new + # + module SqlConnectService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/sql/v1/sql_connect_service/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/rest/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/rest/client.rb new file mode 100644 index 000000000000..dfe45496b814 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/rest/client.rb @@ -0,0 +1,544 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_connect_pb" +require "google/cloud/sql/v1/sql_connect_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Sql + module V1 + module SqlConnectService + module Rest + ## + # REST client for the SqlConnectService service. + # + # Cloud SQL connect service. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_connect_service_stub + + ## + # Configure the SqlConnectService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlConnectService clients + # ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlConnectService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_connect_service_stub.universe_domain + end + + ## + # Create a new SqlConnectService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlConnectService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_connect_service_stub = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @sql_connect_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_connect_service_stub.endpoint + config.universe_domain = @sql_connect_service_stub.universe_domain + config.logger = @sql_connect_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_connect_service_stub.logger + end + + # Service calls + + ## + # Retrieves connect settings about a Cloud SQL instance. + # + # @overload get_connect_settings(request, options = nil) + # Pass arguments to `get_connect_settings` via a request object, either of type + # {::Google::Cloud::Sql::V1::GetConnectSettingsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::GetConnectSettingsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_connect_settings(instance: nil, project: nil, read_time: nil) + # Pass arguments to `get_connect_settings` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param read_time [::Google::Protobuf::Timestamp, ::Hash] + # Optional. Optional snapshot read timestamp to trade freshness for + # performance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::ConnectSettings] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::ConnectSettings] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::GetConnectSettingsRequest.new + # + # # Call the get_connect_settings method. + # result = client.get_connect_settings request + # + # # The returned object is of type Google::Cloud::Sql::V1::ConnectSettings. + # p result + # + def get_connect_settings request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::GetConnectSettingsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_connect_settings.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_connect_settings.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_connect_settings.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_connect_service_stub.get_connect_settings request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload generate_ephemeral_cert(request, options = nil) + # Pass arguments to `generate_ephemeral_cert` via a request object, either of type + # {::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload generate_ephemeral_cert(instance: nil, project: nil, public_key: nil, access_token: nil, read_time: nil, valid_duration: nil) + # Pass arguments to `generate_ephemeral_cert` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param public_key [::String] + # PEM encoded public key to include in the signed certificate. + # @param access_token [::String] + # Optional. Access token to include in the signed certificate. + # @param read_time [::Google::Protobuf::Timestamp, ::Hash] + # Optional. Optional snapshot read timestamp to trade freshness for + # performance. + # @param valid_duration [::Google::Protobuf::Duration, ::Hash] + # Optional. If set, it will contain the cert valid duration. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::GenerateEphemeralCertRequest.new + # + # # Call the generate_ephemeral_cert method. + # result = client.generate_ephemeral_cert request + # + # # The returned object is of type Google::Cloud::Sql::V1::GenerateEphemeralCertResponse. + # p result + # + def generate_ephemeral_cert request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.generate_ephemeral_cert.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.generate_ephemeral_cert.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.generate_ephemeral_cert.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_connect_service_stub.generate_ephemeral_cert request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlConnectService REST API. + # + # This class represents the configuration for SqlConnectService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # get_connect_settings to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.get_connect_settings.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.get_connect_settings.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the SqlConnectService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `get_connect_settings` + # @return [::Gapic::Config::Method] + # + attr_reader :get_connect_settings + ## + # RPC-specific configuration for `generate_ephemeral_cert` + # @return [::Gapic::Config::Method] + # + attr_reader :generate_ephemeral_cert + + # @private + def initialize parent_rpcs = nil + get_connect_settings_config = parent_rpcs.get_connect_settings if parent_rpcs.respond_to? :get_connect_settings + @get_connect_settings = ::Gapic::Config::Method.new get_connect_settings_config + generate_ephemeral_cert_config = parent_rpcs.generate_ephemeral_cert if parent_rpcs.respond_to? :generate_ephemeral_cert + @generate_ephemeral_cert = ::Gapic::Config::Method.new generate_ephemeral_cert_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/rest/service_stub.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/rest/service_stub.rb new file mode 100644 index 000000000000..756aac96d09e --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_connect_service/rest/service_stub.rb @@ -0,0 +1,206 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/sql/v1/cloud_sql_connect_pb" + +module Google + module Cloud + module Sql + module V1 + module SqlConnectService + module Rest + ## + # REST service stub for the SqlConnectService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the get_connect_settings REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::GetConnectSettingsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::ConnectSettings] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::ConnectSettings] + # A result object deserialized from the server's reply + def get_connect_settings request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_connect_settings_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_connect_settings", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::ConnectSettings.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the generate_ephemeral_cert REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse] + # A result object deserialized from the server's reply + def generate_ephemeral_cert request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_generate_ephemeral_cert_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "generate_ephemeral_cert", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the get_connect_settings REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::GetConnectSettingsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_connect_settings_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/connectSettings", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the generate_ephemeral_cert REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_generate_ephemeral_cert_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}:generateEphemeralCert", + body: "*", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service.rb new file mode 100644 index 000000000000..340968c30f0e --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_databases_service/credentials" +require "google/cloud/sql/v1/sql_databases_service/client" +require "google/cloud/sql/v1/sql_databases_service/rest" + +module Google + module Cloud + module Sql + module V1 + ## + # Service to manage databases. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/sql/v1/sql_databases_service" + # client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/sql/v1/sql_databases_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new + # + module SqlDatabasesService + end + end + end + end +end + +helper_path = ::File.join __dir__, "sql_databases_service", "helpers.rb" +require "google/cloud/sql/v1/sql_databases_service/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/client.rb new file mode 100644 index 000000000000..6385f4ef17b4 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/client.rb @@ -0,0 +1,1011 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_databases_pb" +require "google/cloud/location" + +module Google + module Cloud + module Sql + module V1 + module SqlDatabasesService + ## + # Client for the SqlDatabasesService service. + # + # Service to manage databases. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_databases_service_stub + + ## + # Configure the SqlDatabasesService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlDatabasesService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlDatabasesService clients + # ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlDatabasesService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlDatabasesService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_databases_service_stub.universe_domain + end + + ## + # Create a new SqlDatabasesService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlDatabasesService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/sql/v1/cloud_sql_databases_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_databases_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Sql::V1::SqlDatabasesService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @sql_databases_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_databases_service_stub.endpoint + config.universe_domain = @sql_databases_service_stub.universe_domain + config.logger = @sql_databases_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_databases_service_stub.logger + end + + # Service calls + + ## + # Deletes a database from a Cloud SQL instance. + # + # @overload delete(request, options = nil) + # Pass arguments to `delete` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete(database: nil, instance: nil, project: nil) + # Pass arguments to `delete` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param database [::String] + # Name of the database to be deleted in the instance. + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest.new + # + # # Call the delete method. + # result = client.delete request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def delete request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + if request.database + header_params["database"] = request.database + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_databases_service_stub.call_rpc :delete, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Retrieves a resource containing information about a database inside a Cloud + # SQL instance. + # + # @overload get(request, options = nil) + # Pass arguments to `get` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlDatabasesGetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlDatabasesGetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get(database: nil, instance: nil, project: nil) + # Pass arguments to `get` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param database [::String] + # Name of the database in the instance. + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Database] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Database] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlDatabasesGetRequest.new + # + # # Call the get method. + # result = client.get request + # + # # The returned object is of type Google::Cloud::Sql::V1::Database. + # p result + # + def get request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlDatabasesGetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + if request.database + header_params["database"] = request.database + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_databases_service_stub.call_rpc :get, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Inserts a resource containing information about a database inside a Cloud + # SQL instance. + # + # **Note:** You can't modify the default character set and collation. + # + # @overload insert(request, options = nil) + # Pass arguments to `insert` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload insert(instance: nil, project: nil, body: nil) + # Pass arguments to `insert` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::Database, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlDatabasesInsertRequest.new + # + # # Call the insert method. + # result = client.insert request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def insert request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.insert.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.insert.timeout, + metadata: metadata, + retry_policy: @config.rpcs.insert.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_databases_service_stub.call_rpc :insert, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists databases in the specified Cloud SQL instance. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlDatabasesListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlDatabasesListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list(instance: nil, project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::DatabasesListResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::DatabasesListResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlDatabasesListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::DatabasesListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlDatabasesListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_databases_service_stub.call_rpc :list, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Partially updates a resource containing information about a database inside + # a Cloud SQL instance. This method supports patch semantics. + # + # @overload patch(request, options = nil) + # Pass arguments to `patch` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload patch(database: nil, instance: nil, project: nil, body: nil) + # Pass arguments to `patch` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param database [::String] + # Name of the database to be updated in the instance. + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::Database, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new + # + # # Call the patch method. + # result = client.patch request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def patch request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.patch.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + if request.database + header_params["database"] = request.database + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.patch.timeout, + metadata: metadata, + retry_policy: @config.rpcs.patch.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_databases_service_stub.call_rpc :patch, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a resource containing information about a database inside a Cloud + # SQL instance. + # + # @overload update(request, options = nil) + # Pass arguments to `update` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update(database: nil, instance: nil, project: nil, body: nil) + # Pass arguments to `update` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param database [::String] + # Name of the database to be updated in the instance. + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::Database, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new + # + # # Call the update method. + # result = client.update request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def update request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + if request.database + header_params["database"] = request.database + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_databases_service_stub.call_rpc :update, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlDatabasesService API. + # + # This class represents the configuration for SqlDatabasesService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlDatabasesService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # delete to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the SqlDatabasesService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `delete` + # @return [::Gapic::Config::Method] + # + attr_reader :delete + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `insert` + # @return [::Gapic::Config::Method] + # + attr_reader :insert + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + ## + # RPC-specific configuration for `patch` + # @return [::Gapic::Config::Method] + # + attr_reader :patch + ## + # RPC-specific configuration for `update` + # @return [::Gapic::Config::Method] + # + attr_reader :update + + # @private + def initialize parent_rpcs = nil + delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete + @delete = ::Gapic::Config::Method.new delete_config + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert + @insert = ::Gapic::Config::Method.new insert_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + patch_config = parent_rpcs.patch if parent_rpcs.respond_to? :patch + @patch = ::Gapic::Config::Method.new patch_config + update_config = parent_rpcs.update if parent_rpcs.respond_to? :update + @update = ::Gapic::Config::Method.new update_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/credentials.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/credentials.rb new file mode 100644 index 000000000000..c1f2fd9ae6fa --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/credentials.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Sql + module V1 + module SqlDatabasesService + # Credentials for the SqlDatabasesService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/sqlservice.admin" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/rest.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/rest.rb new file mode 100644 index 000000000000..f477baf4c547 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/rest.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_databases_service/credentials" +require "google/cloud/sql/v1/sql_databases_service/rest/client" + +module Google + module Cloud + module Sql + module V1 + ## + # Service to manage databases. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/sql/v1/sql_databases_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new + # + module SqlDatabasesService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/sql/v1/sql_databases_service/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/rest/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/rest/client.rb new file mode 100644 index 000000000000..417d0fad32c5 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/rest/client.rb @@ -0,0 +1,896 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_databases_pb" +require "google/cloud/sql/v1/sql_databases_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Sql + module V1 + module SqlDatabasesService + module Rest + ## + # REST client for the SqlDatabasesService service. + # + # Service to manage databases. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_databases_service_stub + + ## + # Configure the SqlDatabasesService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlDatabasesService clients + # ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlDatabasesService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_databases_service_stub.universe_domain + end + + ## + # Create a new SqlDatabasesService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlDatabasesService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_databases_service_stub = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @sql_databases_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_databases_service_stub.endpoint + config.universe_domain = @sql_databases_service_stub.universe_domain + config.logger = @sql_databases_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_databases_service_stub.logger + end + + # Service calls + + ## + # Deletes a database from a Cloud SQL instance. + # + # @overload delete(request, options = nil) + # Pass arguments to `delete` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete(database: nil, instance: nil, project: nil) + # Pass arguments to `delete` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param database [::String] + # Name of the database to be deleted in the instance. + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest.new + # + # # Call the delete method. + # result = client.delete request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def delete request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_databases_service_stub.delete request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Retrieves a resource containing information about a database inside a Cloud + # SQL instance. + # + # @overload get(request, options = nil) + # Pass arguments to `get` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlDatabasesGetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlDatabasesGetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get(database: nil, instance: nil, project: nil) + # Pass arguments to `get` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param database [::String] + # Name of the database in the instance. + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Database] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Database] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlDatabasesGetRequest.new + # + # # Call the get method. + # result = client.get request + # + # # The returned object is of type Google::Cloud::Sql::V1::Database. + # p result + # + def get request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlDatabasesGetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_databases_service_stub.get request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Inserts a resource containing information about a database inside a Cloud + # SQL instance. + # + # **Note:** You can't modify the default character set and collation. + # + # @overload insert(request, options = nil) + # Pass arguments to `insert` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload insert(instance: nil, project: nil, body: nil) + # Pass arguments to `insert` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::Database, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlDatabasesInsertRequest.new + # + # # Call the insert method. + # result = client.insert request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def insert request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.insert.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.insert.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.insert.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_databases_service_stub.insert request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists databases in the specified Cloud SQL instance. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlDatabasesListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlDatabasesListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list(instance: nil, project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::DatabasesListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::DatabasesListResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlDatabasesListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::DatabasesListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlDatabasesListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_databases_service_stub.list request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Partially updates a resource containing information about a database inside + # a Cloud SQL instance. This method supports patch semantics. + # + # @overload patch(request, options = nil) + # Pass arguments to `patch` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload patch(database: nil, instance: nil, project: nil, body: nil) + # Pass arguments to `patch` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param database [::String] + # Name of the database to be updated in the instance. + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::Database, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new + # + # # Call the patch method. + # result = client.patch request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def patch request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.patch.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.patch.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.patch.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_databases_service_stub.patch request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a resource containing information about a database inside a Cloud + # SQL instance. + # + # @overload update(request, options = nil) + # Pass arguments to `update` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update(database: nil, instance: nil, project: nil, body: nil) + # Pass arguments to `update` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param database [::String] + # Name of the database to be updated in the instance. + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::Database, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new + # + # # Call the update method. + # result = client.update request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def update request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_databases_service_stub.update request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlDatabasesService REST API. + # + # This class represents the configuration for SqlDatabasesService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # delete to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the SqlDatabasesService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `delete` + # @return [::Gapic::Config::Method] + # + attr_reader :delete + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `insert` + # @return [::Gapic::Config::Method] + # + attr_reader :insert + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + ## + # RPC-specific configuration for `patch` + # @return [::Gapic::Config::Method] + # + attr_reader :patch + ## + # RPC-specific configuration for `update` + # @return [::Gapic::Config::Method] + # + attr_reader :update + + # @private + def initialize parent_rpcs = nil + delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete + @delete = ::Gapic::Config::Method.new delete_config + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert + @insert = ::Gapic::Config::Method.new insert_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + patch_config = parent_rpcs.patch if parent_rpcs.respond_to? :patch + @patch = ::Gapic::Config::Method.new patch_config + update_config = parent_rpcs.update if parent_rpcs.respond_to? :update + @update = ::Gapic::Config::Method.new update_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/rest/service_stub.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/rest/service_stub.rb new file mode 100644 index 000000000000..555b18c01f00 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_databases_service/rest/service_stub.rb @@ -0,0 +1,460 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/sql/v1/cloud_sql_databases_pb" + +module Google + module Cloud + module Sql + module V1 + module SqlDatabasesService + module Rest + ## + # REST service stub for the SqlDatabasesService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the delete REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def delete request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlDatabasesGetRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Database] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Database] + # A result object deserialized from the server's reply + def get request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Database.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the insert REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def insert request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_insert_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "insert", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlDatabasesListRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::DatabasesListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::DatabasesListResponse] + # A result object deserialized from the server's reply + def list request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::DatabasesListResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the patch REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def patch request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_patch_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "patch", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def update request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the delete REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/projects/{project}/instances/{instance}/databases/{database}", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false], + ["database", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlDatabasesGetRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/databases/{database}", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false], + ["database", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the insert REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_insert_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/databases", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlDatabasesListRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/databases", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the patch REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_patch_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1/projects/{project}/instances/{instance}/databases/{database}", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false], + ["database", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :put, + uri_template: "/v1/projects/{project}/instances/{instance}/databases/{database}", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false], + ["database", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service.rb new file mode 100644 index 000000000000..6b670a706ea8 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_flags_service/credentials" +require "google/cloud/sql/v1/sql_flags_service/client" +require "google/cloud/sql/v1/sql_flags_service/rest" + +module Google + module Cloud + module Sql + module V1 + ## + # Service to manage database flags for Cloud SQL instances. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/sql/v1/sql_flags_service" + # client = ::Google::Cloud::Sql::V1::SqlFlagsService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/sql/v1/sql_flags_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client.new + # + module SqlFlagsService + end + end + end + end +end + +helper_path = ::File.join __dir__, "sql_flags_service", "helpers.rb" +require "google/cloud/sql/v1/sql_flags_service/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/client.rb new file mode 100644 index 000000000000..1e476439ff83 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/client.rb @@ -0,0 +1,488 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_flags_pb" +require "google/cloud/location" + +module Google + module Cloud + module Sql + module V1 + module SqlFlagsService + ## + # Client for the SqlFlagsService service. + # + # Service to manage database flags for Cloud SQL instances. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_flags_service_stub + + ## + # Configure the SqlFlagsService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlFlagsService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlFlagsService clients + # ::Google::Cloud::Sql::V1::SqlFlagsService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlFlagsService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlFlagsService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_flags_service_stub.universe_domain + end + + ## + # Create a new SqlFlagsService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlFlagsService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlFlagsService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlFlagsService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/sql/v1/cloud_sql_flags_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_flags_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Sql::V1::SqlFlagsService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @sql_flags_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_flags_service_stub.endpoint + config.universe_domain = @sql_flags_service_stub.universe_domain + config.logger = @sql_flags_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_flags_service_stub.logger + end + + # Service calls + + ## + # Lists all available database flags for Cloud SQL instances. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlFlagsListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlFlagsListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list(database_version: nil, flag_scope: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param database_version [::String] + # Database type and version you want to retrieve flags for. By default, this + # method returns flags for all database types and versions. + # @param flag_scope [::Google::Cloud::Sql::V1::SqlFlagScope] + # Optional. Specify the scope of flags to be returned by SqlFlagsListService. + # Return list of database flags if unspecified. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::FlagsListResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::FlagsListResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlFlagsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlFlagsListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::FlagsListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlFlagsListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_flags_service_stub.call_rpc :list, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlFlagsService API. + # + # This class represents the configuration for SqlFlagsService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlFlagsService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlFlagsService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlFlagsService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Sql::V1::SqlFlagsService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the SqlFlagsService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + + # @private + def initialize parent_rpcs = nil + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/credentials.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/credentials.rb new file mode 100644 index 000000000000..410e84f0f364 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/credentials.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Sql + module V1 + module SqlFlagsService + # Credentials for the SqlFlagsService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/sqlservice.admin" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/rest.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/rest.rb new file mode 100644 index 000000000000..dcbc9237a112 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/rest.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_flags_service/credentials" +require "google/cloud/sql/v1/sql_flags_service/rest/client" + +module Google + module Cloud + module Sql + module V1 + ## + # Service to manage database flags for Cloud SQL instances. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/sql/v1/sql_flags_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client.new + # + module SqlFlagsService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/sql/v1/sql_flags_service/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/rest/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/rest/client.rb new file mode 100644 index 000000000000..b316c703cd8a --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/rest/client.rb @@ -0,0 +1,446 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_flags_pb" +require "google/cloud/sql/v1/sql_flags_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Sql + module V1 + module SqlFlagsService + module Rest + ## + # REST client for the SqlFlagsService service. + # + # Service to manage database flags for Cloud SQL instances. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_flags_service_stub + + ## + # Configure the SqlFlagsService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlFlagsService clients + # ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlFlagsService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_flags_service_stub.universe_domain + end + + ## + # Create a new SqlFlagsService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlFlagsService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_flags_service_stub = ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @sql_flags_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_flags_service_stub.endpoint + config.universe_domain = @sql_flags_service_stub.universe_domain + config.logger = @sql_flags_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_flags_service_stub.logger + end + + # Service calls + + ## + # Lists all available database flags for Cloud SQL instances. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlFlagsListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlFlagsListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list(database_version: nil, flag_scope: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param database_version [::String] + # Database type and version you want to retrieve flags for. By default, this + # method returns flags for all database types and versions. + # @param flag_scope [::Google::Cloud::Sql::V1::SqlFlagScope] + # Optional. Specify the scope of flags to be returned by SqlFlagsListService. + # Return list of database flags if unspecified. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::FlagsListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::FlagsListResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlFlagsListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::FlagsListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlFlagsListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_flags_service_stub.list request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlFlagsService REST API. + # + # This class represents the configuration for SqlFlagsService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the SqlFlagsService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + + # @private + def initialize parent_rpcs = nil + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/rest/service_stub.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/rest/service_stub.rb new file mode 100644 index 000000000000..86630d7c48e0 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_flags_service/rest/service_stub.rb @@ -0,0 +1,140 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/sql/v1/cloud_sql_flags_pb" + +module Google + module Cloud + module Sql + module V1 + module SqlFlagsService + module Rest + ## + # REST service stub for the SqlFlagsService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlFlagsListRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::FlagsListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::FlagsListResponse] + # A result object deserialized from the server's reply + def list request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::FlagsListResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlFlagsListRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/flags", + matches: [] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service.rb new file mode 100644 index 000000000000..448814196ac7 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_instances_service/credentials" +require "google/cloud/sql/v1/sql_instances_service/paths" +require "google/cloud/sql/v1/sql_instances_service/client" +require "google/cloud/sql/v1/sql_instances_service/rest" + +module Google + module Cloud + module Sql + module V1 + ## + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/sql/v1/sql_instances_service" + # client = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/sql/v1/sql_instances_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + module SqlInstancesService + end + end + end + end +end + +helper_path = ::File.join __dir__, "sql_instances_service", "helpers.rb" +require "google/cloud/sql/v1/sql_instances_service/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/client.rb new file mode 100644 index 000000000000..197f683f8ef2 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/client.rb @@ -0,0 +1,4738 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_instances_pb" +require "google/cloud/location" + +module Google + module Cloud + module Sql + module V1 + module SqlInstancesService + ## + # Client for the SqlInstancesService service. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :sql_instances_service_stub + + ## + # Configure the SqlInstancesService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlInstancesService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlInstancesService clients + # ::Google::Cloud::Sql::V1::SqlInstancesService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlInstancesService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlInstancesService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_instances_service_stub.universe_domain + end + + ## + # Create a new SqlInstancesService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlInstancesService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/sql/v1/cloud_sql_instances_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_instances_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Sql::V1::SqlInstancesService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @sql_instances_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_instances_service_stub.endpoint + config.universe_domain = @sql_instances_service_stub.universe_domain + config.logger = @sql_instances_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_instances_service_stub.logger + end + + # 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. + # + # @overload add_server_ca(request, options = nil) + # Pass arguments to `add_server_ca` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload add_server_ca(instance: nil, project: nil) + # Pass arguments to `add_server_ca` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest.new + # + # # Call the add_server_ca method. + # result = client.add_server_ca request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def add_server_ca request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.add_server_ca.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.add_server_ca.timeout, + metadata: metadata, + retry_policy: @config.rpcs.add_server_ca.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :add_server_ca, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload add_server_certificate(request, options = nil) + # Pass arguments to `add_server_certificate` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload add_server_certificate(instance: nil, project: nil) + # Pass arguments to `add_server_certificate` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest.new + # + # # Call the add_server_certificate method. + # result = client.add_server_certificate request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def add_server_certificate request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.add_server_certificate.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.add_server_certificate.timeout, + metadata: metadata, + retry_policy: @config.rpcs.add_server_certificate.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :add_server_certificate, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload add_entra_id_certificate(request, options = nil) + # Pass arguments to `add_entra_id_certificate` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload add_entra_id_certificate(instance: nil, project: nil) + # Pass arguments to `add_entra_id_certificate` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest.new + # + # # Call the add_entra_id_certificate method. + # result = client.add_entra_id_certificate request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def add_entra_id_certificate request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.add_entra_id_certificate.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.add_entra_id_certificate.timeout, + metadata: metadata, + retry_policy: @config.rpcs.add_entra_id_certificate.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :add_entra_id_certificate, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a Cloud SQL instance as a clone of the source instance. Using this + # operation might cause your instance to restart. + # + # @overload call_clone(request, options = nil) + # Pass arguments to `call_clone` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesCloneRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesCloneRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload call_clone(instance: nil, project: nil, body: nil) + # Pass arguments to `call_clone` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. The ID of the Cloud SQL instance to be cloned (source). This does + # not include the project ID. + # @param project [::String] + # Required. Project ID of the source Cloud SQL instance. + # @param body [::Google::Cloud::Sql::V1::InstancesCloneRequest, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesCloneRequest.new + # + # # Call the call_clone method. + # result = client.call_clone request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def call_clone request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesCloneRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.call_clone.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.call_clone.timeout, + metadata: metadata, + retry_policy: @config.rpcs.call_clone.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :call_clone, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a Cloud SQL instance. + # + # @overload delete(request, options = nil) + # Pass arguments to `delete` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete(instance: nil, project: nil, enable_final_backup: nil, final_backup_ttl_days: nil, final_backup_expiry_time: nil, final_backup_description: nil) + # Pass arguments to `delete` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance to be deleted. + # @param enable_final_backup [::Boolean] + # Flag to opt-in for final backup. By default, it is turned off. + # @param final_backup_ttl_days [::Integer] + # Optional. Retention period of the final backup. + # + # Note: The following parameters are mutually exclusive: `final_backup_ttl_days`, `final_backup_expiry_time`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. + # @param final_backup_expiry_time [::Google::Protobuf::Timestamp, ::Hash] + # Optional. Final Backup expiration time. + # Timestamp in UTC of when this resource is considered expired. + # + # Note: The following parameters are mutually exclusive: `final_backup_expiry_time`, `final_backup_ttl_days`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. + # @param final_backup_description [::String] + # Optional. The description of the final backup. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesDeleteRequest.new + # + # # Call the delete method. + # result = client.delete request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def delete request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :delete, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Demotes the stand-alone instance to be a Cloud SQL read replica for an + # external database server. + # + # @overload demote_master(request, options = nil) + # Pass arguments to `demote_master` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload demote_master(instance: nil, project: nil, body: nil) + # Pass arguments to `demote_master` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance name. + # @param project [::String] + # ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesDemoteMasterRequest, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest.new + # + # # Call the demote_master method. + # result = client.demote_master request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def demote_master request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.demote_master.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.demote_master.timeout, + metadata: metadata, + retry_policy: @config.rpcs.demote_master.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :demote_master, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Demotes an existing standalone instance to be a Cloud SQL read replica + # for an external database server. + # + # @overload demote(request, options = nil) + # Pass arguments to `demote` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload demote(instance: nil, project: nil, body: nil) + # Pass arguments to `demote` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance name. + # @param project [::String] + # Required. ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesDemoteRequest, ::Hash] + # Required. The request body. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesDemoteRequest.new + # + # # Call the demote method. + # result = client.demote request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def demote request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.demote.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.demote.timeout, + metadata: metadata, + retry_policy: @config.rpcs.demote.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :demote, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL + # dump or CSV file. + # + # @overload export(request, options = nil) + # Pass arguments to `export` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesExportRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesExportRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload export(instance: nil, project: nil, body: nil) + # Pass arguments to `export` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance to be exported. + # @param body [::Google::Cloud::Sql::V1::InstancesExportRequest, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesExportRequest.new + # + # # Call the export method. + # result = client.export request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def export request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesExportRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.export.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.export.timeout, + metadata: metadata, + retry_policy: @config.rpcs.export.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :export, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload failover(request, options = nil) + # Pass arguments to `failover` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload failover(instance: nil, project: nil, body: nil) + # Pass arguments to `failover` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # ID of the project that contains the read replica. + # @param body [::Google::Cloud::Sql::V1::InstancesFailoverRequest, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesFailoverRequest.new + # + # # Call the failover method. + # result = client.failover request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def failover request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.failover.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.failover.timeout, + metadata: metadata, + retry_policy: @config.rpcs.failover.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :failover, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Reencrypt CMEK instance with latest key version. + # + # @overload reencrypt(request, options = nil) + # Pass arguments to `reencrypt` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload reencrypt(instance: nil, project: nil, body: nil) + # Pass arguments to `reencrypt` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesReencryptRequest, ::Hash] + # Reencrypt body that users request + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesReencryptRequest.new + # + # # Call the reencrypt method. + # result = client.reencrypt request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def reencrypt request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.reencrypt.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.reencrypt.timeout, + metadata: metadata, + retry_policy: @config.rpcs.reencrypt.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :reencrypt, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Retrieves a resource containing information about a Cloud SQL instance. + # + # @overload get(request, options = nil) + # Pass arguments to `get` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesGetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesGetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get(instance: nil, project: nil) + # Pass arguments to `get` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Database instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::DatabaseInstance] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::DatabaseInstance] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesGetRequest.new + # + # # Call the get method. + # result = client.get request + # + # # The returned object is of type Google::Cloud::Sql::V1::DatabaseInstance. + # p result + # + def get request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesGetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :get, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Imports data into a Cloud SQL instance from a SQL dump or CSV file in + # Cloud Storage. + # + # @overload import(request, options = nil) + # Pass arguments to `import` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesImportRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesImportRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload import(instance: nil, project: nil, body: nil) + # Pass arguments to `import` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesImportRequest, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesImportRequest.new + # + # # Call the import method. + # result = client.import request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def import request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesImportRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.import.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.import.timeout, + metadata: metadata, + retry_policy: @config.rpcs.import.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :import, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a new Cloud SQL instance. + # + # @overload insert(request, options = nil) + # Pass arguments to `insert` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesInsertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesInsertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload insert(project: nil, body: nil) + # Pass arguments to `insert` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param project [::String] + # Project ID of the project to which the newly created Cloud SQL instances + # should belong. + # @param body [::Google::Cloud::Sql::V1::DatabaseInstance, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesInsertRequest.new + # + # # Call the insert method. + # result = client.insert request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def insert request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesInsertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.insert.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.insert.timeout, + metadata: metadata, + retry_policy: @config.rpcs.insert.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :insert, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists instances under a given project. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list(filter: nil, max_results: nil, page_token: nil, project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param filter [::String] + # 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 max_results [::Integer] + # 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 page_token [::String] + # A previously-returned page token representing part of the larger set of + # results to view. + # @param project [::String] + # Project ID of the project for which to list Cloud SQL instances. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::InstancesListResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::InstancesListResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::InstancesListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :list, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload list_server_cas(request, options = nil) + # Pass arguments to `list_server_cas` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_server_cas(instance: nil, project: nil) + # Pass arguments to `list_server_cas` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::InstancesListServerCasResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::InstancesListServerCasResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest.new + # + # # Call the list_server_cas method. + # result = client.list_server_cas request + # + # # The returned object is of type Google::Cloud::Sql::V1::InstancesListServerCasResponse. + # p result + # + def list_server_cas request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_server_cas.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_server_cas.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_server_cas.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :list_server_cas, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload list_server_certificates(request, options = nil) + # Pass arguments to `list_server_certificates` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_server_certificates(instance: nil, project: nil) + # Pass arguments to `list_server_certificates` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest.new + # + # # Call the list_server_certificates method. + # result = client.list_server_certificates request + # + # # The returned object is of type Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse. + # p result + # + def list_server_certificates request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_server_certificates.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_server_certificates.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_server_certificates.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :list_server_certificates, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload list_entra_id_certificates(request, options = nil) + # Pass arguments to `list_entra_id_certificates` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_entra_id_certificates(instance: nil, project: nil) + # Pass arguments to `list_entra_id_certificates` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest.new + # + # # Call the list_entra_id_certificates method. + # result = client.list_entra_id_certificates request + # + # # The returned object is of type Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse. + # p result + # + def list_entra_id_certificates request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_entra_id_certificates.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_entra_id_certificates.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_entra_id_certificates.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :list_entra_id_certificates, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Partially updates settings of a Cloud SQL instance by merging the request + # with the current configuration. This method supports patch semantics. + # + # @overload patch(request, options = nil) + # Pass arguments to `patch` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesPatchRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesPatchRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload patch(instance: nil, project: nil, body: nil) + # Pass arguments to `patch` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::DatabaseInstance, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesPatchRequest.new + # + # # Call the patch method. + # result = client.patch request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def patch request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPatchRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.patch.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.patch.timeout, + metadata: metadata, + retry_policy: @config.rpcs.patch.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :patch, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Promotes the read replica instance to be an independent Cloud SQL + # primary instance. + # Using this operation might cause your instance to restart. + # + # @overload promote_replica(request, options = nil) + # Pass arguments to `promote_replica` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload promote_replica(instance: nil, project: nil, failover: nil) + # Pass arguments to `promote_replica` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL read replica instance name. + # @param project [::String] + # ID of the project that contains the read replica. + # @param failover [::Boolean] + # 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. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest.new + # + # # Call the promote_replica method. + # result = client.promote_replica request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def promote_replica request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.promote_replica.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.promote_replica.timeout, + metadata: metadata, + retry_policy: @config.rpcs.promote_replica.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :promote_replica, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Switches over from the primary instance to the DR replica + # instance. + # + # @overload switchover(request, options = nil) + # Pass arguments to `switchover` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload switchover(instance: nil, project: nil, db_timeout: nil) + # Pass arguments to `switchover` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL read replica instance name. + # @param project [::String] + # ID of the project that contains the replica. + # @param db_timeout [::Google::Protobuf::Duration, ::Hash] + # 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. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest.new + # + # # Call the switchover method. + # result = client.switchover request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def switchover request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.switchover.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.switchover.timeout, + metadata: metadata, + retry_policy: @config.rpcs.switchover.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :switchover, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes all client certificates and generates a new server SSL certificate + # for the instance. + # + # @overload reset_ssl_config(request, options = nil) + # Pass arguments to `reset_ssl_config` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload reset_ssl_config(instance: nil, project: nil, mode: nil) + # Pass arguments to `reset_ssl_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param mode [::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest::ResetSslMode] + # Optional. Reset SSL mode to use. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest.new + # + # # Call the reset_ssl_config method. + # result = client.reset_ssl_config request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def reset_ssl_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.reset_ssl_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.reset_ssl_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.reset_ssl_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :reset_ssl_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Restarts a Cloud SQL instance. + # + # @overload restart(request, options = nil) + # Pass arguments to `restart` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesRestartRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesRestartRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload restart(instance: nil, project: nil) + # Pass arguments to `restart` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance to be restarted. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesRestartRequest.new + # + # # Call the restart method. + # result = client.restart request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def restart request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRestartRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.restart.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.restart.timeout, + metadata: metadata, + retry_policy: @config.rpcs.restart.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :restart, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Restores a backup of a Cloud SQL instance. Using this operation might cause + # your instance to restart. + # + # @overload restore_backup(request, options = nil) + # Pass arguments to `restore_backup` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload restore_backup(instance: nil, project: nil, body: nil) + # Pass arguments to `restore_backup` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesRestoreBackupRequest, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest.new + # + # # Call the restore_backup method. + # result = client.restore_backup request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def restore_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.restore_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.restore_backup.timeout, + metadata: metadata, + retry_policy: @config.rpcs.restore_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :restore_backup, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload rotate_server_ca(request, options = nil) + # Pass arguments to `rotate_server_ca` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload rotate_server_ca(instance: nil, project: nil, body: nil) + # Pass arguments to `rotate_server_ca` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesRotateServerCaRequest, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest.new + # + # # Call the rotate_server_ca method. + # result = client.rotate_server_ca request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def rotate_server_ca request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.rotate_server_ca.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.rotate_server_ca.timeout, + metadata: metadata, + retry_policy: @config.rpcs.rotate_server_ca.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :rotate_server_ca, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload rotate_server_certificate(request, options = nil) + # Pass arguments to `rotate_server_certificate` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload rotate_server_certificate(instance: nil, project: nil, body: nil) + # Pass arguments to `rotate_server_certificate` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesRotateServerCertificateRequest, ::Hash] + # Optional. Rotate server certificate request body. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest.new + # + # # Call the rotate_server_certificate method. + # result = client.rotate_server_certificate request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def rotate_server_certificate request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.rotate_server_certificate.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.rotate_server_certificate.timeout, + metadata: metadata, + retry_policy: @config.rpcs.rotate_server_certificate.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :rotate_server_certificate, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Rotates the server certificate version to one previously added with the + # addEntraIdCertificate method. + # + # @overload rotate_entra_id_certificate(request, options = nil) + # Pass arguments to `rotate_entra_id_certificate` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload rotate_entra_id_certificate(instance: nil, project: nil, body: nil) + # Pass arguments to `rotate_entra_id_certificate` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesRotateEntraIdCertificateRequest, ::Hash] + # Optional. Rotate Entra ID certificate request body. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest.new + # + # # Call the rotate_entra_id_certificate method. + # result = client.rotate_entra_id_certificate request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def rotate_entra_id_certificate request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.rotate_entra_id_certificate.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.rotate_entra_id_certificate.timeout, + metadata: metadata, + retry_policy: @config.rpcs.rotate_entra_id_certificate.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :rotate_entra_id_certificate, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts the replication in the read replica instance. + # + # @overload start_replica(request, options = nil) + # Pass arguments to `start_replica` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload start_replica(instance: nil, project: nil) + # Pass arguments to `start_replica` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL read replica instance name. + # @param project [::String] + # ID of the project that contains the read replica. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest.new + # + # # Call the start_replica method. + # result = client.start_replica request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def start_replica request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.start_replica.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.start_replica.timeout, + metadata: metadata, + retry_policy: @config.rpcs.start_replica.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :start_replica, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Stops the replication in the read replica instance. + # + # @overload stop_replica(request, options = nil) + # Pass arguments to `stop_replica` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload stop_replica(instance: nil, project: nil) + # Pass arguments to `stop_replica` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL read replica instance name. + # @param project [::String] + # ID of the project that contains the read replica. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest.new + # + # # Call the stop_replica method. + # result = client.stop_replica request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def stop_replica request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.stop_replica.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.stop_replica.timeout, + metadata: metadata, + retry_policy: @config.rpcs.stop_replica.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :stop_replica, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Truncate MySQL general and slow query log tables + # MySQL only. + # + # @overload truncate_log(request, options = nil) + # Pass arguments to `truncate_log` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload truncate_log(instance: nil, project: nil, body: nil) + # Pass arguments to `truncate_log` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the Cloud SQL project. + # @param body [::Google::Cloud::Sql::V1::InstancesTruncateLogRequest, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest.new + # + # # Call the truncate_log method. + # result = client.truncate_log request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def truncate_log request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.truncate_log.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.truncate_log.timeout, + metadata: metadata, + retry_policy: @config.rpcs.truncate_log.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :truncate_log, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates settings of a Cloud SQL instance. Using this operation might cause + # your instance to restart. + # + # @overload update(request, options = nil) + # Pass arguments to `update` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update(instance: nil, project: nil, body: nil) + # Pass arguments to `update` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::DatabaseInstance, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesUpdateRequest.new + # + # # Call the update method. + # result = client.update request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def update request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :update, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload create_ephemeral(request, options = nil) + # Pass arguments to `create_ephemeral` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_ephemeral(instance: nil, project: nil, body: nil) + # Pass arguments to `create_ephemeral` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the Cloud SQL project. + # @param body [::Google::Cloud::Sql::V1::SslCertsCreateEphemeralRequest, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::SslCert] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::SslCert] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest.new + # + # # Call the create_ephemeral method. + # result = client.create_ephemeral request + # + # # The returned object is of type Google::Cloud::Sql::V1::SslCert. + # p result + # + def create_ephemeral request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_ephemeral.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_ephemeral.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_ephemeral.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :create_ephemeral, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Reschedules the maintenance on the given instance. + # + # @overload reschedule_maintenance(request, options = nil) + # Pass arguments to `reschedule_maintenance` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload reschedule_maintenance(instance: nil, project: nil, body: nil) + # Pass arguments to `reschedule_maintenance` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequestBody, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest.new + # + # # Call the reschedule_maintenance method. + # result = client.reschedule_maintenance request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def reschedule_maintenance request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.reschedule_maintenance.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.reschedule_maintenance.timeout, + metadata: metadata, + retry_policy: @config.rpcs.reschedule_maintenance.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :reschedule_maintenance, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Verify External primary instance external sync settings. + # + # @overload verify_external_sync_settings(request, options = nil) + # Pass arguments to `verify_external_sync_settings` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload verify_external_sync_settings(instance: nil, project: nil, verify_connection_only: nil, sync_mode: nil, verify_replication_only: nil, mysql_sync_config: nil, migration_type: nil, sync_parallel_level: nil, selected_objects: nil) + # Pass arguments to `verify_external_sync_settings` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param verify_connection_only [::Boolean] + # Flag to enable verifying connection only + # @param sync_mode [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::ExternalSyncMode] + # External sync mode + # @param verify_replication_only [::Boolean] + # Optional. Flag to verify settings required by replication setup only + # @param mysql_sync_config [::Google::Cloud::Sql::V1::MySqlSyncConfig, ::Hash] + # Optional. MySQL-specific settings for start external sync. + # @param migration_type [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::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 sync_parallel_level [::Google::Cloud::Sql::V1::ExternalSyncParallelLevel] + # Optional. Parallel level for initial data sync. Only applicable for + # PostgreSQL. + # @param selected_objects [::Array<::Google::Cloud::Sql::V1::ExternalSyncSelectedObject, ::Hash>] + # Optional. Migrate only the specified objects from the source instance. If + # this field is empty, then migrate all objects. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest.new + # + # # Call the verify_external_sync_settings method. + # result = client.verify_external_sync_settings request + # + # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse. + # p result + # + def verify_external_sync_settings request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.verify_external_sync_settings.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.verify_external_sync_settings.timeout, + metadata: metadata, + retry_policy: @config.rpcs.verify_external_sync_settings.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :verify_external_sync_settings, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Start External primary instance migration. + # + # @overload start_external_sync(request, options = nil) + # Pass arguments to `start_external_sync` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload start_external_sync(instance: nil, project: nil, sync_mode: nil, skip_verification: nil, mysql_sync_config: nil, sync_parallel_level: nil, migration_type: nil, replica_overwrite_enabled: nil) + # Pass arguments to `start_external_sync` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # ID of the project that contains the instance. + # @param sync_mode [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::ExternalSyncMode] + # External sync mode. + # @param skip_verification [::Boolean] + # Whether to skip the verification step (VESS). + # @param mysql_sync_config [::Google::Cloud::Sql::V1::MySqlSyncConfig, ::Hash] + # MySQL-specific settings for start external sync. + # @param sync_parallel_level [::Google::Cloud::Sql::V1::ExternalSyncParallelLevel] + # Optional. Parallel level for initial data sync. Currently only applicable + # for MySQL. + # @param migration_type [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::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 replica_overwrite_enabled [::Boolean] + # 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. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest.new + # + # # Call the start_external_sync method. + # result = client.start_external_sync request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def start_external_sync request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.start_external_sync.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.start_external_sync.timeout, + metadata: metadata, + retry_policy: @config.rpcs.start_external_sync.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :start_external_sync, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Perform Disk Shrink on primary instance. + # + # @overload perform_disk_shrink(request, options = nil) + # Pass arguments to `perform_disk_shrink` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload perform_disk_shrink(instance: nil, project: nil, body: nil) + # Pass arguments to `perform_disk_shrink` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::PerformDiskShrinkContext, ::Hash] + # Perform disk shrink context. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest.new + # + # # Call the perform_disk_shrink method. + # result = client.perform_disk_shrink request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def perform_disk_shrink request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.perform_disk_shrink.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.perform_disk_shrink.timeout, + metadata: metadata, + retry_policy: @config.rpcs.perform_disk_shrink.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :perform_disk_shrink, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Get Disk Shrink Config for a given instance. + # + # @overload get_disk_shrink_config(request, options = nil) + # Pass arguments to `get_disk_shrink_config` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_disk_shrink_config(instance: nil, project: nil) + # Pass arguments to `get_disk_shrink_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest.new + # + # # Call the get_disk_shrink_config method. + # result = client.get_disk_shrink_config request + # + # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse. + # p result + # + def get_disk_shrink_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_disk_shrink_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_disk_shrink_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_disk_shrink_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :get_disk_shrink_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Reset Replica Size to primary instance disk size. + # + # @overload reset_replica_size(request, options = nil) + # Pass arguments to `reset_replica_size` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload reset_replica_size(instance: nil, project: nil) + # Pass arguments to `reset_replica_size` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL read replica instance name. + # @param project [::String] + # ID of the project that contains the read replica. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest.new + # + # # Call the reset_replica_size method. + # result = client.reset_replica_size request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def reset_replica_size request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.reset_replica_size.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.reset_replica_size.timeout, + metadata: metadata, + retry_policy: @config.rpcs.reset_replica_size.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :reset_replica_size, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Get Latest Recovery Time for a given instance. + # + # @overload get_latest_recovery_time(request, options = nil) + # Pass arguments to `get_latest_recovery_time` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_latest_recovery_time(instance: nil, project: nil, source_instance_deletion_time: nil) + # Pass arguments to `get_latest_recovery_time` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param source_instance_deletion_time [::Google::Protobuf::Timestamp, ::Hash] + # The timestamp used to identify the time when the source instance is + # deleted. If this instance is deleted, then you must set the timestamp. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest.new + # + # # Call the get_latest_recovery_time method. + # result = client.get_latest_recovery_time request + # + # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse. + # p result + # + def get_latest_recovery_time request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_latest_recovery_time.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_latest_recovery_time.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_latest_recovery_time.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :get_latest_recovery_time, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Execute SQL statements. + # + # @overload execute_sql(request, options = nil) + # Pass arguments to `execute_sql` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload execute_sql(instance: nil, project: nil, body: nil) + # Pass arguments to `execute_sql` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Database instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::ExecuteSqlPayload, ::Hash] + # The request body. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest.new + # + # # Call the execute_sql method. + # result = client.execute_sql request + # + # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse. + # p result + # + def execute_sql request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.execute_sql.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.execute_sql.timeout, + metadata: metadata, + retry_policy: @config.rpcs.execute_sql.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :execute_sql, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + # + # @overload acquire_ssrs_lease(request, options = nil) + # Pass arguments to `acquire_ssrs_lease` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload acquire_ssrs_lease(instance: nil, project: nil, body: nil) + # Pass arguments to `acquire_ssrs_lease` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # 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 project [::String] + # Required. Project ID of the project that contains the instance (Example: + # project-id). + # @param body [::Google::Cloud::Sql::V1::InstancesAcquireSsrsLeaseRequest, ::Hash] + # Required. The request body. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest.new + # + # # Call the acquire_ssrs_lease method. + # result = client.acquire_ssrs_lease request + # + # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse. + # p result + # + def acquire_ssrs_lease request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.acquire_ssrs_lease.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.acquire_ssrs_lease.timeout, + metadata: metadata, + retry_policy: @config.rpcs.acquire_ssrs_lease.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :acquire_ssrs_lease, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Release a lease for the setup of SQL Server Reporting Services (SSRS). + # + # @overload release_ssrs_lease(request, options = nil) + # Pass arguments to `release_ssrs_lease` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload release_ssrs_lease(instance: nil, project: nil) + # Pass arguments to `release_ssrs_lease` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # 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 project [::String] + # Required. The project ID that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest.new + # + # # Call the release_ssrs_lease method. + # result = client.release_ssrs_lease request + # + # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse. + # p result + # + def release_ssrs_lease request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.release_ssrs_lease.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.release_ssrs_lease.timeout, + metadata: metadata, + retry_policy: @config.rpcs.release_ssrs_lease.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :release_ssrs_lease, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Execute MVU Pre-checks + # + # @overload pre_check_major_version_upgrade(request, options = nil) + # Pass arguments to `pre_check_major_version_upgrade` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload pre_check_major_version_upgrade(instance: nil, project: nil, body: nil) + # Pass arguments to `pre_check_major_version_upgrade` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesPreCheckMajorVersionUpgradeRequest, ::Hash] + # Required. The context for request to perform the pre-check major version + # upgrade operation. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest.new + # + # # Call the pre_check_major_version_upgrade method. + # result = client.pre_check_major_version_upgrade request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def pre_check_major_version_upgrade request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.pre_check_major_version_upgrade.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.pre_check_major_version_upgrade.timeout, + metadata: metadata, + retry_policy: @config.rpcs.pre_check_major_version_upgrade.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :pre_check_major_version_upgrade, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Point in time restore for an instance managed by Google Cloud Backup and + # Disaster Recovery. + # + # @overload point_in_time_restore(request, options = nil) + # Pass arguments to `point_in_time_restore` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload point_in_time_restore(parent: nil, context: nil) + # Pass arguments to `point_in_time_restore` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent resource where you created this instance. + # Format: projects/\\{project} + # @param context [::Google::Cloud::Sql::V1::PointInTimeRestoreContext, ::Hash] + # Required. The context for request to perform a PITR on a Google Cloud + # Backup and Disaster Recovery managed instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest.new + # + # # Call the point_in_time_restore method. + # result = client.point_in_time_restore request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def point_in_time_restore request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.point_in_time_restore.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.point_in_time_restore.timeout, + metadata: metadata, + retry_policy: @config.rpcs.point_in_time_restore.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_rpc :point_in_time_restore, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlInstancesService API. + # + # This class represents the configuration for SqlInstancesService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlInstancesService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # add_server_ca to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlInstancesService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.add_server_ca.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.add_server_ca.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the SqlInstancesService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `add_server_ca` + # @return [::Gapic::Config::Method] + # + attr_reader :add_server_ca + ## + # RPC-specific configuration for `add_server_certificate` + # @return [::Gapic::Config::Method] + # + attr_reader :add_server_certificate + ## + # RPC-specific configuration for `add_entra_id_certificate` + # @return [::Gapic::Config::Method] + # + attr_reader :add_entra_id_certificate + ## + # RPC-specific configuration for `call_clone` + # @return [::Gapic::Config::Method] + # + attr_reader :call_clone + ## + # RPC-specific configuration for `delete` + # @return [::Gapic::Config::Method] + # + attr_reader :delete + ## + # RPC-specific configuration for `demote_master` + # @return [::Gapic::Config::Method] + # + attr_reader :demote_master + ## + # RPC-specific configuration for `demote` + # @return [::Gapic::Config::Method] + # + attr_reader :demote + ## + # RPC-specific configuration for `export` + # @return [::Gapic::Config::Method] + # + attr_reader :export + ## + # RPC-specific configuration for `failover` + # @return [::Gapic::Config::Method] + # + attr_reader :failover + ## + # RPC-specific configuration for `reencrypt` + # @return [::Gapic::Config::Method] + # + attr_reader :reencrypt + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `import` + # @return [::Gapic::Config::Method] + # + attr_reader :import + ## + # RPC-specific configuration for `insert` + # @return [::Gapic::Config::Method] + # + attr_reader :insert + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + ## + # RPC-specific configuration for `list_server_cas` + # @return [::Gapic::Config::Method] + # + attr_reader :list_server_cas + ## + # RPC-specific configuration for `list_server_certificates` + # @return [::Gapic::Config::Method] + # + attr_reader :list_server_certificates + ## + # RPC-specific configuration for `list_entra_id_certificates` + # @return [::Gapic::Config::Method] + # + attr_reader :list_entra_id_certificates + ## + # RPC-specific configuration for `patch` + # @return [::Gapic::Config::Method] + # + attr_reader :patch + ## + # RPC-specific configuration for `promote_replica` + # @return [::Gapic::Config::Method] + # + attr_reader :promote_replica + ## + # RPC-specific configuration for `switchover` + # @return [::Gapic::Config::Method] + # + attr_reader :switchover + ## + # RPC-specific configuration for `reset_ssl_config` + # @return [::Gapic::Config::Method] + # + attr_reader :reset_ssl_config + ## + # RPC-specific configuration for `restart` + # @return [::Gapic::Config::Method] + # + attr_reader :restart + ## + # RPC-specific configuration for `restore_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :restore_backup + ## + # RPC-specific configuration for `rotate_server_ca` + # @return [::Gapic::Config::Method] + # + attr_reader :rotate_server_ca + ## + # RPC-specific configuration for `rotate_server_certificate` + # @return [::Gapic::Config::Method] + # + attr_reader :rotate_server_certificate + ## + # RPC-specific configuration for `rotate_entra_id_certificate` + # @return [::Gapic::Config::Method] + # + attr_reader :rotate_entra_id_certificate + ## + # RPC-specific configuration for `start_replica` + # @return [::Gapic::Config::Method] + # + attr_reader :start_replica + ## + # RPC-specific configuration for `stop_replica` + # @return [::Gapic::Config::Method] + # + attr_reader :stop_replica + ## + # RPC-specific configuration for `truncate_log` + # @return [::Gapic::Config::Method] + # + attr_reader :truncate_log + ## + # RPC-specific configuration for `update` + # @return [::Gapic::Config::Method] + # + attr_reader :update + ## + # RPC-specific configuration for `create_ephemeral` + # @return [::Gapic::Config::Method] + # + attr_reader :create_ephemeral + ## + # RPC-specific configuration for `reschedule_maintenance` + # @return [::Gapic::Config::Method] + # + attr_reader :reschedule_maintenance + ## + # RPC-specific configuration for `verify_external_sync_settings` + # @return [::Gapic::Config::Method] + # + attr_reader :verify_external_sync_settings + ## + # RPC-specific configuration for `start_external_sync` + # @return [::Gapic::Config::Method] + # + attr_reader :start_external_sync + ## + # RPC-specific configuration for `perform_disk_shrink` + # @return [::Gapic::Config::Method] + # + attr_reader :perform_disk_shrink + ## + # RPC-specific configuration for `get_disk_shrink_config` + # @return [::Gapic::Config::Method] + # + attr_reader :get_disk_shrink_config + ## + # RPC-specific configuration for `reset_replica_size` + # @return [::Gapic::Config::Method] + # + attr_reader :reset_replica_size + ## + # RPC-specific configuration for `get_latest_recovery_time` + # @return [::Gapic::Config::Method] + # + attr_reader :get_latest_recovery_time + ## + # RPC-specific configuration for `execute_sql` + # @return [::Gapic::Config::Method] + # + attr_reader :execute_sql + ## + # RPC-specific configuration for `acquire_ssrs_lease` + # @return [::Gapic::Config::Method] + # + attr_reader :acquire_ssrs_lease + ## + # RPC-specific configuration for `release_ssrs_lease` + # @return [::Gapic::Config::Method] + # + attr_reader :release_ssrs_lease + ## + # RPC-specific configuration for `pre_check_major_version_upgrade` + # @return [::Gapic::Config::Method] + # + attr_reader :pre_check_major_version_upgrade + ## + # RPC-specific configuration for `point_in_time_restore` + # @return [::Gapic::Config::Method] + # + attr_reader :point_in_time_restore + + # @private + def initialize parent_rpcs = nil + add_server_ca_config = parent_rpcs.add_server_ca if parent_rpcs.respond_to? :add_server_ca + @add_server_ca = ::Gapic::Config::Method.new add_server_ca_config + add_server_certificate_config = parent_rpcs.add_server_certificate if parent_rpcs.respond_to? :add_server_certificate + @add_server_certificate = ::Gapic::Config::Method.new add_server_certificate_config + add_entra_id_certificate_config = parent_rpcs.add_entra_id_certificate if parent_rpcs.respond_to? :add_entra_id_certificate + @add_entra_id_certificate = ::Gapic::Config::Method.new add_entra_id_certificate_config + call_clone_config = parent_rpcs.call_clone if parent_rpcs.respond_to? :call_clone + @call_clone = ::Gapic::Config::Method.new call_clone_config + delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete + @delete = ::Gapic::Config::Method.new delete_config + demote_master_config = parent_rpcs.demote_master if parent_rpcs.respond_to? :demote_master + @demote_master = ::Gapic::Config::Method.new demote_master_config + demote_config = parent_rpcs.demote if parent_rpcs.respond_to? :demote + @demote = ::Gapic::Config::Method.new demote_config + export_config = parent_rpcs.export if parent_rpcs.respond_to? :export + @export = ::Gapic::Config::Method.new export_config + failover_config = parent_rpcs.failover if parent_rpcs.respond_to? :failover + @failover = ::Gapic::Config::Method.new failover_config + reencrypt_config = parent_rpcs.reencrypt if parent_rpcs.respond_to? :reencrypt + @reencrypt = ::Gapic::Config::Method.new reencrypt_config + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + import_config = parent_rpcs.import if parent_rpcs.respond_to? :import + @import = ::Gapic::Config::Method.new import_config + insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert + @insert = ::Gapic::Config::Method.new insert_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + list_server_cas_config = parent_rpcs.list_server_cas if parent_rpcs.respond_to? :list_server_cas + @list_server_cas = ::Gapic::Config::Method.new list_server_cas_config + list_server_certificates_config = parent_rpcs.list_server_certificates if parent_rpcs.respond_to? :list_server_certificates + @list_server_certificates = ::Gapic::Config::Method.new list_server_certificates_config + list_entra_id_certificates_config = parent_rpcs.list_entra_id_certificates if parent_rpcs.respond_to? :list_entra_id_certificates + @list_entra_id_certificates = ::Gapic::Config::Method.new list_entra_id_certificates_config + patch_config = parent_rpcs.patch if parent_rpcs.respond_to? :patch + @patch = ::Gapic::Config::Method.new patch_config + promote_replica_config = parent_rpcs.promote_replica if parent_rpcs.respond_to? :promote_replica + @promote_replica = ::Gapic::Config::Method.new promote_replica_config + switchover_config = parent_rpcs.switchover if parent_rpcs.respond_to? :switchover + @switchover = ::Gapic::Config::Method.new switchover_config + reset_ssl_config_config = parent_rpcs.reset_ssl_config if parent_rpcs.respond_to? :reset_ssl_config + @reset_ssl_config = ::Gapic::Config::Method.new reset_ssl_config_config + restart_config = parent_rpcs.restart if parent_rpcs.respond_to? :restart + @restart = ::Gapic::Config::Method.new restart_config + restore_backup_config = parent_rpcs.restore_backup if parent_rpcs.respond_to? :restore_backup + @restore_backup = ::Gapic::Config::Method.new restore_backup_config + rotate_server_ca_config = parent_rpcs.rotate_server_ca if parent_rpcs.respond_to? :rotate_server_ca + @rotate_server_ca = ::Gapic::Config::Method.new rotate_server_ca_config + rotate_server_certificate_config = parent_rpcs.rotate_server_certificate if parent_rpcs.respond_to? :rotate_server_certificate + @rotate_server_certificate = ::Gapic::Config::Method.new rotate_server_certificate_config + rotate_entra_id_certificate_config = parent_rpcs.rotate_entra_id_certificate if parent_rpcs.respond_to? :rotate_entra_id_certificate + @rotate_entra_id_certificate = ::Gapic::Config::Method.new rotate_entra_id_certificate_config + start_replica_config = parent_rpcs.start_replica if parent_rpcs.respond_to? :start_replica + @start_replica = ::Gapic::Config::Method.new start_replica_config + stop_replica_config = parent_rpcs.stop_replica if parent_rpcs.respond_to? :stop_replica + @stop_replica = ::Gapic::Config::Method.new stop_replica_config + truncate_log_config = parent_rpcs.truncate_log if parent_rpcs.respond_to? :truncate_log + @truncate_log = ::Gapic::Config::Method.new truncate_log_config + update_config = parent_rpcs.update if parent_rpcs.respond_to? :update + @update = ::Gapic::Config::Method.new update_config + create_ephemeral_config = parent_rpcs.create_ephemeral if parent_rpcs.respond_to? :create_ephemeral + @create_ephemeral = ::Gapic::Config::Method.new create_ephemeral_config + reschedule_maintenance_config = parent_rpcs.reschedule_maintenance if parent_rpcs.respond_to? :reschedule_maintenance + @reschedule_maintenance = ::Gapic::Config::Method.new reschedule_maintenance_config + verify_external_sync_settings_config = parent_rpcs.verify_external_sync_settings if parent_rpcs.respond_to? :verify_external_sync_settings + @verify_external_sync_settings = ::Gapic::Config::Method.new verify_external_sync_settings_config + start_external_sync_config = parent_rpcs.start_external_sync if parent_rpcs.respond_to? :start_external_sync + @start_external_sync = ::Gapic::Config::Method.new start_external_sync_config + perform_disk_shrink_config = parent_rpcs.perform_disk_shrink if parent_rpcs.respond_to? :perform_disk_shrink + @perform_disk_shrink = ::Gapic::Config::Method.new perform_disk_shrink_config + get_disk_shrink_config_config = parent_rpcs.get_disk_shrink_config if parent_rpcs.respond_to? :get_disk_shrink_config + @get_disk_shrink_config = ::Gapic::Config::Method.new get_disk_shrink_config_config + reset_replica_size_config = parent_rpcs.reset_replica_size if parent_rpcs.respond_to? :reset_replica_size + @reset_replica_size = ::Gapic::Config::Method.new reset_replica_size_config + get_latest_recovery_time_config = parent_rpcs.get_latest_recovery_time if parent_rpcs.respond_to? :get_latest_recovery_time + @get_latest_recovery_time = ::Gapic::Config::Method.new get_latest_recovery_time_config + execute_sql_config = parent_rpcs.execute_sql if parent_rpcs.respond_to? :execute_sql + @execute_sql = ::Gapic::Config::Method.new execute_sql_config + acquire_ssrs_lease_config = parent_rpcs.acquire_ssrs_lease if parent_rpcs.respond_to? :acquire_ssrs_lease + @acquire_ssrs_lease = ::Gapic::Config::Method.new acquire_ssrs_lease_config + release_ssrs_lease_config = parent_rpcs.release_ssrs_lease if parent_rpcs.respond_to? :release_ssrs_lease + @release_ssrs_lease = ::Gapic::Config::Method.new release_ssrs_lease_config + pre_check_major_version_upgrade_config = parent_rpcs.pre_check_major_version_upgrade if parent_rpcs.respond_to? :pre_check_major_version_upgrade + @pre_check_major_version_upgrade = ::Gapic::Config::Method.new pre_check_major_version_upgrade_config + point_in_time_restore_config = parent_rpcs.point_in_time_restore if parent_rpcs.respond_to? :point_in_time_restore + @point_in_time_restore = ::Gapic::Config::Method.new point_in_time_restore_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/credentials.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/credentials.rb new file mode 100644 index 000000000000..602053781d2c --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/credentials.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Sql + module V1 + module SqlInstancesService + # Credentials for the SqlInstancesService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/sqlservice.admin" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/paths.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/paths.rb new file mode 100644 index 000000000000..b17468d2a11f --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/paths.rb @@ -0,0 +1,95 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + module SqlInstancesService + # Path helper methods for the SqlInstancesService API. + module Paths + ## + # Create a fully-qualified Backup resource string. + # + # @overload backup_path(project:, backup:) + # The resource will be in the following format: + # + # `projects/{project}/backups/{backup}` + # + # @param project [String] + # @param backup [String] + # + # @overload backup_path(project:, location:, backupvault:, datasource:, backup:) + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup}` + # + # @param project [String] + # @param location [String] + # @param backupvault [String] + # @param datasource [String] + # @param backup [String] + # + # @return [::String] + def backup_path **args + resources = { + "backup:project" => (proc do |project:, backup:| + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + + "projects/#{project}/backups/#{backup}" + end), + "backup:backupvault:datasource:location:project" => (proc do |project:, location:, backupvault:, datasource:, backup:| + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "backupvault cannot contain /" if backupvault.to_s.include? "/" + raise ::ArgumentError, "datasource cannot contain /" if datasource.to_s.include? "/" + + "projects/#{project}/locations/#{location}/backupVaults/#{backupvault}/dataSources/#{datasource}/backups/#{backup}" + end) + } + + resource = resources[args.keys.sort.join(":")] + raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil? + resource.call(**args) + end + + ## + # Create a fully-qualified Network resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/global/networks/{network}` + # + # @param project [String] + # @param network [String] + # + # @return [::String] + def network_path project:, network: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + + "projects/#{project}/global/networks/#{network}" + end + + extend self + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/rest.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/rest.rb new file mode 100644 index 000000000000..975246f218b2 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/rest.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_instances_service/credentials" +require "google/cloud/sql/v1/sql_instances_service/paths" +require "google/cloud/sql/v1/sql_instances_service/rest/client" + +module Google + module Cloud + module Sql + module V1 + ## + # To load this service and instantiate a REST client: + # + # require "google/cloud/sql/v1/sql_instances_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + module SqlInstancesService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/sql/v1/sql_instances_service/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb new file mode 100644 index 000000000000..8501509be631 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/rest/client.rb @@ -0,0 +1,4274 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_instances_pb" +require "google/cloud/sql/v1/sql_instances_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Sql + module V1 + module SqlInstancesService + module Rest + ## + # REST client for the SqlInstancesService service. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :sql_instances_service_stub + + ## + # Configure the SqlInstancesService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlInstancesService clients + # ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlInstancesService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_instances_service_stub.universe_domain + end + + ## + # Create a new SqlInstancesService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlInstancesService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_instances_service_stub = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @sql_instances_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_instances_service_stub.endpoint + config.universe_domain = @sql_instances_service_stub.universe_domain + config.logger = @sql_instances_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_instances_service_stub.logger + end + + # 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. + # + # @overload add_server_ca(request, options = nil) + # Pass arguments to `add_server_ca` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload add_server_ca(instance: nil, project: nil) + # Pass arguments to `add_server_ca` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest.new + # + # # Call the add_server_ca method. + # result = client.add_server_ca request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def add_server_ca request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.add_server_ca.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.add_server_ca.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.add_server_ca.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.add_server_ca request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload add_server_certificate(request, options = nil) + # Pass arguments to `add_server_certificate` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload add_server_certificate(instance: nil, project: nil) + # Pass arguments to `add_server_certificate` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest.new + # + # # Call the add_server_certificate method. + # result = client.add_server_certificate request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def add_server_certificate request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.add_server_certificate.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.add_server_certificate.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.add_server_certificate.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.add_server_certificate request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload add_entra_id_certificate(request, options = nil) + # Pass arguments to `add_entra_id_certificate` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload add_entra_id_certificate(instance: nil, project: nil) + # Pass arguments to `add_entra_id_certificate` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest.new + # + # # Call the add_entra_id_certificate method. + # result = client.add_entra_id_certificate request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def add_entra_id_certificate request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.add_entra_id_certificate.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.add_entra_id_certificate.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.add_entra_id_certificate.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.add_entra_id_certificate request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a Cloud SQL instance as a clone of the source instance. Using this + # operation might cause your instance to restart. + # + # @overload call_clone(request, options = nil) + # Pass arguments to `call_clone` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesCloneRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesCloneRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload call_clone(instance: nil, project: nil, body: nil) + # Pass arguments to `call_clone` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. The ID of the Cloud SQL instance to be cloned (source). This does + # not include the project ID. + # @param project [::String] + # Required. Project ID of the source Cloud SQL instance. + # @param body [::Google::Cloud::Sql::V1::InstancesCloneRequest, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesCloneRequest.new + # + # # Call the call_clone method. + # result = client.call_clone request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def call_clone request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesCloneRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.call_clone.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.call_clone.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.call_clone.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.call_clone request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a Cloud SQL instance. + # + # @overload delete(request, options = nil) + # Pass arguments to `delete` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete(instance: nil, project: nil, enable_final_backup: nil, final_backup_ttl_days: nil, final_backup_expiry_time: nil, final_backup_description: nil) + # Pass arguments to `delete` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance to be deleted. + # @param enable_final_backup [::Boolean] + # Flag to opt-in for final backup. By default, it is turned off. + # @param final_backup_ttl_days [::Integer] + # Optional. Retention period of the final backup. + # + # Note: The following parameters are mutually exclusive: `final_backup_ttl_days`, `final_backup_expiry_time`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. + # @param final_backup_expiry_time [::Google::Protobuf::Timestamp, ::Hash] + # Optional. Final Backup expiration time. + # Timestamp in UTC of when this resource is considered expired. + # + # Note: The following parameters are mutually exclusive: `final_backup_expiry_time`, `final_backup_ttl_days`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. + # @param final_backup_description [::String] + # Optional. The description of the final backup. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesDeleteRequest.new + # + # # Call the delete method. + # result = client.delete request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def delete request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.delete request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Demotes the stand-alone instance to be a Cloud SQL read replica for an + # external database server. + # + # @overload demote_master(request, options = nil) + # Pass arguments to `demote_master` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload demote_master(instance: nil, project: nil, body: nil) + # Pass arguments to `demote_master` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance name. + # @param project [::String] + # ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesDemoteMasterRequest, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest.new + # + # # Call the demote_master method. + # result = client.demote_master request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def demote_master request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.demote_master.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.demote_master.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.demote_master.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.demote_master request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Demotes an existing standalone instance to be a Cloud SQL read replica + # for an external database server. + # + # @overload demote(request, options = nil) + # Pass arguments to `demote` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload demote(instance: nil, project: nil, body: nil) + # Pass arguments to `demote` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance name. + # @param project [::String] + # Required. ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesDemoteRequest, ::Hash] + # Required. The request body. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesDemoteRequest.new + # + # # Call the demote method. + # result = client.demote request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def demote request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.demote.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.demote.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.demote.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.demote request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL + # dump or CSV file. + # + # @overload export(request, options = nil) + # Pass arguments to `export` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesExportRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesExportRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload export(instance: nil, project: nil, body: nil) + # Pass arguments to `export` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance to be exported. + # @param body [::Google::Cloud::Sql::V1::InstancesExportRequest, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesExportRequest.new + # + # # Call the export method. + # result = client.export request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def export request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesExportRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.export.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.export.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.export.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.export request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload failover(request, options = nil) + # Pass arguments to `failover` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload failover(instance: nil, project: nil, body: nil) + # Pass arguments to `failover` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # ID of the project that contains the read replica. + # @param body [::Google::Cloud::Sql::V1::InstancesFailoverRequest, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesFailoverRequest.new + # + # # Call the failover method. + # result = client.failover request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def failover request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.failover.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.failover.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.failover.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.failover request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Reencrypt CMEK instance with latest key version. + # + # @overload reencrypt(request, options = nil) + # Pass arguments to `reencrypt` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload reencrypt(instance: nil, project: nil, body: nil) + # Pass arguments to `reencrypt` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesReencryptRequest, ::Hash] + # Reencrypt body that users request + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesReencryptRequest.new + # + # # Call the reencrypt method. + # result = client.reencrypt request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def reencrypt request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.reencrypt.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.reencrypt.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.reencrypt.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.reencrypt request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Retrieves a resource containing information about a Cloud SQL instance. + # + # @overload get(request, options = nil) + # Pass arguments to `get` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesGetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesGetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get(instance: nil, project: nil) + # Pass arguments to `get` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Database instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::DatabaseInstance] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::DatabaseInstance] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesGetRequest.new + # + # # Call the get method. + # result = client.get request + # + # # The returned object is of type Google::Cloud::Sql::V1::DatabaseInstance. + # p result + # + def get request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesGetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.get request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Imports data into a Cloud SQL instance from a SQL dump or CSV file in + # Cloud Storage. + # + # @overload import(request, options = nil) + # Pass arguments to `import` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesImportRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesImportRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload import(instance: nil, project: nil, body: nil) + # Pass arguments to `import` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesImportRequest, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesImportRequest.new + # + # # Call the import method. + # result = client.import request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def import request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesImportRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.import.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.import.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.import.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.import request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a new Cloud SQL instance. + # + # @overload insert(request, options = nil) + # Pass arguments to `insert` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesInsertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesInsertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload insert(project: nil, body: nil) + # Pass arguments to `insert` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param project [::String] + # Project ID of the project to which the newly created Cloud SQL instances + # should belong. + # @param body [::Google::Cloud::Sql::V1::DatabaseInstance, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesInsertRequest.new + # + # # Call the insert method. + # result = client.insert request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def insert request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesInsertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.insert.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.insert.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.insert.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.insert request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists instances under a given project. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list(filter: nil, max_results: nil, page_token: nil, project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param filter [::String] + # 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 max_results [::Integer] + # 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 page_token [::String] + # A previously-returned page token representing part of the larger set of + # results to view. + # @param project [::String] + # Project ID of the project for which to list Cloud SQL instances. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::InstancesListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::InstancesListResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::InstancesListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.list request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload list_server_cas(request, options = nil) + # Pass arguments to `list_server_cas` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_server_cas(instance: nil, project: nil) + # Pass arguments to `list_server_cas` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::InstancesListServerCasResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::InstancesListServerCasResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest.new + # + # # Call the list_server_cas method. + # result = client.list_server_cas request + # + # # The returned object is of type Google::Cloud::Sql::V1::InstancesListServerCasResponse. + # p result + # + def list_server_cas request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_server_cas.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_server_cas.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_server_cas.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.list_server_cas request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload list_server_certificates(request, options = nil) + # Pass arguments to `list_server_certificates` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_server_certificates(instance: nil, project: nil) + # Pass arguments to `list_server_certificates` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest.new + # + # # Call the list_server_certificates method. + # result = client.list_server_certificates request + # + # # The returned object is of type Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse. + # p result + # + def list_server_certificates request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_server_certificates.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_server_certificates.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_server_certificates.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.list_server_certificates request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload list_entra_id_certificates(request, options = nil) + # Pass arguments to `list_entra_id_certificates` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_entra_id_certificates(instance: nil, project: nil) + # Pass arguments to `list_entra_id_certificates` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest.new + # + # # Call the list_entra_id_certificates method. + # result = client.list_entra_id_certificates request + # + # # The returned object is of type Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse. + # p result + # + def list_entra_id_certificates request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_entra_id_certificates.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_entra_id_certificates.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_entra_id_certificates.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.list_entra_id_certificates request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Partially updates settings of a Cloud SQL instance by merging the request + # with the current configuration. This method supports patch semantics. + # + # @overload patch(request, options = nil) + # Pass arguments to `patch` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesPatchRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesPatchRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload patch(instance: nil, project: nil, body: nil) + # Pass arguments to `patch` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::DatabaseInstance, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesPatchRequest.new + # + # # Call the patch method. + # result = client.patch request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def patch request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPatchRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.patch.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.patch.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.patch.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.patch request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Promotes the read replica instance to be an independent Cloud SQL + # primary instance. + # Using this operation might cause your instance to restart. + # + # @overload promote_replica(request, options = nil) + # Pass arguments to `promote_replica` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload promote_replica(instance: nil, project: nil, failover: nil) + # Pass arguments to `promote_replica` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL read replica instance name. + # @param project [::String] + # ID of the project that contains the read replica. + # @param failover [::Boolean] + # 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. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest.new + # + # # Call the promote_replica method. + # result = client.promote_replica request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def promote_replica request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.promote_replica.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.promote_replica.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.promote_replica.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.promote_replica request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Switches over from the primary instance to the DR replica + # instance. + # + # @overload switchover(request, options = nil) + # Pass arguments to `switchover` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload switchover(instance: nil, project: nil, db_timeout: nil) + # Pass arguments to `switchover` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL read replica instance name. + # @param project [::String] + # ID of the project that contains the replica. + # @param db_timeout [::Google::Protobuf::Duration, ::Hash] + # 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. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest.new + # + # # Call the switchover method. + # result = client.switchover request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def switchover request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.switchover.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.switchover.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.switchover.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.switchover request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes all client certificates and generates a new server SSL certificate + # for the instance. + # + # @overload reset_ssl_config(request, options = nil) + # Pass arguments to `reset_ssl_config` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload reset_ssl_config(instance: nil, project: nil, mode: nil) + # Pass arguments to `reset_ssl_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param mode [::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest::ResetSslMode] + # Optional. Reset SSL mode to use. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest.new + # + # # Call the reset_ssl_config method. + # result = client.reset_ssl_config request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def reset_ssl_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.reset_ssl_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.reset_ssl_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.reset_ssl_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.reset_ssl_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Restarts a Cloud SQL instance. + # + # @overload restart(request, options = nil) + # Pass arguments to `restart` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesRestartRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesRestartRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload restart(instance: nil, project: nil) + # Pass arguments to `restart` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance to be restarted. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesRestartRequest.new + # + # # Call the restart method. + # result = client.restart request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def restart request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRestartRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.restart.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.restart.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.restart.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.restart request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Restores a backup of a Cloud SQL instance. Using this operation might cause + # your instance to restart. + # + # @overload restore_backup(request, options = nil) + # Pass arguments to `restore_backup` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload restore_backup(instance: nil, project: nil, body: nil) + # Pass arguments to `restore_backup` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesRestoreBackupRequest, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest.new + # + # # Call the restore_backup method. + # result = client.restore_backup request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def restore_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.restore_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.restore_backup.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.restore_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.restore_backup request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload rotate_server_ca(request, options = nil) + # Pass arguments to `rotate_server_ca` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload rotate_server_ca(instance: nil, project: nil, body: nil) + # Pass arguments to `rotate_server_ca` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesRotateServerCaRequest, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest.new + # + # # Call the rotate_server_ca method. + # result = client.rotate_server_ca request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def rotate_server_ca request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.rotate_server_ca.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.rotate_server_ca.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.rotate_server_ca.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.rotate_server_ca request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload rotate_server_certificate(request, options = nil) + # Pass arguments to `rotate_server_certificate` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload rotate_server_certificate(instance: nil, project: nil, body: nil) + # Pass arguments to `rotate_server_certificate` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesRotateServerCertificateRequest, ::Hash] + # Optional. Rotate server certificate request body. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest.new + # + # # Call the rotate_server_certificate method. + # result = client.rotate_server_certificate request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def rotate_server_certificate request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.rotate_server_certificate.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.rotate_server_certificate.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.rotate_server_certificate.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.rotate_server_certificate request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Rotates the server certificate version to one previously added with the + # addEntraIdCertificate method. + # + # @overload rotate_entra_id_certificate(request, options = nil) + # Pass arguments to `rotate_entra_id_certificate` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload rotate_entra_id_certificate(instance: nil, project: nil, body: nil) + # Pass arguments to `rotate_entra_id_certificate` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesRotateEntraIdCertificateRequest, ::Hash] + # Optional. Rotate Entra ID certificate request body. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest.new + # + # # Call the rotate_entra_id_certificate method. + # result = client.rotate_entra_id_certificate request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def rotate_entra_id_certificate request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.rotate_entra_id_certificate.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.rotate_entra_id_certificate.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.rotate_entra_id_certificate.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.rotate_entra_id_certificate request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts the replication in the read replica instance. + # + # @overload start_replica(request, options = nil) + # Pass arguments to `start_replica` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload start_replica(instance: nil, project: nil) + # Pass arguments to `start_replica` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL read replica instance name. + # @param project [::String] + # ID of the project that contains the read replica. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest.new + # + # # Call the start_replica method. + # result = client.start_replica request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def start_replica request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.start_replica.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.start_replica.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.start_replica.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.start_replica request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Stops the replication in the read replica instance. + # + # @overload stop_replica(request, options = nil) + # Pass arguments to `stop_replica` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload stop_replica(instance: nil, project: nil) + # Pass arguments to `stop_replica` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL read replica instance name. + # @param project [::String] + # ID of the project that contains the read replica. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest.new + # + # # Call the stop_replica method. + # result = client.stop_replica request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def stop_replica request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.stop_replica.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.stop_replica.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.stop_replica.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.stop_replica request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Truncate MySQL general and slow query log tables + # MySQL only. + # + # @overload truncate_log(request, options = nil) + # Pass arguments to `truncate_log` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload truncate_log(instance: nil, project: nil, body: nil) + # Pass arguments to `truncate_log` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the Cloud SQL project. + # @param body [::Google::Cloud::Sql::V1::InstancesTruncateLogRequest, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest.new + # + # # Call the truncate_log method. + # result = client.truncate_log request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def truncate_log request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.truncate_log.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.truncate_log.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.truncate_log.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.truncate_log request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates settings of a Cloud SQL instance. Using this operation might cause + # your instance to restart. + # + # @overload update(request, options = nil) + # Pass arguments to `update` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update(instance: nil, project: nil, body: nil) + # Pass arguments to `update` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::DatabaseInstance, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesUpdateRequest.new + # + # # Call the update method. + # result = client.update request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def update request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.update request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload create_ephemeral(request, options = nil) + # Pass arguments to `create_ephemeral` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_ephemeral(instance: nil, project: nil, body: nil) + # Pass arguments to `create_ephemeral` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the Cloud SQL project. + # @param body [::Google::Cloud::Sql::V1::SslCertsCreateEphemeralRequest, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SslCert] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SslCert] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest.new + # + # # Call the create_ephemeral method. + # result = client.create_ephemeral request + # + # # The returned object is of type Google::Cloud::Sql::V1::SslCert. + # p result + # + def create_ephemeral request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_ephemeral.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_ephemeral.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_ephemeral.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.create_ephemeral request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Reschedules the maintenance on the given instance. + # + # @overload reschedule_maintenance(request, options = nil) + # Pass arguments to `reschedule_maintenance` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload reschedule_maintenance(instance: nil, project: nil, body: nil) + # Pass arguments to `reschedule_maintenance` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequestBody, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest.new + # + # # Call the reschedule_maintenance method. + # result = client.reschedule_maintenance request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def reschedule_maintenance request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.reschedule_maintenance.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.reschedule_maintenance.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.reschedule_maintenance.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.reschedule_maintenance request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Verify External primary instance external sync settings. + # + # @overload verify_external_sync_settings(request, options = nil) + # Pass arguments to `verify_external_sync_settings` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload verify_external_sync_settings(instance: nil, project: nil, verify_connection_only: nil, sync_mode: nil, verify_replication_only: nil, mysql_sync_config: nil, migration_type: nil, sync_parallel_level: nil, selected_objects: nil) + # Pass arguments to `verify_external_sync_settings` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param verify_connection_only [::Boolean] + # Flag to enable verifying connection only + # @param sync_mode [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::ExternalSyncMode] + # External sync mode + # @param verify_replication_only [::Boolean] + # Optional. Flag to verify settings required by replication setup only + # @param mysql_sync_config [::Google::Cloud::Sql::V1::MySqlSyncConfig, ::Hash] + # Optional. MySQL-specific settings for start external sync. + # @param migration_type [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::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 sync_parallel_level [::Google::Cloud::Sql::V1::ExternalSyncParallelLevel] + # Optional. Parallel level for initial data sync. Only applicable for + # PostgreSQL. + # @param selected_objects [::Array<::Google::Cloud::Sql::V1::ExternalSyncSelectedObject, ::Hash>] + # Optional. Migrate only the specified objects from the source instance. If + # this field is empty, then migrate all objects. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest.new + # + # # Call the verify_external_sync_settings method. + # result = client.verify_external_sync_settings request + # + # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse. + # p result + # + def verify_external_sync_settings request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.verify_external_sync_settings.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.verify_external_sync_settings.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.verify_external_sync_settings.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.verify_external_sync_settings request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Start External primary instance migration. + # + # @overload start_external_sync(request, options = nil) + # Pass arguments to `start_external_sync` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload start_external_sync(instance: nil, project: nil, sync_mode: nil, skip_verification: nil, mysql_sync_config: nil, sync_parallel_level: nil, migration_type: nil, replica_overwrite_enabled: nil) + # Pass arguments to `start_external_sync` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # ID of the project that contains the instance. + # @param sync_mode [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::ExternalSyncMode] + # External sync mode. + # @param skip_verification [::Boolean] + # Whether to skip the verification step (VESS). + # @param mysql_sync_config [::Google::Cloud::Sql::V1::MySqlSyncConfig, ::Hash] + # MySQL-specific settings for start external sync. + # @param sync_parallel_level [::Google::Cloud::Sql::V1::ExternalSyncParallelLevel] + # Optional. Parallel level for initial data sync. Currently only applicable + # for MySQL. + # @param migration_type [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::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 replica_overwrite_enabled [::Boolean] + # 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. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest.new + # + # # Call the start_external_sync method. + # result = client.start_external_sync request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def start_external_sync request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.start_external_sync.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.start_external_sync.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.start_external_sync.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.start_external_sync request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Perform Disk Shrink on primary instance. + # + # @overload perform_disk_shrink(request, options = nil) + # Pass arguments to `perform_disk_shrink` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload perform_disk_shrink(instance: nil, project: nil, body: nil) + # Pass arguments to `perform_disk_shrink` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::PerformDiskShrinkContext, ::Hash] + # Perform disk shrink context. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest.new + # + # # Call the perform_disk_shrink method. + # result = client.perform_disk_shrink request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def perform_disk_shrink request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.perform_disk_shrink.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.perform_disk_shrink.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.perform_disk_shrink.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.perform_disk_shrink request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Get Disk Shrink Config for a given instance. + # + # @overload get_disk_shrink_config(request, options = nil) + # Pass arguments to `get_disk_shrink_config` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_disk_shrink_config(instance: nil, project: nil) + # Pass arguments to `get_disk_shrink_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest.new + # + # # Call the get_disk_shrink_config method. + # result = client.get_disk_shrink_config request + # + # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse. + # p result + # + def get_disk_shrink_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_disk_shrink_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_disk_shrink_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_disk_shrink_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.get_disk_shrink_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Reset Replica Size to primary instance disk size. + # + # @overload reset_replica_size(request, options = nil) + # Pass arguments to `reset_replica_size` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload reset_replica_size(instance: nil, project: nil) + # Pass arguments to `reset_replica_size` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL read replica instance name. + # @param project [::String] + # ID of the project that contains the read replica. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest.new + # + # # Call the reset_replica_size method. + # result = client.reset_replica_size request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def reset_replica_size request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.reset_replica_size.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.reset_replica_size.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.reset_replica_size.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.reset_replica_size request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Get Latest Recovery Time for a given instance. + # + # @overload get_latest_recovery_time(request, options = nil) + # Pass arguments to `get_latest_recovery_time` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_latest_recovery_time(instance: nil, project: nil, source_instance_deletion_time: nil) + # Pass arguments to `get_latest_recovery_time` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param source_instance_deletion_time [::Google::Protobuf::Timestamp, ::Hash] + # The timestamp used to identify the time when the source instance is + # deleted. If this instance is deleted, then you must set the timestamp. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest.new + # + # # Call the get_latest_recovery_time method. + # result = client.get_latest_recovery_time request + # + # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse. + # p result + # + def get_latest_recovery_time request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_latest_recovery_time.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_latest_recovery_time.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_latest_recovery_time.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.get_latest_recovery_time request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Execute SQL statements. + # + # @overload execute_sql(request, options = nil) + # Pass arguments to `execute_sql` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload execute_sql(instance: nil, project: nil, body: nil) + # Pass arguments to `execute_sql` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Database instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::ExecuteSqlPayload, ::Hash] + # The request body. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest.new + # + # # Call the execute_sql method. + # result = client.execute_sql request + # + # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse. + # p result + # + def execute_sql request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.execute_sql.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.execute_sql.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.execute_sql.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.execute_sql request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + # + # @overload acquire_ssrs_lease(request, options = nil) + # Pass arguments to `acquire_ssrs_lease` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload acquire_ssrs_lease(instance: nil, project: nil, body: nil) + # Pass arguments to `acquire_ssrs_lease` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # 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 project [::String] + # Required. Project ID of the project that contains the instance (Example: + # project-id). + # @param body [::Google::Cloud::Sql::V1::InstancesAcquireSsrsLeaseRequest, ::Hash] + # Required. The request body. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest.new + # + # # Call the acquire_ssrs_lease method. + # result = client.acquire_ssrs_lease request + # + # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse. + # p result + # + def acquire_ssrs_lease request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.acquire_ssrs_lease.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.acquire_ssrs_lease.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.acquire_ssrs_lease.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.acquire_ssrs_lease request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Release a lease for the setup of SQL Server Reporting Services (SSRS). + # + # @overload release_ssrs_lease(request, options = nil) + # Pass arguments to `release_ssrs_lease` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload release_ssrs_lease(instance: nil, project: nil) + # Pass arguments to `release_ssrs_lease` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # 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 project [::String] + # Required. The project ID that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest.new + # + # # Call the release_ssrs_lease method. + # result = client.release_ssrs_lease request + # + # # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse. + # p result + # + def release_ssrs_lease request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.release_ssrs_lease.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.release_ssrs_lease.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.release_ssrs_lease.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.release_ssrs_lease request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Execute MVU Pre-checks + # + # @overload pre_check_major_version_upgrade(request, options = nil) + # Pass arguments to `pre_check_major_version_upgrade` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload pre_check_major_version_upgrade(instance: nil, project: nil, body: nil) + # Pass arguments to `pre_check_major_version_upgrade` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::InstancesPreCheckMajorVersionUpgradeRequest, ::Hash] + # Required. The context for request to perform the pre-check major version + # upgrade operation. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest.new + # + # # Call the pre_check_major_version_upgrade method. + # result = client.pre_check_major_version_upgrade request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def pre_check_major_version_upgrade request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.pre_check_major_version_upgrade.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.pre_check_major_version_upgrade.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.pre_check_major_version_upgrade.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.pre_check_major_version_upgrade request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Point in time restore for an instance managed by Google Cloud Backup and + # Disaster Recovery. + # + # @overload point_in_time_restore(request, options = nil) + # Pass arguments to `point_in_time_restore` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload point_in_time_restore(parent: nil, context: nil) + # Pass arguments to `point_in_time_restore` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent resource where you created this instance. + # Format: projects/\\{project} + # @param context [::Google::Cloud::Sql::V1::PointInTimeRestoreContext, ::Hash] + # Required. The context for request to perform a PITR on a Google Cloud + # Backup and Disaster Recovery managed instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest.new + # + # # Call the point_in_time_restore method. + # result = client.point_in_time_restore request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def point_in_time_restore request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.point_in_time_restore.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.point_in_time_restore.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.point_in_time_restore.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_instances_service_stub.point_in_time_restore request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlInstancesService REST API. + # + # This class represents the configuration for SqlInstancesService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # add_server_ca to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.add_server_ca.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.add_server_ca.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the SqlInstancesService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `add_server_ca` + # @return [::Gapic::Config::Method] + # + attr_reader :add_server_ca + ## + # RPC-specific configuration for `add_server_certificate` + # @return [::Gapic::Config::Method] + # + attr_reader :add_server_certificate + ## + # RPC-specific configuration for `add_entra_id_certificate` + # @return [::Gapic::Config::Method] + # + attr_reader :add_entra_id_certificate + ## + # RPC-specific configuration for `call_clone` + # @return [::Gapic::Config::Method] + # + attr_reader :call_clone + ## + # RPC-specific configuration for `delete` + # @return [::Gapic::Config::Method] + # + attr_reader :delete + ## + # RPC-specific configuration for `demote_master` + # @return [::Gapic::Config::Method] + # + attr_reader :demote_master + ## + # RPC-specific configuration for `demote` + # @return [::Gapic::Config::Method] + # + attr_reader :demote + ## + # RPC-specific configuration for `export` + # @return [::Gapic::Config::Method] + # + attr_reader :export + ## + # RPC-specific configuration for `failover` + # @return [::Gapic::Config::Method] + # + attr_reader :failover + ## + # RPC-specific configuration for `reencrypt` + # @return [::Gapic::Config::Method] + # + attr_reader :reencrypt + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `import` + # @return [::Gapic::Config::Method] + # + attr_reader :import + ## + # RPC-specific configuration for `insert` + # @return [::Gapic::Config::Method] + # + attr_reader :insert + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + ## + # RPC-specific configuration for `list_server_cas` + # @return [::Gapic::Config::Method] + # + attr_reader :list_server_cas + ## + # RPC-specific configuration for `list_server_certificates` + # @return [::Gapic::Config::Method] + # + attr_reader :list_server_certificates + ## + # RPC-specific configuration for `list_entra_id_certificates` + # @return [::Gapic::Config::Method] + # + attr_reader :list_entra_id_certificates + ## + # RPC-specific configuration for `patch` + # @return [::Gapic::Config::Method] + # + attr_reader :patch + ## + # RPC-specific configuration for `promote_replica` + # @return [::Gapic::Config::Method] + # + attr_reader :promote_replica + ## + # RPC-specific configuration for `switchover` + # @return [::Gapic::Config::Method] + # + attr_reader :switchover + ## + # RPC-specific configuration for `reset_ssl_config` + # @return [::Gapic::Config::Method] + # + attr_reader :reset_ssl_config + ## + # RPC-specific configuration for `restart` + # @return [::Gapic::Config::Method] + # + attr_reader :restart + ## + # RPC-specific configuration for `restore_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :restore_backup + ## + # RPC-specific configuration for `rotate_server_ca` + # @return [::Gapic::Config::Method] + # + attr_reader :rotate_server_ca + ## + # RPC-specific configuration for `rotate_server_certificate` + # @return [::Gapic::Config::Method] + # + attr_reader :rotate_server_certificate + ## + # RPC-specific configuration for `rotate_entra_id_certificate` + # @return [::Gapic::Config::Method] + # + attr_reader :rotate_entra_id_certificate + ## + # RPC-specific configuration for `start_replica` + # @return [::Gapic::Config::Method] + # + attr_reader :start_replica + ## + # RPC-specific configuration for `stop_replica` + # @return [::Gapic::Config::Method] + # + attr_reader :stop_replica + ## + # RPC-specific configuration for `truncate_log` + # @return [::Gapic::Config::Method] + # + attr_reader :truncate_log + ## + # RPC-specific configuration for `update` + # @return [::Gapic::Config::Method] + # + attr_reader :update + ## + # RPC-specific configuration for `create_ephemeral` + # @return [::Gapic::Config::Method] + # + attr_reader :create_ephemeral + ## + # RPC-specific configuration for `reschedule_maintenance` + # @return [::Gapic::Config::Method] + # + attr_reader :reschedule_maintenance + ## + # RPC-specific configuration for `verify_external_sync_settings` + # @return [::Gapic::Config::Method] + # + attr_reader :verify_external_sync_settings + ## + # RPC-specific configuration for `start_external_sync` + # @return [::Gapic::Config::Method] + # + attr_reader :start_external_sync + ## + # RPC-specific configuration for `perform_disk_shrink` + # @return [::Gapic::Config::Method] + # + attr_reader :perform_disk_shrink + ## + # RPC-specific configuration for `get_disk_shrink_config` + # @return [::Gapic::Config::Method] + # + attr_reader :get_disk_shrink_config + ## + # RPC-specific configuration for `reset_replica_size` + # @return [::Gapic::Config::Method] + # + attr_reader :reset_replica_size + ## + # RPC-specific configuration for `get_latest_recovery_time` + # @return [::Gapic::Config::Method] + # + attr_reader :get_latest_recovery_time + ## + # RPC-specific configuration for `execute_sql` + # @return [::Gapic::Config::Method] + # + attr_reader :execute_sql + ## + # RPC-specific configuration for `acquire_ssrs_lease` + # @return [::Gapic::Config::Method] + # + attr_reader :acquire_ssrs_lease + ## + # RPC-specific configuration for `release_ssrs_lease` + # @return [::Gapic::Config::Method] + # + attr_reader :release_ssrs_lease + ## + # RPC-specific configuration for `pre_check_major_version_upgrade` + # @return [::Gapic::Config::Method] + # + attr_reader :pre_check_major_version_upgrade + ## + # RPC-specific configuration for `point_in_time_restore` + # @return [::Gapic::Config::Method] + # + attr_reader :point_in_time_restore + + # @private + def initialize parent_rpcs = nil + add_server_ca_config = parent_rpcs.add_server_ca if parent_rpcs.respond_to? :add_server_ca + @add_server_ca = ::Gapic::Config::Method.new add_server_ca_config + add_server_certificate_config = parent_rpcs.add_server_certificate if parent_rpcs.respond_to? :add_server_certificate + @add_server_certificate = ::Gapic::Config::Method.new add_server_certificate_config + add_entra_id_certificate_config = parent_rpcs.add_entra_id_certificate if parent_rpcs.respond_to? :add_entra_id_certificate + @add_entra_id_certificate = ::Gapic::Config::Method.new add_entra_id_certificate_config + call_clone_config = parent_rpcs.call_clone if parent_rpcs.respond_to? :call_clone + @call_clone = ::Gapic::Config::Method.new call_clone_config + delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete + @delete = ::Gapic::Config::Method.new delete_config + demote_master_config = parent_rpcs.demote_master if parent_rpcs.respond_to? :demote_master + @demote_master = ::Gapic::Config::Method.new demote_master_config + demote_config = parent_rpcs.demote if parent_rpcs.respond_to? :demote + @demote = ::Gapic::Config::Method.new demote_config + export_config = parent_rpcs.export if parent_rpcs.respond_to? :export + @export = ::Gapic::Config::Method.new export_config + failover_config = parent_rpcs.failover if parent_rpcs.respond_to? :failover + @failover = ::Gapic::Config::Method.new failover_config + reencrypt_config = parent_rpcs.reencrypt if parent_rpcs.respond_to? :reencrypt + @reencrypt = ::Gapic::Config::Method.new reencrypt_config + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + import_config = parent_rpcs.import if parent_rpcs.respond_to? :import + @import = ::Gapic::Config::Method.new import_config + insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert + @insert = ::Gapic::Config::Method.new insert_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + list_server_cas_config = parent_rpcs.list_server_cas if parent_rpcs.respond_to? :list_server_cas + @list_server_cas = ::Gapic::Config::Method.new list_server_cas_config + list_server_certificates_config = parent_rpcs.list_server_certificates if parent_rpcs.respond_to? :list_server_certificates + @list_server_certificates = ::Gapic::Config::Method.new list_server_certificates_config + list_entra_id_certificates_config = parent_rpcs.list_entra_id_certificates if parent_rpcs.respond_to? :list_entra_id_certificates + @list_entra_id_certificates = ::Gapic::Config::Method.new list_entra_id_certificates_config + patch_config = parent_rpcs.patch if parent_rpcs.respond_to? :patch + @patch = ::Gapic::Config::Method.new patch_config + promote_replica_config = parent_rpcs.promote_replica if parent_rpcs.respond_to? :promote_replica + @promote_replica = ::Gapic::Config::Method.new promote_replica_config + switchover_config = parent_rpcs.switchover if parent_rpcs.respond_to? :switchover + @switchover = ::Gapic::Config::Method.new switchover_config + reset_ssl_config_config = parent_rpcs.reset_ssl_config if parent_rpcs.respond_to? :reset_ssl_config + @reset_ssl_config = ::Gapic::Config::Method.new reset_ssl_config_config + restart_config = parent_rpcs.restart if parent_rpcs.respond_to? :restart + @restart = ::Gapic::Config::Method.new restart_config + restore_backup_config = parent_rpcs.restore_backup if parent_rpcs.respond_to? :restore_backup + @restore_backup = ::Gapic::Config::Method.new restore_backup_config + rotate_server_ca_config = parent_rpcs.rotate_server_ca if parent_rpcs.respond_to? :rotate_server_ca + @rotate_server_ca = ::Gapic::Config::Method.new rotate_server_ca_config + rotate_server_certificate_config = parent_rpcs.rotate_server_certificate if parent_rpcs.respond_to? :rotate_server_certificate + @rotate_server_certificate = ::Gapic::Config::Method.new rotate_server_certificate_config + rotate_entra_id_certificate_config = parent_rpcs.rotate_entra_id_certificate if parent_rpcs.respond_to? :rotate_entra_id_certificate + @rotate_entra_id_certificate = ::Gapic::Config::Method.new rotate_entra_id_certificate_config + start_replica_config = parent_rpcs.start_replica if parent_rpcs.respond_to? :start_replica + @start_replica = ::Gapic::Config::Method.new start_replica_config + stop_replica_config = parent_rpcs.stop_replica if parent_rpcs.respond_to? :stop_replica + @stop_replica = ::Gapic::Config::Method.new stop_replica_config + truncate_log_config = parent_rpcs.truncate_log if parent_rpcs.respond_to? :truncate_log + @truncate_log = ::Gapic::Config::Method.new truncate_log_config + update_config = parent_rpcs.update if parent_rpcs.respond_to? :update + @update = ::Gapic::Config::Method.new update_config + create_ephemeral_config = parent_rpcs.create_ephemeral if parent_rpcs.respond_to? :create_ephemeral + @create_ephemeral = ::Gapic::Config::Method.new create_ephemeral_config + reschedule_maintenance_config = parent_rpcs.reschedule_maintenance if parent_rpcs.respond_to? :reschedule_maintenance + @reschedule_maintenance = ::Gapic::Config::Method.new reschedule_maintenance_config + verify_external_sync_settings_config = parent_rpcs.verify_external_sync_settings if parent_rpcs.respond_to? :verify_external_sync_settings + @verify_external_sync_settings = ::Gapic::Config::Method.new verify_external_sync_settings_config + start_external_sync_config = parent_rpcs.start_external_sync if parent_rpcs.respond_to? :start_external_sync + @start_external_sync = ::Gapic::Config::Method.new start_external_sync_config + perform_disk_shrink_config = parent_rpcs.perform_disk_shrink if parent_rpcs.respond_to? :perform_disk_shrink + @perform_disk_shrink = ::Gapic::Config::Method.new perform_disk_shrink_config + get_disk_shrink_config_config = parent_rpcs.get_disk_shrink_config if parent_rpcs.respond_to? :get_disk_shrink_config + @get_disk_shrink_config = ::Gapic::Config::Method.new get_disk_shrink_config_config + reset_replica_size_config = parent_rpcs.reset_replica_size if parent_rpcs.respond_to? :reset_replica_size + @reset_replica_size = ::Gapic::Config::Method.new reset_replica_size_config + get_latest_recovery_time_config = parent_rpcs.get_latest_recovery_time if parent_rpcs.respond_to? :get_latest_recovery_time + @get_latest_recovery_time = ::Gapic::Config::Method.new get_latest_recovery_time_config + execute_sql_config = parent_rpcs.execute_sql if parent_rpcs.respond_to? :execute_sql + @execute_sql = ::Gapic::Config::Method.new execute_sql_config + acquire_ssrs_lease_config = parent_rpcs.acquire_ssrs_lease if parent_rpcs.respond_to? :acquire_ssrs_lease + @acquire_ssrs_lease = ::Gapic::Config::Method.new acquire_ssrs_lease_config + release_ssrs_lease_config = parent_rpcs.release_ssrs_lease if parent_rpcs.respond_to? :release_ssrs_lease + @release_ssrs_lease = ::Gapic::Config::Method.new release_ssrs_lease_config + pre_check_major_version_upgrade_config = parent_rpcs.pre_check_major_version_upgrade if parent_rpcs.respond_to? :pre_check_major_version_upgrade + @pre_check_major_version_upgrade = ::Gapic::Config::Method.new pre_check_major_version_upgrade_config + point_in_time_restore_config = parent_rpcs.point_in_time_restore if parent_rpcs.respond_to? :point_in_time_restore + @point_in_time_restore = ::Gapic::Config::Method.new point_in_time_restore_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/rest/service_stub.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/rest/service_stub.rb new file mode 100644 index 000000000000..14610babca8f --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_instances_service/rest/service_stub.rb @@ -0,0 +1,2769 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/sql/v1/cloud_sql_instances_pb" + +module Google + module Cloud + module Sql + module V1 + module SqlInstancesService + module Rest + ## + # REST service stub for the SqlInstancesService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the add_server_ca REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def add_server_ca request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_add_server_ca_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "add_server_ca", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the add_server_certificate REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def add_server_certificate request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_add_server_certificate_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "add_server_certificate", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the add_entra_id_certificate REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def add_entra_id_certificate request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_add_entra_id_certificate_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "add_entra_id_certificate", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the call_clone REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesCloneRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def call_clone request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_call_clone_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "call_clone", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def delete request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the demote_master REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def demote_master request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_demote_master_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "demote_master", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the demote REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def demote request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_demote_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "demote", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the export REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesExportRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def export request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_export_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "export", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the failover REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def failover request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_failover_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "failover", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the reencrypt REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def reencrypt request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_reencrypt_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "reencrypt", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesGetRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::DatabaseInstance] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::DatabaseInstance] + # A result object deserialized from the server's reply + def get request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::DatabaseInstance.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the import REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesImportRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def import request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_import_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "import", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the insert REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesInsertRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def insert request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_insert_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "insert", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesListRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::InstancesListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::InstancesListResponse] + # A result object deserialized from the server's reply + def list request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::InstancesListResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_server_cas REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::InstancesListServerCasResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::InstancesListServerCasResponse] + # A result object deserialized from the server's reply + def list_server_cas request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_server_cas_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_server_cas", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::InstancesListServerCasResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_server_certificates REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse] + # A result object deserialized from the server's reply + def list_server_certificates request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_server_certificates_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_server_certificates", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_entra_id_certificates REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse] + # A result object deserialized from the server's reply + def list_entra_id_certificates request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_entra_id_certificates_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_entra_id_certificates", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the patch REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesPatchRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def patch request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_patch_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "patch", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the promote_replica REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def promote_replica request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_promote_replica_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "promote_replica", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the switchover REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def switchover request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_switchover_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "switchover", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the reset_ssl_config REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def reset_ssl_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_reset_ssl_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "reset_ssl_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the restart REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesRestartRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def restart request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_restart_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "restart", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the restore_backup REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def restore_backup request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_restore_backup_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "restore_backup", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the rotate_server_ca REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def rotate_server_ca request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_rotate_server_ca_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "rotate_server_ca", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the rotate_server_certificate REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def rotate_server_certificate request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_rotate_server_certificate_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "rotate_server_certificate", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the rotate_entra_id_certificate REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def rotate_entra_id_certificate request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_rotate_entra_id_certificate_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "rotate_entra_id_certificate", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the start_replica REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def start_replica request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_start_replica_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "start_replica", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the stop_replica REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def stop_replica request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_stop_replica_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "stop_replica", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the truncate_log REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def truncate_log request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_truncate_log_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "truncate_log", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def update request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the create_ephemeral REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SslCert] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SslCert] + # A result object deserialized from the server's reply + def create_ephemeral request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_ephemeral_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_ephemeral", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::SslCert.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the reschedule_maintenance REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def reschedule_maintenance request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_reschedule_maintenance_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "reschedule_maintenance", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the verify_external_sync_settings REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse] + # A result object deserialized from the server's reply + def verify_external_sync_settings request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_verify_external_sync_settings_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "verify_external_sync_settings", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the start_external_sync REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def start_external_sync request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_start_external_sync_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "start_external_sync", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the perform_disk_shrink REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def perform_disk_shrink request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_perform_disk_shrink_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "perform_disk_shrink", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_disk_shrink_config REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse] + # A result object deserialized from the server's reply + def get_disk_shrink_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_disk_shrink_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_disk_shrink_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the reset_replica_size REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def reset_replica_size request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_reset_replica_size_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "reset_replica_size", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_latest_recovery_time REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse] + # A result object deserialized from the server's reply + def get_latest_recovery_time request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_latest_recovery_time_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_latest_recovery_time", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the execute_sql REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse] + # A result object deserialized from the server's reply + def execute_sql request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_execute_sql_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "execute_sql", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the acquire_ssrs_lease REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse] + # A result object deserialized from the server's reply + def acquire_ssrs_lease request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_acquire_ssrs_lease_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "acquire_ssrs_lease", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the release_ssrs_lease REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse] + # A result object deserialized from the server's reply + def release_ssrs_lease request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_release_ssrs_lease_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "release_ssrs_lease", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the pre_check_major_version_upgrade REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def pre_check_major_version_upgrade request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_pre_check_major_version_upgrade_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "pre_check_major_version_upgrade", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the point_in_time_restore REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def point_in_time_restore request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_point_in_time_restore_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "point_in_time_restore", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the add_server_ca REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_add_server_ca_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/addServerCa", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the add_server_certificate REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_add_server_certificate_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/addServerCertificate", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the add_entra_id_certificate REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_add_entra_id_certificate_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/addEntraIdCertificate", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the call_clone REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesCloneRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_call_clone_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/clone", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/projects/{project}/instances/{instance}", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the demote_master REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_demote_master_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/demoteMaster", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the demote REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_demote_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/demote", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the export REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesExportRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_export_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/export", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the failover REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_failover_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/failover", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the reencrypt REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_reencrypt_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/reencrypt", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesGetRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the import REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesImportRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_import_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/import", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the insert REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesInsertRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_insert_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesListRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances", + matches: [ + ["project", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_server_cas REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_server_cas_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/listServerCas", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_server_certificates REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_server_certificates_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/listServerCertificates", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_entra_id_certificates REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_entra_id_certificates_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/listEntraIdCertificates", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the patch REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesPatchRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_patch_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1/projects/{project}/instances/{instance}", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the promote_replica REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_promote_replica_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/promoteReplica", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the switchover REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_switchover_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/switchover", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the reset_ssl_config REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_reset_ssl_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/resetSslConfig", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the restart REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesRestartRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_restart_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/restart", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the restore_backup REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_restore_backup_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/restoreBackup", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the rotate_server_ca REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_rotate_server_ca_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/rotateServerCa", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the rotate_server_certificate REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_rotate_server_certificate_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/rotateServerCertificate", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the rotate_entra_id_certificate REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_rotate_entra_id_certificate_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/rotateEntraIdCertificate", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the start_replica REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_start_replica_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/startReplica", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the stop_replica REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_stop_replica_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/stopReplica", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the truncate_log REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_truncate_log_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/truncateLog", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :put, + uri_template: "/v1/projects/{project}/instances/{instance}", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_ephemeral REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_ephemeral_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/createEphemeral", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the reschedule_maintenance REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_reschedule_maintenance_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/rescheduleMaintenance", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the verify_external_sync_settings REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_verify_external_sync_settings_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/verifyExternalSyncSettings", + body: "*", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the start_external_sync REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_start_external_sync_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/startExternalSync", + body: "*", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the perform_disk_shrink REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_perform_disk_shrink_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/performDiskShrink", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_disk_shrink_config REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_disk_shrink_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/getDiskShrinkConfig", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the reset_replica_size REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_reset_replica_size_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/resetReplicaSize", + body: "*", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_latest_recovery_time REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_latest_recovery_time_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/getLatestRecoveryTime", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the execute_sql REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_execute_sql_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/executeSql", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the acquire_ssrs_lease REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_acquire_ssrs_lease_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/acquireSsrsLease", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the release_ssrs_lease REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_release_ssrs_lease_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/releaseSsrsLease", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the pre_check_major_version_upgrade REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_pre_check_major_version_upgrade_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the point_in_time_restore REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_point_in_time_restore_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{parent}:pointInTimeRestore", + body: "context", + matches: [ + ["parent", %r{^projects/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service.rb new file mode 100644 index 000000000000..d83f343d4806 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_operations_service/credentials" +require "google/cloud/sql/v1/sql_operations_service/client" +require "google/cloud/sql/v1/sql_operations_service/rest" + +module Google + module Cloud + module Sql + module V1 + ## + # Service to fetch operations for database instances. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/sql/v1/sql_operations_service" + # client = ::Google::Cloud::Sql::V1::SqlOperationsService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/sql/v1/sql_operations_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.new + # + module SqlOperationsService + end + end + end + end +end + +helper_path = ::File.join __dir__, "sql_operations_service", "helpers.rb" +require "google/cloud/sql/v1/sql_operations_service/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/client.rb new file mode 100644 index 000000000000..f57f36175f98 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/client.rb @@ -0,0 +1,694 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_operations_pb" +require "google/cloud/location" + +module Google + module Cloud + module Sql + module V1 + module SqlOperationsService + ## + # Client for the SqlOperationsService service. + # + # Service to fetch operations for database instances. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_operations_service_stub + + ## + # Configure the SqlOperationsService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlOperationsService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlOperationsService clients + # ::Google::Cloud::Sql::V1::SqlOperationsService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlOperationsService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlOperationsService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_operations_service_stub.universe_domain + end + + ## + # Create a new SqlOperationsService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlOperationsService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlOperationsService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlOperationsService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/sql/v1/cloud_sql_operations_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_operations_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Sql::V1::SqlOperationsService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @sql_operations_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_operations_service_stub.endpoint + config.universe_domain = @sql_operations_service_stub.universe_domain + config.logger = @sql_operations_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_operations_service_stub.logger + end + + # Service calls + + ## + # Retrieves an instance operation that has been performed on an instance. + # + # @overload get(request, options = nil) + # Pass arguments to `get` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlOperationsGetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlOperationsGetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get(operation: nil, project: nil) + # Pass arguments to `get` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param operation [::String] + # Required. Instance operation ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlOperationsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlOperationsGetRequest.new + # + # # Call the get method. + # result = client.get request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def get request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlOperationsGetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.operation + header_params["operation"] = request.operation + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_operations_service_stub.call_rpc :get, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all instance operations that have been performed on the given Cloud + # SQL instance in the reverse chronological order of the start time. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlOperationsListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlOperationsListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list(instance: nil, max_results: nil, page_token: nil, project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param max_results [::Integer] + # Maximum number of operations per response. + # @param page_token [::String] + # A previously-returned page token representing part of the larger set of + # results to view. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::OperationsListResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::OperationsListResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlOperationsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlOperationsListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::OperationsListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlOperationsListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_operations_service_stub.call_rpc :list, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Cancels an instance operation that has been performed on an instance. + # + # @overload cancel(request, options = nil) + # Pass arguments to `cancel` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlOperationsCancelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlOperationsCancelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload cancel(operation: nil, project: nil) + # Pass arguments to `cancel` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param operation [::String] + # Instance operation ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlOperationsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlOperationsCancelRequest.new + # + # # Call the cancel method. + # result = client.cancel request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlOperationsCancelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.cancel.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.operation + header_params["operation"] = request.operation + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.cancel.timeout, + metadata: metadata, + retry_policy: @config.rpcs.cancel.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_operations_service_stub.call_rpc :cancel, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlOperationsService API. + # + # This class represents the configuration for SqlOperationsService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlOperationsService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # get to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlOperationsService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.get.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlOperationsService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.get.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Sql::V1::SqlOperationsService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the SqlOperationsService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + ## + # RPC-specific configuration for `cancel` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel + + # @private + def initialize parent_rpcs = nil + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + cancel_config = parent_rpcs.cancel if parent_rpcs.respond_to? :cancel + @cancel = ::Gapic::Config::Method.new cancel_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/credentials.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/credentials.rb new file mode 100644 index 000000000000..87ea549d018e --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/credentials.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Sql + module V1 + module SqlOperationsService + # Credentials for the SqlOperationsService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/sqlservice.admin" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/rest.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/rest.rb new file mode 100644 index 000000000000..96fc62eaeef9 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/rest.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_operations_service/credentials" +require "google/cloud/sql/v1/sql_operations_service/rest/client" + +module Google + module Cloud + module Sql + module V1 + ## + # Service to fetch operations for database instances. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/sql/v1/sql_operations_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.new + # + module SqlOperationsService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/sql/v1/sql_operations_service/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/rest/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/rest/client.rb new file mode 100644 index 000000000000..02834ad654a5 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/rest/client.rb @@ -0,0 +1,624 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_operations_pb" +require "google/cloud/sql/v1/sql_operations_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Sql + module V1 + module SqlOperationsService + module Rest + ## + # REST client for the SqlOperationsService service. + # + # Service to fetch operations for database instances. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_operations_service_stub + + ## + # Configure the SqlOperationsService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlOperationsService clients + # ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlOperationsService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_operations_service_stub.universe_domain + end + + ## + # Create a new SqlOperationsService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlOperationsService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_operations_service_stub = ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @sql_operations_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_operations_service_stub.endpoint + config.universe_domain = @sql_operations_service_stub.universe_domain + config.logger = @sql_operations_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_operations_service_stub.logger + end + + # Service calls + + ## + # Retrieves an instance operation that has been performed on an instance. + # + # @overload get(request, options = nil) + # Pass arguments to `get` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlOperationsGetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlOperationsGetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get(operation: nil, project: nil) + # Pass arguments to `get` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param operation [::String] + # Required. Instance operation ID. + # @param project [::String] + # Required. Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlOperationsGetRequest.new + # + # # Call the get method. + # result = client.get request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def get request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlOperationsGetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_operations_service_stub.get request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all instance operations that have been performed on the given Cloud + # SQL instance in the reverse chronological order of the start time. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlOperationsListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlOperationsListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list(instance: nil, max_results: nil, page_token: nil, project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param max_results [::Integer] + # Maximum number of operations per response. + # @param page_token [::String] + # A previously-returned page token representing part of the larger set of + # results to view. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::OperationsListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::OperationsListResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlOperationsListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::OperationsListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlOperationsListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_operations_service_stub.list request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Cancels an instance operation that has been performed on an instance. + # + # @overload cancel(request, options = nil) + # Pass arguments to `cancel` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlOperationsCancelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlOperationsCancelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload cancel(operation: nil, project: nil) + # Pass arguments to `cancel` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param operation [::String] + # Instance operation ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlOperationsCancelRequest.new + # + # # Call the cancel method. + # result = client.cancel request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlOperationsCancelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.cancel.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.cancel.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.cancel.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_operations_service_stub.cancel request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlOperationsService REST API. + # + # This class represents the configuration for SqlOperationsService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # get to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.get.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.get.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the SqlOperationsService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + ## + # RPC-specific configuration for `cancel` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel + + # @private + def initialize parent_rpcs = nil + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + cancel_config = parent_rpcs.cancel if parent_rpcs.respond_to? :cancel + @cancel = ::Gapic::Config::Method.new cancel_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/rest/service_stub.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/rest/service_stub.rb new file mode 100644 index 000000000000..0cc0088b0b8f --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_operations_service/rest/service_stub.rb @@ -0,0 +1,266 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/sql/v1/cloud_sql_operations_pb" + +module Google + module Cloud + module Sql + module V1 + module SqlOperationsService + module Rest + ## + # REST service stub for the SqlOperationsService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the get REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlOperationsGetRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def get request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlOperationsListRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::OperationsListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::OperationsListResponse] + # A result object deserialized from the server's reply + def list request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::OperationsListResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the cancel REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlOperationsCancelRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def cancel request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_cancel_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "cancel", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the get REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlOperationsGetRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/operations/{operation}", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["operation", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlOperationsListRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/operations", + matches: [ + ["project", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the cancel REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlOperationsCancelRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_cancel_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/operations/{operation}/cancel", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["operation", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service.rb new file mode 100644 index 000000000000..66e28a4712d4 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_ssl_certs_service/credentials" +require "google/cloud/sql/v1/sql_ssl_certs_service/client" +require "google/cloud/sql/v1/sql_ssl_certs_service/rest" + +module Google + module Cloud + module Sql + module V1 + ## + # Service to manage SSL certs for Cloud SQL instances. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/sql/v1/sql_ssl_certs_service" + # client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/sql/v1/sql_ssl_certs_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new + # + module SqlSslCertsService + end + end + end + end +end + +helper_path = ::File.join __dir__, "sql_ssl_certs_service", "helpers.rb" +require "google/cloud/sql/v1/sql_ssl_certs_service/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/client.rb new file mode 100644 index 000000000000..89b593f0d7b4 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/client.rb @@ -0,0 +1,804 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_ssl_certs_pb" +require "google/cloud/location" + +module Google + module Cloud + module Sql + module V1 + module SqlSslCertsService + ## + # Client for the SqlSslCertsService service. + # + # Service to manage SSL certs for Cloud SQL instances. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_ssl_certs_service_stub + + ## + # Configure the SqlSslCertsService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlSslCertsService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlSslCertsService clients + # ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlSslCertsService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlSslCertsService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_ssl_certs_service_stub.universe_domain + end + + ## + # Create a new SqlSslCertsService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlSslCertsService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/sql/v1/cloud_sql_ssl_certs_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_ssl_certs_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Sql::V1::SqlSslCertsService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @sql_ssl_certs_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_ssl_certs_service_stub.endpoint + config.universe_domain = @sql_ssl_certs_service_stub.universe_domain + config.logger = @sql_ssl_certs_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_ssl_certs_service_stub.logger + end + + # Service calls + + ## + # Deletes the SSL certificate. For First Generation instances, the + # certificate remains valid until the instance is restarted. + # + # @overload delete(request, options = nil) + # Pass arguments to `delete` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete(instance: nil, project: nil, sha1_fingerprint: nil) + # Pass arguments to `delete` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param sha1_fingerprint [::String] + # Sha1 FingerPrint. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlSslCertsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest.new + # + # # Call the delete method. + # result = client.delete request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def delete request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + if request.sha1_fingerprint + header_params["sha1_fingerprint"] = request.sha1_fingerprint + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_ssl_certs_service_stub.call_rpc :delete, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload get(request, options = nil) + # Pass arguments to `get` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlSslCertsGetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlSslCertsGetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get(instance: nil, project: nil, sha1_fingerprint: nil) + # Pass arguments to `get` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param sha1_fingerprint [::String] + # Sha1 FingerPrint. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::SslCert] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::SslCert] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlSslCertsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlSslCertsGetRequest.new + # + # # Call the get method. + # result = client.get request + # + # # The returned object is of type Google::Cloud::Sql::V1::SslCert. + # p result + # + def get request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlSslCertsGetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + if request.sha1_fingerprint + header_params["sha1_fingerprint"] = request.sha1_fingerprint + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_ssl_certs_service_stub.call_rpc :get, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload insert(request, options = nil) + # Pass arguments to `insert` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload insert(instance: nil, project: nil, body: nil) + # Pass arguments to `insert` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::SslCertsInsertRequest, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::SslCertsInsertResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::SslCertsInsertResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlSslCertsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlSslCertsInsertRequest.new + # + # # Call the insert method. + # result = client.insert request + # + # # The returned object is of type Google::Cloud::Sql::V1::SslCertsInsertResponse. + # p result + # + def insert request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.insert.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.insert.timeout, + metadata: metadata, + retry_policy: @config.rpcs.insert.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_ssl_certs_service_stub.call_rpc :insert, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all of the current SSL certificates for the instance. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlSslCertsListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlSslCertsListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list(instance: nil, project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::SslCertsListResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::SslCertsListResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlSslCertsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlSslCertsListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::SslCertsListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlSslCertsListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_ssl_certs_service_stub.call_rpc :list, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlSslCertsService API. + # + # This class represents the configuration for SqlSslCertsService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlSslCertsService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # delete to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the SqlSslCertsService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `delete` + # @return [::Gapic::Config::Method] + # + attr_reader :delete + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `insert` + # @return [::Gapic::Config::Method] + # + attr_reader :insert + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + + # @private + def initialize parent_rpcs = nil + delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete + @delete = ::Gapic::Config::Method.new delete_config + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert + @insert = ::Gapic::Config::Method.new insert_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/credentials.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/credentials.rb new file mode 100644 index 000000000000..ab3efac8c05d --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/credentials.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Sql + module V1 + module SqlSslCertsService + # Credentials for the SqlSslCertsService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/sqlservice.admin" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/rest.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/rest.rb new file mode 100644 index 000000000000..c65bd86fefce --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/rest.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_ssl_certs_service/credentials" +require "google/cloud/sql/v1/sql_ssl_certs_service/rest/client" + +module Google + module Cloud + module Sql + module V1 + ## + # Service to manage SSL certs for Cloud SQL instances. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/sql/v1/sql_ssl_certs_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new + # + module SqlSslCertsService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/sql/v1/sql_ssl_certs_service/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/rest/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/rest/client.rb new file mode 100644 index 000000000000..dd3ac5c622a8 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/rest/client.rb @@ -0,0 +1,715 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_ssl_certs_pb" +require "google/cloud/sql/v1/sql_ssl_certs_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Sql + module V1 + module SqlSslCertsService + module Rest + ## + # REST client for the SqlSslCertsService service. + # + # Service to manage SSL certs for Cloud SQL instances. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_ssl_certs_service_stub + + ## + # Configure the SqlSslCertsService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlSslCertsService clients + # ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlSslCertsService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_ssl_certs_service_stub.universe_domain + end + + ## + # Create a new SqlSslCertsService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlSslCertsService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_ssl_certs_service_stub = ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @sql_ssl_certs_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_ssl_certs_service_stub.endpoint + config.universe_domain = @sql_ssl_certs_service_stub.universe_domain + config.logger = @sql_ssl_certs_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_ssl_certs_service_stub.logger + end + + # Service calls + + ## + # Deletes the SSL certificate. For First Generation instances, the + # certificate remains valid until the instance is restarted. + # + # @overload delete(request, options = nil) + # Pass arguments to `delete` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete(instance: nil, project: nil, sha1_fingerprint: nil) + # Pass arguments to `delete` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param sha1_fingerprint [::String] + # Sha1 FingerPrint. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest.new + # + # # Call the delete method. + # result = client.delete request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def delete request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_ssl_certs_service_stub.delete request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload get(request, options = nil) + # Pass arguments to `get` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlSslCertsGetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlSslCertsGetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get(instance: nil, project: nil, sha1_fingerprint: nil) + # Pass arguments to `get` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param sha1_fingerprint [::String] + # Sha1 FingerPrint. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SslCert] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SslCert] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlSslCertsGetRequest.new + # + # # Call the get method. + # result = client.get request + # + # # The returned object is of type Google::Cloud::Sql::V1::SslCert. + # p result + # + def get request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlSslCertsGetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_ssl_certs_service_stub.get request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload insert(request, options = nil) + # Pass arguments to `insert` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload insert(instance: nil, project: nil, body: nil) + # Pass arguments to `insert` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::SslCertsInsertRequest, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SslCertsInsertResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SslCertsInsertResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlSslCertsInsertRequest.new + # + # # Call the insert method. + # result = client.insert request + # + # # The returned object is of type Google::Cloud::Sql::V1::SslCertsInsertResponse. + # p result + # + def insert request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.insert.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.insert.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.insert.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_ssl_certs_service_stub.insert request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all of the current SSL certificates for the instance. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlSslCertsListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlSslCertsListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list(instance: nil, project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SslCertsListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SslCertsListResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlSslCertsListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::SslCertsListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlSslCertsListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_ssl_certs_service_stub.list request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlSslCertsService REST API. + # + # This class represents the configuration for SqlSslCertsService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # delete to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the SqlSslCertsService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `delete` + # @return [::Gapic::Config::Method] + # + attr_reader :delete + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `insert` + # @return [::Gapic::Config::Method] + # + attr_reader :insert + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + + # @private + def initialize parent_rpcs = nil + delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete + @delete = ::Gapic::Config::Method.new delete_config + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert + @insert = ::Gapic::Config::Method.new insert_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/rest/service_stub.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/rest/service_stub.rb new file mode 100644 index 000000000000..9f719e71100c --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_ssl_certs_service/rest/service_stub.rb @@ -0,0 +1,332 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/sql/v1/cloud_sql_ssl_certs_pb" + +module Google + module Cloud + module Sql + module V1 + module SqlSslCertsService + module Rest + ## + # REST service stub for the SqlSslCertsService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the delete REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def delete request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlSslCertsGetRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SslCert] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SslCert] + # A result object deserialized from the server's reply + def get request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::SslCert.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the insert REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SslCertsInsertResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SslCertsInsertResponse] + # A result object deserialized from the server's reply + def insert request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_insert_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "insert", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::SslCertsInsertResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlSslCertsListRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::SslCertsListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::SslCertsListResponse] + # A result object deserialized from the server's reply + def list request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::SslCertsListResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the delete REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false], + ["sha1_fingerprint", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlSslCertsGetRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false], + ["sha1_fingerprint", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the insert REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_insert_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/sslCerts", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlSslCertsListRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/sslCerts", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service.rb new file mode 100644 index 000000000000..7a82a96f0364 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_tiers_service/credentials" +require "google/cloud/sql/v1/sql_tiers_service/client" +require "google/cloud/sql/v1/sql_tiers_service/rest" + +module Google + module Cloud + module Sql + module V1 + ## + # Service for providing machine types (tiers) for Cloud SQL instances. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/sql/v1/sql_tiers_service" + # client = ::Google::Cloud::Sql::V1::SqlTiersService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/sql/v1/sql_tiers_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client.new + # + module SqlTiersService + end + end + end + end +end + +helper_path = ::File.join __dir__, "sql_tiers_service", "helpers.rb" +require "google/cloud/sql/v1/sql_tiers_service/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/client.rb new file mode 100644 index 000000000000..5c081cdba0c7 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/client.rb @@ -0,0 +1,494 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_tiers_pb" +require "google/cloud/location" + +module Google + module Cloud + module Sql + module V1 + module SqlTiersService + ## + # Client for the SqlTiersService service. + # + # Service for providing machine types (tiers) for Cloud SQL instances. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_tiers_service_stub + + ## + # Configure the SqlTiersService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlTiersService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlTiersService clients + # ::Google::Cloud::Sql::V1::SqlTiersService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlTiersService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlTiersService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_tiers_service_stub.universe_domain + end + + ## + # Create a new SqlTiersService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlTiersService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlTiersService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlTiersService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/sql/v1/cloud_sql_tiers_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_tiers_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Sql::V1::SqlTiersService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @sql_tiers_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_tiers_service_stub.endpoint + config.universe_domain = @sql_tiers_service_stub.universe_domain + config.logger = @sql_tiers_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_tiers_service_stub.logger + end + + # 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. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlTiersListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlTiersListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list(project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param project [::String] + # Project ID of the project for which to list tiers. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::TiersListResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::TiersListResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlTiersService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlTiersListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::TiersListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlTiersListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_tiers_service_stub.call_rpc :list, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlTiersService API. + # + # This class represents the configuration for SqlTiersService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlTiersService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlTiersService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlTiersService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Sql::V1::SqlTiersService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the SqlTiersService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + + # @private + def initialize parent_rpcs = nil + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/credentials.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/credentials.rb new file mode 100644 index 000000000000..a0a3a8fa8b78 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/credentials.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Sql + module V1 + module SqlTiersService + # Credentials for the SqlTiersService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/sqlservice.admin" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/rest.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/rest.rb new file mode 100644 index 000000000000..ddaf2df7d957 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/rest.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_tiers_service/credentials" +require "google/cloud/sql/v1/sql_tiers_service/rest/client" + +module Google + module Cloud + module Sql + module V1 + ## + # Service for providing machine types (tiers) for Cloud SQL instances. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/sql/v1/sql_tiers_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client.new + # + module SqlTiersService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/sql/v1/sql_tiers_service/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/rest/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/rest/client.rb new file mode 100644 index 000000000000..ce1e9b3e69eb --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/rest/client.rb @@ -0,0 +1,444 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_tiers_pb" +require "google/cloud/sql/v1/sql_tiers_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Sql + module V1 + module SqlTiersService + module Rest + ## + # REST client for the SqlTiersService service. + # + # Service for providing machine types (tiers) for Cloud SQL instances. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_tiers_service_stub + + ## + # Configure the SqlTiersService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlTiersService clients + # ::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlTiersService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_tiers_service_stub.universe_domain + end + + ## + # Create a new SqlTiersService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlTiersService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_tiers_service_stub = ::Google::Cloud::Sql::V1::SqlTiersService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @sql_tiers_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_tiers_service_stub.endpoint + config.universe_domain = @sql_tiers_service_stub.universe_domain + config.logger = @sql_tiers_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_tiers_service_stub.logger + end + + # 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. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlTiersListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlTiersListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list(project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param project [::String] + # Project ID of the project for which to list tiers. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::TiersListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::TiersListResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlTiersService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlTiersListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::TiersListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlTiersListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_tiers_service_stub.list request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlTiersService REST API. + # + # This class represents the configuration for SqlTiersService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the SqlTiersService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + + # @private + def initialize parent_rpcs = nil + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/rest/service_stub.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/rest/service_stub.rb new file mode 100644 index 000000000000..2186156aedd2 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_tiers_service/rest/service_stub.rb @@ -0,0 +1,142 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/sql/v1/cloud_sql_tiers_pb" + +module Google + module Cloud + module Sql + module V1 + module SqlTiersService + module Rest + ## + # REST service stub for the SqlTiersService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlTiersListRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::TiersListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::TiersListResponse] + # A result object deserialized from the server's reply + def list request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::TiersListResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlTiersListRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/tiers", + matches: [ + ["project", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service.rb new file mode 100644 index 000000000000..bc0e3546942a --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_users_service/credentials" +require "google/cloud/sql/v1/sql_users_service/client" +require "google/cloud/sql/v1/sql_users_service/rest" + +module Google + module Cloud + module Sql + module V1 + ## + # Cloud SQL users service. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/sql/v1/sql_users_service" + # client = ::Google::Cloud::Sql::V1::SqlUsersService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/sql/v1/sql_users_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new + # + module SqlUsersService + end + end + end + end +end + +helper_path = ::File.join __dir__, "sql_users_service", "helpers.rb" +require "google/cloud/sql/v1/sql_users_service/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/client.rb new file mode 100644 index 000000000000..cd64f76bd48e --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/client.rb @@ -0,0 +1,909 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_users_pb" +require "google/cloud/location" + +module Google + module Cloud + module Sql + module V1 + module SqlUsersService + ## + # Client for the SqlUsersService service. + # + # Cloud SQL users service. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_users_service_stub + + ## + # Configure the SqlUsersService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlUsersService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlUsersService clients + # ::Google::Cloud::Sql::V1::SqlUsersService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlUsersService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlUsersService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_users_service_stub.universe_domain + end + + ## + # Create a new SqlUsersService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlUsersService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlUsersService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlUsersService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/sql/v1/cloud_sql_users_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_users_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Sql::V1::SqlUsersService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @sql_users_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_users_service_stub.endpoint + config.universe_domain = @sql_users_service_stub.universe_domain + config.logger = @sql_users_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_users_service_stub.logger + end + + # Service calls + + ## + # Deletes a user from a Cloud SQL instance. + # + # @overload delete(request, options = nil) + # Pass arguments to `delete` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlUsersDeleteRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlUsersDeleteRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete(host: nil, instance: nil, name: nil, project: nil) + # Pass arguments to `delete` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param host [::String] + # Host of the user in the instance. + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param name [::String] + # Name of the user in the instance. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlUsersService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlUsersDeleteRequest.new + # + # # Call the delete method. + # result = client.delete request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def delete request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlUsersDeleteRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_users_service_stub.call_rpc :delete, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Retrieves a resource containing information about a user. + # + # @overload get(request, options = nil) + # Pass arguments to `get` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlUsersGetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlUsersGetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get(instance: nil, name: nil, project: nil, host: nil) + # Pass arguments to `get` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param name [::String] + # User of the instance. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param host [::String] + # Host of a user of the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::User] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::User] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlUsersService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlUsersGetRequest.new + # + # # Call the get method. + # result = client.get request + # + # # The returned object is of type Google::Cloud::Sql::V1::User. + # p result + # + def get request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlUsersGetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_users_service_stub.call_rpc :get, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a new user in a Cloud SQL instance. + # + # @overload insert(request, options = nil) + # Pass arguments to `insert` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlUsersInsertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlUsersInsertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload insert(instance: nil, project: nil, body: nil) + # Pass arguments to `insert` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::User, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlUsersService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlUsersInsertRequest.new + # + # # Call the insert method. + # result = client.insert request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def insert request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlUsersInsertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.insert.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.insert.timeout, + metadata: metadata, + retry_policy: @config.rpcs.insert.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_users_service_stub.call_rpc :insert, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists users in the specified Cloud SQL instance. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlUsersListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlUsersListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list(instance: nil, project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::UsersListResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::UsersListResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlUsersService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlUsersListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::UsersListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlUsersListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_users_service_stub.call_rpc :list, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates an existing user in a Cloud SQL instance. + # + # @overload update(request, options = nil) + # Pass arguments to `update` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlUsersUpdateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlUsersUpdateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update(host: nil, instance: nil, name: nil, project: nil, database_roles: nil, revoke_existing_roles: nil, body: nil) + # Pass arguments to `update` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param host [::String] + # Optional. Host of the user in the instance. + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param name [::String] + # Name of the user in the instance. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param database_roles [::Array<::String>] + # Optional. List of database roles to grant to the user. body.database_roles + # will be ignored for update request. + # @param revoke_existing_roles [::Boolean] + # 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 body [::Google::Cloud::Sql::V1::User, ::Hash] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlUsersService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlUsersUpdateRequest.new + # + # # Call the update method. + # result = client.update request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def update request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlUsersUpdateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.project + header_params["project"] = request.project + end + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_users_service_stub.call_rpc :update, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlUsersService API. + # + # This class represents the configuration for SqlUsersService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlUsersService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # delete to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlUsersService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlUsersService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Sql::V1::SqlUsersService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the SqlUsersService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `delete` + # @return [::Gapic::Config::Method] + # + attr_reader :delete + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `insert` + # @return [::Gapic::Config::Method] + # + attr_reader :insert + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + ## + # RPC-specific configuration for `update` + # @return [::Gapic::Config::Method] + # + attr_reader :update + + # @private + def initialize parent_rpcs = nil + delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete + @delete = ::Gapic::Config::Method.new delete_config + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert + @insert = ::Gapic::Config::Method.new insert_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + update_config = parent_rpcs.update if parent_rpcs.respond_to? :update + @update = ::Gapic::Config::Method.new update_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/credentials.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/credentials.rb new file mode 100644 index 000000000000..975a3a379f36 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/credentials.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Sql + module V1 + module SqlUsersService + # Credentials for the SqlUsersService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/sqlservice.admin" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/rest.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/rest.rb new file mode 100644 index 000000000000..27f0dbc1492d --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/rest.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/sql/v1/version" + +require "google/cloud/sql/v1/sql_users_service/credentials" +require "google/cloud/sql/v1/sql_users_service/rest/client" + +module Google + module Cloud + module Sql + module V1 + ## + # Cloud SQL users service. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/sql/v1/sql_users_service/rest" + # client = ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new + # + module SqlUsersService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/sql/v1/sql_users_service/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/rest/client.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/rest/client.rb new file mode 100644 index 000000000000..6243c54a243d --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/rest/client.rb @@ -0,0 +1,813 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/sql/v1/cloud_sql_users_pb" +require "google/cloud/sql/v1/sql_users_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Sql + module V1 + module SqlUsersService + module Rest + ## + # REST client for the SqlUsersService service. + # + # Cloud SQL users service. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "sqladmin.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :sql_users_service_stub + + ## + # Configure the SqlUsersService Client class. + # + # See {::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SqlUsersService clients + # ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Sql", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SqlUsersService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @sql_users_service_stub.universe_domain + end + + ## + # Create a new SqlUsersService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SqlUsersService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @sql_users_service_stub = ::Google::Cloud::Sql::V1::SqlUsersService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @sql_users_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @sql_users_service_stub.endpoint + config.universe_domain = @sql_users_service_stub.universe_domain + config.logger = @sql_users_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @sql_users_service_stub.logger + end + + # Service calls + + ## + # Deletes a user from a Cloud SQL instance. + # + # @overload delete(request, options = nil) + # Pass arguments to `delete` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlUsersDeleteRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlUsersDeleteRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete(host: nil, instance: nil, name: nil, project: nil) + # Pass arguments to `delete` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param host [::String] + # Host of the user in the instance. + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param name [::String] + # Name of the user in the instance. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlUsersDeleteRequest.new + # + # # Call the delete method. + # result = client.delete request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def delete request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlUsersDeleteRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_users_service_stub.delete request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Retrieves a resource containing information about a user. + # + # @overload get(request, options = nil) + # Pass arguments to `get` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlUsersGetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlUsersGetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get(instance: nil, name: nil, project: nil, host: nil) + # Pass arguments to `get` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param name [::String] + # User of the instance. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param host [::String] + # Host of a user of the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::User] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::User] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlUsersGetRequest.new + # + # # Call the get method. + # result = client.get request + # + # # The returned object is of type Google::Cloud::Sql::V1::User. + # p result + # + def get request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlUsersGetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_users_service_stub.get request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a new user in a Cloud SQL instance. + # + # @overload insert(request, options = nil) + # Pass arguments to `insert` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlUsersInsertRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlUsersInsertRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload insert(instance: nil, project: nil, body: nil) + # Pass arguments to `insert` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param body [::Google::Cloud::Sql::V1::User, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlUsersInsertRequest.new + # + # # Call the insert method. + # result = client.insert request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def insert request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlUsersInsertRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.insert.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.insert.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.insert.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_users_service_stub.insert request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists users in the specified Cloud SQL instance. + # + # @overload list(request, options = nil) + # Pass arguments to `list` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlUsersListRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlUsersListRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list(instance: nil, project: nil) + # Pass arguments to `list` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param project [::String] + # Project ID of the project that contains the instance. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::UsersListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::UsersListResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlUsersListRequest.new + # + # # Call the list method. + # result = client.list request + # + # # The returned object is of type Google::Cloud::Sql::V1::UsersListResponse. + # p result + # + def list request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlUsersListRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_users_service_stub.list request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates an existing user in a Cloud SQL instance. + # + # @overload update(request, options = nil) + # Pass arguments to `update` via a request object, either of type + # {::Google::Cloud::Sql::V1::SqlUsersUpdateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Sql::V1::SqlUsersUpdateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update(host: nil, instance: nil, name: nil, project: nil, database_roles: nil, revoke_existing_roles: nil, body: nil) + # Pass arguments to `update` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param host [::String] + # Optional. Host of the user in the instance. + # @param instance [::String] + # Database instance ID. This does not include the project ID. + # @param name [::String] + # Name of the user in the instance. + # @param project [::String] + # Project ID of the project that contains the instance. + # @param database_roles [::Array<::String>] + # Optional. List of database roles to grant to the user. body.database_roles + # will be ignored for update request. + # @param revoke_existing_roles [::Boolean] + # 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 body [::Google::Cloud::Sql::V1::User, ::Hash] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/sql/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Sql::V1::SqlUsersUpdateRequest.new + # + # # Call the update method. + # result = client.update request + # + # # The returned object is of type Google::Cloud::Sql::V1::Operation. + # p result + # + def update request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Sql::V1::SqlUsersUpdateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Sql::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @sql_users_service_stub.update request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SqlUsersService REST API. + # + # This class represents the configuration for SqlUsersService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # delete to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.delete.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "sqladmin.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the SqlUsersService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `delete` + # @return [::Gapic::Config::Method] + # + attr_reader :delete + ## + # RPC-specific configuration for `get` + # @return [::Gapic::Config::Method] + # + attr_reader :get + ## + # RPC-specific configuration for `insert` + # @return [::Gapic::Config::Method] + # + attr_reader :insert + ## + # RPC-specific configuration for `list` + # @return [::Gapic::Config::Method] + # + attr_reader :list + ## + # RPC-specific configuration for `update` + # @return [::Gapic::Config::Method] + # + attr_reader :update + + # @private + def initialize parent_rpcs = nil + delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete + @delete = ::Gapic::Config::Method.new delete_config + get_config = parent_rpcs.get if parent_rpcs.respond_to? :get + @get = ::Gapic::Config::Method.new get_config + insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert + @insert = ::Gapic::Config::Method.new insert_config + list_config = parent_rpcs.list if parent_rpcs.respond_to? :list + @list = ::Gapic::Config::Method.new list_config + update_config = parent_rpcs.update if parent_rpcs.respond_to? :update + @update = ::Gapic::Config::Method.new update_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/rest/service_stub.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/rest/service_stub.rb new file mode 100644 index 000000000000..54a129caba31 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/sql_users_service/rest/service_stub.rb @@ -0,0 +1,394 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/sql/v1/cloud_sql_users_pb" + +module Google + module Cloud + module Sql + module V1 + module SqlUsersService + module Rest + ## + # REST service stub for the SqlUsersService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the delete REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlUsersDeleteRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def delete request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlUsersGetRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::User] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::User] + # A result object deserialized from the server's reply + def get request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::User.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the insert REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlUsersInsertRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def insert request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_insert_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "insert", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlUsersListRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::UsersListResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::UsersListResponse] + # A result object deserialized from the server's reply + def list request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::UsersListResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlUsersUpdateRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Sql::V1::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Sql::V1::Operation] + # A result object deserialized from the server's reply + def update request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Sql::V1::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the delete REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlUsersDeleteRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/projects/{project}/instances/{instance}/users", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlUsersGetRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/users/{name}", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false], + ["name", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the insert REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlUsersInsertRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_insert_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/projects/{project}/instances/{instance}/users", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlUsersListRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/projects/{project}/instances/{instance}/users", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update REST call + # + # @param request_pb [::Google::Cloud::Sql::V1::SqlUsersUpdateRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :put, + uri_template: "/v1/projects/{project}/instances/{instance}/users", + body: "body", + matches: [ + ["project", %r{^[^/]+/?$}, false], + ["instance", %r{^[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/lib/google/cloud/sql/v1/version.rb b/google-cloud-sql-v1/lib/google/cloud/sql/v1/version.rb new file mode 100644 index 000000000000..bd2ecaee2bd1 --- /dev/null +++ b/google-cloud-sql-v1/lib/google/cloud/sql/v1/version.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + VERSION = "0.0.1" + end + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/README.md b/google-cloud-sql-v1/proto_docs/README.md new file mode 100644 index 000000000000..a24febec335f --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/README.md @@ -0,0 +1,4 @@ +# Cloud SQL Admin V1 Protocol Buffer Documentation + +These files are for the YARD documentation of the generated protobuf files. +They are not intended to be required or loaded at runtime. diff --git a/google-cloud-sql-v1/proto_docs/google/api/client.rb b/google-cloud-sql-v1/proto_docs/google/api/client.rb new file mode 100644 index 000000000000..3ab0b096d445 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/api/client.rb @@ -0,0 +1,593 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # Required information for every language. + # @!attribute [rw] reference_docs_uri + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::String] + # Link to automatically generated reference documentation. Example: + # https://cloud.google.com/nodejs/docs/reference/asset/latest + # @!attribute [rw] destinations + # @return [::Array<::Google::Api::ClientLibraryDestination>] + # The destination where API teams want this client library to be published. + # @!attribute [rw] selective_gapic_generation + # @return [::Google::Api::SelectiveGapicGeneration] + # Configuration for which RPCs should be generated in the GAPIC client. + # + # Note: This field should not be used in most cases. + class CommonLanguageSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Details about how and where to publish client libraries. + # @!attribute [rw] version + # @return [::String] + # Version of the API to apply these settings to. This is the full protobuf + # package for the API, ending in the version element. + # Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". + # @!attribute [rw] launch_stage + # @return [::Google::Api::LaunchStage] + # Launch stage of this version of the API. + # @!attribute [rw] rest_numeric_enums + # @return [::Boolean] + # When using transport=rest, the client request will encode enums as + # numbers rather than strings. + # @!attribute [rw] java_settings + # @return [::Google::Api::JavaSettings] + # Settings for legacy Java features, supported in the Service YAML. + # @!attribute [rw] cpp_settings + # @return [::Google::Api::CppSettings] + # Settings for C++ client libraries. + # @!attribute [rw] php_settings + # @return [::Google::Api::PhpSettings] + # Settings for PHP client libraries. + # @!attribute [rw] python_settings + # @return [::Google::Api::PythonSettings] + # Settings for Python client libraries. + # @!attribute [rw] node_settings + # @return [::Google::Api::NodeSettings] + # Settings for Node client libraries. + # @!attribute [rw] dotnet_settings + # @return [::Google::Api::DotnetSettings] + # Settings for .NET client libraries. + # @!attribute [rw] ruby_settings + # @return [::Google::Api::RubySettings] + # Settings for Ruby client libraries. + # @!attribute [rw] go_settings + # @return [::Google::Api::GoSettings] + # Settings for Go client libraries. + class ClientLibrarySettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This message configures the settings for publishing [Google Cloud Client + # libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) + # generated from the service config. + # @!attribute [rw] method_settings + # @return [::Array<::Google::Api::MethodSettings>] + # A list of API method settings, e.g. the behavior for methods that use the + # long-running operation pattern. + # @!attribute [rw] new_issue_uri + # @return [::String] + # Link to a *public* URI where users can report issues. Example: + # https://issuetracker.google.com/issues/new?component=190865&template=1161103 + # @!attribute [rw] documentation_uri + # @return [::String] + # Link to product home page. Example: + # https://cloud.google.com/asset-inventory/docs/overview + # @!attribute [rw] api_short_name + # @return [::String] + # Used as a tracking tag when collecting data about the APIs developer + # relations artifacts like docs, packages delivered to package managers, + # etc. Example: "speech". + # @!attribute [rw] github_label + # @return [::String] + # GitHub label to apply to issues and pull requests opened for this API. + # @!attribute [rw] codeowner_github_teams + # @return [::Array<::String>] + # GitHub teams to be added to CODEOWNERS in the directory in GitHub + # containing source code for the client libraries for this API. + # @!attribute [rw] doc_tag_prefix + # @return [::String] + # A prefix used in sample code when demarking regions to be included in + # documentation. + # @!attribute [rw] organization + # @return [::Google::Api::ClientLibraryOrganization] + # For whom the client library is being published. + # @!attribute [rw] library_settings + # @return [::Array<::Google::Api::ClientLibrarySettings>] + # Client library settings. If the same version string appears multiple + # times in this list, then the last one wins. Settings from earlier + # settings with the same version string are discarded. + # @!attribute [rw] proto_reference_documentation_uri + # @return [::String] + # Optional link to proto reference documentation. Example: + # https://cloud.google.com/pubsub/lite/docs/reference/rpc + # @!attribute [rw] rest_reference_documentation_uri + # @return [::String] + # Optional link to REST reference documentation. Example: + # https://cloud.google.com/pubsub/lite/docs/reference/rest + class Publishing + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Java client libraries. + # @!attribute [rw] library_package + # @return [::String] + # The package name to use in Java. Clobbers the java_package option + # set in the protobuf. This should be used **only** by APIs + # who have already set the language_settings.java.package_name" field + # in gapic.yaml. API teams should use the protobuf java_package option + # where possible. + # + # Example of a YAML configuration:: + # + # publishing: + # library_settings: + # java_settings: + # library_package: com.google.cloud.pubsub.v1 + # @!attribute [rw] service_class_names + # @return [::Google::Protobuf::Map{::String => ::String}] + # Configure the Java class name to use instead of the service's for its + # corresponding generated GAPIC client. Keys are fully-qualified + # service names as they appear in the protobuf (including the full + # the language_settings.java.interface_names" field in gapic.yaml. API + # teams should otherwise use the service name as it appears in the + # protobuf. + # + # Example of a YAML configuration:: + # + # publishing: + # java_settings: + # service_class_names: + # - google.pubsub.v1.Publisher: TopicAdmin + # - google.pubsub.v1.Subscriber: SubscriptionAdmin + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class JavaSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class ServiceClassNamesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for C++ client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class CppSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Php client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] library_package + # @return [::String] + # The package name to use in Php. Clobbers the php_namespace option + # set in the protobuf. This should be used **only** by APIs + # who have already set the language_settings.php.package_name" field + # in gapic.yaml. API teams should use the protobuf php_namespace option + # where possible. + # + # Example of a YAML configuration:: + # + # publishing: + # library_settings: + # php_settings: + # library_package: Google\Cloud\PubSub\V1 + class PhpSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Python client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] experimental_features + # @return [::Google::Api::PythonSettings::ExperimentalFeatures] + # Experimental features to be included during client library generation. + class PythonSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Experimental features to be included during client library generation. + # These fields will be deprecated once the feature graduates and is enabled + # by default. + # @!attribute [rw] rest_async_io_enabled + # @return [::Boolean] + # Enables generation of asynchronous REST clients if `rest` transport is + # enabled. By default, asynchronous REST clients will not be generated. + # This feature will be enabled by default 1 month after launching the + # feature in preview packages. + # @!attribute [rw] protobuf_pythonic_types_enabled + # @return [::Boolean] + # Enables generation of protobuf code using new types that are more + # Pythonic which are included in `protobuf>=5.29.x`. This feature will be + # enabled by default 1 month after launching the feature in preview + # packages. + # @!attribute [rw] unversioned_package_disabled + # @return [::Boolean] + # Disables generation of an unversioned Python package for this client + # library. This means that the module names will need to be versioned in + # import statements. For example `import google.cloud.library_v2` instead + # of `import google.cloud.library`. + class ExperimentalFeatures + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for Node client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class NodeSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Dotnet client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] renamed_services + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map from original service names to renamed versions. + # This is used when the default generated types + # would cause a naming conflict. (Neither name is + # fully-qualified.) + # Example: Subscriber to SubscriberServiceApi. + # @!attribute [rw] renamed_resources + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map from full resource types to the effective short name + # for the resource. This is used when otherwise resource + # named from different services would cause naming collisions. + # Example entry: + # "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" + # @!attribute [rw] ignored_resources + # @return [::Array<::String>] + # List of full resource types to ignore during generation. + # This is typically used for API-specific Location resources, + # which should be handled by the generator as if they were actually + # the common Location resources. + # Example entry: "documentai.googleapis.com/Location" + # @!attribute [rw] forced_namespace_aliases + # @return [::Array<::String>] + # Namespaces which must be aliased in snippets due to + # a known (but non-generator-predictable) naming collision + # @!attribute [rw] handwritten_signatures + # @return [::Array<::String>] + # Method signatures (in the form "service.method(signature)") + # which are provided separately, so shouldn't be generated. + # Snippets *calling* these methods are still generated, however. + class DotnetSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedServicesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedResourcesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for Ruby client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class RubySettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Go client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] renamed_services + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map of service names to renamed services. Keys are the package relative + # service names and values are the name to be used for the service client + # and call options. + # + # Example: + # + # publishing: + # go_settings: + # renamed_services: + # Publisher: TopicAdmin + class GoSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedServicesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Describes the generator configuration for a method. + # @!attribute [rw] selector + # @return [::String] + # The fully qualified name of the method, for which the options below apply. + # This is used to find the method to apply the options. + # + # Example: + # + # publishing: + # method_settings: + # - selector: google.storage.control.v2.StorageControl.CreateFolder + # # method settings for CreateFolder... + # @!attribute [rw] long_running + # @return [::Google::Api::MethodSettings::LongRunning] + # Describes settings to use for long-running operations when generating + # API methods for RPCs. Complements RPCs that use the annotations in + # google/longrunning/operations.proto. + # + # Example of a YAML configuration:: + # + # publishing: + # method_settings: + # - selector: google.cloud.speech.v2.Speech.BatchRecognize + # long_running: + # initial_poll_delay: 60s # 1 minute + # poll_delay_multiplier: 1.5 + # max_poll_delay: 360s # 6 minutes + # total_poll_timeout: 54000s # 90 minutes + # @!attribute [rw] auto_populated_fields + # @return [::Array<::String>] + # List of top-level fields of the request message, that should be + # automatically populated by the client libraries based on their + # (google.api.field_info).format. Currently supported format: UUID4. + # + # Example of a YAML configuration: + # + # publishing: + # method_settings: + # - selector: google.example.v1.ExampleService.CreateExample + # auto_populated_fields: + # - request_id + # @!attribute [rw] batching + # @return [::Google::Api::BatchingConfigProto] + # Batching configuration for an API method in client libraries. + # + # Example of a YAML configuration: + # + # publishing: + # method_settings: + # - selector: google.example.v1.ExampleService.BatchCreateExample + # batching: + # element_count_threshold: 1000 + # request_byte_threshold: 100000000 + # delay_threshold_millis: 10 + class MethodSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Describes settings to use when generating API methods that use the + # long-running operation pattern. + # All default values below are from those used in the client library + # generators (e.g. + # [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). + # @!attribute [rw] initial_poll_delay + # @return [::Google::Protobuf::Duration] + # Initial delay after which the first poll request will be made. + # Default value: 5 seconds. + # @!attribute [rw] poll_delay_multiplier + # @return [::Float] + # Multiplier to gradually increase delay between subsequent polls until it + # reaches max_poll_delay. + # Default value: 1.5. + # @!attribute [rw] max_poll_delay + # @return [::Google::Protobuf::Duration] + # Maximum time between two subsequent poll requests. + # Default value: 45 seconds. + # @!attribute [rw] total_poll_timeout + # @return [::Google::Protobuf::Duration] + # Total polling timeout. + # Default value: 5 minutes. + class LongRunning + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # This message is used to configure the generation of a subset of the RPCs in + # a service for client libraries. + # + # Note: This feature should not be used in most cases. + # @!attribute [rw] methods + # @return [::Array<::String>] + # An allowlist of the fully qualified names of RPCs that should be included + # on public client surfaces. + # @!attribute [rw] generate_omitted_as_internal + # @return [::Boolean] + # Setting this to true indicates to the client generators that methods + # that would be excluded from the generation should instead be generated + # in a way that indicates these methods should not be consumed by + # end users. How this is expressed is up to individual language + # implementations to decide. Some examples may be: added annotations, + # obfuscated identifiers, or other language idiomatic patterns. + class SelectiveGapicGeneration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `BatchingConfigProto` defines the batching configuration for an API method. + # @!attribute [rw] thresholds + # @return [::Google::Api::BatchingSettingsProto] + # The thresholds which trigger a batched request to be sent. + # @!attribute [rw] batch_descriptor + # @return [::Google::Api::BatchingDescriptorProto] + # The request and response fields used in batching. + class BatchingConfigProto + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `BatchingSettingsProto` specifies a set of batching thresholds, each of + # which acts as a trigger to send a batch of messages as a request. At least + # one threshold must be positive nonzero. + # @!attribute [rw] element_count_threshold + # @return [::Integer] + # The number of elements of a field collected into a batch which, if + # exceeded, causes the batch to be sent. + # @!attribute [rw] request_byte_threshold + # @return [::Integer] + # The aggregated size of the batched field which, if exceeded, causes the + # batch to be sent. This size is computed by aggregating the sizes of the + # request field to be batched, not of the entire request message. + # @!attribute [rw] delay_threshold + # @return [::Google::Protobuf::Duration] + # The duration after which a batch should be sent, starting from the addition + # of the first message to that batch. + # @!attribute [rw] element_count_limit + # @return [::Integer] + # The maximum number of elements collected in a batch that could be accepted + # by server. + # @!attribute [rw] request_byte_limit + # @return [::Integer] + # The maximum size of the request that could be accepted by server. + # @!attribute [rw] flow_control_element_limit + # @return [::Integer] + # The maximum number of elements allowed by flow control. + # @!attribute [rw] flow_control_byte_limit + # @return [::Integer] + # The maximum size of data allowed by flow control. + # @!attribute [rw] flow_control_limit_exceeded_behavior + # @return [::Google::Api::FlowControlLimitExceededBehaviorProto] + # The behavior to take when the flow control limit is exceeded. + class BatchingSettingsProto + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `BatchingDescriptorProto` specifies the fields of the request message to be + # used for batching, and, optionally, the fields of the response message to be + # used for demultiplexing. + # @!attribute [rw] batched_field + # @return [::String] + # The repeated field in the request message to be aggregated by batching. + # @!attribute [rw] discriminator_fields + # @return [::Array<::String>] + # A list of the fields in the request message. Two requests will be batched + # together only if the values of every field specified in + # `request_discriminator_fields` is equal between the two requests. + # @!attribute [rw] subresponse_field + # @return [::String] + # Optional. When present, indicates the field in the response message to be + # used to demultiplex the response into multiple response messages, in + # correspondence with the multiple request messages originally batched + # together. + class BatchingDescriptorProto + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The organization for which the client libraries are being published. + # Affects the url where generated docs are published, etc. + module ClientLibraryOrganization + # Not useful. + CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0 + + # Google Cloud Platform Org. + CLOUD = 1 + + # Ads (Advertising) Org. + ADS = 2 + + # Photos Org. + PHOTOS = 3 + + # Street View Org. + STREET_VIEW = 4 + + # Shopping Org. + SHOPPING = 5 + + # Geo Org. + GEO = 6 + + # Generative AI - https://developers.generativeai.google + GENERATIVE_AI = 7 + end + + # To where should client libraries be published? + module ClientLibraryDestination + # Client libraries will neither be generated nor published to package + # managers. + CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0 + + # Generate the client library in a repo under github.com/googleapis, + # but don't publish it to package managers. + GITHUB = 10 + + # Publish the library to package managers like nuget.org and npmjs.com. + PACKAGE_MANAGER = 20 + end + + # The behavior to take when the flow control limit is exceeded. + module FlowControlLimitExceededBehaviorProto + # Default behavior, system-defined. + UNSET_BEHAVIOR = 0 + + # Stop operation, raise error. + THROW_EXCEPTION = 1 + + # Pause operation until limit clears. + BLOCK = 2 + + # Continue operation, disregard limit. + IGNORE = 3 + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/api/field_behavior.rb b/google-cloud-sql-v1/proto_docs/google/api/field_behavior.rb new file mode 100644 index 000000000000..582be187d115 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/api/field_behavior.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # An indicator of the behavior of a given field (for example, that a field + # is required in requests, or given as output but ignored as input). + # This **does not** change the behavior in protocol buffers itself; it only + # denotes the behavior and may affect how API tooling handles the field. + # + # Note: This enum **may** receive new values in the future. + module FieldBehavior + # Conventional default for enums. Do not use this. + FIELD_BEHAVIOR_UNSPECIFIED = 0 + + # Specifically denotes a field as optional. + # While all fields in protocol buffers are optional, this may be specified + # for emphasis if appropriate. + OPTIONAL = 1 + + # Denotes a field as required. + # This indicates that the field **must** be provided as part of the request, + # and failure to do so will cause an error (usually `INVALID_ARGUMENT`). + REQUIRED = 2 + + # Denotes a field as output only. + # This indicates that the field is provided in responses, but including the + # field in a request does nothing (the server *must* ignore it and + # *must not* throw an error as a result of the field's presence). + OUTPUT_ONLY = 3 + + # Denotes a field as input only. + # This indicates that the field is provided in requests, and the + # corresponding field is not included in output. + INPUT_ONLY = 4 + + # Denotes a field as immutable. + # This indicates that the field may be set once in a request to create a + # resource, but may not be changed thereafter. + IMMUTABLE = 5 + + # Denotes that a (repeated) field is an unordered list. + # This indicates that the service may provide the elements of the list + # in any arbitrary order, rather than the order the user originally + # provided. Additionally, the list's order may or may not be stable. + UNORDERED_LIST = 6 + + # Denotes that this field returns a non-empty default value if not set. + # This indicates that if the user provides the empty value in a request, + # a non-empty value will be returned. The user will not be aware of what + # non-empty value to expect. + NON_EMPTY_DEFAULT = 7 + + # Denotes that the field in a resource (a message annotated with + # google.api.resource) is used in the resource name to uniquely identify the + # resource. For AIP-compliant APIs, this should only be applied to the + # `name` field on the resource. + # + # This behavior should not be applied to references to other resources within + # the message. + # + # The identifier field of resources often have different field behavior + # depending on the request it is embedded in (e.g. for Create methods name + # is optional and unused, while for Update methods it is required). Instead + # of method-specific annotations, only `IDENTIFIER` is required. + IDENTIFIER = 8 + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/api/field_info.rb b/google-cloud-sql-v1/proto_docs/google/api/field_info.rb new file mode 100644 index 000000000000..0f5acf0a5538 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/api/field_info.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # Rich semantic information of an API field beyond basic typing. + # @!attribute [rw] format + # @return [::Google::Api::FieldInfo::Format] + # The standard format of a field value. This does not explicitly configure + # any API consumer, just documents the API's format for the field it is + # applied to. + # @!attribute [rw] referenced_types + # @return [::Array<::Google::Api::TypeReference>] + # The type(s) that the annotated, generic field may represent. + # + # Currently, this must only be used on fields of type `google.protobuf.Any`. + # Supporting other generic types may be considered in the future. + class FieldInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The standard format of a field value. The supported formats are all backed + # by either an RFC defined by the IETF or a Google-defined AIP. + module Format + # Default, unspecified value. + FORMAT_UNSPECIFIED = 0 + + # Universally Unique Identifier, version 4, value as defined by + # https://datatracker.ietf.org/doc/html/rfc4122. The value may be + # normalized to entirely lowercase letters. For example, the value + # `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to + # `f47ac10b-58cc-0372-8567-0e02b2c3d479`. + UUID4 = 1 + + # Internet Protocol v4 value as defined by [RFC + # 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be + # condensed, with leading zeros in each octet stripped. For example, + # `001.022.233.040` would be condensed to `1.22.233.40`. + IPV4 = 2 + + # Internet Protocol v6 value as defined by [RFC + # 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be + # normalized to entirely lowercase letters with zeros compressed, following + # [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example, + # the value `2001:0DB8:0::0` would be normalized to `2001:db8::`. + IPV6 = 3 + + # An IP address in either v4 or v6 format as described by the individual + # values defined herein. See the comments on the IPV4 and IPV6 types for + # allowed normalizations of each. + IPV4_OR_IPV6 = 4 + end + end + + # A reference to a message type, for use in {::Google::Api::FieldInfo FieldInfo}. + # @!attribute [rw] type_name + # @return [::String] + # The name of the type that the annotated, generic field may represent. + # If the type is in the same protobuf package, the value can be the simple + # message name e.g., `"MyMessage"`. Otherwise, the value must be the + # fully-qualified message name e.g., `"google.library.v1.Book"`. + # + # If the type(s) are unknown to the service (e.g. the field accepts generic + # user input), use the wildcard `"*"` to denote this behavior. + # + # See [AIP-202](https://google.aip.dev/202#type-references) for more details. + class TypeReference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/api/launch_stage.rb b/google-cloud-sql-v1/proto_docs/google/api/launch_stage.rb new file mode 100644 index 000000000000..9392a413fb1b --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/api/launch_stage.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # The launch stage as defined by [Google Cloud Platform + # Launch Stages](https://cloud.google.com/terms/launch-stages). + module LaunchStage + # Do not use this default value. + LAUNCH_STAGE_UNSPECIFIED = 0 + + # The feature is not yet implemented. Users can not use it. + UNIMPLEMENTED = 6 + + # Prelaunch features are hidden from users and are only visible internally. + PRELAUNCH = 7 + + # Early Access features are limited to a closed group of testers. To use + # these features, you must sign up in advance and sign a Trusted Tester + # agreement (which includes confidentiality provisions). These features may + # be unstable, changed in backward-incompatible ways, and are not + # guaranteed to be released. + EARLY_ACCESS = 1 + + # Alpha is a limited availability test for releases before they are cleared + # for widespread use. By Alpha, all significant design issues are resolved + # and we are in the process of verifying functionality. Alpha customers + # need to apply for access, agree to applicable terms, and have their + # projects allowlisted. Alpha releases don't have to be feature complete, + # no SLAs are provided, and there are no technical support obligations, but + # they will be far enough along that customers can actually use them in + # test environments or for limited-use tests -- just like they would in + # normal production cases. + ALPHA = 2 + + # Beta is the point at which we are ready to open a release for any + # customer to use. There are no SLA or technical support obligations in a + # Beta release. Products will be complete from a feature perspective, but + # may have some open outstanding issues. Beta releases are suitable for + # limited production use cases. + BETA = 3 + + # GA features are open to all developers and are considered stable and + # fully qualified for production use. + GA = 4 + + # Deprecated features are scheduled to be shut down and removed. For more + # information, see the "Deprecation Policy" section of our [Terms of + # Service](https://cloud.google.com/terms/) + # and the [Google Cloud Platform Subject to the Deprecation + # Policy](https://cloud.google.com/terms/deprecation) documentation. + DEPRECATED = 5 + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/api/resource.rb b/google-cloud-sql-v1/proto_docs/google/api/resource.rb new file mode 100644 index 000000000000..25dec4847ac1 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/api/resource.rb @@ -0,0 +1,227 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # A simple descriptor of a resource type. + # + # ResourceDescriptor annotates a resource message (either by means of a + # protobuf annotation or use in the service config), and associates the + # resource's schema, the resource type, and the pattern of the resource name. + # + # Example: + # + # message Topic { + # // Indicates this message defines a resource schema. + # // Declares the resource type in the format of {service}/{kind}. + # // For Kubernetes resources, the format is {api group}/{kind}. + # option (google.api.resource) = { + # type: "pubsub.googleapis.com/Topic" + # pattern: "projects/{project}/topics/{topic}" + # }; + # } + # + # The ResourceDescriptor Yaml config will look like: + # + # resources: + # - type: "pubsub.googleapis.com/Topic" + # pattern: "projects/{project}/topics/{topic}" + # + # Sometimes, resources have multiple patterns, typically because they can + # live under multiple parents. + # + # Example: + # + # message LogEntry { + # option (google.api.resource) = { + # type: "logging.googleapis.com/LogEntry" + # pattern: "projects/{project}/logs/{log}" + # pattern: "folders/{folder}/logs/{log}" + # pattern: "organizations/{organization}/logs/{log}" + # pattern: "billingAccounts/{billing_account}/logs/{log}" + # }; + # } + # + # The ResourceDescriptor Yaml config will look like: + # + # resources: + # - type: 'logging.googleapis.com/LogEntry' + # pattern: "projects/{project}/logs/{log}" + # pattern: "folders/{folder}/logs/{log}" + # pattern: "organizations/{organization}/logs/{log}" + # pattern: "billingAccounts/{billing_account}/logs/{log}" + # @!attribute [rw] type + # @return [::String] + # The resource type. It must be in the format of + # \\{service_name}/\\{resource_type_kind}. The `resource_type_kind` must be + # singular and must not include version numbers. + # + # Example: `storage.googleapis.com/Bucket` + # + # The value of the resource_type_kind must follow the regular expression + # /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + # should use PascalCase (UpperCamelCase). The maximum number of + # characters allowed for the `resource_type_kind` is 100. + # @!attribute [rw] pattern + # @return [::Array<::String>] + # Optional. The relative resource name pattern associated with this resource + # type. The DNS prefix of the full resource name shouldn't be specified here. + # + # The path pattern must follow the syntax, which aligns with HTTP binding + # syntax: + # + # Template = Segment { "/" Segment } ; + # Segment = LITERAL | Variable ; + # Variable = "{" LITERAL "}" ; + # + # Examples: + # + # - "projects/\\{project}/topics/\\{topic}" + # - "projects/\\{project}/knowledgeBases/\\{knowledge_base}" + # + # The components in braces correspond to the IDs for each resource in the + # hierarchy. It is expected that, if multiple patterns are provided, + # the same component name (e.g. "project") refers to IDs of the same + # type of resource. + # @!attribute [rw] name_field + # @return [::String] + # Optional. The field on the resource that designates the resource name + # field. If omitted, this is assumed to be "name". + # @!attribute [rw] history + # @return [::Google::Api::ResourceDescriptor::History] + # Optional. The historical or future-looking state of the resource pattern. + # + # Example: + # + # // The InspectTemplate message originally only supported resource + # // names with organization, and project was added later. + # message InspectTemplate { + # option (google.api.resource) = { + # type: "dlp.googleapis.com/InspectTemplate" + # pattern: + # "organizations/{organization}/inspectTemplates/{inspect_template}" + # pattern: "projects/{project}/inspectTemplates/{inspect_template}" + # history: ORIGINALLY_SINGLE_PATTERN + # }; + # } + # @!attribute [rw] plural + # @return [::String] + # The plural name used in the resource name and permission names, such as + # 'projects' for the resource name of 'projects/\\{project}' and the permission + # name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception + # to this is for Nested Collections that have stuttering names, as defined + # in [AIP-122](https://google.aip.dev/122#nested-collections), where the + # collection ID in the resource name pattern does not necessarily directly + # match the `plural` value. + # + # It is the same concept of the `plural` field in k8s CRD spec + # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + # + # Note: The plural form is required even for singleton resources. See + # https://aip.dev/156 + # @!attribute [rw] singular + # @return [::String] + # The same concept of the `singular` field in k8s CRD spec + # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + # Such as "project" for the `resourcemanager.googleapis.com/Project` type. + # @!attribute [rw] style + # @return [::Array<::Google::Api::ResourceDescriptor::Style>] + # Style flag(s) for this resource. + # These indicate that a resource is expected to conform to a given + # style. See the specific style flags for additional information. + class ResourceDescriptor + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # A description of the historical or future-looking state of the + # resource pattern. + module History + # The "unset" value. + HISTORY_UNSPECIFIED = 0 + + # The resource originally had one pattern and launched as such, and + # additional patterns were added later. + ORIGINALLY_SINGLE_PATTERN = 1 + + # The resource has one pattern, but the API owner expects to add more + # later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents + # that from being necessary once there are multiple patterns.) + FUTURE_MULTI_PATTERN = 2 + end + + # A flag representing a specific style that a resource claims to conform to. + module Style + # The unspecified value. Do not use. + STYLE_UNSPECIFIED = 0 + + # This resource is intended to be "declarative-friendly". + # + # Declarative-friendly resources must be more strictly consistent, and + # setting this to true communicates to tools that this resource should + # adhere to declarative-friendly expectations. + # + # Note: This is used by the API linter (linter.aip.dev) to enable + # additional checks. + DECLARATIVE_FRIENDLY = 1 + end + end + + # Defines a proto annotation that describes a string field that refers to + # an API resource. + # @!attribute [rw] type + # @return [::String] + # The resource type that the annotated field references. + # + # Example: + # + # message Subscription { + # string topic = 2 [(google.api.resource_reference) = { + # type: "pubsub.googleapis.com/Topic" + # }]; + # } + # + # Occasionally, a field may reference an arbitrary resource. In this case, + # APIs use the special value * in their resource reference. + # + # Example: + # + # message GetIamPolicyRequest { + # string resource = 2 [(google.api.resource_reference) = { + # type: "*" + # }]; + # } + # @!attribute [rw] child_type + # @return [::String] + # The resource type of a child collection that the annotated field + # references. This is useful for annotating the `parent` field that + # doesn't have a fixed resource type. + # + # Example: + # + # message ListLogEntriesRequest { + # string parent = 1 [(google.api.resource_reference) = { + # child_type: "logging.googleapis.com/LogEntry" + # }; + # } + class ResourceReference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_backup_runs.rb b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_backup_runs.rb new file mode 100644 index 000000000000..fc3074cb3710 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_backup_runs.rb @@ -0,0 +1,245 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + # Backup runs delete request. + # @!attribute [rw] id + # @return [::Integer] + # 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. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlBackupRunsDeleteRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Backup runs get request. + # @!attribute [rw] id + # @return [::Integer] + # The ID of this backup run. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlBackupRunsGetRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Backup runs insert request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::BackupRun] + class SqlBackupRunsInsertRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Backup runs list request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID, or "-" for all instances. This does not include + # the project ID. + # @!attribute [rw] max_results + # @return [::Integer] + # Maximum number of backup runs per response. + # @!attribute [rw] page_token + # @return [::String] + # A previously-returned page token representing part of the larger set of + # results to view. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlBackupRunsListRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A BackupRun resource. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#backupRun`. + # @!attribute [rw] status + # @return [::Google::Cloud::Sql::V1::SqlBackupRunStatus] + # The status of this run. + # @!attribute [rw] enqueued_time + # @return [::Google::Protobuf::Timestamp] + # 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`. + # @!attribute [rw] id + # @return [::Integer] + # The identifier for this backup run. Unique only for a specific Cloud SQL + # instance. + # @!attribute [rw] start_time + # @return [::Google::Protobuf::Timestamp] + # 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`. + # @!attribute [rw] end_time + # @return [::Google::Protobuf::Timestamp] + # 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`. + # @!attribute [rw] error + # @return [::Google::Cloud::Sql::V1::OperationError] + # Information about why the backup operation failed. This is only present if + # the run has the FAILED status. + # @!attribute [rw] type + # @return [::Google::Cloud::Sql::V1::SqlBackupRunType] + # 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. + # @!attribute [rw] description + # @return [::String] + # The description of this run, only applicable to on-demand backups. + # @!attribute [rw] window_start_time + # @return [::Google::Protobuf::Timestamp] + # 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`. + # @!attribute [rw] instance + # @return [::String] + # Name of the database instance. + # @!attribute [rw] self_link + # @return [::String] + # The URI of this resource. + # @!attribute [rw] location + # @return [::String] + # Location of the backups. + # @!attribute [r] database_version + # @return [::Google::Cloud::Sql::V1::SqlDatabaseVersion] + # Output only. The instance database version at the time this backup was + # made. + # @!attribute [rw] disk_encryption_configuration + # @return [::Google::Cloud::Sql::V1::DiskEncryptionConfiguration] + # Encryption configuration specific to a backup. + # @!attribute [rw] disk_encryption_status + # @return [::Google::Cloud::Sql::V1::DiskEncryptionStatus] + # Encryption status specific to a backup. + # @!attribute [rw] backup_kind + # @return [::Google::Cloud::Sql::V1::SqlBackupKind] + # Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT. + # @!attribute [rw] time_zone + # @return [::String] + # Backup time zone to prevent restores to an instance with + # a different time zone. Now relevant only for SQL Server. + # @!attribute [r] max_chargeable_bytes + # @return [::Integer] + # Output only. The maximum chargeable bytes for the backup. + class BackupRun + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Backup run list results. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#backupRunsList`. + # @!attribute [rw] items + # @return [::Array<::Google::Cloud::Sql::V1::BackupRun>] + # A list of backup runs in reverse chronological order of the enqueued time. + # @!attribute [rw] next_page_token + # @return [::String] + # The continuation token, used to page through large result sets. Provide + # this value in a subsequent request to return the next page of results. + class BackupRunsListResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The status of a backup run. + module 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 + end + + # Defines the supported backup kinds. + module SqlBackupKind + # This is an unknown BackupKind. + SQL_BACKUP_KIND_UNSPECIFIED = 0 + + # Snapshot-based backups. + SNAPSHOT = 1 + + # Physical backups. + PHYSICAL = 2 + end + + # Type of backup (i.e. automated, on demand, etc). + module 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 + end + end + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_backups.rb b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_backups.rb new file mode 100644 index 000000000000..ea197c5cedd8 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_backups.rb @@ -0,0 +1,259 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + # The request payload to create the backup + # @!attribute [rw] parent + # @return [::String] + # Required. The parent resource where this backup is created. + # Format: projects/\\{project} + # @!attribute [rw] backup + # @return [::Google::Cloud::Sql::V1::Backup] + # Required. The Backup to create. + class CreateBackupRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request payload to get the backup. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the backup to retrieve. + # Format: projects/\\{project}/backups/\\{backup} + class GetBackupRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request payload to list the backups. + # @!attribute [rw] parent + # @return [::String] + # Required. The parent that owns this collection of backups. + # Format: projects/\\{project} + # @!attribute [rw] page_size + # @return [::Integer] + # 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. + # @!attribute [rw] page_token + # @return [::String] + # 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. + # @!attribute [rw] filter + # @return [::String] + # 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. + class ListBackupsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The response payload containing a list of the backups. + # @!attribute [rw] backups + # @return [::Array<::Google::Cloud::Sql::V1::Backup>] + # A list of backups. + # @!attribute [rw] next_page_token + # @return [::String] + # 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. + # @!attribute [rw] warnings + # @return [::Array<::Google::Cloud::Sql::V1::ApiWarning>] + # If a region isn't unavailable or if an unknown error occurs, then a warning + # message is returned. + class ListBackupsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request payload to update the backup. + # @!attribute [rw] backup + # @return [::Google::Cloud::Sql::V1::Backup] + # Required. The backup to update. + # The backup’s `name` field is used to identify the backup to update. + # Format: projects/\\{project}/backups/\\{backup} + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # The list of fields that you can update. You can update only the description + # and retention period of the final backup. + class UpdateBackupRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request payload to delete the backup. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the backup to delete. + # Format: projects/\\{project}/backups/\\{backup} + class DeleteBackupRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A backup resource. + # @!attribute [r] name + # @return [::String] + # Output only. The resource name of the backup. + # Format: projects/\\{project}/backups/\\{backup}. + # @!attribute [r] kind + # @return [::String] + # Output only. This is always `sql#backup`. + # @!attribute [r] self_link + # @return [::String] + # Output only. The URI of this resource. + # @!attribute [r] type + # @return [::Google::Cloud::Sql::V1::Backup::SqlBackupType] + # Output only. The type of this backup. The type can be "AUTOMATED", + # "ON_DEMAND" or “FINAL”. + # @!attribute [rw] description + # @return [::String] + # The description of this backup. + # @!attribute [rw] instance + # @return [::String] + # The name of the source database instance. + # @!attribute [rw] location + # @return [::String] + # The storage location of the backups. The location can be multi-regional. + # @!attribute [r] backup_interval + # @return [::Google::Type::Interval] + # 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. + # @!attribute [r] state + # @return [::Google::Cloud::Sql::V1::Backup::SqlBackupState] + # Output only. The status of this backup. + # @!attribute [r] error + # @return [::Google::Cloud::Sql::V1::OperationError] + # Output only. Information about why the backup operation fails (for example, + # when the backup state fails). + # @!attribute [r] kms_key + # @return [::String] + # Output only. This output contains the encryption configuration for a backup + # and the resource name of the KMS key for disk encryption. + # @!attribute [r] kms_key_version + # @return [::String] + # 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. + # @!attribute [r] backup_kind + # @return [::Google::Cloud::Sql::V1::SqlBackupKind] + # Output only. Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT. + # @!attribute [r] time_zone + # @return [::String] + # 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. + # @!attribute [rw] ttl_days + # @return [::Integer] + # 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. + # + # Note: The following fields are mutually exclusive: `ttl_days`, `expiry_time`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] expiry_time + # @return [::Google::Protobuf::Timestamp] + # Backup expiration time. + # A UTC timestamp of when this backup expired. + # + # Note: The following fields are mutually exclusive: `expiry_time`, `ttl_days`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [r] database_version + # @return [::Google::Cloud::Sql::V1::SqlDatabaseVersion] + # Output only. The database version of the instance of at the time this + # backup was made. + # @!attribute [r] max_chargeable_bytes + # @return [::Integer] + # Output only. The maximum chargeable bytes for the backup. + # @!attribute [r] instance_deletion_time + # @return [::Google::Protobuf::Timestamp] + # Optional. Output only. Timestamp in UTC of when the instance associated + # with this backup is deleted. + # @!attribute [r] instance_settings + # @return [::Google::Cloud::Sql::V1::DatabaseInstance] + # Optional. Output only. The instance setting of the source instance that's + # associated with this backup. + # @!attribute [r] backup_run + # @return [::String] + # Output only. The mapping to backup run resource used for IAM validations. + # @!attribute [r] satisfies_pzs + # @return [::Google::Protobuf::BoolValue] + # Output only. This status indicates whether the backup satisfies PZS. + # + # The status is reserved for future use. + # @!attribute [r] satisfies_pzi + # @return [::Google::Protobuf::BoolValue] + # Output only. This status indicates whether the backup satisfies PZI. + # + # The status is reserved for future use. + class Backup + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The backup type. + module 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 + end + + # The backup's state + module 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 + end + end + end + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_connect.rb b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_connect.rb new file mode 100644 index 000000000000..53bf861e4626 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_connect.rb @@ -0,0 +1,190 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + # Connect settings retrieval request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] read_time + # @return [::Google::Protobuf::Timestamp] + # Optional. Optional snapshot read timestamp to trade freshness for + # performance. + class GetConnectSettingsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Connect settings retrieval response. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#connectSettings`. + # @!attribute [rw] server_ca_cert + # @return [::Google::Cloud::Sql::V1::SslCert] + # SSL configuration. + # @!attribute [rw] ip_addresses + # @return [::Array<::Google::Cloud::Sql::V1::IpMapping>] + # The assigned IP addresses for the instance. + # @!attribute [rw] region + # @return [::String] + # The cloud region for the instance. For example, `us-central1`, + # `europe-west1`. The region cannot be changed after instance creation. + # @!attribute [rw] database_version + # @return [::Google::Cloud::Sql::V1::SqlDatabaseVersion] + # 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`. + # @!attribute [rw] backend_type + # @return [::Google::Cloud::Sql::V1::SqlBackendType] + # `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. + # @!attribute [rw] psc_enabled + # @return [::Boolean] + # Whether PSC connectivity is enabled for this instance. + # @!attribute [rw] dns_name + # @return [::String] + # The dns name of the instance. + # @!attribute [rw] server_ca_mode + # @return [::Google::Cloud::Sql::V1::ConnectSettings::CaMode] + # Specify what type of CA is used for the server certificate. + # @!attribute [rw] custom_subject_alternative_names + # @return [::Array<::String>] + # Custom subject alternative names for the server certificate. + # @!attribute [r] dns_names + # @return [::Array<::Google::Cloud::Sql::V1::DnsNameMapping>] + # Output only. The list of DNS names used by this instance. + # @!attribute [rw] node_count + # @return [::Integer] + # The number of read pool nodes in a read pool. + # @!attribute [r] nodes + # @return [::Array<::Google::Cloud::Sql::V1::ConnectSettings::ConnectPoolNodeConfig>] + # Output only. Entries containing information about each read pool node of + # the read pool. + # @!attribute [r] mdx_protocol_support + # @return [::Array<::Google::Cloud::Sql::V1::ConnectSettings::MdxProtocolSupport>] + # 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. + class ConnectSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Details of a single read pool node of a read pool. + # @!attribute [r] name + # @return [::String] + # Output only. The name of the read pool node. Doesn't include the project + # ID. + # @!attribute [r] ip_addresses + # @return [::Array<::Google::Cloud::Sql::V1::IpMapping>] + # Output only. Mappings containing IP addresses that can be used to connect + # to the read pool node. + # @!attribute [r] dns_name + # @return [::String] + # Output only. The DNS name of the read pool node. + # @!attribute [r] dns_names + # @return [::Array<::Google::Cloud::Sql::V1::DnsNameMapping>] + # Output only. The list of DNS names used by this read pool node. + class ConnectPoolNodeConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Various Certificate Authority (CA) modes for certificate signing. + module 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 + end + + # MdxProtocolSupport describes parts of the MDX protocol supported by this + # instance. + module MdxProtocolSupport + # Not specified. + MDX_PROTOCOL_SUPPORT_UNSPECIFIED = 0 + + # Client should send the client protocol type in the MDX request. + CLIENT_PROTOCOL_TYPE = 1 + end + end + + # Ephemeral certificate creation request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] public_key + # @return [::String] + # PEM encoded public key to include in the signed certificate. + # @!attribute [rw] access_token + # @return [::String] + # Optional. Access token to include in the signed certificate. + # @!attribute [rw] read_time + # @return [::Google::Protobuf::Timestamp] + # Optional. Optional snapshot read timestamp to trade freshness for + # performance. + # @!attribute [rw] valid_duration + # @return [::Google::Protobuf::Duration] + # Optional. If set, it will contain the cert valid duration. + class GenerateEphemeralCertRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Ephemeral certificate creation request. + # @!attribute [rw] ephemeral_cert + # @return [::Google::Cloud::Sql::V1::SslCert] + # Generated cert + class GenerateEphemeralCertResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_databases.rb b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_databases.rb new file mode 100644 index 000000000000..6d40e648a074 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_databases.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + # Database delete request. + # @!attribute [rw] database + # @return [::String] + # Name of the database to be deleted in the instance. + # @!attribute [rw] instance + # @return [::String] + # Database instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlDatabasesDeleteRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database get request. + # @!attribute [rw] database + # @return [::String] + # Name of the database in the instance. + # @!attribute [rw] instance + # @return [::String] + # Database instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlDatabasesGetRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database insert request. + # @!attribute [rw] instance + # @return [::String] + # Database instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::Database] + class SqlDatabasesInsertRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database list request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlDatabasesListRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database update request. + # @!attribute [rw] database + # @return [::String] + # Name of the database to be updated in the instance. + # @!attribute [rw] instance + # @return [::String] + # Database instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::Database] + class SqlDatabasesUpdateRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database list response. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#databasesList`. + # @!attribute [rw] items + # @return [::Array<::Google::Cloud::Sql::V1::Database>] + # List of database resources in the instance. + class DatabasesListResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_flags.rb b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_flags.rb new file mode 100644 index 000000000000..433e3d8b1f54 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_flags.rb @@ -0,0 +1,154 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + # Flags list request. + # @!attribute [rw] database_version + # @return [::String] + # Database type and version you want to retrieve flags for. By default, this + # method returns flags for all database types and versions. + # @!attribute [rw] flag_scope + # @return [::Google::Cloud::Sql::V1::SqlFlagScope] + # Optional. Specify the scope of flags to be returned by SqlFlagsListService. + # Return list of database flags if unspecified. + class SqlFlagsListRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Flags list response. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#flagsList`. + # @!attribute [rw] items + # @return [::Array<::Google::Cloud::Sql::V1::Flag>] + # List of flags. + class FlagsListResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A flag resource. + # @!attribute [rw] name + # @return [::String] + # This is the name of the flag. Flag names always use underscores, not + # hyphens, for example: `max_allowed_packet` + # @!attribute [rw] type + # @return [::Google::Cloud::Sql::V1::SqlFlagType] + # 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`. + # @!attribute [rw] applies_to + # @return [::Array<::Google::Cloud::Sql::V1::SqlDatabaseVersion>] + # 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). + # @!attribute [rw] allowed_string_values + # @return [::Array<::String>] + # For `STRING` flags, a list of strings that the value can be set to. + # @!attribute [rw] min_value + # @return [::Google::Protobuf::Int64Value] + # For `INTEGER` flags, the minimum allowed value. + # @!attribute [rw] max_value + # @return [::Google::Protobuf::Int64Value] + # For `INTEGER` flags, the maximum allowed value. + # @!attribute [rw] requires_restart + # @return [::Google::Protobuf::BoolValue] + # Indicates whether changing this flag will trigger a database restart. Only + # applicable to Second Generation instances. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#flag`. + # @!attribute [rw] in_beta + # @return [::Google::Protobuf::BoolValue] + # Whether or not the flag is considered in beta. + # @!attribute [rw] allowed_int_values + # @return [::Array<::Integer>] + # Use this field if only certain integers are accepted. Can be combined + # with min_value and max_value to add additional values. + # @!attribute [rw] flag_scope + # @return [::Google::Cloud::Sql::V1::SqlFlagScope] + # Scope of flag. + # @!attribute [rw] recommended_string_value + # @return [::String] + # Recommended string value in string format for UI display. + # + # Note: The following fields are mutually exclusive: `recommended_string_value`, `recommended_int_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] recommended_int_value + # @return [::Google::Protobuf::Int64Value] + # Recommended int value in integer format for UI display. + # + # Note: The following fields are mutually exclusive: `recommended_int_value`, `recommended_string_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. + class Flag + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + module 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 + end + + # Scopes of a flag describe where the flag is used. + module 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 + end + end + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_instances.rb b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_instances.rb new file mode 100644 index 000000000000..8a0d7de68453 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_instances.rb @@ -0,0 +1,2357 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + # Instance add server CA request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlInstancesAddServerCaRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance add server certificate request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlInstancesAddServerCertificateRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance add Entra ID certificate request. + # @!attribute [rw] instance + # @return [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Required. Project ID of the project that contains the instance. + class SqlInstancesAddEntraIdCertificateRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance clone request. + # @!attribute [rw] instance + # @return [::String] + # Required. The ID of the Cloud SQL instance to be cloned (source). This does + # not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Required. Project ID of the source Cloud SQL instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesCloneRequest] + class SqlInstancesCloneRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance delete request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance to be deleted. + # @!attribute [rw] enable_final_backup + # @return [::Boolean] + # Flag to opt-in for final backup. By default, it is turned off. + # @!attribute [rw] final_backup_ttl_days + # @return [::Integer] + # Optional. Retention period of the final backup. + # + # Note: The following fields are mutually exclusive: `final_backup_ttl_days`, `final_backup_expiry_time`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] final_backup_expiry_time + # @return [::Google::Protobuf::Timestamp] + # Optional. Final Backup expiration time. + # Timestamp in UTC of when this resource is considered expired. + # + # Note: The following fields are mutually exclusive: `final_backup_expiry_time`, `final_backup_ttl_days`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] final_backup_description + # @return [::String] + # Optional. The description of the final backup. + class SqlInstancesDeleteRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance demote master request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance name. + # @!attribute [rw] project + # @return [::String] + # ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesDemoteMasterRequest] + class SqlInstancesDemoteMasterRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance demote request. + # @!attribute [rw] instance + # @return [::String] + # Required. Cloud SQL instance name. + # @!attribute [rw] project + # @return [::String] + # Required. ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesDemoteRequest] + # Required. The request body. + class SqlInstancesDemoteRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance export request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance to be exported. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesExportRequest] + class SqlInstancesExportRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance failover request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # ID of the project that contains the read replica. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesFailoverRequest] + class SqlInstancesFailoverRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance get request. + # @!attribute [rw] instance + # @return [::String] + # Required. Database instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Required. Project ID of the project that contains the instance. + class SqlInstancesGetRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance import request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesImportRequest] + class SqlInstancesImportRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance insert request. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project to which the newly created Cloud SQL instances + # should belong. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::DatabaseInstance] + class SqlInstancesInsertRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance list request. + # @!attribute [rw] filter + # @return [::String] + # 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. + # @!attribute [rw] max_results + # @return [::Integer] + # 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. + # @!attribute [rw] page_token + # @return [::String] + # A previously-returned page token representing part of the larger set of + # results to view. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project for which to list Cloud SQL instances. + class SqlInstancesListRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance list server CAs request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlInstancesListServerCasRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance list server certificates request. + # @!attribute [rw] instance + # @return [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Required. Project ID of the project that contains the instance. + class SqlInstancesListServerCertificatesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance list Entra ID certificates request. + # @!attribute [rw] instance + # @return [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Required. Project ID of the project that contains the instance. + class SqlInstancesListEntraIdCertificatesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance patch request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::DatabaseInstance] + class SqlInstancesPatchRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance promote replica request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL read replica instance name. + # @!attribute [rw] project + # @return [::String] + # ID of the project that contains the read replica. + # @!attribute [rw] failover + # @return [::Boolean] + # 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. + class SqlInstancesPromoteReplicaRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance switchover request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL read replica instance name. + # @!attribute [rw] project + # @return [::String] + # ID of the project that contains the replica. + # @!attribute [rw] db_timeout + # @return [::Google::Protobuf::Duration] + # 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. + class SqlInstancesSwitchoverRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance reset SSL config request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] mode + # @return [::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest::ResetSslMode] + # Optional. Reset SSL mode to use. + class SqlInstancesResetSslConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Reset SSL mode to selectively refresh the SSL materials. + module 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 + end + end + + # Instance restart request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance to be restarted. + class SqlInstancesRestartRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance restore backup request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesRestoreBackupRequest] + class SqlInstancesRestoreBackupRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance rotate server CA request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesRotateServerCaRequest] + class SqlInstancesRotateServerCaRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance rotate server certificate request. + # @!attribute [rw] instance + # @return [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Required. Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesRotateServerCertificateRequest] + # Optional. Rotate server certificate request body. + class SqlInstancesRotateServerCertificateRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance rotate server certificate request. + # @!attribute [rw] instance + # @return [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Required. Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesRotateEntraIdCertificateRequest] + # Optional. Rotate Entra ID certificate request body. + class SqlInstancesRotateEntraIdCertificateRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance start replica request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL read replica instance name. + # @!attribute [rw] project + # @return [::String] + # ID of the project that contains the read replica. + class SqlInstancesStartReplicaRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance stop replica request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL read replica instance name. + # @!attribute [rw] project + # @return [::String] + # ID of the project that contains the read replica. + class SqlInstancesStopReplicaRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance truncate log request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the Cloud SQL project. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesTruncateLogRequest] + class SqlInstancesTruncateLogRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance perform disk shrink request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::PerformDiskShrinkContext] + # Perform disk shrink context. + class SqlInstancesPerformDiskShrinkRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance update request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::DatabaseInstance] + class SqlInstancesUpdateRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance reschedule maintenance request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequestBody] + class SqlInstancesRescheduleMaintenanceRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance reencrypt request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesReencryptRequest] + # Reencrypt body that users request + class SqlInstancesReencryptRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database Instance reencrypt request. + # @!attribute [rw] backup_reencryption_config + # @return [::Google::Cloud::Sql::V1::BackupReencryptionConfig] + # Configuration specific to backup re-encryption + class InstancesReencryptRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Backup Reencryption Config + # @!attribute [rw] backup_limit + # @return [::Integer] + # Backup re-encryption limit + # @!attribute [rw] backup_type + # @return [::Google::Cloud::Sql::V1::BackupReencryptionConfig::BackupType] + # Type of backups users want to re-encrypt. + class BackupReencryptionConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Backup type for re-encryption + module 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 + end + end + + # The selected object that Cloud SQL migrates. + # @!attribute [rw] database + # @return [::String] + # The name of the database that Cloud SQL migrates. + class ExternalSyncSelectedObject + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance get disk shrink config request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlInstancesGetDiskShrinkConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance verify external sync settings request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] verify_connection_only + # @return [::Boolean] + # Flag to enable verifying connection only + # @!attribute [rw] sync_mode + # @return [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::ExternalSyncMode] + # External sync mode + # @!attribute [rw] verify_replication_only + # @return [::Boolean] + # Optional. Flag to verify settings required by replication setup only + # @!attribute [rw] mysql_sync_config + # @return [::Google::Cloud::Sql::V1::MySqlSyncConfig] + # Optional. MySQL-specific settings for start external sync. + # @!attribute [rw] migration_type + # @return [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::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. + # @!attribute [rw] sync_parallel_level + # @return [::Google::Cloud::Sql::V1::ExternalSyncParallelLevel] + # Optional. Parallel level for initial data sync. Only applicable for + # PostgreSQL. + # @!attribute [rw] selected_objects + # @return [::Array<::Google::Cloud::Sql::V1::ExternalSyncSelectedObject>] + # Optional. Migrate only the specified objects from the source instance. If + # this field is empty, then migrate all objects. + class SqlInstancesVerifyExternalSyncSettingsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + module 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 + end + + # MigrationType determines whether the migration is a physical file-based + # migration or a logical dump file-based migration. + module 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 + end + end + + # Instance start external sync request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # ID of the project that contains the instance. + # @!attribute [rw] sync_mode + # @return [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::ExternalSyncMode] + # External sync mode. + # @!attribute [rw] skip_verification + # @return [::Boolean] + # Whether to skip the verification step (VESS). + # @!attribute [rw] mysql_sync_config + # @return [::Google::Cloud::Sql::V1::MySqlSyncConfig] + # MySQL-specific settings for start external sync. + # @!attribute [rw] sync_parallel_level + # @return [::Google::Cloud::Sql::V1::ExternalSyncParallelLevel] + # Optional. Parallel level for initial data sync. Currently only applicable + # for MySQL. + # @!attribute [rw] migration_type + # @return [::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest::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. + # @!attribute [rw] replica_overwrite_enabled + # @return [::Boolean] + # 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. + class SqlInstancesStartExternalSyncRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance reset replica size request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL read replica instance name. + # @!attribute [rw] project + # @return [::String] + # ID of the project that contains the read replica. + class SqlInstancesResetReplicaSizeRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance create ephemeral certificate request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the Cloud SQL project. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::SslCertsCreateEphemeralRequest] + class SqlInstancesCreateEphemeralCertRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database instance clone request. + # @!attribute [rw] clone_context + # @return [::Google::Cloud::Sql::V1::CloneContext] + # Required. Contains details about the clone operation. + class InstancesCloneRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database demote primary instance request. + # @!attribute [rw] demote_master_context + # @return [::Google::Cloud::Sql::V1::DemoteMasterContext] + # Contains details about the demoteMaster operation. + class InstancesDemoteMasterRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This request is used to demote an existing standalone instance to be a + # Cloud SQL read replica for an external database server. + # @!attribute [rw] demote_context + # @return [::Google::Cloud::Sql::V1::DemoteContext] + # Required. Contains details about the demote operation. + class InstancesDemoteRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database instance export request. + # @!attribute [rw] export_context + # @return [::Google::Cloud::Sql::V1::ExportContext] + # Contains details about the export operation. + class InstancesExportRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance failover request. + # @!attribute [rw] failover_context + # @return [::Google::Cloud::Sql::V1::FailoverContext] + # Failover Context. + class InstancesFailoverRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # SslCerts create ephemeral certificate request. + # @!attribute [rw] public_key + # @return [::String] + # PEM encoded public key to include in the signed certificate. + # @!attribute [rw] access_token + # @return [::String] + # Access token to include in the signed certificate. + class SslCertsCreateEphemeralRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database instance import request. + # @!attribute [rw] import_context + # @return [::Google::Cloud::Sql::V1::ImportContext] + # Contains details about the import operation. + class InstancesImportRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for Pre-checks for MVU + # @!attribute [rw] pre_check_major_version_upgrade_context + # @return [::Google::Cloud::Sql::V1::PreCheckMajorVersionUpgradeContext] + # Required. Contains details about the pre-check major version upgrade + # operation. + class InstancesPreCheckMajorVersionUpgradeRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database instances list response. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#instancesList`. + # @!attribute [rw] warnings + # @return [::Array<::Google::Cloud::Sql::V1::ApiWarning>] + # List of warnings that occurred while handling the request. + # @!attribute [rw] items + # @return [::Array<::Google::Cloud::Sql::V1::DatabaseInstance>] + # List of database instance resources. + # @!attribute [rw] next_page_token + # @return [::String] + # The continuation token, used to page through large result sets. Provide + # this value in a subsequent request to return the next page of results. + class InstancesListResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instances ListServerCas response. + # @!attribute [rw] certs + # @return [::Array<::Google::Cloud::Sql::V1::SslCert>] + # List of server CA certificates for the instance. + # @!attribute [rw] active_version + # @return [::String] + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#instancesListServerCas`. + class InstancesListServerCasResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instances ListServerCertificates response. + # @!attribute [rw] ca_certs + # @return [::Array<::Google::Cloud::Sql::V1::SslCert>] + # List of server CA certificates for the instance. + # @!attribute [rw] server_certs + # @return [::Array<::Google::Cloud::Sql::V1::SslCert>] + # List of server certificates for the instance, signed by the corresponding + # CA from the `ca_certs` list. + # @!attribute [rw] active_version + # @return [::String] + # The `sha1_fingerprint` of the active certificate from `server_certs`. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#instancesListServerCertificates`. + class InstancesListServerCertificatesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instances ListEntraIdCertificates response. + # @!attribute [rw] certs + # @return [::Array<::Google::Cloud::Sql::V1::SslCert>] + # List of Entra ID certificates for the instance. + # @!attribute [rw] active_version + # @return [::String] + # The `sha1_fingerprint` of the active certificate from `certs`. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#instancesListEntraIdCertificates`. + class InstancesListEntraIdCertificatesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database instance restore backup request. + # @!attribute [rw] restore_backup_context + # @return [::Google::Cloud::Sql::V1::RestoreBackupContext] + # Parameters required to perform the restore backup operation. + # @!attribute [rw] backup + # @return [::String] + # 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. + # @!attribute [rw] backupdr_backup + # @return [::String] + # 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. + # @!attribute [rw] restore_instance_settings + # @return [::Google::Cloud::Sql::V1::DatabaseInstance] + # 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. + # @!attribute [rw] restore_instance_clear_overrides_field_names + # @return [::Array<::String>] + # 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. + class InstancesRestoreBackupRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Rotate server CA request. + # @!attribute [rw] rotate_server_ca_context + # @return [::Google::Cloud::Sql::V1::RotateServerCaContext] + # Contains details about the rotate server CA operation. + class InstancesRotateServerCaRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Rotate server certificate request. + # @!attribute [rw] rotate_server_certificate_context + # @return [::Google::Cloud::Sql::V1::RotateServerCertificateContext] + # Optional. Contains details about the rotate server certificate operation. + class InstancesRotateServerCertificateRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Rotate Entra ID certificate request. + # @!attribute [rw] rotate_entra_id_certificate_context + # @return [::Google::Cloud::Sql::V1::RotateEntraIdCertificateContext] + # Optional. Contains details about the rotate server certificate operation. + class InstancesRotateEntraIdCertificateRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance truncate log request. + # @!attribute [rw] truncate_log_context + # @return [::Google::Cloud::Sql::V1::TruncateLogContext] + # Contains details about the truncate log operation. + class InstancesTruncateLogRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request to acquire a lease for SSRS. + # @!attribute [rw] acquire_ssrs_lease_context + # @return [::Google::Cloud::Sql::V1::AcquireSsrsLeaseContext] + # Contains details about the acquire SSRS lease operation. + class InstancesAcquireSsrsLeaseRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for Pre-checks for MVU + # @!attribute [rw] instance + # @return [::String] + # Required. Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Required. Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesPreCheckMajorVersionUpgradeRequest] + # Required. The context for request to perform the pre-check major version + # upgrade operation. + class SqlInstancesPreCheckMajorVersionUpgradeRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance verify external sync settings response. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#migrationSettingErrorList`. + # @!attribute [rw] errors + # @return [::Array<::Google::Cloud::Sql::V1::SqlExternalSyncSettingError>] + # List of migration violations. + # @!attribute [rw] warnings + # @return [::Array<::Google::Cloud::Sql::V1::SqlExternalSyncSettingError>] + # List of migration warnings. + class SqlInstancesVerifyExternalSyncSettingsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance get disk shrink config response. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#getDiskShrinkConfig`. + # @!attribute [rw] minimal_target_size_gb + # @return [::Integer] + # The minimum size to which a disk can be shrunk in GigaBytes. + # @!attribute [rw] message + # @return [::String] + # Additional message to customers. + class SqlInstancesGetDiskShrinkConfigResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance get latest recovery time request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] source_instance_deletion_time + # @return [::Google::Protobuf::Timestamp] + # The timestamp used to identify the time when the source instance is + # deleted. If this instance is deleted, then you must set the timestamp. + class SqlInstancesGetLatestRecoveryTimeRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance get latest recovery time response. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#getLatestRecoveryTime`. + # @!attribute [rw] latest_recovery_time + # @return [::Google::Protobuf::Timestamp] + # Timestamp, identifies the latest recovery time of the source instance. + # @!attribute [rw] earliest_recovery_time + # @return [::Google::Protobuf::Timestamp] + # Timestamp, identifies the earliest recovery time of the source instance. + class SqlInstancesGetLatestRecoveryTimeResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database instance clone context. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#cloneContext`. + # @!attribute [rw] pitr_timestamp_ms + # @return [::Integer] + # Reserved for future use. + # @!attribute [rw] destination_instance_name + # @return [::String] + # Required. Name of the Cloud SQL instance to be created as a clone. + # @!attribute [rw] bin_log_coordinates + # @return [::Google::Cloud::Sql::V1::BinLogCoordinates] + # 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. + # @!attribute [rw] point_in_time + # @return [::Google::Protobuf::Timestamp] + # Timestamp, if specified, identifies the time to which the source instance + # is cloned. + # @!attribute [rw] allocated_ip_range + # @return [::String] + # 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. + # @!attribute [rw] database_names + # @return [::Array<::String>] + # (SQL Server only) Clone only the specified databases from the source + # instance. Clone all databases if empty. + # @!attribute [rw] preferred_zone + # @return [::String] + # 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. + # @!attribute [rw] preferred_secondary_zone + # @return [::String] + # 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. + # @!attribute [rw] source_instance_deletion_time + # @return [::Google::Protobuf::Timestamp] + # The timestamp used to identify the time when the source instance is + # deleted. If this instance is deleted, then you must set the timestamp. + # @!attribute [rw] destination_project + # @return [::String] + # 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. + # @!attribute [rw] destination_network + # @return [::String] + # 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. + class CloneContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The context to perform a point-in-time recovery of an instance managed by + # Backup and Disaster Recovery (DR) Service. + # @!attribute [rw] datasource + # @return [::String] + # The Backup and Disaster Recovery (DR) Service Datasource URI. + # Format: + # projects/\\{project}/locations/\\{region}/backupVaults/\\{backupvault}/dataSources/\\{datasource}. + # @!attribute [rw] point_in_time + # @return [::Google::Protobuf::Timestamp] + # Required. The date and time to which you want to restore the instance. + # @!attribute [rw] target_instance + # @return [::String] + # Target instance name. + # @!attribute [rw] private_network + # @return [::String] + # 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`. + # @!attribute [rw] allocated_ip_range + # @return [::String] + # 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. + # @!attribute [rw] preferred_zone + # @return [::String] + # 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. + # @!attribute [rw] preferred_secondary_zone + # @return [::String] + # 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. + # @!attribute [rw] target_instance_settings + # @return [::Google::Cloud::Sql::V1::DatabaseInstance] + # Optional. Specifies the instance settings that will be overridden from the + # source instance. This field is only applicable for cross project PITRs. + # @!attribute [rw] target_instance_clear_settings_field_names + # @return [::Array<::String>] + # Optional. Specifies the instance settings that will be cleared from the + # source instance. This field is only applicable for cross project PITRs. + # @!attribute [rw] region + # @return [::String] + # Optional. The region of the target instance where the datasource will be + # restored. For example: "us-central1". + class PointInTimeRestoreContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Binary log coordinates. + # @!attribute [rw] bin_log_file_name + # @return [::String] + # Name of the binary log file for a Cloud SQL instance. + # @!attribute [rw] bin_log_position + # @return [::Integer] + # Position (offset) within the binary log file. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#binLogCoordinates`. + class BinLogCoordinates + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A Cloud SQL instance resource. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#instance`. + # @!attribute [rw] state + # @return [::Google::Cloud::Sql::V1::DatabaseInstance::SqlInstanceState] + # The current serving state of the Cloud SQL instance. + # @!attribute [rw] database_version + # @return [::Google::Cloud::Sql::V1::SqlDatabaseVersion] + # The database engine type and version. The `databaseVersion` field cannot + # be changed after instance creation. + # @!attribute [rw] settings + # @return [::Google::Cloud::Sql::V1::Settings] + # The user settings. + # @!attribute [rw] etag + # @return [::String] + # This field is deprecated and will be removed from a future version of the + # API. Use the `settings.settingsVersion` field instead. + # @!attribute [rw] failover_replica + # @return [::Google::Cloud::Sql::V1::DatabaseInstance::SqlFailoverReplica] + # The name and status of the failover replica. + # @!attribute [rw] master_instance_name + # @return [::String] + # The name of the instance which will act as primary in the replication + # setup. + # @!attribute [rw] replica_names + # @return [::Array<::String>] + # The replicas of the instance. + # @!attribute [rw] max_disk_size + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Protobuf::Int64Value] + # The maximum disk size of the instance in bytes. + # @!attribute [rw] current_disk_size + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Protobuf::Int64Value] + # 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. + # @!attribute [rw] ip_addresses + # @return [::Array<::Google::Cloud::Sql::V1::IpMapping>] + # The assigned IP addresses for the instance. + # @!attribute [rw] server_ca_cert + # @return [::Google::Cloud::Sql::V1::SslCert] + # SSL configuration. + # @!attribute [rw] instance_type + # @return [::Google::Cloud::Sql::V1::SqlInstanceType] + # The instance type. + # @!attribute [rw] project + # @return [::String] + # The project ID of the project containing the Cloud SQL instance. The Google + # apps domain is prefixed if applicable. + # @!attribute [rw] ipv6_address + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::String] + # The IPv6 address assigned to the instance. + # (Deprecated) This property was applicable only + # to First Generation instances. + # @!attribute [rw] service_account_email_address + # @return [::String] + # The service account email address assigned to the instance.\This + # property is read-only. + # @!attribute [rw] on_premises_configuration + # @return [::Google::Cloud::Sql::V1::OnPremisesConfiguration] + # Configuration specific to on-premises instances. + # @!attribute [rw] replica_configuration + # @return [::Google::Cloud::Sql::V1::ReplicaConfiguration] + # Configuration specific to failover replicas and read replicas. + # @!attribute [rw] backend_type + # @return [::Google::Cloud::Sql::V1::SqlBackendType] + # 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. + # @!attribute [rw] self_link + # @return [::String] + # The URI of this resource. + # @!attribute [rw] suspension_reason + # @return [::Array<::Google::Cloud::Sql::V1::SqlSuspensionReason>] + # If the instance state is SUSPENDED, the reason for the suspension. + # @!attribute [rw] connection_name + # @return [::String] + # Connection name of the Cloud SQL instance used in connection strings. + # @!attribute [rw] name + # @return [::String] + # Name of the Cloud SQL instance. This does not include the project ID. + # @!attribute [rw] region + # @return [::String] + # 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`. + # @!attribute [rw] gce_zone + # @return [::String] + # 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. + # @!attribute [rw] secondary_gce_zone + # @return [::String] + # 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. + # @!attribute [rw] disk_encryption_configuration + # @return [::Google::Cloud::Sql::V1::DiskEncryptionConfiguration] + # Disk encryption configuration specific to an instance. + # @!attribute [rw] disk_encryption_status + # @return [::Google::Cloud::Sql::V1::DiskEncryptionStatus] + # Disk encryption status specific to an instance. + # @!attribute [rw] root_password + # @return [::String] + # Initial root password. Use only on creation. You must set root passwords + # before you can connect to PostgreSQL instances. + # @!attribute [rw] scheduled_maintenance + # @return [::Google::Cloud::Sql::V1::DatabaseInstance::SqlScheduledMaintenance] + # The start time of any upcoming scheduled maintenance for this instance. + # @!attribute [rw] satisfies_pzs + # @return [::Google::Protobuf::BoolValue] + # This status indicates whether the instance satisfies PZS. + # + # The status is reserved for future use. + # @!attribute [r] database_installed_version + # @return [::String] + # Output only. Stores the current database version running on the instance + # including minor version such as `MYSQL_8_0_18`. + # @!attribute [rw] out_of_disk_report + # @return [::Google::Cloud::Sql::V1::DatabaseInstance::SqlOutOfDiskReport] + # 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 + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # 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`. + # @!attribute [r] available_maintenance_versions + # @return [::Array<::String>] + # Output only. List all maintenance versions applicable on the instance + # @!attribute [rw] maintenance_version + # @return [::String] + # The current software version on the instance. + # @!attribute [r] upgradable_database_versions + # @return [::Array<::Google::Cloud::Sql::V1::AvailableDatabaseVersion>] + # Output only. All database versions that are available for upgrade. + # @!attribute [rw] sql_network_architecture + # @return [::Google::Cloud::Sql::V1::DatabaseInstance::SqlNetworkArchitecture] + # @!attribute [r] psc_service_attachment_link + # @return [::String] + # Output only. The link to service attachment of PSC instance. + # @!attribute [r] dns_name + # @return [::String] + # Output only. The dns name of the instance. + # @!attribute [r] primary_dns_name + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::String] + # Output only. DEPRECATED: please use write_endpoint instead. + # @!attribute [r] write_endpoint + # @return [::String] + # Output only. The dns name of the primary instance in a replication group. + # @!attribute [rw] replication_cluster + # @return [::Google::Cloud::Sql::V1::ReplicationCluster] + # 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. + # @!attribute [rw] gemini_config + # @return [::Google::Cloud::Sql::V1::GeminiInstanceConfig] + # Gemini instance configuration. + # @!attribute [r] satisfies_pzi + # @return [::Google::Protobuf::BoolValue] + # Output only. This status indicates whether the instance satisfies PZI. + # + # The status is reserved for future use. + # @!attribute [rw] switch_transaction_logs_to_cloud_storage_enabled + # @return [::Google::Protobuf::BoolValue] + # Input only. Whether Cloud SQL is enabled to switch storing point-in-time + # recovery log files from a data disk to Cloud Storage. + # @!attribute [rw] include_replicas_for_major_version_upgrade + # @return [::Google::Protobuf::BoolValue] + # 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. + # @!attribute [rw] tags + # @return [::Google::Protobuf::Map{::String => ::String}] + # 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. + # @!attribute [rw] node_count + # @return [::Integer] + # The number of read pool nodes in a read pool. + # @!attribute [r] nodes + # @return [::Array<::Google::Cloud::Sql::V1::DatabaseInstance::PoolNodeConfig>] + # Output only. Entries containing information about each read pool node of + # the read pool. + # @!attribute [r] dns_names + # @return [::Array<::Google::Cloud::Sql::V1::DnsNameMapping>] + # Output only. The list of DNS names used by this instance. + class DatabaseInstance + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] name + # @return [::String] + # 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. + # @!attribute [rw] available + # @return [::Google::Protobuf::BoolValue] + # 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. + class SqlFailoverReplica + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Any scheduled maintenance for this instance. + # @!attribute [rw] start_time + # @return [::Google::Protobuf::Timestamp] + # The start time of any upcoming scheduled maintenance for this instance. + # @!attribute [rw] can_defer + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Boolean] + # @!attribute [rw] can_reschedule + # @return [::Boolean] + # If the scheduled maintenance can be rescheduled. + # @!attribute [rw] schedule_deadline_time + # @return [::Google::Protobuf::Timestamp] + # Maintenance cannot be rescheduled to start beyond this deadline. + class SqlScheduledMaintenance + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This message wraps up the information written by out-of-disk detection job. + # @!attribute [rw] sql_out_of_disk_state + # @return [::Google::Cloud::Sql::V1::DatabaseInstance::SqlOutOfDiskReport::SqlOutOfDiskState] + # 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 + # @!attribute [rw] sql_min_recommended_increase_size_gb + # @return [::Integer] + # The minimum recommended increase size in GigaBytes + # This field is consumed by the frontend + # * Writers: + # * the proactive database wellness job for OOD. + # * Readers: + class SqlOutOfDiskReport + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # This enum lists all possible states regarding out-of-disk issues. + module 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 + end + end + + # Details of a single read pool node of a read pool. + # @!attribute [r] name + # @return [::String] + # Output only. The name of the read pool node, to be used for retrieving + # metrics and logs. + # @!attribute [r] gce_zone + # @return [::String] + # Output only. The zone of the read pool node. + # @!attribute [r] ip_addresses + # @return [::Array<::Google::Cloud::Sql::V1::IpMapping>] + # Output only. Mappings containing IP addresses that can be used to connect + # to the read pool node. + # @!attribute [r] dns_name + # @return [::String] + # Output only. The DNS name of the read pool node. + # @!attribute [r] state + # @return [::Google::Cloud::Sql::V1::DatabaseInstance::SqlInstanceState] + # Output only. The current state of the read pool node. + # @!attribute [r] dns_names + # @return [::Array<::Google::Cloud::Sql::V1::DnsNameMapping>] + # Output only. The list of DNS names used by this read pool node. + # @!attribute [r] psc_service_attachment_link + # @return [::String] + # Output only. The Private Service Connect (PSC) service attachment of the + # read pool node. + # @!attribute [r] psc_auto_connections + # @return [::Array<::Google::Cloud::Sql::V1::PscAutoConnectionConfig>] + # 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. + class PoolNodeConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class TagsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The current serving state of the database instance. + module 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 + + # (Applicable to read pool nodes only.) The read pool node needs to be + # repaired. The database might be unavailable. + REPAIRING = 8 + end + + # The SQL network architecture for the instance. + module 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 + end + end + + # Gemini instance configuration. + # @!attribute [r] entitled + # @return [::Boolean] + # Output only. Whether Gemini is enabled. + # @!attribute [r] google_vacuum_mgmt_enabled + # @return [::Boolean] + # Output only. Whether the vacuum management is enabled. + # @!attribute [r] oom_session_cancel_enabled + # @return [::Boolean] + # Output only. Whether canceling the out-of-memory (OOM) session is enabled. + # @!attribute [r] active_query_enabled + # @return [::Boolean] + # Output only. Whether the active query is enabled. + # @!attribute [r] index_advisor_enabled + # @return [::Boolean] + # Output only. Whether the index advisor is enabled. + # @!attribute [r] flag_recommender_enabled + # @return [::Boolean] + # Output only. Whether the flag recommender is enabled. + class GeminiInstanceConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # 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. + # @!attribute [r] psa_write_endpoint + # @return [::String] + # 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. + # @!attribute [rw] failover_dr_replica_name + # @return [::String] + # 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. + # @!attribute [r] dr_replica + # @return [::Boolean] + # 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. + class ReplicationCluster + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # An available database version. It can be a major or a minor version. + # @!attribute [rw] major_version + # @return [::String] + # The version's major version name. + # @!attribute [rw] name + # @return [::String] + # The database version name. For MySQL 8.0, this string provides the database + # major and minor version. + # @!attribute [rw] display_name + # @return [::String] + # The database version's display name. + class AvailableDatabaseVersion + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Reschedule options for maintenance windows. + # @!attribute [rw] reschedule + # @return [::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequestBody::Reschedule] + # Required. The type of the reschedule the user wants. + class SqlInstancesRescheduleMaintenanceRequestBody + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] reschedule_type + # @return [::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequestBody::RescheduleType] + # Required. The type of the reschedule. + # @!attribute [rw] schedule_time + # @return [::Google::Protobuf::Timestamp] + # 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`. + class Reschedule + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + module 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 + end + end + + # Database instance demote primary instance context. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#demoteMasterContext`. + # @!attribute [rw] verify_gtid_consistency + # @return [::Google::Protobuf::BoolValue] + # 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. + # @!attribute [rw] master_instance_name + # @return [::String] + # The name of the instance which will act as on-premises primary instance + # in the replication setup. + # @!attribute [rw] replica_configuration + # @return [::Google::Cloud::Sql::V1::DemoteMasterConfiguration] + # Configuration specific to read-replicas replicating from the on-premises + # primary instance. + # @!attribute [rw] skip_replication_setup + # @return [::Boolean] + # Flag to skip replication setup on the instance. + class DemoteMasterContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This context is used to demote an existing standalone instance to be + # a Cloud SQL read replica for an external database server. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#demoteContext`. + # @!attribute [rw] source_representative_instance_name + # @return [::String] + # Required. The name of the instance which acts as the on-premises primary + # instance in the replication setup. + class DemoteContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database instance failover context. + # @!attribute [rw] settings_version + # @return [::Integer] + # The current settings version of this instance. Request will be rejected if + # this version doesn't match the current settings version. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#failoverContext`. + class FailoverContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database instance restore from backup context. + # Backup context contains source instance id and project id. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#restoreBackupContext`. + # @!attribute [rw] backup_run_id + # @return [::Integer] + # The ID of the backup run to restore from. + # @!attribute [rw] instance_id + # @return [::String] + # The ID of the instance that the backup was taken from. + # @!attribute [rw] project + # @return [::String] + # The full project ID of the source instance. + class RestoreBackupContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance rotate server CA context. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#rotateServerCaContext`. + # @!attribute [rw] next_version + # @return [::String] + # The fingerprint of the next version to be rotated to. If left unspecified, + # will be rotated to the most recently added server CA version. + class RotateServerCaContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance rotate server certificate context. + # @!attribute [rw] kind + # @return [::String] + # Optional. This is always `sql#rotateServerCertificateContext`. + # @!attribute [rw] next_version + # @return [::String] + # The fingerprint of the next version to be rotated to. If left unspecified, + # will be rotated to the most recently added server certificate version. + class RotateServerCertificateContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Instance rotate Entra ID certificate context. + # @!attribute [rw] kind + # @return [::String] + # Optional. This is always `sql#rotateEntraIdCertificateContext`. + # @!attribute [rw] next_version + # @return [::String] + # 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. + class RotateEntraIdCertificateContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database Instance truncate log context. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#truncateLogContext`. + # @!attribute [rw] log_type + # @return [::String] + # The type of log to truncate. Valid values are `MYSQL_GENERAL_TABLE` and + # `MYSQL_SLOW_TABLE`. + class TruncateLogContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # External primary instance migration setting error/warning. + # @!attribute [rw] kind + # @return [::String] + # Can be `sql#externalSyncSettingError` or + # `sql#externalSyncSettingWarning`. + # @!attribute [rw] type + # @return [::Google::Cloud::Sql::V1::SqlExternalSyncSettingError::SqlExternalSyncSettingErrorType] + # Identifies the specific error that occurred. + # @!attribute [rw] detail + # @return [::String] + # Additional information about the error encountered. + class SqlExternalSyncSettingError + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + module 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 + # {::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest#replica_overwrite_enabled 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; + # {::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest#replica_overwrite_enabled 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 + end + end + + # A list of objects that the user selects for replication from an external + # source instance. + # @!attribute [rw] database + # @return [::String] + # Required. The name of the database to migrate. + class SelectedObjects + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # On-premises instance configuration. + # @!attribute [rw] host_port + # @return [::String] + # The host and port of the on-premises instance in host:port format + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#onPremisesConfiguration`. + # @!attribute [rw] username + # @return [::String] + # The username for connecting to on-premises instance. + # @!attribute [rw] password + # @return [::String] + # The password for connecting to on-premises instance. + # @!attribute [rw] ca_certificate + # @return [::String] + # PEM representation of the trusted CA's x509 certificate. + # @!attribute [rw] client_certificate + # @return [::String] + # PEM representation of the replica's x509 certificate. + # @!attribute [rw] client_key + # @return [::String] + # PEM representation of the replica's private key. The corresponding public + # key is encoded in the client's certificate. + # @!attribute [rw] dump_file_path + # @return [::String] + # The dump file to create the Cloud SQL replica. + # @!attribute [rw] source_instance + # @return [::Google::Cloud::Sql::V1::InstanceReference] + # The reference to Cloud SQL instance if the source is Cloud SQL. + # @!attribute [rw] selected_objects + # @return [::Array<::Google::Cloud::Sql::V1::SelectedObjects>] + # Optional. A list of objects that the user selects for replication from an + # external source instance. + # @!attribute [rw] ssl_option + # @return [::Google::Cloud::Sql::V1::OnPremisesConfiguration::SslOption] + # Optional. SSL option for replica connection to the on-premises source. + class OnPremisesConfiguration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # SslOption defines the SSL mode to be used for replica connection to the + # on-premises source. + module 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 + end + end + + # Read-replica configuration for connecting to the primary instance. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#replicaConfiguration`. + # @!attribute [rw] mysql_replica_configuration + # @return [::Google::Cloud::Sql::V1::MySqlReplicaConfiguration] + # 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. + # @!attribute [rw] failover_target + # @return [::Google::Protobuf::BoolValue] + # 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. + # @!attribute [rw] cascadable_replica + # @return [::Google::Protobuf::BoolValue] + # 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. + class ReplicaConfiguration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Execute SQL statements request. + # @!attribute [rw] instance + # @return [::String] + # Required. Database instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Required. Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::ExecuteSqlPayload] + # The request body. + class SqlInstancesExecuteSqlRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request payload used to execute SQL statements. + # @!attribute [rw] user + # @return [::String] + # 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. + # @!attribute [rw] sql_statement + # @return [::String] + # Required. SQL statements to run on the database. It can be a single + # statement or a sequence of statements separated by semicolons. + # @!attribute [rw] database + # @return [::String] + # Optional. Name of the database on which the statement will be executed. + # @!attribute [rw] auto_iam_authn + # @return [::Boolean] + # 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. + # @!attribute [rw] row_limit + # @return [::Integer] + # Optional. The maximum number of rows returned per SQL statement. + # @!attribute [rw] partial_result_mode + # @return [::Google::Cloud::Sql::V1::ExecuteSqlPayload::PartialResultMode] + # 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. + # @!attribute [rw] application + # @return [::String] + # 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. + class ExecuteSqlPayload + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Controls how the API should respond when the SQL execution result exceeds + # 10 MB. + module 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 + end + end + + # Execute SQL statements response. + # @!attribute [rw] messages + # @return [::Array<::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse::Message>] + # 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. + # @!attribute [rw] metadata + # @return [::Google::Cloud::Sql::V1::Metadata] + # The additional metadata information regarding the execution of the SQL + # statements. + # @!attribute [rw] results + # @return [::Array<::Google::Cloud::Sql::V1::QueryResult>] + # The list of results after executing all the SQL statements. + # @!attribute [rw] status + # @return [::Google::Rpc::Status] + # Contains the error from the database if the SQL execution failed. + class SqlInstancesExecuteSqlResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Represents a notice or warning message from the database. + # @!attribute [rw] message + # @return [::String] + # 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. + # @!attribute [rw] severity + # @return [::String] + # The severity of the message (e.g., "NOTICE" for PostgreSQL, "WARNING" for + # MySQL). + class Message + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # QueryResult contains the result of executing a single SQL statement. + # @!attribute [rw] columns + # @return [::Array<::Google::Cloud::Sql::V1::Column>] + # List of columns included in the result. This also includes the data type + # of the column. + # @!attribute [rw] rows + # @return [::Array<::Google::Cloud::Sql::V1::Row>] + # Rows returned by the SQL statement. + # @!attribute [rw] message + # @return [::String] + # Message related to the SQL execution result. + # @!attribute [rw] partial_result + # @return [::Boolean] + # Set to true if the SQL execution's result is truncated due to size limits + # or an error retrieving results. + # @!attribute [rw] status + # @return [::Google::Rpc::Status] + # If results were truncated due to an error, details of that error. + class QueryResult + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Contains the name and datatype of a column. + # @!attribute [rw] name + # @return [::String] + # Name of the column. + # @!attribute [rw] type + # @return [::String] + # Datatype of the column. + class Column + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Contains the values for a row. + # @!attribute [rw] values + # @return [::Array<::Google::Cloud::Sql::V1::Value>] + # The values for the row. + class Row + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The cell value of the table. + # @!attribute [rw] value + # @return [::String] + # The cell value in string format. + # @!attribute [rw] null_value + # @return [::Boolean] + # If cell value is null, then this flag will be set to true. + class Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The additional metadata information regarding the execution of the SQL + # statements. + # @!attribute [rw] sql_statement_execution_time + # @return [::Google::Protobuf::Duration] + # The time taken to execute the SQL statements. + class Metadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request to acquire a lease for SSRS. + # @!attribute [rw] instance + # @return [::String] + # 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). + # @!attribute [rw] project + # @return [::String] + # Required. Project ID of the project that contains the instance (Example: + # project-id). + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::InstancesAcquireSsrsLeaseRequest] + # Required. The request body. + class SqlInstancesAcquireSsrsLeaseRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for the acquire SSRS lease request. + # @!attribute [rw] operation_id + # @return [::String] + # The unique identifier for this operation. + class SqlInstancesAcquireSsrsLeaseResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request to release a lease for SSRS. + # @!attribute [rw] instance + # @return [::String] + # 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. + # @!attribute [rw] project + # @return [::String] + # Required. The project ID that contains the instance. + class SqlInstancesReleaseSsrsLeaseRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for the release SSRS lease request. + # @!attribute [rw] operation_id + # @return [::String] + # The unique identifier for this operation. + class SqlInstancesReleaseSsrsLeaseResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request to perform a point in time restore on a Google Cloud Backup and + # Disaster Recovery managed instance. + # @!attribute [rw] parent + # @return [::String] + # Required. The parent resource where you created this instance. + # Format: projects/\\{project} + # @!attribute [rw] context + # @return [::Google::Cloud::Sql::V1::PointInTimeRestoreContext] + # Required. The context for request to perform a PITR on a Google Cloud + # Backup and Disaster Recovery managed instance. + class SqlInstancesPointInTimeRestoreRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # External Sync parallel level. + module 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 + end + + module 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 + end + + # The suspension reason of the database instance if the state is SUSPENDED. + module 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 + end + end + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_operations.rb b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_operations.rb new file mode 100644 index 000000000000..f3e93aaa97d4 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_operations.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + # Operations get request. + # @!attribute [rw] operation + # @return [::String] + # Required. Instance operation ID. + # @!attribute [rw] project + # @return [::String] + # Required. Project ID of the project that contains the instance. + class SqlOperationsGetRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Operations list request. + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] max_results + # @return [::Integer] + # Maximum number of operations per response. + # @!attribute [rw] page_token + # @return [::String] + # A previously-returned page token representing part of the larger set of + # results to view. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlOperationsListRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Operations list response. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#operationsList`. + # @!attribute [rw] items + # @return [::Array<::Google::Cloud::Sql::V1::Operation>] + # List of operation resources. + # @!attribute [rw] next_page_token + # @return [::String] + # The continuation token, used to page through large result sets. Provide + # this value in a subsequent request to return the next page of results. + class OperationsListResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Operations cancel request. + # @!attribute [rw] operation + # @return [::String] + # Instance operation ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlOperationsCancelRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_resources.rb b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_resources.rb new file mode 100644 index 000000000000..71ae5c7a84e1 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_resources.rb @@ -0,0 +1,2522 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + # An entry for an Access Control list. + # @!attribute [rw] value + # @return [::String] + # The allowlisted value for the access control list. + # @!attribute [rw] expiration_time + # @return [::Google::Protobuf::Timestamp] + # 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`. + # @!attribute [rw] name + # @return [::String] + # Optional. A label to identify this entry. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#aclEntry`. + class AclEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # An Admin API warning message. + # @!attribute [rw] code + # @return [::Google::Cloud::Sql::V1::ApiWarning::SqlApiWarningCode] + # Code to uniquely identify the warning type. + # @!attribute [rw] message + # @return [::String] + # The warning message. + # @!attribute [rw] region + # @return [::String] + # The region name for REGION_UNREACHABLE warning. + class ApiWarning + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + module 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 + end + end + + # We currently only support backup retention by specifying the number + # of backups we will retain. + # @!attribute [rw] retention_unit + # @return [::Google::Cloud::Sql::V1::BackupRetentionSettings::RetentionUnit] + # The unit that 'retained_backups' represents. + # @!attribute [rw] retained_backups + # @return [::Google::Protobuf::Int32Value] + # 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. + class BackupRetentionSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The units that retained_backups specifies, we only support COUNT. + module 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 + end + end + + # Database instance backup configuration. + # @!attribute [rw] start_time + # @return [::String] + # Start time for the daily backup configuration in UTC timezone in the 24 + # hour format - `HH:MM`. + # @!attribute [rw] enabled + # @return [::Google::Protobuf::BoolValue] + # Whether this configuration is enabled. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#backupConfiguration`. + # @!attribute [rw] binary_log_enabled + # @return [::Google::Protobuf::BoolValue] + # (MySQL only) Whether binary log is enabled. If backup configuration is + # disabled, binarylog must be disabled as well. + # @!attribute [rw] replication_log_archiving_enabled + # @return [::Google::Protobuf::BoolValue] + # Reserved for future use. + # @!attribute [rw] location + # @return [::String] + # Location of the backup + # @!attribute [rw] point_in_time_recovery_enabled + # @return [::Google::Protobuf::BoolValue] + # Whether point in time recovery is enabled. + # @!attribute [rw] backup_retention_settings + # @return [::Google::Cloud::Sql::V1::BackupRetentionSettings] + # Backup retention settings. + # @!attribute [rw] transaction_log_retention_days + # @return [::Google::Protobuf::Int32Value] + # The number of days of transaction logs we retain for point in time + # restore, from 1-7. + # @!attribute [r] transactional_log_storage_state + # @return [::Google::Cloud::Sql::V1::BackupConfiguration::TransactionalLogStorageState] + # Output only. This value contains the storage location of transactional logs + # used to perform point-in-time recovery (PITR) for the database. + # @!attribute [r] backup_tier + # @return [::Google::Cloud::Sql::V1::BackupConfiguration::BackupTier] + # Output only. Backup tier that manages the backups for the instance. + class BackupConfiguration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # This value contains the storage location of the transactional logs + # used to perform point-in-time recovery (PITR) for the database. + module 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 + end + + # Backup tier that manages the backups for the instance. + module BackupTier + # Unspecified. + BACKUP_TIER_UNSPECIFIED = 0 + + # Instance is managed by Cloud SQL. + STANDARD = 1 + + # Deprecated: ADVANCED is deprecated. Please use ENHANCED instead. + ADVANCED = 2 + + # Instance is managed by Google Cloud Backup and DR Service. + ENHANCED = 3 + end + end + + # Perform disk shrink context. + # @!attribute [rw] target_size_gb + # @return [::Integer] + # The target disk shrink size in GigaBytes. + class PerformDiskShrinkContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Structured PreCheckResponse containing message, type, and required + # actions. + # @!attribute [rw] message + # @return [::String] + # The message to be displayed to the user. + # @!attribute [rw] message_type + # @return [::Google::Cloud::Sql::V1::PreCheckResponse::MessageType] + # The type of message whether it is an info, warning, or error. + # @!attribute [rw] actions_required + # @return [::Array<::String>] + # The actions that the user needs to take. Use repeated for multiple + # actions. + class PreCheckResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The type of message which can be an info, a warning, or an error that + # requires user intervention. + module 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 + end + end + + # Pre-check major version upgrade context. + # @!attribute [rw] target_database_version + # @return [::Google::Cloud::Sql::V1::SqlDatabaseVersion] + # Required. The target database version to upgrade to. + # @!attribute [r] pre_check_response + # @return [::Array<::Google::Cloud::Sql::V1::PreCheckResponse>] + # Output only. The responses from the precheck operation. + # @!attribute [rw] kind + # @return [::String] + # Optional. This is always `sql#preCheckMajorVersionUpgradeContext`. + class PreCheckMajorVersionUpgradeContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Backup context. + # @!attribute [rw] backup_id + # @return [::Integer] + # The identifier of the backup. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#backupContext`. + # @!attribute [rw] name + # @return [::String] + # The name of the backup. + # Format: projects/\\{project}/backups/\\{backup} + class BackupContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Represents a SQL database on the Cloud SQL instance. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#database`. + # @!attribute [rw] charset + # @return [::String] + # The Cloud SQL charset value. + # @!attribute [rw] collation + # @return [::String] + # The Cloud SQL collation value. + # @!attribute [rw] etag + # @return [::String] + # This field is deprecated and will be removed from a future version of the + # API. + # @!attribute [rw] name + # @return [::String] + # The name of the database in the Cloud SQL instance. This does not include + # the project ID or instance name. + # @!attribute [rw] instance + # @return [::String] + # The name of the Cloud SQL instance. This does not include the project ID. + # @!attribute [rw] self_link + # @return [::String] + # The URI of this resource. + # @!attribute [rw] project + # @return [::String] + # The project ID of the project containing the Cloud SQL database. The Google + # apps domain is prefixed if applicable. + # @!attribute [rw] sqlserver_database_details + # @return [::Google::Cloud::Sql::V1::SqlServerDatabaseDetails] + class Database + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Represents a Sql Server database on the Cloud SQL instance. + # @!attribute [rw] compatibility_level + # @return [::Integer] + # The version of SQL Server with which the database is to be made compatible + # @!attribute [rw] recovery_model + # @return [::String] + # The recovery model of a SQL Server database + class SqlServerDatabaseDetails + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database flags for Cloud SQL instances. + # @!attribute [rw] name + # @return [::String] + # 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. + # @!attribute [rw] value + # @return [::String] + # 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. + class DatabaseFlags + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # MySQL-specific external server sync settings. + # @!attribute [rw] initial_sync_flags + # @return [::Array<::Google::Cloud::Sql::V1::SyncFlags>] + # Flags to use for the initial dump. + class MySqlSyncConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Initial sync flags for certain Cloud SQL APIs. + # Currently used for the MySQL external server initial dump. + # @!attribute [rw] name + # @return [::String] + # The name of the flag. + # @!attribute [rw] value + # @return [::String] + # The value of the flag. This field must be omitted if the flag + # doesn't take a value. + class SyncFlags + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Reference to another Cloud SQL instance. + # @!attribute [rw] name + # @return [::String] + # The name of the Cloud SQL instance being referenced. + # This does not include the project ID. + # @!attribute [rw] region + # @return [::String] + # The region of the Cloud SQL instance being referenced. + # @!attribute [rw] project + # @return [::String] + # The project ID of the Cloud SQL instance being referenced. + # The default is the same project ID as the instance references it. + class InstanceReference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Read-replica configuration for connecting to the on-premises primary + # instance. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#demoteMasterConfiguration`. + # @!attribute [rw] mysql_replica_configuration + # @return [::Google::Cloud::Sql::V1::DemoteMasterMySqlReplicaConfiguration] + # 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. + class DemoteMasterConfiguration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Read-replica configuration specific to MySQL databases. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#demoteMasterMysqlReplicaConfiguration`. + # @!attribute [rw] username + # @return [::String] + # The username for the replication connection. + # @!attribute [rw] password + # @return [::String] + # The password for the replication connection. + # @!attribute [rw] client_key + # @return [::String] + # 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. + # @!attribute [rw] client_certificate + # @return [::String] + # PEM representation of the replica's x509 certificate. + # @!attribute [rw] ca_certificate + # @return [::String] + # PEM representation of the trusted CA's x509 certificate. + class DemoteMasterMySqlReplicaConfiguration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database instance export context. + # @!attribute [rw] uri + # @return [::String] + # 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. + # @!attribute [rw] databases + # @return [::Array<::String>] + # 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`. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#exportContext`. + # @!attribute [rw] sql_export_options + # @return [::Google::Cloud::Sql::V1::ExportContext::SqlExportOptions] + # Options for exporting data as SQL statements. + # @!attribute [rw] csv_export_options + # @return [::Google::Cloud::Sql::V1::ExportContext::SqlCsvExportOptions] + # Options for exporting data as CSV. `MySQL` and `PostgreSQL` + # instances only. + # @!attribute [rw] file_type + # @return [::Google::Cloud::Sql::V1::SqlFileType] + # The file type for the specified uri. + # @!attribute [rw] offload + # @return [::Google::Protobuf::BoolValue] + # Whether to perform a serverless export. + # @!attribute [rw] bak_export_options + # @return [::Google::Cloud::Sql::V1::ExportContext::SqlBakExportOptions] + # Options for exporting data as BAK files. + # @!attribute [rw] tde_export_options + # @return [::Google::Cloud::Sql::V1::ExportContext::SqlTdeExportOptions] + # Optional. Export parameters specific to SQL Server TDE certificates + class ExportContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] select_query + # @return [::String] + # The select query used to extract the data. + # @!attribute [rw] escape_character + # @return [::String] + # Specifies the character that should appear before a data character that + # needs to be escaped. + # @!attribute [rw] quote_character + # @return [::String] + # Specifies the quoting character to be used when a data value is quoted. + # @!attribute [rw] fields_terminated_by + # @return [::String] + # Specifies the character that separates columns within each row (line) of + # the file. + # @!attribute [rw] lines_terminated_by + # @return [::String] + # 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. + class SqlCsvExportOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] tables + # @return [::Array<::String>] + # 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. + # @!attribute [rw] schema_only + # @return [::Google::Protobuf::BoolValue] + # Export only schemas. + # @!attribute [rw] mysql_export_options + # @return [::Google::Cloud::Sql::V1::ExportContext::SqlExportOptions::MysqlExportOptions] + # @!attribute [rw] threads + # @return [::Google::Protobuf::Int32Value] + # Optional. The number of threads to use for parallel export. + # @!attribute [rw] parallel + # @return [::Google::Protobuf::BoolValue] + # Optional. Whether or not the export should be parallel. + # @!attribute [rw] postgres_export_options + # @return [::Google::Cloud::Sql::V1::ExportContext::SqlExportOptions::PostgresExportOptions] + # Optional. Options for exporting from a Cloud SQL for PostgreSQL instance. + class SqlExportOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Options for exporting from MySQL. + # @!attribute [rw] master_data + # @return [::Google::Protobuf::Int32Value] + # 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. + class MysqlExportOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Options for exporting from a Cloud SQL for PostgreSQL instance. + # @!attribute [rw] clean + # @return [::Google::Protobuf::BoolValue] + # Optional. Use this option to include DROP <object> + # SQL statements. Use these statements to delete database objects before + # running the import operation. + # @!attribute [rw] if_exists + # @return [::Google::Protobuf::BoolValue] + # Optional. Option to include an IF EXISTS SQL statement with each DROP + # statement produced by clean. + class PostgresExportOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Options for exporting BAK files (SQL Server-only) + # @!attribute [rw] striped + # @return [::Google::Protobuf::BoolValue] + # Whether or not the export should be striped. + # @!attribute [rw] stripe_count + # @return [::Google::Protobuf::Int32Value] + # 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. + # @!attribute [rw] bak_type + # @return [::Google::Cloud::Sql::V1::BakType] + # Type of this bak file will be export, FULL or DIFF, SQL Server only + # @!attribute [rw] copy_only + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Protobuf::BoolValue] + # Deprecated: copy_only is deprecated. Use differential_base instead + # @!attribute [rw] differential_base + # @return [::Google::Protobuf::BoolValue] + # Whether or not the backup can be used as a differential base + # copy_only backup can not be served as differential base + # @!attribute [rw] export_log_start_time + # @return [::Google::Protobuf::Timestamp] + # 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. + # @!attribute [rw] export_log_end_time + # @return [::Google::Protobuf::Timestamp] + # 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. + class SqlBakExportOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] certificate_path + # @return [::String] + # 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. + # @!attribute [rw] private_key_path + # @return [::String] + # 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. + # @!attribute [rw] private_key_password + # @return [::String] + # Required. Password that encrypts the private key. + # @!attribute [rw] name + # @return [::String] + # Required. Certificate name. + # Applicable only for SQL Server instances. + class SqlTdeExportOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Database instance import context. + # @!attribute [rw] uri + # @return [::String] + # 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. + # @!attribute [rw] database + # @return [::String] + # 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. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#importContext`. + # @!attribute [rw] file_type + # @return [::Google::Cloud::Sql::V1::SqlFileType] + # The file type for the specified uri.\`SQL`: The file + # contains SQL statements. \`CSV`: The file contains CSV data. + # @!attribute [rw] csv_import_options + # @return [::Google::Cloud::Sql::V1::ImportContext::SqlCsvImportOptions] + # Options for importing data as CSV. + # @!attribute [rw] import_user + # @return [::String] + # The PostgreSQL user for this import operation. PostgreSQL instances only. + # @!attribute [rw] bak_import_options + # @return [::Google::Cloud::Sql::V1::ImportContext::SqlBakImportOptions] + # Import parameters specific to SQL Server .BAK files + # @!attribute [rw] sql_import_options + # @return [::Google::Cloud::Sql::V1::ImportContext::SqlImportOptions] + # Optional. Options for importing data from SQL statements. + # @!attribute [rw] tde_import_options + # @return [::Google::Cloud::Sql::V1::ImportContext::SqlTdeImportOptions] + # Optional. Import parameters specific to SQL Server TDE certificates + class ImportContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] threads + # @return [::Google::Protobuf::Int32Value] + # Optional. The number of threads to use for parallel import. + # @!attribute [rw] parallel + # @return [::Google::Protobuf::BoolValue] + # Optional. Whether or not the import should be parallel. + # @!attribute [rw] postgres_import_options + # @return [::Google::Cloud::Sql::V1::ImportContext::SqlImportOptions::PostgresImportOptions] + # Optional. Options for importing from a Cloud SQL for PostgreSQL instance. + class SqlImportOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] clean + # @return [::Google::Protobuf::BoolValue] + # Optional. The --clean flag for the pg_restore utility. This flag + # applies only if you enabled Cloud SQL to import files in parallel. + # @!attribute [rw] if_exists + # @return [::Google::Protobuf::BoolValue] + # Optional. The --if-exists flag for the pg_restore utility. This flag + # applies only if you enabled Cloud SQL to import files in parallel. + class PostgresImportOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # @!attribute [rw] table + # @return [::String] + # The table to which CSV data is imported. + # @!attribute [rw] columns + # @return [::Array<::String>] + # The columns to which CSV data is imported. If not specified, all columns + # of the database table are loaded with CSV data. + # @!attribute [rw] escape_character + # @return [::String] + # Specifies the character that should appear before a data character that + # needs to be escaped. + # @!attribute [rw] quote_character + # @return [::String] + # Specifies the quoting character to be used when a data value is quoted. + # @!attribute [rw] fields_terminated_by + # @return [::String] + # Specifies the character that separates columns within each row (line) of + # the file. + # @!attribute [rw] lines_terminated_by + # @return [::String] + # 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. + class SqlCsvImportOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] encryption_options + # @return [::Google::Cloud::Sql::V1::ImportContext::SqlBakImportOptions::EncryptionOptions] + # @!attribute [rw] striped + # @return [::Google::Protobuf::BoolValue] + # Whether or not the backup set being restored is striped. + # Applies only to Cloud SQL for SQL Server. + # @!attribute [rw] no_recovery + # @return [::Google::Protobuf::BoolValue] + # Whether or not the backup importing will restore database + # with NORECOVERY option. + # Applies only to Cloud SQL for SQL Server. + # @!attribute [rw] recovery_only + # @return [::Google::Protobuf::BoolValue] + # 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. + # @!attribute [rw] bak_type + # @return [::Google::Cloud::Sql::V1::BakType] + # Type of the bak content, FULL or DIFF + # @!attribute [rw] stop_at + # @return [::Google::Protobuf::Timestamp] + # 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. + # @!attribute [rw] stop_at_mark + # @return [::String] + # 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. + class SqlBakImportOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] cert_path + # @return [::String] + # 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. + # @!attribute [rw] pvk_path + # @return [::String] + # 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. + # @!attribute [rw] pvk_password + # @return [::String] + # Password that encrypts the private key + # @!attribute [rw] keep_encrypted + # @return [::Google::Protobuf::BoolValue] + # Optional. Whether the imported file remains encrypted. + class EncryptionOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # @!attribute [rw] certificate_path + # @return [::String] + # 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. + # @!attribute [rw] private_key_path + # @return [::String] + # 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. + # @!attribute [rw] private_key_password + # @return [::String] + # Required. Password that encrypts the private key. + # @!attribute [rw] name + # @return [::String] + # Required. Certificate name. + # Applicable only for SQL Server instances. + class SqlTdeImportOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # IP Management configuration. + # @!attribute [rw] ipv4_enabled + # @return [::Google::Protobuf::BoolValue] + # Whether the instance is assigned a public IP address or not. + # @!attribute [rw] private_network + # @return [::String] + # 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. + # @!attribute [rw] require_ssl + # @return [::Google::Protobuf::BoolValue] + # 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. + # @!attribute [rw] authorized_networks + # @return [::Array<::Google::Cloud::Sql::V1::AclEntry>] + # 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`). + # @!attribute [rw] allocated_ip_range + # @return [::String] + # 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])?.` + # @!attribute [rw] enable_private_path_for_google_cloud_services + # @return [::Google::Protobuf::BoolValue] + # Controls connectivity to private IP instances from Google services, + # such as BigQuery. + # @!attribute [rw] ssl_mode + # @return [::Google::Cloud::Sql::V1::IpConfiguration::SslMode] + # 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. + # @!attribute [rw] psc_config + # @return [::Google::Cloud::Sql::V1::PscConfig] + # PSC settings for this instance. + # @!attribute [rw] server_ca_mode + # @return [::Google::Cloud::Sql::V1::IpConfiguration::CaMode] + # Specify what type of CA is used for the server certificate. + # @!attribute [rw] custom_subject_alternative_names + # @return [::Array<::String>] + # Optional. Custom Subject Alternative Name(SAN)s for a Cloud SQL instance. + # @!attribute [rw] server_ca_pool + # @return [::String] + # 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} + # @!attribute [rw] server_certificate_rotation_mode + # @return [::Google::Cloud::Sql::V1::IpConfiguration::ServerCertificateRotationMode] + # 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. + class IpConfiguration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The SSL options for database connections. + module 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 + end + + # Various Certificate Authority (CA) modes for certificate signing. + module 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 + end + + # Settings for automatic server certificate rotation. + module 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 + end + end + + # PSC settings for a Cloud SQL instance. + # @!attribute [rw] psc_enabled + # @return [::Boolean] + # Whether PSC connectivity is enabled for this instance. + # @!attribute [rw] allowed_consumer_projects + # @return [::Array<::String>] + # 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). + # @!attribute [rw] psc_auto_connections + # @return [::Array<::Google::Cloud::Sql::V1::PscAutoConnectionConfig>] + # Optional. The list of settings for requested Private Service Connect + # consumer endpoints that can be used to connect to this Cloud SQL instance. + # @!attribute [rw] network_attachment_uri + # @return [::String] + # 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 + # @!attribute [rw] psc_auto_dns_enabled + # @return [::Boolean] + # 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. + # @!attribute [rw] psc_write_endpoint_dns_enabled + # @return [::Boolean] + # 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. + class PscConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for an automatically-setup Private Service Connect consumer endpoint + # that is used to connect to a Cloud SQL instance. + # @!attribute [rw] consumer_project + # @return [::String] + # 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. + # @!attribute [rw] consumer_network + # @return [::String] + # 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. + # @!attribute [rw] ip_address + # @return [::String] + # The IP address of the consumer endpoint. + # @!attribute [rw] status + # @return [::String] + # The connection status of the consumer endpoint. + # @!attribute [rw] consumer_network_status + # @return [::String] + # The connection policy status of the consumer network. + class PscAutoConnectionConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # 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. + # @!attribute [rw] follow_gae_application + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::String] + # 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. + # @!attribute [rw] zone + # @return [::String] + # The preferred Compute Engine zone (for example: us-central1-a, + # us-central1-b, etc.). WARNING: Changing this might restart the instance. + # @!attribute [rw] secondary_zone + # @return [::String] + # 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'. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#locationPreference`. + class LocationPreference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Maintenance window. This specifies when a Cloud SQL instance is + # restarted for system maintenance purposes. + # @!attribute [rw] hour + # @return [::Google::Protobuf::Int32Value] + # Hour of day - 0 to 23. Specify in the UTC time zone. + # @!attribute [rw] day + # @return [::Google::Protobuf::Int32Value] + # 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. + # @!attribute [rw] update_track + # @return [::Google::Cloud::Sql::V1::SqlUpdateTrack] + # 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). + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#maintenanceWindow`. + class MaintenanceWindow + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Deny maintenance Periods. This specifies a date range during when all CSA + # rollout will be denied. + # @!attribute [rw] start_date + # @return [::String] + # "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 + # @!attribute [rw] end_date + # @return [::String] + # "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 + # @!attribute [rw] time + # @return [::String] + # 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 + class DenyMaintenancePeriod + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Insights configuration. This specifies when Cloud SQL Insights feature is + # enabled and optional configuration. + # @!attribute [rw] query_insights_enabled + # @return [::Boolean] + # Whether Query Insights feature is enabled. + # @!attribute [rw] record_client_address + # @return [::Boolean] + # Whether Query Insights will record client address when enabled. + # @!attribute [rw] record_application_tags + # @return [::Boolean] + # Whether Query Insights will record application tags from query when + # enabled. + # @!attribute [rw] query_string_length + # @return [::Google::Protobuf::Int32Value] + # 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. + # @!attribute [rw] query_plans_per_minute + # @return [::Google::Protobuf::Int32Value] + # Number of query execution plans captured by Insights per minute + # for all queries combined. Default is 5. + # @!attribute [rw] enhanced_query_insights_enabled + # @return [::Google::Protobuf::BoolValue] + # Optional. Whether enhanced query insights feature is enabled. + class InsightsConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Read-replica configuration specific to MySQL databases. + # @!attribute [rw] dump_file_path + # @return [::String] + # 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. + # @!attribute [rw] username + # @return [::String] + # The username for the replication connection. + # @!attribute [rw] password + # @return [::String] + # The password for the replication connection. + # @!attribute [rw] connect_retry_interval + # @return [::Google::Protobuf::Int32Value] + # Seconds to wait between connect retries. MySQL's default is 60 seconds. + # @!attribute [rw] master_heartbeat_period + # @return [::Google::Protobuf::Int64Value] + # Interval in milliseconds between replication heartbeats. + # @!attribute [rw] ca_certificate + # @return [::String] + # PEM representation of the trusted CA's x509 certificate. + # @!attribute [rw] client_certificate + # @return [::String] + # PEM representation of the replica's x509 certificate. + # @!attribute [rw] client_key + # @return [::String] + # PEM representation of the replica's private key. The corresponding public + # key is encoded in the client's certificate. + # @!attribute [rw] ssl_cipher + # @return [::String] + # A list of permissible ciphers to use for SSL encryption. + # @!attribute [rw] verify_server_certificate + # @return [::Google::Protobuf::BoolValue] + # Whether or not to check the primary instance's Common Name value in the + # certificate that it sends during the SSL handshake. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#mysqlReplicaConfiguration`. + class MySqlReplicaConfiguration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Disk encryption configuration for an instance. + # @!attribute [rw] kms_key_name + # @return [::String] + # Resource name of KMS key for disk encryption + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#diskEncryptionConfiguration`. + class DiskEncryptionConfiguration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Disk encryption status for an instance. + # @!attribute [rw] kms_key_version_name + # @return [::String] + # KMS key version used to encrypt the Cloud SQL instance resource + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#diskEncryptionStatus`. + class DiskEncryptionStatus + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database instance IP mapping + # @!attribute [rw] type + # @return [::Google::Cloud::Sql::V1::SqlIpAddressType] + # 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. + # @!attribute [rw] ip_address + # @return [::String] + # The IP address assigned. + # @!attribute [rw] time_to_retire + # @return [::Google::Protobuf::Timestamp] + # 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. + class IpMapping + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The sub operation type based on the operation type. + # @!attribute [rw] maintenance_type + # @return [::Google::Cloud::Sql::V1::SqlMaintenanceType] + # The type of maintenance to be performed on the instance. + class SqlSubOperationType + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # An Operation resource. For successful operations that return an + # Operation resource, only the fields relevant to the operation are populated + # in the resource. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#operation`. + # @!attribute [rw] target_link + # @return [::String] + # @!attribute [rw] status + # @return [::Google::Cloud::Sql::V1::Operation::SqlOperationStatus] + # The status of an operation. + # @!attribute [rw] user + # @return [::String] + # The email address of the user who initiated this operation. + # @!attribute [rw] insert_time + # @return [::Google::Protobuf::Timestamp] + # 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`. + # @!attribute [rw] start_time + # @return [::Google::Protobuf::Timestamp] + # 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`. + # @!attribute [rw] end_time + # @return [::Google::Protobuf::Timestamp] + # 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`. + # @!attribute [rw] error + # @return [::Google::Cloud::Sql::V1::OperationErrors] + # If errors occurred during processing of this operation, this field will be + # populated. + # @!attribute [rw] api_warning + # @return [::Google::Cloud::Sql::V1::ApiWarning] + # An Admin API warning message. + # @!attribute [rw] operation_type + # @return [::Google::Cloud::Sql::V1::Operation::SqlOperationType] + # 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` + # @!attribute [rw] import_context + # @return [::Google::Cloud::Sql::V1::ImportContext] + # The context for import operation, if applicable. + # @!attribute [rw] export_context + # @return [::Google::Cloud::Sql::V1::ExportContext] + # The context for export operation, if applicable. + # @!attribute [rw] backup_context + # @return [::Google::Cloud::Sql::V1::BackupContext] + # The context for backup operation, if applicable. + # @!attribute [rw] pre_check_major_version_upgrade_context + # @return [::Google::Cloud::Sql::V1::PreCheckMajorVersionUpgradeContext] + # 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). + # @!attribute [rw] name + # @return [::String] + # An identifier that uniquely identifies the operation. You can use this + # identifier to retrieve the Operations resource that has information about + # the operation. + # @!attribute [rw] target_id + # @return [::String] + # Name of the resource on which this operation runs. + # @!attribute [rw] self_link + # @return [::String] + # The URI of this resource. + # @!attribute [rw] target_project + # @return [::String] + # The project ID of the target instance related to this operation. + # @!attribute [rw] acquire_ssrs_lease_context + # @return [::Google::Cloud::Sql::V1::AcquireSsrsLeaseContext] + # The context for acquire SSRS lease operation, if applicable. + # @!attribute [rw] sub_operation_type + # @return [::Google::Cloud::Sql::V1::SqlSubOperationType] + # Optional. The sub operation based on the operation type. + class Operation + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The type of Cloud SQL operation. + module 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 + + SNAPSHOT = 8 + + # 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 + + DEFER_MAINTENANCE = 32 + + # Creates clone instance. + CREATE_CLONE = 33 + + # 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 + + # 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 + + # 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 + + # 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 + end + + # The status of an operation. + module 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 + end + end + + # Database instance operation error. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#operationError`. + # @!attribute [rw] code + # @return [::String] + # Identifies the specific error that occurred. + # @!attribute [rw] message + # @return [::String] + # Additional information about the error encountered. + class OperationError + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database instance operation errors list wrapper. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#operationErrors`. + # @!attribute [rw] errors + # @return [::Array<::Google::Cloud::Sql::V1::OperationError>] + # The list of errors encountered while processing this operation. + class OperationErrors + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # 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. + # @!attribute [rw] min_length + # @return [::Google::Protobuf::Int32Value] + # Minimum number of characters allowed. + # @!attribute [rw] complexity + # @return [::Google::Cloud::Sql::V1::PasswordValidationPolicy::Complexity] + # The complexity of the password. + # @!attribute [rw] reuse_interval + # @return [::Google::Protobuf::Int32Value] + # Number of previous passwords that cannot be reused. + # @!attribute [rw] disallow_username_substring + # @return [::Google::Protobuf::BoolValue] + # Disallow username as a part of the password. + # @!attribute [rw] password_change_interval + # @return [::Google::Protobuf::Duration] + # Minimum interval after which the password can be changed. This flag is only + # supported for PostgreSQL. + # @!attribute [rw] enable_password_policy + # @return [::Google::Protobuf::BoolValue] + # 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. + # @!attribute [rw] disallow_compromised_credentials + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Protobuf::BoolValue] + # This field is deprecated and will be removed in a future version of the + # API. + class PasswordValidationPolicy + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The complexity choices of the password. + module Complexity + # Complexity check is not specified. + COMPLEXITY_UNSPECIFIED = 0 + + # A combination of lowercase, uppercase, numeric, and non-alphanumeric + # characters. + COMPLEXITY_DEFAULT = 1 + end + end + + # Data cache configurations. + # @!attribute [rw] data_cache_enabled + # @return [::Boolean] + # Whether data cache is enabled for the instance. + class DataCacheConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Config used to determine the final backup settings for the instance. + # @!attribute [rw] enabled + # @return [::Boolean] + # Whether the final backup is enabled for the instance. + # @!attribute [rw] retention_days + # @return [::Integer] + # 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). + class FinalBackupConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Database instance settings. + # @!attribute [rw] settings_version + # @return [::Google::Protobuf::Int64Value] + # 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. + # @!attribute [rw] authorized_gae_applications + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Array<::String>] + # The App Engine app IDs that can access this instance. + # (Deprecated) Applied to First Generation instances only. + # @!attribute [rw] tier + # @return [::String] + # The tier (or machine type) for this instance, for example + # `db-custom-1-3840`. WARNING: Changing this restarts the instance. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#settings`. + # @!attribute [rw] user_labels + # @return [::Google::Protobuf::Map{::String => ::String}] + # User-provided labels, represented as a dictionary where each label is a + # single key value pair. + # @!attribute [rw] availability_type + # @return [::Google::Cloud::Sql::V1::SqlAvailabilityType] + # 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). + # @!attribute [rw] pricing_plan + # @return [::Google::Cloud::Sql::V1::SqlPricingPlan] + # The pricing plan for this instance. This can be either `PER_USE` or + # `PACKAGE`. Only `PER_USE` is supported for Second Generation instances. + # @!attribute [rw] replication_type + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Cloud::Sql::V1::SqlReplicationType] + # The type of replication this instance uses. This can be either + # `ASYNCHRONOUS` or `SYNCHRONOUS`. (Deprecated) This property was only + # applicable to First Generation instances. + # @!attribute [rw] storage_auto_resize_limit + # @return [::Google::Protobuf::Int64Value] + # The maximum size to which storage capacity can be automatically increased. + # The default value is 0, which specifies that there is no limit. + # @!attribute [rw] activation_policy + # @return [::Google::Cloud::Sql::V1::Settings::SqlActivationPolicy] + # 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. + # @!attribute [rw] ip_configuration + # @return [::Google::Cloud::Sql::V1::IpConfiguration] + # 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. + # @!attribute [rw] storage_auto_resize + # @return [::Google::Protobuf::BoolValue] + # Configuration to increase storage size automatically. The default value is + # true. + # @!attribute [rw] location_preference + # @return [::Google::Cloud::Sql::V1::LocationPreference] + # 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. + # @!attribute [rw] database_flags + # @return [::Array<::Google::Cloud::Sql::V1::DatabaseFlags>] + # The database flags passed to the instance at startup. + # @!attribute [rw] data_disk_type + # @return [::Google::Cloud::Sql::V1::SqlDataDiskType] + # The type of data disk: `PD_SSD` (default) or `PD_HDD`. Not used for + # First Generation instances. + # @!attribute [rw] maintenance_window + # @return [::Google::Cloud::Sql::V1::MaintenanceWindow] + # The maintenance window for this instance. This specifies when the instance + # can be restarted for maintenance purposes. + # @!attribute [rw] backup_configuration + # @return [::Google::Cloud::Sql::V1::BackupConfiguration] + # The daily backup configuration for the instance. + # @!attribute [rw] database_replication_enabled + # @return [::Google::Protobuf::BoolValue] + # Configuration specific to read replica instances. Indicates whether + # replication is enabled or not. WARNING: Changing this restarts the + # instance. + # @!attribute [rw] crash_safe_replication_enabled + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Protobuf::BoolValue] + # 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. + # @!attribute [rw] data_disk_size_gb + # @return [::Google::Protobuf::Int64Value] + # The size of data disk, in GB. The data disk size minimum is 10GB. + # @!attribute [rw] active_directory_config + # @return [::Google::Cloud::Sql::V1::SqlActiveDirectoryConfig] + # Active Directory configuration, relevant only for Cloud SQL for SQL Server. + # @!attribute [rw] collation + # @return [::String] + # The name of server Instance collation. + # @!attribute [rw] deny_maintenance_periods + # @return [::Array<::Google::Cloud::Sql::V1::DenyMaintenancePeriod>] + # Deny maintenance periods + # @!attribute [rw] insights_config + # @return [::Google::Cloud::Sql::V1::InsightsConfig] + # Insights configuration, for now relevant only for Postgres. + # @!attribute [rw] password_validation_policy + # @return [::Google::Cloud::Sql::V1::PasswordValidationPolicy] + # The local user password validation policy of the instance. + # @!attribute [rw] sql_server_audit_config + # @return [::Google::Cloud::Sql::V1::SqlServerAuditConfig] + # SQL Server specific audit configuration. + # @!attribute [rw] edition + # @return [::Google::Cloud::Sql::V1::Settings::Edition] + # Optional. The edition of the instance. + # @!attribute [rw] connector_enforcement + # @return [::Google::Cloud::Sql::V1::Settings::ConnectorEnforcement] + # 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. + # @!attribute [rw] deletion_protection_enabled + # @return [::Google::Protobuf::BoolValue] + # Configuration to protect against accidental instance deletion. + # @!attribute [rw] time_zone + # @return [::String] + # Server timezone, relevant only for Cloud SQL for SQL Server. + # @!attribute [rw] advanced_machine_features + # @return [::Google::Cloud::Sql::V1::AdvancedMachineFeatures] + # Specifies advanced machine configuration for the instances relevant only + # for SQL Server. + # @!attribute [rw] data_cache_config + # @return [::Google::Cloud::Sql::V1::DataCacheConfig] + # Configuration for data cache. + # @!attribute [rw] replication_lag_max_seconds + # @return [::Google::Protobuf::Int32Value] + # Optional. Configuration value for recreation of replica after certain + # replication lag + # @!attribute [rw] enable_google_ml_integration + # @return [::Google::Protobuf::BoolValue] + # 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. + # @!attribute [rw] enable_dataplex_integration + # @return [::Google::Protobuf::BoolValue] + # 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. + # @!attribute [rw] retain_backups_on_delete + # @return [::Google::Protobuf::BoolValue] + # 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. + # @!attribute [rw] data_disk_provisioned_iops + # @return [::Integer] + # Optional. Provisioned number of I/O operations per second for the data + # disk. This field is only used for hyperdisk-balanced disk types. + # @!attribute [rw] data_disk_provisioned_throughput + # @return [::Integer] + # Optional. Provisioned throughput measured in MiB per second for the data + # disk. This field is only used for hyperdisk-balanced disk types. + # @!attribute [rw] connection_pool_config + # @return [::Google::Cloud::Sql::V1::ConnectionPoolConfig] + # Optional. The managed connection pooling configuration for the instance. + # @!attribute [rw] final_backup_config + # @return [::Google::Cloud::Sql::V1::FinalBackupConfig] + # Optional. The final backup configuration for the instance. + # @!attribute [rw] read_pool_auto_scale_config + # @return [::Google::Cloud::Sql::V1::ReadPoolAutoScaleConfig] + # Optional. The read pool auto-scale configuration for the instance. + # @!attribute [rw] accelerated_replica_mode + # @return [::Google::Protobuf::BoolValue] + # Optional. Whether the replica is in accelerated mode. This feature is in + # private preview and requires allowlisting to take effect. + # @!attribute [rw] auto_upgrade_enabled + # @return [::Boolean] + # 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. + # @!attribute [rw] entraid_config + # @return [::Google::Cloud::Sql::V1::SqlServerEntraIdConfig] + # Optional. The Microsoft Entra ID configuration for the SQL Server instance. + # @!attribute [rw] data_api_access + # @return [::Google::Cloud::Sql::V1::Settings::DataApiAccess] + # This parameter controls whether to allow using ExecuteSql API to connect to + # the instance. Not allowed by default. + # @!attribute [rw] performance_capture_config + # @return [::Google::Cloud::Sql::V1::PerformanceCaptureConfig] + # Optional. Configuration for Performance Capture, provides diagnostic + # metrics during high load situations. + class Settings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class UserLabelsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Specifies when the instance is activated. + module 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 + end + + # The edition of the instance. + module 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 + end + + # The options for enforcing Cloud SQL connectors in the instance. + module 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 + end + + # ExecuteSql API's access to the instance. + module 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 + end + end + + # Performance capture configuration. + # @!attribute [rw] enabled + # @return [::Boolean] + # Optional. Enables or disables the performance capture feature. + # @!attribute [rw] probing_interval_seconds + # @return [::Integer] + # Optional. Specifies the interval in seconds between consecutive probes that + # check if any trigger condition thresholds have been reached. + # @!attribute [rw] probe_threshold + # @return [::Integer] + # Optional. Specifies the minimum number of consecutive probe threshold that + # triggers performance capture. + # @!attribute [rw] running_threads_threshold + # @return [::Integer] + # Optional. Specifies the minimum number of MySQL `Threads_running` to + # trigger the performance capture on the primary instance. + # @!attribute [rw] seconds_behind_source_threshold + # @return [::Integer] + # Optional. Specifies the minimum number of seconds replica must be lagging + # behind primary instance to trigger the performance capture on replica. + # @!attribute [rw] transaction_duration_threshold + # @return [::Integer] + # Optional. Specifies the amount of time in seconds that a transaction needs + # to have been open before the watcher starts recording it. + class PerformanceCaptureConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Connection pool flags for Cloud SQL instances managed connection pool + # configuration. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the flag. + # @!attribute [rw] value + # @return [::String] + # 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. + class ConnectionPoolFlags + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The managed connection pooling configuration. + # @!attribute [rw] connection_pooling_enabled + # @return [::Boolean] + # Whether managed connection pooling is enabled. + # @!attribute [rw] flags + # @return [::Array<::Google::Cloud::Sql::V1::ConnectionPoolFlags>] + # Optional. List of connection pool configuration flags. + # @!attribute [r] pooler_count + # @return [::Integer] + # Output only. Number of connection poolers. + class ConnectionPoolConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The read pool auto-scale configuration. + # @!attribute [rw] enabled + # @return [::Boolean] + # Indicates whether read pool auto scaling is enabled. + # @!attribute [rw] min_node_count + # @return [::Integer] + # Minimum number of read pool nodes to be maintained. + # @!attribute [rw] max_node_count + # @return [::Integer] + # Maximum number of read pool nodes to be maintained. + # @!attribute [rw] target_metrics + # @return [::Array<::Google::Cloud::Sql::V1::ReadPoolAutoScaleConfig::TargetMetric>] + # Optional. Target metrics for read pool auto scaling. + # @!attribute [rw] disable_scale_in + # @return [::Boolean] + # Indicates whether read pool auto scaling supports scale in operations + # (removing nodes). + # @!attribute [rw] scale_in_cooldown_seconds + # @return [::Integer] + # The cooldown period for scale-in operations. + # @!attribute [rw] scale_out_cooldown_seconds + # @return [::Integer] + # The cooldown period for scale-out operations. + class ReadPoolAutoScaleConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Target metric for read pool auto scaling. + # @!attribute [rw] metric + # @return [::String] + # The metric name to be used for auto scaling. + # @!attribute [rw] target_value + # @return [::Float] + # The target value for the metric. + class TargetMetric + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Specifies options for controlling advanced machine features. + # @!attribute [rw] threads_per_core + # @return [::Integer] + # The number of threads per physical core. + class AdvancedMachineFeatures + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # SslCerts Resource + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#sslCert`. + # @!attribute [rw] cert_serial_number + # @return [::String] + # Serial number, as extracted from the certificate. + # @!attribute [rw] cert + # @return [::String] + # PEM representation. + # @!attribute [rw] create_time + # @return [::Google::Protobuf::Timestamp] + # 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` + # @!attribute [rw] common_name + # @return [::String] + # User supplied name. Constrained to [a-zA-Z.-_ ]+. + # @!attribute [rw] expiration_time + # @return [::Google::Protobuf::Timestamp] + # The time when the certificate expires in [RFC + # 3339](https://tools.ietf.org/html/rfc3339) format, for example + # `2012-11-15T16:19:00.094Z`. + # @!attribute [rw] sha1_fingerprint + # @return [::String] + # Sha1 Fingerprint. + # @!attribute [rw] instance + # @return [::String] + # Name of the database instance. + # @!attribute [rw] self_link + # @return [::String] + # The URI of this resource. + class SslCert + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # SslCertDetail. + # @!attribute [rw] cert_info + # @return [::Google::Cloud::Sql::V1::SslCert] + # The public information about the cert. + # @!attribute [rw] cert_private_key + # @return [::String] + # The private key for the client cert, in pem format. Keep private in order + # to protect your security. + class SslCertDetail + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Active Directory configuration, relevant only for Cloud SQL for SQL Server. + # @!attribute [rw] kind + # @return [::String] + # This is always sql#activeDirectoryConfig. + # @!attribute [rw] domain + # @return [::String] + # The name of the domain (e.g., mydomain.com). + # @!attribute [rw] mode + # @return [::Google::Cloud::Sql::V1::SqlActiveDirectoryConfig::ActiveDirectoryMode] + # Optional. The mode of the Active Directory configuration. + # @!attribute [rw] dns_servers + # @return [::Array<::String>] + # Optional. Domain controller IPv4 addresses used to bootstrap Active + # Directory. + # @!attribute [rw] admin_credential_secret_name + # @return [::String] + # Optional. The secret manager key storing the administrator credential. + # (e.g., projects/\\{project}/secrets/\\{secret}). + # @!attribute [rw] organizational_unit + # @return [::String] + # Optional. The organizational unit distinguished name. This is the full + # hierarchical path to the organizational unit. + class SqlActiveDirectoryConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The modes of Active Directory configuration. + module 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 + + # Customer-managed Active Directory mode. + CUSTOMER_MANAGED_ACTIVE_DIRECTORY = 3 + end + end + + # SQL Server specific audit configuration. + # @!attribute [rw] kind + # @return [::String] + # This is always sql#sqlServerAuditConfig + # @!attribute [rw] bucket + # @return [::String] + # The name of the destination bucket (e.g., gs://mybucket). + # @!attribute [rw] retention_interval + # @return [::Google::Protobuf::Duration] + # How long to keep generated audit files. + # @!attribute [rw] upload_interval + # @return [::Google::Protobuf::Duration] + # How often to upload generated audit files. + class SqlServerAuditConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # SQL Server Entra ID configuration. + # @!attribute [r] kind + # @return [::String] + # Output only. This is always sql#sqlServerEntraIdConfig + # @!attribute [rw] tenant_id + # @return [::String] + # Optional. The tenant ID for the Entra ID configuration. + # @!attribute [rw] application_id + # @return [::String] + # Optional. The application ID for the Entra ID configuration. + class SqlServerEntraIdConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Acquire SSRS lease context. + # @!attribute [rw] setup_login + # @return [::String] + # The username to be used as the setup login to connect to the database + # server for SSRS setup. + # @!attribute [rw] service_login + # @return [::String] + # The username to be used as the service login to connect to the report + # database for SSRS setup. + # @!attribute [rw] report_database + # @return [::String] + # The report database to be used for SSRS setup. + # @!attribute [rw] duration + # @return [::Google::Protobuf::Duration] + # Lease duration needed for SSRS setup. + class AcquireSsrsLeaseContext + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # DNS metadata. + # @!attribute [r] name + # @return [::String] + # Output only. The DNS name. + # @!attribute [r] connection_type + # @return [::Google::Cloud::Sql::V1::DnsNameMapping::ConnectionType] + # Output only. The connection type of the DNS name. + # @!attribute [r] dns_scope + # @return [::Google::Cloud::Sql::V1::DnsNameMapping::DnsScope] + # Output only. The scope that the DNS name applies to. + # @!attribute [r] record_manager + # @return [::Google::Cloud::Sql::V1::DnsNameMapping::RecordManager] + # Output only. The manager for this DNS record. + class DnsNameMapping + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The connection type of the DNS name. + # This enum is not frozen, and new values may be added in the future. + module 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 + end + + # The scope that the DNS name applies to. + module 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 + end + + # The system responsible for managing the DNS record. + module 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 + end + end + + module 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 + end + + module BakType + # Default type. + BAK_TYPE_UNSPECIFIED = 0 + + # Full backup. + FULL = 1 + + # Differential backup. + DIFF = 2 + + # Transaction Log backup + TLOG = 3 + end + + # The type of maintenance to be performed on the instance. + module 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 + end + + module SqlBackendType + # This is an unknown backend type for instance. + SQL_BACKEND_TYPE_UNSPECIFIED = 0 + + # V1 speckle instance. + FIRST_GEN = 1 + + # V2 speckle instance. + SECOND_GEN = 2 + + # On premises instance. + EXTERNAL = 3 + end + + module 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 + end + + # The database engine type and version. + module SqlDatabaseVersion + # This is an unknown database version. + SQL_DATABASE_VERSION_UNSPECIFIED = 0 + + # The database version is MySQL 5.1. + MYSQL_5_1 = 2 + + # The database version is MySQL 5.5. + MYSQL_5_5 = 3 + + # 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 + + # 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 + end + + # The pricing plan for this instance. + module 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 + end + + module 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 + end + + # The type of disk that is used for a v2 instance to use. + module 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 + + # A Hyperdisk Balanced data disk. + HYPERDISK_BALANCED = 4 + end + + # The availability type of the given Cloud SQL instance. + module SqlAvailabilityType + # This is an unknown Availability type. + SQL_AVAILABILITY_TYPE_UNSPECIFIED = 0 + + # Zonal available instance. + ZONAL = 1 + + # Regional available instance. + REGIONAL = 2 + end + + module 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). + + # 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). + + # 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. + 3 + end + end + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_ssl_certs.rb b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_ssl_certs.rb new file mode 100644 index 000000000000..e959307281bd --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_ssl_certs.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] sha1_fingerprint + # @return [::String] + # Sha1 FingerPrint. + class SqlSslCertsDeleteRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] sha1_fingerprint + # @return [::String] + # Sha1 FingerPrint. + class SqlSslCertsGetRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::SslCertsInsertRequest] + class SqlSslCertsInsertRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] instance + # @return [::String] + # Cloud SQL instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlSslCertsListRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # SslCerts insert request. + # @!attribute [rw] common_name + # @return [::String] + # User supplied name. Must be a distinct name from the other certificates + # for this instance. + class SslCertsInsertRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # SslCert insert response. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#sslCertsInsert`. + # @!attribute [rw] operation + # @return [::Google::Cloud::Sql::V1::Operation] + # The operation to track the ssl certs insert request. + # @!attribute [rw] server_ca_cert + # @return [::Google::Cloud::Sql::V1::SslCert] + # 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. + # @!attribute [rw] client_cert + # @return [::Google::Cloud::Sql::V1::SslCertDetail] + # The new client certificate and private key. + class SslCertsInsertResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # SslCerts list response. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#sslCertsList`. + # @!attribute [rw] items + # @return [::Array<::Google::Cloud::Sql::V1::SslCert>] + # List of client certificates for the instance. + class SslCertsListResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_tiers.rb b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_tiers.rb new file mode 100644 index 000000000000..2db840c5d13d --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_tiers.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + # Tiers list request. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project for which to list tiers. + class SqlTiersListRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Tiers list response. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#tiersList`. + # @!attribute [rw] items + # @return [::Array<::Google::Cloud::Sql::V1::Tier>] + # List of tiers. + class TiersListResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A Google Cloud SQL service tier resource. + # @!attribute [rw] tier + # @return [::String] + # An identifier for the machine type, for example, `db-custom-1-3840`. For + # related information, see [Pricing](/sql/pricing). + # @!attribute [rw] RAM + # @return [::Integer] + # The maximum RAM usage of this tier in bytes. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#tier`. + # @!attribute [rw] Disk_Quota + # @return [::Integer] + # The maximum disk size of this tier in bytes. + # @!attribute [rw] region + # @return [::Array<::String>] + # The applicable regions for this tier. + class Tier + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_users.rb b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_users.rb new file mode 100644 index 000000000000..2e94011a95d9 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/cloud/sql/v1/cloud_sql_users.rb @@ -0,0 +1,291 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Sql + module V1 + # @!attribute [rw] host + # @return [::String] + # Host of the user in the instance. + # @!attribute [rw] instance + # @return [::String] + # Database instance ID. This does not include the project ID. + # @!attribute [rw] name + # @return [::String] + # Name of the user in the instance. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlUsersDeleteRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for Users Get RPC + # @!attribute [rw] instance + # @return [::String] + # Database instance ID. This does not include the project ID. + # @!attribute [rw] name + # @return [::String] + # User of the instance. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] host + # @return [::String] + # Host of a user of the instance. + class SqlUsersGetRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] instance + # @return [::String] + # Database instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::User] + class SqlUsersInsertRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] instance + # @return [::String] + # Database instance ID. This does not include the project ID. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + class SqlUsersListRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] host + # @return [::String] + # Optional. Host of the user in the instance. + # @!attribute [rw] instance + # @return [::String] + # Database instance ID. This does not include the project ID. + # @!attribute [rw] name + # @return [::String] + # Name of the user in the instance. + # @!attribute [rw] project + # @return [::String] + # Project ID of the project that contains the instance. + # @!attribute [rw] database_roles + # @return [::Array<::String>] + # Optional. List of database roles to grant to the user. body.database_roles + # will be ignored for update request. + # @!attribute [rw] revoke_existing_roles + # @return [::Boolean] + # 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. + # @!attribute [rw] body + # @return [::Google::Cloud::Sql::V1::User] + class SqlUsersUpdateRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # User level password validation policy. + # @!attribute [rw] allowed_failed_attempts + # @return [::Integer] + # Number of failed login attempts allowed before user get locked. + # @!attribute [rw] password_expiration_duration + # @return [::Google::Protobuf::Duration] + # Expiration duration after password is updated. + # @!attribute [rw] enable_failed_attempts_check + # @return [::Boolean] + # If true, failed login attempts check will be enabled. + # @!attribute [r] status + # @return [::Google::Cloud::Sql::V1::PasswordStatus] + # Output only. Read-only password status. + # @!attribute [rw] enable_password_verification + # @return [::Boolean] + # If true, the user must specify the current password before changing the + # password. This flag is supported only for MySQL. + class UserPasswordValidationPolicy + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Read-only password status. + # @!attribute [rw] locked + # @return [::Boolean] + # If true, user does not have login privileges. + # @!attribute [rw] password_expiration_time + # @return [::Google::Protobuf::Timestamp] + # The expiration time of the current password. + class PasswordStatus + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A Cloud SQL user resource. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#user`. + # @!attribute [rw] password + # @return [::String] + # The password for the user. + # @!attribute [rw] etag + # @return [::String] + # This field is deprecated and will be removed from a future version of the + # API. + # @!attribute [rw] name + # @return [::String] + # The name of the user in the Cloud SQL instance. Can be omitted for + # `update` because it is already specified in the URL. + # @!attribute [rw] host + # @return [::String] + # 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. + # @!attribute [rw] instance + # @return [::String] + # 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. + # @!attribute [rw] project + # @return [::String] + # 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. + # @!attribute [rw] type + # @return [::Google::Cloud::Sql::V1::User::SqlUserType] + # The user type. It determines the method to authenticate the user during + # login. The default is the database's built-in user type. + # @!attribute [rw] sqlserver_user_details + # @return [::Google::Cloud::Sql::V1::SqlServerUserDetails] + # @!attribute [rw] iam_email + # @return [::String] + # Optional. The full email for an IAM user. For normal database users, this + # will not be filled. Only applicable to MySQL database users. + # @!attribute [rw] password_policy + # @return [::Google::Cloud::Sql::V1::UserPasswordValidationPolicy] + # User level password validation policy. + # @!attribute [rw] dual_password_type + # @return [::Google::Cloud::Sql::V1::User::DualPasswordType] + # Dual password status for the user. + # @!attribute [rw] iam_status + # @return [::Google::Cloud::Sql::V1::User::IamStatus] + # Indicates if a group is active or inactive for IAM database authentication. + # @!attribute [rw] database_roles + # @return [::Array<::String>] + # Optional. Role memberships of the user + class User + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The user type. + module 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 + end + + # The type of retained password. + module 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 + end + + # Indicates if a group is available for IAM database authentication. + module 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 + end + end + + # Represents a Sql Server user on the Cloud SQL instance. + # @!attribute [rw] disabled + # @return [::Boolean] + # If the user has been disabled + # @!attribute [rw] server_roles + # @return [::Array<::String>] + # The server roles for this user + class SqlServerUserDetails + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # User list response. + # @!attribute [rw] kind + # @return [::String] + # This is always `sql#usersList`. + # @!attribute [rw] items + # @return [::Array<::Google::Cloud::Sql::V1::User>] + # List of user resources in the instance. + # @!attribute [rw] next_page_token + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::String] + # Unused. + class UsersListResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/protobuf/any.rb b/google-cloud-sql-v1/proto_docs/google/protobuf/any.rb new file mode 100644 index 000000000000..58691995f02e --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/protobuf/any.rb @@ -0,0 +1,145 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # `Any` contains an arbitrary serialized protocol buffer message along with a + # URL that describes the type of the serialized message. + # + # Protobuf library provides support to pack/unpack Any values in the form + # of utility functions or additional generated methods of the Any type. + # + # Example 1: Pack and unpack a message in C++. + # + # Foo foo = ...; + # Any any; + # any.PackFrom(foo); + # ... + # if (any.UnpackTo(&foo)) { + # ... + # } + # + # Example 2: Pack and unpack a message in Java. + # + # Foo foo = ...; + # Any any = Any.pack(foo); + # ... + # if (any.is(Foo.class)) { + # foo = any.unpack(Foo.class); + # } + # // or ... + # if (any.isSameTypeAs(Foo.getDefaultInstance())) { + # foo = any.unpack(Foo.getDefaultInstance()); + # } + # + # Example 3: Pack and unpack a message in Python. + # + # foo = Foo(...) + # any = Any() + # any.Pack(foo) + # ... + # if any.Is(Foo.DESCRIPTOR): + # any.Unpack(foo) + # ... + # + # Example 4: Pack and unpack a message in Go + # + # foo := &pb.Foo{...} + # any, err := anypb.New(foo) + # if err != nil { + # ... + # } + # ... + # foo := &pb.Foo{} + # if err := any.UnmarshalTo(foo); err != nil { + # ... + # } + # + # The pack methods provided by protobuf library will by default use + # 'type.googleapis.com/full.type.name' as the type URL and the unpack + # methods only use the fully qualified type name after the last '/' + # in the type URL, for example "foo.bar.com/x/y.z" will yield type + # name "y.z". + # + # JSON + # ==== + # The JSON representation of an `Any` value uses the regular + # representation of the deserialized, embedded message, with an + # additional field `@type` which contains the type URL. Example: + # + # package google.profile; + # message Person { + # string first_name = 1; + # string last_name = 2; + # } + # + # { + # "@type": "type.googleapis.com/google.profile.Person", + # "firstName": , + # "lastName": + # } + # + # If the embedded message type is well-known and has a custom JSON + # representation, that representation will be embedded adding a field + # `value` which holds the custom JSON in addition to the `@type` + # field. Example (for message [google.protobuf.Duration][]): + # + # { + # "@type": "type.googleapis.com/google.protobuf.Duration", + # "value": "1.212s" + # } + # @!attribute [rw] type_url + # @return [::String] + # A URL/resource name that uniquely identifies the type of the serialized + # protocol buffer message. This string must contain at least + # one "/" character. The last segment of the URL's path must represent + # the fully qualified name of the type (as in + # `path/google.protobuf.Duration`). The name should be in a canonical form + # (e.g., leading "." is not accepted). + # + # In practice, teams usually precompile into the binary all types that they + # expect it to use in the context of Any. However, for URLs which use the + # scheme `http`, `https`, or no scheme, one can optionally set up a type + # server that maps type URLs to message definitions as follows: + # + # * If no scheme is provided, `https` is assumed. + # * An HTTP GET on the URL must yield a [google.protobuf.Type][] + # value in binary format, or produce an error. + # * Applications are allowed to cache lookup results based on the + # URL, or have them precompiled into a binary to avoid any + # lookup. Therefore, binary compatibility needs to be preserved + # on changes to types. (Use versioned type names to manage + # breaking changes.) + # + # Note: this functionality is not currently available in the official + # protobuf release, and it is not used for type URLs beginning with + # type.googleapis.com. As of May 2023, there are no widely used type server + # implementations and no plans to implement one. + # + # Schemes other than `http`, `https` (or the empty scheme) might be + # used with implementation specific semantics. + # @!attribute [rw] value + # @return [::String] + # Must be a valid serialized protocol buffer of the above specified type. + class Any + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/protobuf/duration.rb b/google-cloud-sql-v1/proto_docs/google/protobuf/duration.rb new file mode 100644 index 000000000000..ea59f1f91daf --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/protobuf/duration.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A Duration represents a signed, fixed-length span of time represented + # as a count of seconds and fractions of seconds at nanosecond + # resolution. It is independent of any calendar and concepts like "day" + # or "month". It is related to Timestamp in that the difference between + # two Timestamp values is a Duration and it can be added or subtracted + # from a Timestamp. Range is approximately +-10,000 years. + # + # # Examples + # + # Example 1: Compute Duration from two Timestamps in pseudo code. + # + # Timestamp start = ...; + # Timestamp end = ...; + # Duration duration = ...; + # + # duration.seconds = end.seconds - start.seconds; + # duration.nanos = end.nanos - start.nanos; + # + # if (duration.seconds < 0 && duration.nanos > 0) { + # duration.seconds += 1; + # duration.nanos -= 1000000000; + # } else if (duration.seconds > 0 && duration.nanos < 0) { + # duration.seconds -= 1; + # duration.nanos += 1000000000; + # } + # + # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + # + # Timestamp start = ...; + # Duration duration = ...; + # Timestamp end = ...; + # + # end.seconds = start.seconds + duration.seconds; + # end.nanos = start.nanos + duration.nanos; + # + # if (end.nanos < 0) { + # end.seconds -= 1; + # end.nanos += 1000000000; + # } else if (end.nanos >= 1000000000) { + # end.seconds += 1; + # end.nanos -= 1000000000; + # } + # + # Example 3: Compute Duration from datetime.timedelta in Python. + # + # td = datetime.timedelta(days=3, minutes=10) + # duration = Duration() + # duration.FromTimedelta(td) + # + # # JSON Mapping + # + # In JSON format, the Duration type is encoded as a string rather than an + # object, where the string ends in the suffix "s" (indicating seconds) and + # is preceded by the number of seconds, with nanoseconds expressed as + # fractional seconds. For example, 3 seconds with 0 nanoseconds should be + # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + # be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + # microsecond should be expressed in JSON format as "3.000001s". + # @!attribute [rw] seconds + # @return [::Integer] + # Signed seconds of the span of time. Must be from -315,576,000,000 + # to +315,576,000,000 inclusive. Note: these bounds are computed from: + # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + # @!attribute [rw] nanos + # @return [::Integer] + # Signed fractions of a second at nanosecond resolution of the span + # of time. Durations less than one second are represented with a 0 + # `seconds` field and a positive or negative `nanos` field. For durations + # of one second or more, a non-zero value for the `nanos` field must be + # of the same sign as the `seconds` field. Must be from -999,999,999 + # to +999,999,999 inclusive. + class Duration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/protobuf/empty.rb b/google-cloud-sql-v1/proto_docs/google/protobuf/empty.rb new file mode 100644 index 000000000000..83e4481834a6 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/protobuf/empty.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A generic empty message that you can re-use to avoid defining duplicated + # empty messages in your APIs. A typical example is to use it as the request + # or the response type of an API method. For instance: + # + # service Foo { + # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + # } + class Empty + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/protobuf/field_mask.rb b/google-cloud-sql-v1/proto_docs/google/protobuf/field_mask.rb new file mode 100644 index 000000000000..7f3ffc78601a --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/protobuf/field_mask.rb @@ -0,0 +1,229 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # `FieldMask` represents a set of symbolic field paths, for example: + # + # paths: "f.a" + # paths: "f.b.d" + # + # Here `f` represents a field in some root message, `a` and `b` + # fields in the message found in `f`, and `d` a field found in the + # message in `f.b`. + # + # Field masks are used to specify a subset of fields that should be + # returned by a get operation or modified by an update operation. + # Field masks also have a custom JSON encoding (see below). + # + # # Field Masks in Projections + # + # When used in the context of a projection, a response message or + # sub-message is filtered by the API to only contain those fields as + # specified in the mask. For example, if the mask in the previous + # example is applied to a response message as follows: + # + # f { + # a : 22 + # b { + # d : 1 + # x : 2 + # } + # y : 13 + # } + # z: 8 + # + # The result will not contain specific values for fields x,y and z + # (their value will be set to the default, and omitted in proto text + # output): + # + # + # f { + # a : 22 + # b { + # d : 1 + # } + # } + # + # A repeated field is not allowed except at the last position of a + # paths string. + # + # If a FieldMask object is not present in a get operation, the + # operation applies to all fields (as if a FieldMask of all fields + # had been specified). + # + # Note that a field mask does not necessarily apply to the + # top-level response message. In case of a REST get operation, the + # field mask applies directly to the response, but in case of a REST + # list operation, the mask instead applies to each individual message + # in the returned resource list. In case of a REST custom method, + # other definitions may be used. Where the mask applies will be + # clearly documented together with its declaration in the API. In + # any case, the effect on the returned resource/resources is required + # behavior for APIs. + # + # # Field Masks in Update Operations + # + # A field mask in update operations specifies which fields of the + # targeted resource are going to be updated. The API is required + # to only change the values of the fields as specified in the mask + # and leave the others untouched. If a resource is passed in to + # describe the updated values, the API ignores the values of all + # fields not covered by the mask. + # + # If a repeated field is specified for an update operation, new values will + # be appended to the existing repeated field in the target resource. Note that + # a repeated field is only allowed in the last position of a `paths` string. + # + # If a sub-message is specified in the last position of the field mask for an + # update operation, then new value will be merged into the existing sub-message + # in the target resource. + # + # For example, given the target message: + # + # f { + # b { + # d: 1 + # x: 2 + # } + # c: [1] + # } + # + # And an update message: + # + # f { + # b { + # d: 10 + # } + # c: [2] + # } + # + # then if the field mask is: + # + # paths: ["f.b", "f.c"] + # + # then the result will be: + # + # f { + # b { + # d: 10 + # x: 2 + # } + # c: [1, 2] + # } + # + # An implementation may provide options to override this default behavior for + # repeated and message fields. + # + # In order to reset a field's value to the default, the field must + # be in the mask and set to the default value in the provided resource. + # Hence, in order to reset all fields of a resource, provide a default + # instance of the resource and set all fields in the mask, or do + # not provide a mask as described below. + # + # If a field mask is not present on update, the operation applies to + # all fields (as if a field mask of all fields has been specified). + # Note that in the presence of schema evolution, this may mean that + # fields the client does not know and has therefore not filled into + # the request will be reset to their default. If this is unwanted + # behavior, a specific service may require a client to always specify + # a field mask, producing an error if not. + # + # As with get operations, the location of the resource which + # describes the updated values in the request message depends on the + # operation kind. In any case, the effect of the field mask is + # required to be honored by the API. + # + # ## Considerations for HTTP REST + # + # The HTTP kind of an update operation which uses a field mask must + # be set to PATCH instead of PUT in order to satisfy HTTP semantics + # (PUT must only be used for full updates). + # + # # JSON Encoding of Field Masks + # + # In JSON, a field mask is encoded as a single string where paths are + # separated by a comma. Fields name in each path are converted + # to/from lower-camel naming conventions. + # + # As an example, consider the following message declarations: + # + # message Profile { + # User user = 1; + # Photo photo = 2; + # } + # message User { + # string display_name = 1; + # string address = 2; + # } + # + # In proto a field mask for `Profile` may look as such: + # + # mask { + # paths: "user.display_name" + # paths: "photo" + # } + # + # In JSON, the same mask is represented as below: + # + # { + # mask: "user.displayName,photo" + # } + # + # # Field Masks and Oneof Fields + # + # Field masks treat fields in oneofs just as regular fields. Consider the + # following message: + # + # message SampleMessage { + # oneof test_oneof { + # string name = 4; + # SubMessage sub_message = 9; + # } + # } + # + # The field mask can be: + # + # mask { + # paths: "name" + # } + # + # Or: + # + # mask { + # paths: "sub_message" + # } + # + # Note that oneof type names ("test_oneof" in this case) cannot be used in + # paths. + # + # ## Field Mask Verification + # + # The implementation of any API method which has a FieldMask type field in the + # request should verify the included field paths, and return an + # `INVALID_ARGUMENT` error if any path is unmappable. + # @!attribute [rw] paths + # @return [::Array<::String>] + # The set of field mask paths. + class FieldMask + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/protobuf/timestamp.rb b/google-cloud-sql-v1/proto_docs/google/protobuf/timestamp.rb new file mode 100644 index 000000000000..74352be9c58c --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/protobuf/timestamp.rb @@ -0,0 +1,127 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A Timestamp represents a point in time independent of any time zone or local + # calendar, encoded as a count of seconds and fractions of seconds at + # nanosecond resolution. The count is relative to an epoch at UTC midnight on + # January 1, 1970, in the proleptic Gregorian calendar which extends the + # Gregorian calendar backwards to year one. + # + # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + # second table is needed for interpretation, using a [24-hour linear + # smear](https://developers.google.com/time/smear). + # + # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + # restricting to that range, we ensure that we can convert to and from [RFC + # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + # + # # Examples + # + # Example 1: Compute Timestamp from POSIX `time()`. + # + # Timestamp timestamp; + # timestamp.set_seconds(time(NULL)); + # timestamp.set_nanos(0); + # + # Example 2: Compute Timestamp from POSIX `gettimeofday()`. + # + # struct timeval tv; + # gettimeofday(&tv, NULL); + # + # Timestamp timestamp; + # timestamp.set_seconds(tv.tv_sec); + # timestamp.set_nanos(tv.tv_usec * 1000); + # + # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + # + # FILETIME ft; + # GetSystemTimeAsFileTime(&ft); + # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + # + # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + # Timestamp timestamp; + # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + # + # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + # + # long millis = System.currentTimeMillis(); + # + # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + # .setNanos((int) ((millis % 1000) * 1000000)).build(); + # + # Example 5: Compute Timestamp from Java `Instant.now()`. + # + # Instant now = Instant.now(); + # + # Timestamp timestamp = + # Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + # .setNanos(now.getNano()).build(); + # + # Example 6: Compute Timestamp from current time in Python. + # + # timestamp = Timestamp() + # timestamp.GetCurrentTime() + # + # # JSON Mapping + # + # In JSON format, the Timestamp type is encoded as a string in the + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z" + # where \\{year} is always expressed using four digits while \\{month}, \\{day}, + # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional + # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + # is required. A proto3 JSON serializer should always use UTC (as indicated by + # "Z") when printing the Timestamp type and a proto3 JSON parser should be + # able to accept both UTC and other timezones (as indicated by an offset). + # + # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + # 01:30 UTC on January 15, 2017. + # + # In JavaScript, one can convert a Date object to this format using the + # standard + # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + # method. In Python, a standard `datetime.datetime` object can be converted + # to this format using + # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + # the Joda Time's [`ISODateTimeFormat.dateTime()`]( + # http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + # ) to obtain a formatter capable of generating timestamps in this format. + # @!attribute [rw] seconds + # @return [::Integer] + # Represents seconds of UTC time since Unix epoch + # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + # 9999-12-31T23:59:59Z inclusive. + # @!attribute [rw] nanos + # @return [::Integer] + # Non-negative fractions of a second at nanosecond resolution. Negative + # second values with fractions must still have non-negative nanos values + # that count forward in time. Must be from 0 to 999,999,999 + # inclusive. + class Timestamp + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/protobuf/wrappers.rb b/google-cloud-sql-v1/proto_docs/google/protobuf/wrappers.rb new file mode 100644 index 000000000000..9a7c0269fa42 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/protobuf/wrappers.rb @@ -0,0 +1,148 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # Wrapper message for `double`. + # + # The JSON representation for `DoubleValue` is JSON number. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Float] + # The double value. + class DoubleValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `float`. + # + # The JSON representation for `FloatValue` is JSON number. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Float] + # The float value. + class FloatValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `int64`. + # + # The JSON representation for `Int64Value` is JSON string. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Integer] + # The int64 value. + class Int64Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `uint64`. + # + # The JSON representation for `UInt64Value` is JSON string. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Integer] + # The uint64 value. + class UInt64Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `int32`. + # + # The JSON representation for `Int32Value` is JSON number. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Integer] + # The int32 value. + class Int32Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `uint32`. + # + # The JSON representation for `UInt32Value` is JSON number. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Integer] + # The uint32 value. + class UInt32Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `bool`. + # + # The JSON representation for `BoolValue` is JSON `true` and `false`. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Boolean] + # The bool value. + class BoolValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `string`. + # + # The JSON representation for `StringValue` is JSON string. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::String] + # The string value. + class StringValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `bytes`. + # + # The JSON representation for `BytesValue` is JSON string. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::String] + # The bytes value. + class BytesValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/rpc/status.rb b/google-cloud-sql-v1/proto_docs/google/rpc/status.rb new file mode 100644 index 000000000000..c1a1c07eb2db --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/rpc/status.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Rpc + # The `Status` type defines a logical error model that is suitable for + # different programming environments, including REST APIs and RPC APIs. It is + # used by [gRPC](https://github.com/grpc). Each `Status` message contains + # three pieces of data: error code, error message, and error details. + # + # You can find out more about this error model and how to work with it in the + # [API Design Guide](https://cloud.google.com/apis/design/errors). + # @!attribute [rw] code + # @return [::Integer] + # The status code, which should be an enum value of + # [google.rpc.Code][google.rpc.Code]. + # @!attribute [rw] message + # @return [::String] + # A developer-facing error message, which should be in English. Any + # user-facing error message should be localized and sent in the + # {::Google::Rpc::Status#details google.rpc.Status.details} field, or localized + # by the client. + # @!attribute [rw] details + # @return [::Array<::Google::Protobuf::Any>] + # A list of messages that carry the error details. There is a common set of + # message types for APIs to use. + class Status + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-sql-v1/proto_docs/google/type/interval.rb b/google-cloud-sql-v1/proto_docs/google/type/interval.rb new file mode 100644 index 000000000000..9350ca479005 --- /dev/null +++ b/google-cloud-sql-v1/proto_docs/google/type/interval.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Type + # Represents a time interval, encoded as a Timestamp start (inclusive) and a + # Timestamp end (exclusive). + # + # The start must be less than or equal to the end. + # When the start equals the end, the interval is empty (matches no time). + # When both start and end are unspecified, the interval matches any time. + # @!attribute [rw] start_time + # @return [::Google::Protobuf::Timestamp] + # Optional. Inclusive start of the interval. + # + # If specified, a Timestamp matching this interval will have to be the same + # or after the start. + # @!attribute [rw] end_time + # @return [::Google::Protobuf::Timestamp] + # Optional. Exclusive end of the interval. + # + # If specified, a Timestamp matching this interval will have to be before the + # end. + class Interval + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-sql-v1/snippets/Gemfile b/google-cloud-sql-v1/snippets/Gemfile new file mode 100644 index 000000000000..ca17e6ec81c2 --- /dev/null +++ b/google-cloud-sql-v1/snippets/Gemfile @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +source "https://rubygems.org" + +if ENV["GOOGLE_CLOUD_SAMPLES_TEST"] == "master" + gem "google-cloud-sql-v1", path: "../" +else + gem "google-cloud-sql-v1" +end + +group :test do + gem "google-style", "~> 1.26.1" + gem "minitest", "~> 5.16" + gem "minitest-focus", "~> 1.1" + gem "minitest-hooks", "~> 1.5" +end diff --git a/google-cloud-sql-v1/snippets/snippet_metadata_google.cloud.sql.v1.json b/google-cloud-sql-v1/snippets/snippet_metadata_google.cloud.sql.v1.json new file mode 100644 index 000000000000..d851baa8005b --- /dev/null +++ b/google-cloud-sql-v1/snippets/snippet_metadata_google.cloud.sql.v1.json @@ -0,0 +1,2975 @@ +{ + "client_library": { + "name": "google-cloud-sql-v1", + "version": "", + "language": "RUBY", + "apis": [ + { + "id": "google.cloud.sql.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "region_tag": "sqladmin_v1_generated_SqlBackupRunsService_Delete_sync", + "title": "Snippet for the delete call in the SqlBackupRunsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlBackupRunsService::Client#delete.", + "file": "sql_backup_runs_service/delete.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupRunsService::Client#delete", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlBackupRunsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupRunsService::Client" + }, + "method": { + "short_name": "Delete", + "full_name": "google.cloud.sql.v1.SqlBackupRunsService.Delete", + "service": { + "short_name": "SqlBackupRunsService", + "full_name": "google.cloud.sql.v1.SqlBackupRunsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlBackupRunsService_Get_sync", + "title": "Snippet for the get call in the SqlBackupRunsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlBackupRunsService::Client#get.", + "file": "sql_backup_runs_service/get.rb", + "language": "RUBY", + "client_method": { + "short_name": "get", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupRunsService::Client#get", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::BackupRun", + "client": { + "short_name": "SqlBackupRunsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupRunsService::Client" + }, + "method": { + "short_name": "Get", + "full_name": "google.cloud.sql.v1.SqlBackupRunsService.Get", + "service": { + "short_name": "SqlBackupRunsService", + "full_name": "google.cloud.sql.v1.SqlBackupRunsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlBackupRunsService_Insert_sync", + "title": "Snippet for the insert call in the SqlBackupRunsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlBackupRunsService::Client#insert.", + "file": "sql_backup_runs_service/insert.rb", + "language": "RUBY", + "client_method": { + "short_name": "insert", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupRunsService::Client#insert", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlBackupRunsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupRunsService::Client" + }, + "method": { + "short_name": "Insert", + "full_name": "google.cloud.sql.v1.SqlBackupRunsService.Insert", + "service": { + "short_name": "SqlBackupRunsService", + "full_name": "google.cloud.sql.v1.SqlBackupRunsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlBackupRunsService_List_sync", + "title": "Snippet for the list call in the SqlBackupRunsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlBackupRunsService::Client#list.", + "file": "sql_backup_runs_service/list.rb", + "language": "RUBY", + "client_method": { + "short_name": "list", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupRunsService::Client#list", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlBackupRunsListRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::BackupRunsListResponse", + "client": { + "short_name": "SqlBackupRunsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupRunsService::Client" + }, + "method": { + "short_name": "List", + "full_name": "google.cloud.sql.v1.SqlBackupRunsService.List", + "service": { + "short_name": "SqlBackupRunsService", + "full_name": "google.cloud.sql.v1.SqlBackupRunsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_AddServerCa_sync", + "title": "Snippet for the add_server_ca call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#add_server_ca.", + "file": "sql_instances_service/add_server_ca.rb", + "language": "RUBY", + "client_method": { + "short_name": "add_server_ca", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#add_server_ca", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "AddServerCa", + "full_name": "google.cloud.sql.v1.SqlInstancesService.AddServerCa", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_sync", + "title": "Snippet for the add_server_certificate call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#add_server_certificate.", + "file": "sql_instances_service/add_server_certificate.rb", + "language": "RUBY", + "client_method": { + "short_name": "add_server_certificate", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#add_server_certificate", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "AddServerCertificate", + "full_name": "google.cloud.sql.v1.SqlInstancesService.AddServerCertificate", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_sync", + "title": "Snippet for the add_entra_id_certificate call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#add_entra_id_certificate.", + "file": "sql_instances_service/add_entra_id_certificate.rb", + "language": "RUBY", + "client_method": { + "short_name": "add_entra_id_certificate", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#add_entra_id_certificate", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "AddEntraIdCertificate", + "full_name": "google.cloud.sql.v1.SqlInstancesService.AddEntraIdCertificate", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Clone_sync", + "title": "Snippet for the call_clone call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#call_clone.", + "file": "sql_instances_service/call_clone.rb", + "language": "RUBY", + "client_method": { + "short_name": "call_clone", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#call_clone", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesCloneRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Clone", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Clone", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Delete_sync", + "title": "Snippet for the delete call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#delete.", + "file": "sql_instances_service/delete.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#delete", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Delete", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Delete", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_DemoteMaster_sync", + "title": "Snippet for the demote_master call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#demote_master.", + "file": "sql_instances_service/demote_master.rb", + "language": "RUBY", + "client_method": { + "short_name": "demote_master", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#demote_master", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "DemoteMaster", + "full_name": "google.cloud.sql.v1.SqlInstancesService.DemoteMaster", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Demote_sync", + "title": "Snippet for the demote call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#demote.", + "file": "sql_instances_service/demote.rb", + "language": "RUBY", + "client_method": { + "short_name": "demote", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#demote", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Demote", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Demote", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Export_sync", + "title": "Snippet for the export call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#export.", + "file": "sql_instances_service/export.rb", + "language": "RUBY", + "client_method": { + "short_name": "export", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#export", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesExportRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Export", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Export", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Failover_sync", + "title": "Snippet for the failover call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#failover.", + "file": "sql_instances_service/failover.rb", + "language": "RUBY", + "client_method": { + "short_name": "failover", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#failover", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Failover", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Failover", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Reencrypt_sync", + "title": "Snippet for the reencrypt call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#reencrypt.", + "file": "sql_instances_service/reencrypt.rb", + "language": "RUBY", + "client_method": { + "short_name": "reencrypt", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#reencrypt", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Reencrypt", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Reencrypt", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Get_sync", + "title": "Snippet for the get call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#get.", + "file": "sql_instances_service/get.rb", + "language": "RUBY", + "client_method": { + "short_name": "get", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#get", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesGetRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::DatabaseInstance", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Get", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Get", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Import_sync", + "title": "Snippet for the import call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#import.", + "file": "sql_instances_service/import.rb", + "language": "RUBY", + "client_method": { + "short_name": "import", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#import", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesImportRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Import", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Import", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Insert_sync", + "title": "Snippet for the insert call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#insert.", + "file": "sql_instances_service/insert.rb", + "language": "RUBY", + "client_method": { + "short_name": "insert", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#insert", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesInsertRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Insert", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Insert", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_List_sync", + "title": "Snippet for the list call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#list.", + "file": "sql_instances_service/list.rb", + "language": "RUBY", + "client_method": { + "short_name": "list", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#list", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesListRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::InstancesListResponse", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "List", + "full_name": "google.cloud.sql.v1.SqlInstancesService.List", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_ListServerCas_sync", + "title": "Snippet for the list_server_cas call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#list_server_cas.", + "file": "sql_instances_service/list_server_cas.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_server_cas", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#list_server_cas", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::InstancesListServerCasResponse", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "ListServerCas", + "full_name": "google.cloud.sql.v1.SqlInstancesService.ListServerCas", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_sync", + "title": "Snippet for the list_server_certificates call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#list_server_certificates.", + "file": "sql_instances_service/list_server_certificates.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_server_certificates", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#list_server_certificates", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "ListServerCertificates", + "full_name": "google.cloud.sql.v1.SqlInstancesService.ListServerCertificates", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_sync", + "title": "Snippet for the list_entra_id_certificates call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#list_entra_id_certificates.", + "file": "sql_instances_service/list_entra_id_certificates.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_entra_id_certificates", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#list_entra_id_certificates", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "ListEntraIdCertificates", + "full_name": "google.cloud.sql.v1.SqlInstancesService.ListEntraIdCertificates", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Patch_sync", + "title": "Snippet for the patch call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#patch.", + "file": "sql_instances_service/patch.rb", + "language": "RUBY", + "client_method": { + "short_name": "patch", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#patch", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesPatchRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Patch", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Patch", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_PromoteReplica_sync", + "title": "Snippet for the promote_replica call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#promote_replica.", + "file": "sql_instances_service/promote_replica.rb", + "language": "RUBY", + "client_method": { + "short_name": "promote_replica", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#promote_replica", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "PromoteReplica", + "full_name": "google.cloud.sql.v1.SqlInstancesService.PromoteReplica", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Switchover_sync", + "title": "Snippet for the switchover call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#switchover.", + "file": "sql_instances_service/switchover.rb", + "language": "RUBY", + "client_method": { + "short_name": "switchover", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#switchover", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Switchover", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Switchover", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_sync", + "title": "Snippet for the reset_ssl_config call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#reset_ssl_config.", + "file": "sql_instances_service/reset_ssl_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "reset_ssl_config", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#reset_ssl_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "ResetSslConfig", + "full_name": "google.cloud.sql.v1.SqlInstancesService.ResetSslConfig", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Restart_sync", + "title": "Snippet for the restart call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#restart.", + "file": "sql_instances_service/restart.rb", + "language": "RUBY", + "client_method": { + "short_name": "restart", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#restart", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesRestartRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Restart", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Restart", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_RestoreBackup_sync", + "title": "Snippet for the restore_backup call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#restore_backup.", + "file": "sql_instances_service/restore_backup.rb", + "language": "RUBY", + "client_method": { + "short_name": "restore_backup", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#restore_backup", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "RestoreBackup", + "full_name": "google.cloud.sql.v1.SqlInstancesService.RestoreBackup", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_RotateServerCa_sync", + "title": "Snippet for the rotate_server_ca call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#rotate_server_ca.", + "file": "sql_instances_service/rotate_server_ca.rb", + "language": "RUBY", + "client_method": { + "short_name": "rotate_server_ca", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#rotate_server_ca", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "RotateServerCa", + "full_name": "google.cloud.sql.v1.SqlInstancesService.RotateServerCa", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_sync", + "title": "Snippet for the rotate_server_certificate call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#rotate_server_certificate.", + "file": "sql_instances_service/rotate_server_certificate.rb", + "language": "RUBY", + "client_method": { + "short_name": "rotate_server_certificate", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#rotate_server_certificate", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "RotateServerCertificate", + "full_name": "google.cloud.sql.v1.SqlInstancesService.RotateServerCertificate", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_sync", + "title": "Snippet for the rotate_entra_id_certificate call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#rotate_entra_id_certificate.", + "file": "sql_instances_service/rotate_entra_id_certificate.rb", + "language": "RUBY", + "client_method": { + "short_name": "rotate_entra_id_certificate", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#rotate_entra_id_certificate", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "RotateEntraIdCertificate", + "full_name": "google.cloud.sql.v1.SqlInstancesService.RotateEntraIdCertificate", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_StartReplica_sync", + "title": "Snippet for the start_replica call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#start_replica.", + "file": "sql_instances_service/start_replica.rb", + "language": "RUBY", + "client_method": { + "short_name": "start_replica", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#start_replica", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "StartReplica", + "full_name": "google.cloud.sql.v1.SqlInstancesService.StartReplica", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_StopReplica_sync", + "title": "Snippet for the stop_replica call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#stop_replica.", + "file": "sql_instances_service/stop_replica.rb", + "language": "RUBY", + "client_method": { + "short_name": "stop_replica", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#stop_replica", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "StopReplica", + "full_name": "google.cloud.sql.v1.SqlInstancesService.StopReplica", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_TruncateLog_sync", + "title": "Snippet for the truncate_log call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#truncate_log.", + "file": "sql_instances_service/truncate_log.rb", + "language": "RUBY", + "client_method": { + "short_name": "truncate_log", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#truncate_log", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "TruncateLog", + "full_name": "google.cloud.sql.v1.SqlInstancesService.TruncateLog", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_Update_sync", + "title": "Snippet for the update call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#update.", + "file": "sql_instances_service/update.rb", + "language": "RUBY", + "client_method": { + "short_name": "update", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#update", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "Update", + "full_name": "google.cloud.sql.v1.SqlInstancesService.Update", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_sync", + "title": "Snippet for the create_ephemeral call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#create_ephemeral.", + "file": "sql_instances_service/create_ephemeral.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_ephemeral", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#create_ephemeral", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::SslCert", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "CreateEphemeral", + "full_name": "google.cloud.sql.v1.SqlInstancesService.CreateEphemeral", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_sync", + "title": "Snippet for the reschedule_maintenance call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#reschedule_maintenance.", + "file": "sql_instances_service/reschedule_maintenance.rb", + "language": "RUBY", + "client_method": { + "short_name": "reschedule_maintenance", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#reschedule_maintenance", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "RescheduleMaintenance", + "full_name": "google.cloud.sql.v1.SqlInstancesService.RescheduleMaintenance", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_sync", + "title": "Snippet for the verify_external_sync_settings call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#verify_external_sync_settings.", + "file": "sql_instances_service/verify_external_sync_settings.rb", + "language": "RUBY", + "client_method": { + "short_name": "verify_external_sync_settings", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#verify_external_sync_settings", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "VerifyExternalSyncSettings", + "full_name": "google.cloud.sql.v1.SqlInstancesService.VerifyExternalSyncSettings", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_StartExternalSync_sync", + "title": "Snippet for the start_external_sync call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#start_external_sync.", + "file": "sql_instances_service/start_external_sync.rb", + "language": "RUBY", + "client_method": { + "short_name": "start_external_sync", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#start_external_sync", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "StartExternalSync", + "full_name": "google.cloud.sql.v1.SqlInstancesService.StartExternalSync", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_sync", + "title": "Snippet for the perform_disk_shrink call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#perform_disk_shrink.", + "file": "sql_instances_service/perform_disk_shrink.rb", + "language": "RUBY", + "client_method": { + "short_name": "perform_disk_shrink", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#perform_disk_shrink", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "PerformDiskShrink", + "full_name": "google.cloud.sql.v1.SqlInstancesService.PerformDiskShrink", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_sync", + "title": "Snippet for the get_disk_shrink_config call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#get_disk_shrink_config.", + "file": "sql_instances_service/get_disk_shrink_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_disk_shrink_config", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#get_disk_shrink_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "GetDiskShrinkConfig", + "full_name": "google.cloud.sql.v1.SqlInstancesService.GetDiskShrinkConfig", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_sync", + "title": "Snippet for the reset_replica_size call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#reset_replica_size.", + "file": "sql_instances_service/reset_replica_size.rb", + "language": "RUBY", + "client_method": { + "short_name": "reset_replica_size", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#reset_replica_size", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "ResetReplicaSize", + "full_name": "google.cloud.sql.v1.SqlInstancesService.ResetReplicaSize", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_sync", + "title": "Snippet for the get_latest_recovery_time call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#get_latest_recovery_time.", + "file": "sql_instances_service/get_latest_recovery_time.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_latest_recovery_time", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#get_latest_recovery_time", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "GetLatestRecoveryTime", + "full_name": "google.cloud.sql.v1.SqlInstancesService.GetLatestRecoveryTime", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_ExecuteSql_sync", + "title": "Snippet for the execute_sql call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#execute_sql.", + "file": "sql_instances_service/execute_sql.rb", + "language": "RUBY", + "client_method": { + "short_name": "execute_sql", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#execute_sql", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "ExecuteSql", + "full_name": "google.cloud.sql.v1.SqlInstancesService.ExecuteSql", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_sync", + "title": "Snippet for the acquire_ssrs_lease call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#acquire_ssrs_lease.", + "file": "sql_instances_service/acquire_ssrs_lease.rb", + "language": "RUBY", + "client_method": { + "short_name": "acquire_ssrs_lease", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#acquire_ssrs_lease", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "AcquireSsrsLease", + "full_name": "google.cloud.sql.v1.SqlInstancesService.AcquireSsrsLease", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_sync", + "title": "Snippet for the release_ssrs_lease call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#release_ssrs_lease.", + "file": "sql_instances_service/release_ssrs_lease.rb", + "language": "RUBY", + "client_method": { + "short_name": "release_ssrs_lease", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#release_ssrs_lease", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "ReleaseSsrsLease", + "full_name": "google.cloud.sql.v1.SqlInstancesService.ReleaseSsrsLease", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_sync", + "title": "Snippet for the pre_check_major_version_upgrade call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#pre_check_major_version_upgrade.", + "file": "sql_instances_service/pre_check_major_version_upgrade.rb", + "language": "RUBY", + "client_method": { + "short_name": "pre_check_major_version_upgrade", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#pre_check_major_version_upgrade", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "PreCheckMajorVersionUpgrade", + "full_name": "google.cloud.sql.v1.SqlInstancesService.PreCheckMajorVersionUpgrade", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_sync", + "title": "Snippet for the point_in_time_restore call in the SqlInstancesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlInstancesService::Client#point_in_time_restore.", + "file": "sql_instances_service/point_in_time_restore.rb", + "language": "RUBY", + "client_method": { + "short_name": "point_in_time_restore", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client#point_in_time_restore", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlInstancesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlInstancesService::Client" + }, + "method": { + "short_name": "PointInTimeRestore", + "full_name": "google.cloud.sql.v1.SqlInstancesService.PointInTimeRestore", + "service": { + "short_name": "SqlInstancesService", + "full_name": "google.cloud.sql.v1.SqlInstancesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlBackupsService_CreateBackup_sync", + "title": "Snippet for the create_backup call in the SqlBackupsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlBackupsService::Client#create_backup.", + "file": "sql_backups_service/create_backup.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_backup", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupsService::Client#create_backup", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::CreateBackupRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlBackupsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupsService::Client" + }, + "method": { + "short_name": "CreateBackup", + "full_name": "google.cloud.sql.v1.SqlBackupsService.CreateBackup", + "service": { + "short_name": "SqlBackupsService", + "full_name": "google.cloud.sql.v1.SqlBackupsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlBackupsService_GetBackup_sync", + "title": "Snippet for the get_backup call in the SqlBackupsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlBackupsService::Client#get_backup.", + "file": "sql_backups_service/get_backup.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_backup", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupsService::Client#get_backup", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::GetBackupRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Backup", + "client": { + "short_name": "SqlBackupsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupsService::Client" + }, + "method": { + "short_name": "GetBackup", + "full_name": "google.cloud.sql.v1.SqlBackupsService.GetBackup", + "service": { + "short_name": "SqlBackupsService", + "full_name": "google.cloud.sql.v1.SqlBackupsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlBackupsService_ListBackups_sync", + "title": "Snippet for the list_backups call in the SqlBackupsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlBackupsService::Client#list_backups.", + "file": "sql_backups_service/list_backups.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_backups", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupsService::Client#list_backups", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::ListBackupsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::ListBackupsResponse", + "client": { + "short_name": "SqlBackupsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupsService::Client" + }, + "method": { + "short_name": "ListBackups", + "full_name": "google.cloud.sql.v1.SqlBackupsService.ListBackups", + "service": { + "short_name": "SqlBackupsService", + "full_name": "google.cloud.sql.v1.SqlBackupsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlBackupsService_UpdateBackup_sync", + "title": "Snippet for the update_backup call in the SqlBackupsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlBackupsService::Client#update_backup.", + "file": "sql_backups_service/update_backup.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_backup", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupsService::Client#update_backup", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::UpdateBackupRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlBackupsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupsService::Client" + }, + "method": { + "short_name": "UpdateBackup", + "full_name": "google.cloud.sql.v1.SqlBackupsService.UpdateBackup", + "service": { + "short_name": "SqlBackupsService", + "full_name": "google.cloud.sql.v1.SqlBackupsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlBackupsService_DeleteBackup_sync", + "title": "Snippet for the delete_backup call in the SqlBackupsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlBackupsService::Client#delete_backup.", + "file": "sql_backups_service/delete_backup.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_backup", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupsService::Client#delete_backup", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::DeleteBackupRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlBackupsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlBackupsService::Client" + }, + "method": { + "short_name": "DeleteBackup", + "full_name": "google.cloud.sql.v1.SqlBackupsService.DeleteBackup", + "service": { + "short_name": "SqlBackupsService", + "full_name": "google.cloud.sql.v1.SqlBackupsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlConnectService_GetConnectSettings_sync", + "title": "Snippet for the get_connect_settings call in the SqlConnectService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlConnectService::Client#get_connect_settings.", + "file": "sql_connect_service/get_connect_settings.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_connect_settings", + "full_name": "::Google::Cloud::Sql::V1::SqlConnectService::Client#get_connect_settings", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::GetConnectSettingsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::ConnectSettings", + "client": { + "short_name": "SqlConnectService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlConnectService::Client" + }, + "method": { + "short_name": "GetConnectSettings", + "full_name": "google.cloud.sql.v1.SqlConnectService.GetConnectSettings", + "service": { + "short_name": "SqlConnectService", + "full_name": "google.cloud.sql.v1.SqlConnectService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_sync", + "title": "Snippet for the generate_ephemeral_cert call in the SqlConnectService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlConnectService::Client#generate_ephemeral_cert.", + "file": "sql_connect_service/generate_ephemeral_cert.rb", + "language": "RUBY", + "client_method": { + "short_name": "generate_ephemeral_cert", + "full_name": "::Google::Cloud::Sql::V1::SqlConnectService::Client#generate_ephemeral_cert", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse", + "client": { + "short_name": "SqlConnectService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlConnectService::Client" + }, + "method": { + "short_name": "GenerateEphemeralCert", + "full_name": "google.cloud.sql.v1.SqlConnectService.GenerateEphemeralCert", + "service": { + "short_name": "SqlConnectService", + "full_name": "google.cloud.sql.v1.SqlConnectService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlDatabasesService_Delete_sync", + "title": "Snippet for the delete call in the SqlDatabasesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlDatabasesService::Client#delete.", + "file": "sql_databases_service/delete.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete", + "full_name": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client#delete", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlDatabasesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client" + }, + "method": { + "short_name": "Delete", + "full_name": "google.cloud.sql.v1.SqlDatabasesService.Delete", + "service": { + "short_name": "SqlDatabasesService", + "full_name": "google.cloud.sql.v1.SqlDatabasesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlDatabasesService_Get_sync", + "title": "Snippet for the get call in the SqlDatabasesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlDatabasesService::Client#get.", + "file": "sql_databases_service/get.rb", + "language": "RUBY", + "client_method": { + "short_name": "get", + "full_name": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client#get", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlDatabasesGetRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Database", + "client": { + "short_name": "SqlDatabasesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client" + }, + "method": { + "short_name": "Get", + "full_name": "google.cloud.sql.v1.SqlDatabasesService.Get", + "service": { + "short_name": "SqlDatabasesService", + "full_name": "google.cloud.sql.v1.SqlDatabasesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlDatabasesService_Insert_sync", + "title": "Snippet for the insert call in the SqlDatabasesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlDatabasesService::Client#insert.", + "file": "sql_databases_service/insert.rb", + "language": "RUBY", + "client_method": { + "short_name": "insert", + "full_name": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client#insert", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlDatabasesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client" + }, + "method": { + "short_name": "Insert", + "full_name": "google.cloud.sql.v1.SqlDatabasesService.Insert", + "service": { + "short_name": "SqlDatabasesService", + "full_name": "google.cloud.sql.v1.SqlDatabasesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlDatabasesService_List_sync", + "title": "Snippet for the list call in the SqlDatabasesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlDatabasesService::Client#list.", + "file": "sql_databases_service/list.rb", + "language": "RUBY", + "client_method": { + "short_name": "list", + "full_name": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client#list", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlDatabasesListRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::DatabasesListResponse", + "client": { + "short_name": "SqlDatabasesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client" + }, + "method": { + "short_name": "List", + "full_name": "google.cloud.sql.v1.SqlDatabasesService.List", + "service": { + "short_name": "SqlDatabasesService", + "full_name": "google.cloud.sql.v1.SqlDatabasesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlDatabasesService_Patch_sync", + "title": "Snippet for the patch call in the SqlDatabasesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlDatabasesService::Client#patch.", + "file": "sql_databases_service/patch.rb", + "language": "RUBY", + "client_method": { + "short_name": "patch", + "full_name": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client#patch", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlDatabasesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client" + }, + "method": { + "short_name": "Patch", + "full_name": "google.cloud.sql.v1.SqlDatabasesService.Patch", + "service": { + "short_name": "SqlDatabasesService", + "full_name": "google.cloud.sql.v1.SqlDatabasesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlDatabasesService_Update_sync", + "title": "Snippet for the update call in the SqlDatabasesService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlDatabasesService::Client#update.", + "file": "sql_databases_service/update.rb", + "language": "RUBY", + "client_method": { + "short_name": "update", + "full_name": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client#update", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlDatabasesService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlDatabasesService::Client" + }, + "method": { + "short_name": "Update", + "full_name": "google.cloud.sql.v1.SqlDatabasesService.Update", + "service": { + "short_name": "SqlDatabasesService", + "full_name": "google.cloud.sql.v1.SqlDatabasesService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlFlagsService_List_sync", + "title": "Snippet for the list call in the SqlFlagsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlFlagsService::Client#list.", + "file": "sql_flags_service/list.rb", + "language": "RUBY", + "client_method": { + "short_name": "list", + "full_name": "::Google::Cloud::Sql::V1::SqlFlagsService::Client#list", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlFlagsListRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::FlagsListResponse", + "client": { + "short_name": "SqlFlagsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlFlagsService::Client" + }, + "method": { + "short_name": "List", + "full_name": "google.cloud.sql.v1.SqlFlagsService.List", + "service": { + "short_name": "SqlFlagsService", + "full_name": "google.cloud.sql.v1.SqlFlagsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlOperationsService_Get_sync", + "title": "Snippet for the get call in the SqlOperationsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlOperationsService::Client#get.", + "file": "sql_operations_service/get.rb", + "language": "RUBY", + "client_method": { + "short_name": "get", + "full_name": "::Google::Cloud::Sql::V1::SqlOperationsService::Client#get", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlOperationsGetRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlOperationsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlOperationsService::Client" + }, + "method": { + "short_name": "Get", + "full_name": "google.cloud.sql.v1.SqlOperationsService.Get", + "service": { + "short_name": "SqlOperationsService", + "full_name": "google.cloud.sql.v1.SqlOperationsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlOperationsService_List_sync", + "title": "Snippet for the list call in the SqlOperationsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlOperationsService::Client#list.", + "file": "sql_operations_service/list.rb", + "language": "RUBY", + "client_method": { + "short_name": "list", + "full_name": "::Google::Cloud::Sql::V1::SqlOperationsService::Client#list", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlOperationsListRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::OperationsListResponse", + "client": { + "short_name": "SqlOperationsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlOperationsService::Client" + }, + "method": { + "short_name": "List", + "full_name": "google.cloud.sql.v1.SqlOperationsService.List", + "service": { + "short_name": "SqlOperationsService", + "full_name": "google.cloud.sql.v1.SqlOperationsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlOperationsService_Cancel_sync", + "title": "Snippet for the cancel call in the SqlOperationsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlOperationsService::Client#cancel.", + "file": "sql_operations_service/cancel.rb", + "language": "RUBY", + "client_method": { + "short_name": "cancel", + "full_name": "::Google::Cloud::Sql::V1::SqlOperationsService::Client#cancel", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlOperationsCancelRequest", + "name": "request" + } + ], + "result_type": "::Google::Protobuf::Empty", + "client": { + "short_name": "SqlOperationsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlOperationsService::Client" + }, + "method": { + "short_name": "Cancel", + "full_name": "google.cloud.sql.v1.SqlOperationsService.Cancel", + "service": { + "short_name": "SqlOperationsService", + "full_name": "google.cloud.sql.v1.SqlOperationsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlSslCertsService_Delete_sync", + "title": "Snippet for the delete call in the SqlSslCertsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlSslCertsService::Client#delete.", + "file": "sql_ssl_certs_service/delete.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete", + "full_name": "::Google::Cloud::Sql::V1::SqlSslCertsService::Client#delete", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlSslCertsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlSslCertsService::Client" + }, + "method": { + "short_name": "Delete", + "full_name": "google.cloud.sql.v1.SqlSslCertsService.Delete", + "service": { + "short_name": "SqlSslCertsService", + "full_name": "google.cloud.sql.v1.SqlSslCertsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlSslCertsService_Get_sync", + "title": "Snippet for the get call in the SqlSslCertsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlSslCertsService::Client#get.", + "file": "sql_ssl_certs_service/get.rb", + "language": "RUBY", + "client_method": { + "short_name": "get", + "full_name": "::Google::Cloud::Sql::V1::SqlSslCertsService::Client#get", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlSslCertsGetRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::SslCert", + "client": { + "short_name": "SqlSslCertsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlSslCertsService::Client" + }, + "method": { + "short_name": "Get", + "full_name": "google.cloud.sql.v1.SqlSslCertsService.Get", + "service": { + "short_name": "SqlSslCertsService", + "full_name": "google.cloud.sql.v1.SqlSslCertsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlSslCertsService_Insert_sync", + "title": "Snippet for the insert call in the SqlSslCertsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlSslCertsService::Client#insert.", + "file": "sql_ssl_certs_service/insert.rb", + "language": "RUBY", + "client_method": { + "short_name": "insert", + "full_name": "::Google::Cloud::Sql::V1::SqlSslCertsService::Client#insert", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::SslCertsInsertResponse", + "client": { + "short_name": "SqlSslCertsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlSslCertsService::Client" + }, + "method": { + "short_name": "Insert", + "full_name": "google.cloud.sql.v1.SqlSslCertsService.Insert", + "service": { + "short_name": "SqlSslCertsService", + "full_name": "google.cloud.sql.v1.SqlSslCertsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlSslCertsService_List_sync", + "title": "Snippet for the list call in the SqlSslCertsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlSslCertsService::Client#list.", + "file": "sql_ssl_certs_service/list.rb", + "language": "RUBY", + "client_method": { + "short_name": "list", + "full_name": "::Google::Cloud::Sql::V1::SqlSslCertsService::Client#list", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlSslCertsListRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::SslCertsListResponse", + "client": { + "short_name": "SqlSslCertsService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlSslCertsService::Client" + }, + "method": { + "short_name": "List", + "full_name": "google.cloud.sql.v1.SqlSslCertsService.List", + "service": { + "short_name": "SqlSslCertsService", + "full_name": "google.cloud.sql.v1.SqlSslCertsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlTiersService_List_sync", + "title": "Snippet for the list call in the SqlTiersService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlTiersService::Client#list.", + "file": "sql_tiers_service/list.rb", + "language": "RUBY", + "client_method": { + "short_name": "list", + "full_name": "::Google::Cloud::Sql::V1::SqlTiersService::Client#list", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlTiersListRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::TiersListResponse", + "client": { + "short_name": "SqlTiersService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlTiersService::Client" + }, + "method": { + "short_name": "List", + "full_name": "google.cloud.sql.v1.SqlTiersService.List", + "service": { + "short_name": "SqlTiersService", + "full_name": "google.cloud.sql.v1.SqlTiersService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlUsersService_Delete_sync", + "title": "Snippet for the delete call in the SqlUsersService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlUsersService::Client#delete.", + "file": "sql_users_service/delete.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete", + "full_name": "::Google::Cloud::Sql::V1::SqlUsersService::Client#delete", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlUsersDeleteRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlUsersService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlUsersService::Client" + }, + "method": { + "short_name": "Delete", + "full_name": "google.cloud.sql.v1.SqlUsersService.Delete", + "service": { + "short_name": "SqlUsersService", + "full_name": "google.cloud.sql.v1.SqlUsersService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlUsersService_Get_sync", + "title": "Snippet for the get call in the SqlUsersService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlUsersService::Client#get.", + "file": "sql_users_service/get.rb", + "language": "RUBY", + "client_method": { + "short_name": "get", + "full_name": "::Google::Cloud::Sql::V1::SqlUsersService::Client#get", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlUsersGetRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::User", + "client": { + "short_name": "SqlUsersService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlUsersService::Client" + }, + "method": { + "short_name": "Get", + "full_name": "google.cloud.sql.v1.SqlUsersService.Get", + "service": { + "short_name": "SqlUsersService", + "full_name": "google.cloud.sql.v1.SqlUsersService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlUsersService_Insert_sync", + "title": "Snippet for the insert call in the SqlUsersService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlUsersService::Client#insert.", + "file": "sql_users_service/insert.rb", + "language": "RUBY", + "client_method": { + "short_name": "insert", + "full_name": "::Google::Cloud::Sql::V1::SqlUsersService::Client#insert", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlUsersInsertRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlUsersService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlUsersService::Client" + }, + "method": { + "short_name": "Insert", + "full_name": "google.cloud.sql.v1.SqlUsersService.Insert", + "service": { + "short_name": "SqlUsersService", + "full_name": "google.cloud.sql.v1.SqlUsersService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlUsersService_List_sync", + "title": "Snippet for the list call in the SqlUsersService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlUsersService::Client#list.", + "file": "sql_users_service/list.rb", + "language": "RUBY", + "client_method": { + "short_name": "list", + "full_name": "::Google::Cloud::Sql::V1::SqlUsersService::Client#list", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlUsersListRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::UsersListResponse", + "client": { + "short_name": "SqlUsersService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlUsersService::Client" + }, + "method": { + "short_name": "List", + "full_name": "google.cloud.sql.v1.SqlUsersService.List", + "service": { + "short_name": "SqlUsersService", + "full_name": "google.cloud.sql.v1.SqlUsersService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "sqladmin_v1_generated_SqlUsersService_Update_sync", + "title": "Snippet for the update call in the SqlUsersService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Sql::V1::SqlUsersService::Client#update.", + "file": "sql_users_service/update.rb", + "language": "RUBY", + "client_method": { + "short_name": "update", + "full_name": "::Google::Cloud::Sql::V1::SqlUsersService::Client#update", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Sql::V1::SqlUsersUpdateRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Sql::V1::Operation", + "client": { + "short_name": "SqlUsersService::Client", + "full_name": "::Google::Cloud::Sql::V1::SqlUsersService::Client" + }, + "method": { + "short_name": "Update", + "full_name": "google.cloud.sql.v1.SqlUsersService.Update", + "service": { + "short_name": "SqlUsersService", + "full_name": "google.cloud.sql.v1.SqlUsersService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + } + ] +} \ No newline at end of file diff --git a/google-cloud-sql-v1/snippets/sql_backup_runs_service/delete.rb b/google-cloud-sql-v1/snippets/sql_backup_runs_service/delete.rb new file mode 100644 index 000000000000..08e981a52cfc --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_backup_runs_service/delete.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlBackupRunsService_Delete_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the delete call in the SqlBackupRunsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlBackupRunsService::Client#delete. +# +def delete + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest.new + + # Call the delete method. + result = client.delete request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlBackupRunsService_Delete_sync] diff --git a/google-cloud-sql-v1/snippets/sql_backup_runs_service/get.rb b/google-cloud-sql-v1/snippets/sql_backup_runs_service/get.rb new file mode 100644 index 000000000000..b2c083ab7f85 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_backup_runs_service/get.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlBackupRunsService_Get_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the get call in the SqlBackupRunsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlBackupRunsService::Client#get. +# +def get + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlBackupRunsGetRequest.new + + # Call the get method. + result = client.get request + + # The returned object is of type Google::Cloud::Sql::V1::BackupRun. + p result +end +# [END sqladmin_v1_generated_SqlBackupRunsService_Get_sync] diff --git a/google-cloud-sql-v1/snippets/sql_backup_runs_service/insert.rb b/google-cloud-sql-v1/snippets/sql_backup_runs_service/insert.rb new file mode 100644 index 000000000000..04413fdae299 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_backup_runs_service/insert.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlBackupRunsService_Insert_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the insert call in the SqlBackupRunsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlBackupRunsService::Client#insert. +# +def insert + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest.new + + # Call the insert method. + result = client.insert request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlBackupRunsService_Insert_sync] diff --git a/google-cloud-sql-v1/snippets/sql_backup_runs_service/list.rb b/google-cloud-sql-v1/snippets/sql_backup_runs_service/list.rb new file mode 100644 index 000000000000..3aa9f1f42614 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_backup_runs_service/list.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlBackupRunsService_List_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the list call in the SqlBackupRunsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlBackupRunsService::Client#list. +# +def list + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlBackupRunsListRequest.new + + # Call the list method. + result = client.list request + + # The returned object is of type Google::Cloud::Sql::V1::BackupRunsListResponse. + p result +end +# [END sqladmin_v1_generated_SqlBackupRunsService_List_sync] diff --git a/google-cloud-sql-v1/snippets/sql_backups_service/create_backup.rb b/google-cloud-sql-v1/snippets/sql_backups_service/create_backup.rb new file mode 100644 index 000000000000..537982f21d7c --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_backups_service/create_backup.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlBackupsService_CreateBackup_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the create_backup call in the SqlBackupsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlBackupsService::Client#create_backup. +# +def create_backup + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::CreateBackupRequest.new + + # Call the create_backup method. + result = client.create_backup request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlBackupsService_CreateBackup_sync] diff --git a/google-cloud-sql-v1/snippets/sql_backups_service/delete_backup.rb b/google-cloud-sql-v1/snippets/sql_backups_service/delete_backup.rb new file mode 100644 index 000000000000..f253ebf63b33 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_backups_service/delete_backup.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlBackupsService_DeleteBackup_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the delete_backup call in the SqlBackupsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlBackupsService::Client#delete_backup. +# +def delete_backup + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::DeleteBackupRequest.new + + # Call the delete_backup method. + result = client.delete_backup request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlBackupsService_DeleteBackup_sync] diff --git a/google-cloud-sql-v1/snippets/sql_backups_service/get_backup.rb b/google-cloud-sql-v1/snippets/sql_backups_service/get_backup.rb new file mode 100644 index 000000000000..2e43caa5619f --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_backups_service/get_backup.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlBackupsService_GetBackup_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the get_backup call in the SqlBackupsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlBackupsService::Client#get_backup. +# +def get_backup + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::GetBackupRequest.new + + # Call the get_backup method. + result = client.get_backup request + + # The returned object is of type Google::Cloud::Sql::V1::Backup. + p result +end +# [END sqladmin_v1_generated_SqlBackupsService_GetBackup_sync] diff --git a/google-cloud-sql-v1/snippets/sql_backups_service/list_backups.rb b/google-cloud-sql-v1/snippets/sql_backups_service/list_backups.rb new file mode 100644 index 000000000000..7159384ddf6f --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_backups_service/list_backups.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlBackupsService_ListBackups_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the list_backups call in the SqlBackupsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlBackupsService::Client#list_backups. +# +def list_backups + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::ListBackupsRequest.new + + # Call the list_backups method. + result = client.list_backups request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Sql::V1::Backup. + p item + end +end +# [END sqladmin_v1_generated_SqlBackupsService_ListBackups_sync] diff --git a/google-cloud-sql-v1/snippets/sql_backups_service/update_backup.rb b/google-cloud-sql-v1/snippets/sql_backups_service/update_backup.rb new file mode 100644 index 000000000000..374f9c45ec7b --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_backups_service/update_backup.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlBackupsService_UpdateBackup_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the update_backup call in the SqlBackupsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlBackupsService::Client#update_backup. +# +def update_backup + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlBackupsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::UpdateBackupRequest.new + + # Call the update_backup method. + result = client.update_backup request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlBackupsService_UpdateBackup_sync] diff --git a/google-cloud-sql-v1/snippets/sql_connect_service/generate_ephemeral_cert.rb b/google-cloud-sql-v1/snippets/sql_connect_service/generate_ephemeral_cert.rb new file mode 100644 index 000000000000..b5b08b0ab4fe --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_connect_service/generate_ephemeral_cert.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the generate_ephemeral_cert call in the SqlConnectService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlConnectService::Client#generate_ephemeral_cert. +# +def generate_ephemeral_cert + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlConnectService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::GenerateEphemeralCertRequest.new + + # Call the generate_ephemeral_cert method. + result = client.generate_ephemeral_cert request + + # The returned object is of type Google::Cloud::Sql::V1::GenerateEphemeralCertResponse. + p result +end +# [END sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_sync] diff --git a/google-cloud-sql-v1/snippets/sql_connect_service/get_connect_settings.rb b/google-cloud-sql-v1/snippets/sql_connect_service/get_connect_settings.rb new file mode 100644 index 000000000000..ede841a9c6b2 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_connect_service/get_connect_settings.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlConnectService_GetConnectSettings_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the get_connect_settings call in the SqlConnectService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlConnectService::Client#get_connect_settings. +# +def get_connect_settings + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlConnectService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::GetConnectSettingsRequest.new + + # Call the get_connect_settings method. + result = client.get_connect_settings request + + # The returned object is of type Google::Cloud::Sql::V1::ConnectSettings. + p result +end +# [END sqladmin_v1_generated_SqlConnectService_GetConnectSettings_sync] diff --git a/google-cloud-sql-v1/snippets/sql_databases_service/delete.rb b/google-cloud-sql-v1/snippets/sql_databases_service/delete.rb new file mode 100644 index 000000000000..cdb3a8a94160 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_databases_service/delete.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlDatabasesService_Delete_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the delete call in the SqlDatabasesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlDatabasesService::Client#delete. +# +def delete + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest.new + + # Call the delete method. + result = client.delete request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlDatabasesService_Delete_sync] diff --git a/google-cloud-sql-v1/snippets/sql_databases_service/get.rb b/google-cloud-sql-v1/snippets/sql_databases_service/get.rb new file mode 100644 index 000000000000..24b54dc11d14 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_databases_service/get.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlDatabasesService_Get_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the get call in the SqlDatabasesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlDatabasesService::Client#get. +# +def get + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlDatabasesGetRequest.new + + # Call the get method. + result = client.get request + + # The returned object is of type Google::Cloud::Sql::V1::Database. + p result +end +# [END sqladmin_v1_generated_SqlDatabasesService_Get_sync] diff --git a/google-cloud-sql-v1/snippets/sql_databases_service/insert.rb b/google-cloud-sql-v1/snippets/sql_databases_service/insert.rb new file mode 100644 index 000000000000..15098a14b7c4 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_databases_service/insert.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlDatabasesService_Insert_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the insert call in the SqlDatabasesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlDatabasesService::Client#insert. +# +def insert + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlDatabasesInsertRequest.new + + # Call the insert method. + result = client.insert request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlDatabasesService_Insert_sync] diff --git a/google-cloud-sql-v1/snippets/sql_databases_service/list.rb b/google-cloud-sql-v1/snippets/sql_databases_service/list.rb new file mode 100644 index 000000000000..b9aea8a64fdb --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_databases_service/list.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlDatabasesService_List_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the list call in the SqlDatabasesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlDatabasesService::Client#list. +# +def list + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlDatabasesListRequest.new + + # Call the list method. + result = client.list request + + # The returned object is of type Google::Cloud::Sql::V1::DatabasesListResponse. + p result +end +# [END sqladmin_v1_generated_SqlDatabasesService_List_sync] diff --git a/google-cloud-sql-v1/snippets/sql_databases_service/patch.rb b/google-cloud-sql-v1/snippets/sql_databases_service/patch.rb new file mode 100644 index 000000000000..8458f0a7dc4b --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_databases_service/patch.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlDatabasesService_Patch_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the patch call in the SqlDatabasesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlDatabasesService::Client#patch. +# +def patch + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new + + # Call the patch method. + result = client.patch request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlDatabasesService_Patch_sync] diff --git a/google-cloud-sql-v1/snippets/sql_databases_service/update.rb b/google-cloud-sql-v1/snippets/sql_databases_service/update.rb new file mode 100644 index 000000000000..e43741b7f716 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_databases_service/update.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlDatabasesService_Update_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the update call in the SqlDatabasesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlDatabasesService::Client#update. +# +def update + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlDatabasesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new + + # Call the update method. + result = client.update request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlDatabasesService_Update_sync] diff --git a/google-cloud-sql-v1/snippets/sql_flags_service/list.rb b/google-cloud-sql-v1/snippets/sql_flags_service/list.rb new file mode 100644 index 000000000000..d8ec484f6f9a --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_flags_service/list.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlFlagsService_List_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the list call in the SqlFlagsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlFlagsService::Client#list. +# +def list + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlFlagsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlFlagsListRequest.new + + # Call the list method. + result = client.list request + + # The returned object is of type Google::Cloud::Sql::V1::FlagsListResponse. + p result +end +# [END sqladmin_v1_generated_SqlFlagsService_List_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/acquire_ssrs_lease.rb b/google-cloud-sql-v1/snippets/sql_instances_service/acquire_ssrs_lease.rb new file mode 100644 index 000000000000..2ee9ec5f48f9 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/acquire_ssrs_lease.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the acquire_ssrs_lease call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#acquire_ssrs_lease. +# +def acquire_ssrs_lease + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest.new + + # Call the acquire_ssrs_lease method. + result = client.acquire_ssrs_lease request + + # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/add_entra_id_certificate.rb b/google-cloud-sql-v1/snippets/sql_instances_service/add_entra_id_certificate.rb new file mode 100644 index 000000000000..9208b67d3439 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/add_entra_id_certificate.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the add_entra_id_certificate call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#add_entra_id_certificate. +# +def add_entra_id_certificate + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest.new + + # Call the add_entra_id_certificate method. + result = client.add_entra_id_certificate request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/add_server_ca.rb b/google-cloud-sql-v1/snippets/sql_instances_service/add_server_ca.rb new file mode 100644 index 000000000000..7c40dfdbf0f2 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/add_server_ca.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_AddServerCa_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the add_server_ca call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#add_server_ca. +# +def add_server_ca + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest.new + + # Call the add_server_ca method. + result = client.add_server_ca request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_AddServerCa_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/add_server_certificate.rb b/google-cloud-sql-v1/snippets/sql_instances_service/add_server_certificate.rb new file mode 100644 index 000000000000..718a05a8233e --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/add_server_certificate.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the add_server_certificate call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#add_server_certificate. +# +def add_server_certificate + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest.new + + # Call the add_server_certificate method. + result = client.add_server_certificate request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/call_clone.rb b/google-cloud-sql-v1/snippets/sql_instances_service/call_clone.rb new file mode 100644 index 000000000000..d4b004799f01 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/call_clone.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Clone_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the call_clone call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#call_clone. +# +def call_clone + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesCloneRequest.new + + # Call the call_clone method. + result = client.call_clone request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Clone_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/create_ephemeral.rb b/google-cloud-sql-v1/snippets/sql_instances_service/create_ephemeral.rb new file mode 100644 index 000000000000..63ec557b992d --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/create_ephemeral.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the create_ephemeral call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#create_ephemeral. +# +def create_ephemeral + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest.new + + # Call the create_ephemeral method. + result = client.create_ephemeral request + + # The returned object is of type Google::Cloud::Sql::V1::SslCert. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/delete.rb b/google-cloud-sql-v1/snippets/sql_instances_service/delete.rb new file mode 100644 index 000000000000..3fd58cf64062 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/delete.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Delete_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the delete call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#delete. +# +def delete + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesDeleteRequest.new + + # Call the delete method. + result = client.delete request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Delete_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/demote.rb b/google-cloud-sql-v1/snippets/sql_instances_service/demote.rb new file mode 100644 index 000000000000..1dc32d815798 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/demote.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Demote_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the demote call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#demote. +# +def demote + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesDemoteRequest.new + + # Call the demote method. + result = client.demote request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Demote_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/demote_master.rb b/google-cloud-sql-v1/snippets/sql_instances_service/demote_master.rb new file mode 100644 index 000000000000..6d58e0036b0d --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/demote_master.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_DemoteMaster_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the demote_master call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#demote_master. +# +def demote_master + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest.new + + # Call the demote_master method. + result = client.demote_master request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_DemoteMaster_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/execute_sql.rb b/google-cloud-sql-v1/snippets/sql_instances_service/execute_sql.rb new file mode 100644 index 000000000000..8bee03948c37 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/execute_sql.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_ExecuteSql_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the execute_sql call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#execute_sql. +# +def execute_sql + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest.new + + # Call the execute_sql method. + result = client.execute_sql request + + # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_ExecuteSql_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/export.rb b/google-cloud-sql-v1/snippets/sql_instances_service/export.rb new file mode 100644 index 000000000000..b75272dbceb5 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/export.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Export_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the export call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#export. +# +def export + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesExportRequest.new + + # Call the export method. + result = client.export request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Export_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/failover.rb b/google-cloud-sql-v1/snippets/sql_instances_service/failover.rb new file mode 100644 index 000000000000..a954dc704986 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/failover.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Failover_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the failover call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#failover. +# +def failover + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesFailoverRequest.new + + # Call the failover method. + result = client.failover request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Failover_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/get.rb b/google-cloud-sql-v1/snippets/sql_instances_service/get.rb new file mode 100644 index 000000000000..2debb0efa963 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/get.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Get_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the get call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#get. +# +def get + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesGetRequest.new + + # Call the get method. + result = client.get request + + # The returned object is of type Google::Cloud::Sql::V1::DatabaseInstance. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Get_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/get_disk_shrink_config.rb b/google-cloud-sql-v1/snippets/sql_instances_service/get_disk_shrink_config.rb new file mode 100644 index 000000000000..f6b9db3b7222 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/get_disk_shrink_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the get_disk_shrink_config call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#get_disk_shrink_config. +# +def get_disk_shrink_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest.new + + # Call the get_disk_shrink_config method. + result = client.get_disk_shrink_config request + + # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/get_latest_recovery_time.rb b/google-cloud-sql-v1/snippets/sql_instances_service/get_latest_recovery_time.rb new file mode 100644 index 000000000000..600a3c1e22cf --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/get_latest_recovery_time.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the get_latest_recovery_time call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#get_latest_recovery_time. +# +def get_latest_recovery_time + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest.new + + # Call the get_latest_recovery_time method. + result = client.get_latest_recovery_time request + + # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/import.rb b/google-cloud-sql-v1/snippets/sql_instances_service/import.rb new file mode 100644 index 000000000000..11bae85cfa3e --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/import.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Import_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the import call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#import. +# +def import + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesImportRequest.new + + # Call the import method. + result = client.import request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Import_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/insert.rb b/google-cloud-sql-v1/snippets/sql_instances_service/insert.rb new file mode 100644 index 000000000000..d6a6e505eb99 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/insert.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Insert_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the insert call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#insert. +# +def insert + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesInsertRequest.new + + # Call the insert method. + result = client.insert request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Insert_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/list.rb b/google-cloud-sql-v1/snippets/sql_instances_service/list.rb new file mode 100644 index 000000000000..9924a8ed1181 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/list.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_List_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the list call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#list. +# +def list + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesListRequest.new + + # Call the list method. + result = client.list request + + # The returned object is of type Google::Cloud::Sql::V1::InstancesListResponse. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_List_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/list_entra_id_certificates.rb b/google-cloud-sql-v1/snippets/sql_instances_service/list_entra_id_certificates.rb new file mode 100644 index 000000000000..d97adbf90b84 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/list_entra_id_certificates.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the list_entra_id_certificates call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#list_entra_id_certificates. +# +def list_entra_id_certificates + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest.new + + # Call the list_entra_id_certificates method. + result = client.list_entra_id_certificates request + + # The returned object is of type Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/list_server_cas.rb b/google-cloud-sql-v1/snippets/sql_instances_service/list_server_cas.rb new file mode 100644 index 000000000000..d939cf6429c2 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/list_server_cas.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_ListServerCas_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the list_server_cas call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#list_server_cas. +# +def list_server_cas + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest.new + + # Call the list_server_cas method. + result = client.list_server_cas request + + # The returned object is of type Google::Cloud::Sql::V1::InstancesListServerCasResponse. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_ListServerCas_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/list_server_certificates.rb b/google-cloud-sql-v1/snippets/sql_instances_service/list_server_certificates.rb new file mode 100644 index 000000000000..eff57acc2b9d --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/list_server_certificates.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the list_server_certificates call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#list_server_certificates. +# +def list_server_certificates + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest.new + + # Call the list_server_certificates method. + result = client.list_server_certificates request + + # The returned object is of type Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/patch.rb b/google-cloud-sql-v1/snippets/sql_instances_service/patch.rb new file mode 100644 index 000000000000..7141d8981a6b --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/patch.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Patch_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the patch call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#patch. +# +def patch + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesPatchRequest.new + + # Call the patch method. + result = client.patch request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Patch_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/perform_disk_shrink.rb b/google-cloud-sql-v1/snippets/sql_instances_service/perform_disk_shrink.rb new file mode 100644 index 000000000000..0f053c6c2d59 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/perform_disk_shrink.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the perform_disk_shrink call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#perform_disk_shrink. +# +def perform_disk_shrink + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest.new + + # Call the perform_disk_shrink method. + result = client.perform_disk_shrink request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/point_in_time_restore.rb b/google-cloud-sql-v1/snippets/sql_instances_service/point_in_time_restore.rb new file mode 100644 index 000000000000..1ecfff1e02a7 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/point_in_time_restore.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the point_in_time_restore call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#point_in_time_restore. +# +def point_in_time_restore + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest.new + + # Call the point_in_time_restore method. + result = client.point_in_time_restore request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/pre_check_major_version_upgrade.rb b/google-cloud-sql-v1/snippets/sql_instances_service/pre_check_major_version_upgrade.rb new file mode 100644 index 000000000000..d1ab4297d497 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/pre_check_major_version_upgrade.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the pre_check_major_version_upgrade call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#pre_check_major_version_upgrade. +# +def pre_check_major_version_upgrade + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest.new + + # Call the pre_check_major_version_upgrade method. + result = client.pre_check_major_version_upgrade request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/promote_replica.rb b/google-cloud-sql-v1/snippets/sql_instances_service/promote_replica.rb new file mode 100644 index 000000000000..718e99446cc8 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/promote_replica.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_PromoteReplica_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the promote_replica call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#promote_replica. +# +def promote_replica + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest.new + + # Call the promote_replica method. + result = client.promote_replica request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_PromoteReplica_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/reencrypt.rb b/google-cloud-sql-v1/snippets/sql_instances_service/reencrypt.rb new file mode 100644 index 000000000000..07d31916c974 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/reencrypt.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Reencrypt_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the reencrypt call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#reencrypt. +# +def reencrypt + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesReencryptRequest.new + + # Call the reencrypt method. + result = client.reencrypt request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Reencrypt_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/release_ssrs_lease.rb b/google-cloud-sql-v1/snippets/sql_instances_service/release_ssrs_lease.rb new file mode 100644 index 000000000000..673d0eeeeed4 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/release_ssrs_lease.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the release_ssrs_lease call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#release_ssrs_lease. +# +def release_ssrs_lease + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest.new + + # Call the release_ssrs_lease method. + result = client.release_ssrs_lease request + + # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/reschedule_maintenance.rb b/google-cloud-sql-v1/snippets/sql_instances_service/reschedule_maintenance.rb new file mode 100644 index 000000000000..f68558bcaff5 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/reschedule_maintenance.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the reschedule_maintenance call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#reschedule_maintenance. +# +def reschedule_maintenance + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest.new + + # Call the reschedule_maintenance method. + result = client.reschedule_maintenance request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/reset_replica_size.rb b/google-cloud-sql-v1/snippets/sql_instances_service/reset_replica_size.rb new file mode 100644 index 000000000000..6590e44f07c4 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/reset_replica_size.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the reset_replica_size call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#reset_replica_size. +# +def reset_replica_size + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest.new + + # Call the reset_replica_size method. + result = client.reset_replica_size request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/reset_ssl_config.rb b/google-cloud-sql-v1/snippets/sql_instances_service/reset_ssl_config.rb new file mode 100644 index 000000000000..d198f19b91e2 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/reset_ssl_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the reset_ssl_config call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#reset_ssl_config. +# +def reset_ssl_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest.new + + # Call the reset_ssl_config method. + result = client.reset_ssl_config request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/restart.rb b/google-cloud-sql-v1/snippets/sql_instances_service/restart.rb new file mode 100644 index 000000000000..c95a2ae06775 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/restart.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Restart_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the restart call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#restart. +# +def restart + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesRestartRequest.new + + # Call the restart method. + result = client.restart request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Restart_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/restore_backup.rb b/google-cloud-sql-v1/snippets/sql_instances_service/restore_backup.rb new file mode 100644 index 000000000000..bbdc60bffbf7 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/restore_backup.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_RestoreBackup_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the restore_backup call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#restore_backup. +# +def restore_backup + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest.new + + # Call the restore_backup method. + result = client.restore_backup request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_RestoreBackup_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/rotate_entra_id_certificate.rb b/google-cloud-sql-v1/snippets/sql_instances_service/rotate_entra_id_certificate.rb new file mode 100644 index 000000000000..cb05cce32cd0 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/rotate_entra_id_certificate.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the rotate_entra_id_certificate call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#rotate_entra_id_certificate. +# +def rotate_entra_id_certificate + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest.new + + # Call the rotate_entra_id_certificate method. + result = client.rotate_entra_id_certificate request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/rotate_server_ca.rb b/google-cloud-sql-v1/snippets/sql_instances_service/rotate_server_ca.rb new file mode 100644 index 000000000000..5f9637c45824 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/rotate_server_ca.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_RotateServerCa_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the rotate_server_ca call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#rotate_server_ca. +# +def rotate_server_ca + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest.new + + # Call the rotate_server_ca method. + result = client.rotate_server_ca request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_RotateServerCa_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/rotate_server_certificate.rb b/google-cloud-sql-v1/snippets/sql_instances_service/rotate_server_certificate.rb new file mode 100644 index 000000000000..63a248338037 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/rotate_server_certificate.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the rotate_server_certificate call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#rotate_server_certificate. +# +def rotate_server_certificate + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest.new + + # Call the rotate_server_certificate method. + result = client.rotate_server_certificate request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/start_external_sync.rb b/google-cloud-sql-v1/snippets/sql_instances_service/start_external_sync.rb new file mode 100644 index 000000000000..3c97b2a74a20 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/start_external_sync.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_StartExternalSync_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the start_external_sync call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#start_external_sync. +# +def start_external_sync + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest.new + + # Call the start_external_sync method. + result = client.start_external_sync request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_StartExternalSync_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/start_replica.rb b/google-cloud-sql-v1/snippets/sql_instances_service/start_replica.rb new file mode 100644 index 000000000000..02410ff4db40 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/start_replica.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_StartReplica_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the start_replica call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#start_replica. +# +def start_replica + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest.new + + # Call the start_replica method. + result = client.start_replica request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_StartReplica_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/stop_replica.rb b/google-cloud-sql-v1/snippets/sql_instances_service/stop_replica.rb new file mode 100644 index 000000000000..edc408c12dce --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/stop_replica.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_StopReplica_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the stop_replica call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#stop_replica. +# +def stop_replica + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest.new + + # Call the stop_replica method. + result = client.stop_replica request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_StopReplica_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/switchover.rb b/google-cloud-sql-v1/snippets/sql_instances_service/switchover.rb new file mode 100644 index 000000000000..c33757404ca2 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/switchover.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Switchover_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the switchover call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#switchover. +# +def switchover + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest.new + + # Call the switchover method. + result = client.switchover request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Switchover_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/truncate_log.rb b/google-cloud-sql-v1/snippets/sql_instances_service/truncate_log.rb new file mode 100644 index 000000000000..808cabab6876 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/truncate_log.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_TruncateLog_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the truncate_log call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#truncate_log. +# +def truncate_log + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest.new + + # Call the truncate_log method. + result = client.truncate_log request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_TruncateLog_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/update.rb b/google-cloud-sql-v1/snippets/sql_instances_service/update.rb new file mode 100644 index 000000000000..b71c7244b788 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/update.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_Update_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the update call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#update. +# +def update + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesUpdateRequest.new + + # Call the update method. + result = client.update request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_Update_sync] diff --git a/google-cloud-sql-v1/snippets/sql_instances_service/verify_external_sync_settings.rb b/google-cloud-sql-v1/snippets/sql_instances_service/verify_external_sync_settings.rb new file mode 100644 index 000000000000..8367578f42db --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_instances_service/verify_external_sync_settings.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the verify_external_sync_settings call in the SqlInstancesService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlInstancesService::Client#verify_external_sync_settings. +# +def verify_external_sync_settings + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlInstancesService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest.new + + # Call the verify_external_sync_settings method. + result = client.verify_external_sync_settings request + + # The returned object is of type Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse. + p result +end +# [END sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_sync] diff --git a/google-cloud-sql-v1/snippets/sql_operations_service/cancel.rb b/google-cloud-sql-v1/snippets/sql_operations_service/cancel.rb new file mode 100644 index 000000000000..3d5ec881e650 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_operations_service/cancel.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlOperationsService_Cancel_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the cancel call in the SqlOperationsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlOperationsService::Client#cancel. +# +def cancel + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlOperationsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlOperationsCancelRequest.new + + # Call the cancel method. + result = client.cancel request + + # The returned object is of type Google::Protobuf::Empty. + p result +end +# [END sqladmin_v1_generated_SqlOperationsService_Cancel_sync] diff --git a/google-cloud-sql-v1/snippets/sql_operations_service/get.rb b/google-cloud-sql-v1/snippets/sql_operations_service/get.rb new file mode 100644 index 000000000000..4fa408323961 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_operations_service/get.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlOperationsService_Get_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the get call in the SqlOperationsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlOperationsService::Client#get. +# +def get + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlOperationsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlOperationsGetRequest.new + + # Call the get method. + result = client.get request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlOperationsService_Get_sync] diff --git a/google-cloud-sql-v1/snippets/sql_operations_service/list.rb b/google-cloud-sql-v1/snippets/sql_operations_service/list.rb new file mode 100644 index 000000000000..ea21b0af382c --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_operations_service/list.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlOperationsService_List_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the list call in the SqlOperationsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlOperationsService::Client#list. +# +def list + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlOperationsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlOperationsListRequest.new + + # Call the list method. + result = client.list request + + # The returned object is of type Google::Cloud::Sql::V1::OperationsListResponse. + p result +end +# [END sqladmin_v1_generated_SqlOperationsService_List_sync] diff --git a/google-cloud-sql-v1/snippets/sql_ssl_certs_service/delete.rb b/google-cloud-sql-v1/snippets/sql_ssl_certs_service/delete.rb new file mode 100644 index 000000000000..e4e707c7f538 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_ssl_certs_service/delete.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlSslCertsService_Delete_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the delete call in the SqlSslCertsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlSslCertsService::Client#delete. +# +def delete + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlSslCertsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest.new + + # Call the delete method. + result = client.delete request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlSslCertsService_Delete_sync] diff --git a/google-cloud-sql-v1/snippets/sql_ssl_certs_service/get.rb b/google-cloud-sql-v1/snippets/sql_ssl_certs_service/get.rb new file mode 100644 index 000000000000..24a19cbcd504 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_ssl_certs_service/get.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlSslCertsService_Get_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the get call in the SqlSslCertsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlSslCertsService::Client#get. +# +def get + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlSslCertsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlSslCertsGetRequest.new + + # Call the get method. + result = client.get request + + # The returned object is of type Google::Cloud::Sql::V1::SslCert. + p result +end +# [END sqladmin_v1_generated_SqlSslCertsService_Get_sync] diff --git a/google-cloud-sql-v1/snippets/sql_ssl_certs_service/insert.rb b/google-cloud-sql-v1/snippets/sql_ssl_certs_service/insert.rb new file mode 100644 index 000000000000..a7390711037f --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_ssl_certs_service/insert.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlSslCertsService_Insert_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the insert call in the SqlSslCertsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlSslCertsService::Client#insert. +# +def insert + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlSslCertsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlSslCertsInsertRequest.new + + # Call the insert method. + result = client.insert request + + # The returned object is of type Google::Cloud::Sql::V1::SslCertsInsertResponse. + p result +end +# [END sqladmin_v1_generated_SqlSslCertsService_Insert_sync] diff --git a/google-cloud-sql-v1/snippets/sql_ssl_certs_service/list.rb b/google-cloud-sql-v1/snippets/sql_ssl_certs_service/list.rb new file mode 100644 index 000000000000..cc0542cefc71 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_ssl_certs_service/list.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlSslCertsService_List_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the list call in the SqlSslCertsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlSslCertsService::Client#list. +# +def list + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlSslCertsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlSslCertsListRequest.new + + # Call the list method. + result = client.list request + + # The returned object is of type Google::Cloud::Sql::V1::SslCertsListResponse. + p result +end +# [END sqladmin_v1_generated_SqlSslCertsService_List_sync] diff --git a/google-cloud-sql-v1/snippets/sql_tiers_service/list.rb b/google-cloud-sql-v1/snippets/sql_tiers_service/list.rb new file mode 100644 index 000000000000..1c13fa0c8d67 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_tiers_service/list.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlTiersService_List_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the list call in the SqlTiersService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlTiersService::Client#list. +# +def list + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlTiersService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlTiersListRequest.new + + # Call the list method. + result = client.list request + + # The returned object is of type Google::Cloud::Sql::V1::TiersListResponse. + p result +end +# [END sqladmin_v1_generated_SqlTiersService_List_sync] diff --git a/google-cloud-sql-v1/snippets/sql_users_service/delete.rb b/google-cloud-sql-v1/snippets/sql_users_service/delete.rb new file mode 100644 index 000000000000..b023055755ae --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_users_service/delete.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlUsersService_Delete_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the delete call in the SqlUsersService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlUsersService::Client#delete. +# +def delete + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlUsersService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlUsersDeleteRequest.new + + # Call the delete method. + result = client.delete request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlUsersService_Delete_sync] diff --git a/google-cloud-sql-v1/snippets/sql_users_service/get.rb b/google-cloud-sql-v1/snippets/sql_users_service/get.rb new file mode 100644 index 000000000000..4f383e4f3da9 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_users_service/get.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlUsersService_Get_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the get call in the SqlUsersService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlUsersService::Client#get. +# +def get + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlUsersService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlUsersGetRequest.new + + # Call the get method. + result = client.get request + + # The returned object is of type Google::Cloud::Sql::V1::User. + p result +end +# [END sqladmin_v1_generated_SqlUsersService_Get_sync] diff --git a/google-cloud-sql-v1/snippets/sql_users_service/insert.rb b/google-cloud-sql-v1/snippets/sql_users_service/insert.rb new file mode 100644 index 000000000000..c5f50b5d5213 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_users_service/insert.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlUsersService_Insert_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the insert call in the SqlUsersService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlUsersService::Client#insert. +# +def insert + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlUsersService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlUsersInsertRequest.new + + # Call the insert method. + result = client.insert request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlUsersService_Insert_sync] diff --git a/google-cloud-sql-v1/snippets/sql_users_service/list.rb b/google-cloud-sql-v1/snippets/sql_users_service/list.rb new file mode 100644 index 000000000000..0add411ff6b4 --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_users_service/list.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlUsersService_List_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the list call in the SqlUsersService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlUsersService::Client#list. +# +def list + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlUsersService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlUsersListRequest.new + + # Call the list method. + result = client.list request + + # The returned object is of type Google::Cloud::Sql::V1::UsersListResponse. + p result +end +# [END sqladmin_v1_generated_SqlUsersService_List_sync] diff --git a/google-cloud-sql-v1/snippets/sql_users_service/update.rb b/google-cloud-sql-v1/snippets/sql_users_service/update.rb new file mode 100644 index 000000000000..74c127e1698e --- /dev/null +++ b/google-cloud-sql-v1/snippets/sql_users_service/update.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START sqladmin_v1_generated_SqlUsersService_Update_sync] +require "google/cloud/sql/v1" + +## +# Snippet for the update call in the SqlUsersService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Sql::V1::SqlUsersService::Client#update. +# +def update + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Sql::V1::SqlUsersService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Sql::V1::SqlUsersUpdateRequest.new + + # Call the update method. + result = client.update request + + # The returned object is of type Google::Cloud::Sql::V1::Operation. + p result +end +# [END sqladmin_v1_generated_SqlUsersService_Update_sync] diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backup_runs_service_rest_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backup_runs_service_rest_test.rb new file mode 100644 index 000000000000..f18b08f7dbbe --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backup_runs_service_rest_test.rb @@ -0,0 +1,324 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/sql/v1/cloud_sql_backup_runs_pb" +require "google/cloud/sql/v1/sql_backup_runs_service/rest" + + +class ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_delete + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + id = 42 + instance = "hello world" + project = "hello world" + + delete_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::ServiceStub.stub :transcode_delete_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.delete({ id: id, instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.delete id: id, instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.delete ::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest.new(id: id, instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.delete({ id: id, instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.delete(::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest.new(id: id, instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_client_stub.call_count + end + end + end + + def test_get + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::BackupRun.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + id = 42 + instance = "hello world" + project = "hello world" + + get_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::ServiceStub.stub :transcode_get_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get({ id: id, instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get id: id, instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get ::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest.new(id: id, instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get({ id: id, instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get(::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest.new(id: id, instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_client_stub.call_count + end + end + end + + def test_insert + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + insert_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::ServiceStub.stub :transcode_insert_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, insert_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.insert({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.insert instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.insert ::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.insert({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.insert(::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, insert_client_stub.call_count + end + end + end + + def test_list + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::BackupRunsListResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + max_results = 42 + page_token = "hello world" + project = "hello world" + + list_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::ServiceStub.stub :transcode_list_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list({ instance: instance, max_results: max_results, page_token: page_token, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list instance: instance, max_results: max_results, page_token: page_token, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlBackupRunsListRequest.new(instance: instance, max_results: max_results, page_token: page_token, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list({ instance: instance, max_results: max_results, page_token: page_token, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlBackupRunsListRequest.new(instance: instance, max_results: max_results, page_token: page_token, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlBackupRunsService::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backup_runs_service_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backup_runs_service_test.rb new file mode 100644 index 000000000000..a64cb01663ea --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backup_runs_service_test.rb @@ -0,0 +1,354 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/sql/v1/cloud_sql_backup_runs_pb" +require "google/cloud/sql/v1/sql_backup_runs_service" + +class ::Google::Cloud::Sql::V1::SqlBackupRunsService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_delete + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + id = 42 + instance = "hello world" + project = "hello world" + + delete_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest, request + assert_equal 42, request["id"] + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete({ id: id, instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete id: id, instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete ::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest.new(id: id, instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete({ id: id, instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete(::Google::Cloud::Sql::V1::SqlBackupRunsDeleteRequest.new(id: id, instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_client_stub.call_rpc_count + end + end + + def test_get + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::BackupRun.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + id = 42 + instance = "hello world" + project = "hello world" + + get_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest, request + assert_equal 42, request["id"] + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get({ id: id, instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get id: id, instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get ::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest.new(id: id, instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get({ id: id, instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get(::Google::Cloud::Sql::V1::SqlBackupRunsGetRequest.new(id: id, instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_client_stub.call_rpc_count + end + end + + def test_insert + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + insert_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :insert, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::BackupRun), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, insert_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.insert({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.insert instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.insert ::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.insert({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.insert(::Google::Cloud::Sql::V1::SqlBackupRunsInsertRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, insert_client_stub.call_rpc_count + end + end + + def test_list + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::BackupRunsListResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + max_results = 42 + page_token = "hello world" + project = "hello world" + + list_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlBackupRunsListRequest, request + assert_equal "hello world", request["instance"] + assert_equal 42, request["max_results"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list({ instance: instance, max_results: max_results, page_token: page_token, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list instance: instance, max_results: max_results, page_token: page_token, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlBackupRunsListRequest.new(instance: instance, max_results: max_results, page_token: page_token, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list({ instance: instance, max_results: max_results, page_token: page_token, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlBackupRunsListRequest.new(instance: instance, max_results: max_results, page_token: page_token, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Sql::V1::SqlBackupRunsService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backups_service_paths_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backups_service_paths_test.rb new file mode 100644 index 000000000000..8ada7f7e1c78 --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backups_service_paths_test.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/sql/v1/sql_backups_service" + +class ::Google::Cloud::Sql::V1::SqlBackupsService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_backup_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.backup_path project: "value0", backup: "value1" + assert_equal "projects/value0/backups/value1", path + end + end + + def test_project_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.project_path project: "value0" + assert_equal "projects/value0", path + end + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backups_service_rest_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backups_service_rest_test.rb new file mode 100644 index 000000000000..5c30b8a60dee --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backups_service_rest_test.rb @@ -0,0 +1,374 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/sql/v1/cloud_sql_backups_pb" +require "google/cloud/sql/v1/sql_backups_service/rest" + + +class ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_create_backup + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + backup = {} + + create_backup_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::ServiceStub.stub :transcode_create_backup_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_backup_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.create_backup({ parent: parent, backup: backup }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.create_backup parent: parent, backup: backup do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.create_backup ::Google::Cloud::Sql::V1::CreateBackupRequest.new(parent: parent, backup: backup) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.create_backup({ parent: parent, backup: backup }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.create_backup(::Google::Cloud::Sql::V1::CreateBackupRequest.new(parent: parent, backup: backup), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_backup_client_stub.call_count + end + end + end + + def test_get_backup + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Backup.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_backup_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::ServiceStub.stub :transcode_get_backup_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_backup_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_backup({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_backup name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_backup ::Google::Cloud::Sql::V1::GetBackupRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_backup({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_backup(::Google::Cloud::Sql::V1::GetBackupRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_backup_client_stub.call_count + end + end + end + + def test_list_backups + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::ListBackupsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + + list_backups_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::ServiceStub.stub :transcode_list_backups_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_backups_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list_backups({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list_backups parent: parent, page_size: page_size, page_token: page_token, filter: filter do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list_backups ::Google::Cloud::Sql::V1::ListBackupsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list_backups({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list_backups(::Google::Cloud::Sql::V1::ListBackupsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_backups_client_stub.call_count + end + end + end + + def test_update_backup + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + backup = {} + update_mask = {} + + update_backup_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::ServiceStub.stub :transcode_update_backup_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_backup_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update_backup({ backup: backup, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update_backup backup: backup, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update_backup ::Google::Cloud::Sql::V1::UpdateBackupRequest.new(backup: backup, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update_backup({ backup: backup, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update_backup(::Google::Cloud::Sql::V1::UpdateBackupRequest.new(backup: backup, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_backup_client_stub.call_count + end + end + end + + def test_delete_backup + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_backup_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::ServiceStub.stub :transcode_delete_backup_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_backup_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.delete_backup({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.delete_backup name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.delete_backup ::Google::Cloud::Sql::V1::DeleteBackupRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.delete_backup({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.delete_backup(::Google::Cloud::Sql::V1::DeleteBackupRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_backup_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlBackupsService::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backups_service_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backups_service_test.rb new file mode 100644 index 000000000000..954fb182a08b --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_backups_service_test.rb @@ -0,0 +1,409 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/sql/v1/cloud_sql_backups_pb" +require "google/cloud/sql/v1/sql_backups_service" + +class ::Google::Cloud::Sql::V1::SqlBackupsService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_create_backup + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + backup = {} + + create_backup_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_backup, name + assert_kind_of ::Google::Cloud::Sql::V1::CreateBackupRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::Backup), request["backup"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_backup_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.create_backup({ parent: parent, backup: backup }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.create_backup parent: parent, backup: backup do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.create_backup ::Google::Cloud::Sql::V1::CreateBackupRequest.new(parent: parent, backup: backup) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.create_backup({ parent: parent, backup: backup }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.create_backup(::Google::Cloud::Sql::V1::CreateBackupRequest.new(parent: parent, backup: backup), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_backup_client_stub.call_rpc_count + end + end + + def test_get_backup + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Backup.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_backup_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_backup, name + assert_kind_of ::Google::Cloud::Sql::V1::GetBackupRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_backup_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_backup({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_backup name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_backup ::Google::Cloud::Sql::V1::GetBackupRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_backup({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_backup(::Google::Cloud::Sql::V1::GetBackupRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_backup_client_stub.call_rpc_count + end + end + + def test_list_backups + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::ListBackupsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + + list_backups_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_backups, name + assert_kind_of ::Google::Cloud::Sql::V1::ListBackupsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_backups_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_backups({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_backups parent: parent, page_size: page_size, page_token: page_token, filter: filter do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_backups ::Google::Cloud::Sql::V1::ListBackupsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_backups({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_backups(::Google::Cloud::Sql::V1::ListBackupsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_backups_client_stub.call_rpc_count + end + end + + def test_update_backup + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + backup = {} + update_mask = {} + + update_backup_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_backup, name + assert_kind_of ::Google::Cloud::Sql::V1::UpdateBackupRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::Backup), request["backup"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_backup_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update_backup({ backup: backup, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update_backup backup: backup, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update_backup ::Google::Cloud::Sql::V1::UpdateBackupRequest.new(backup: backup, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update_backup({ backup: backup, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update_backup(::Google::Cloud::Sql::V1::UpdateBackupRequest.new(backup: backup, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_backup_client_stub.call_rpc_count + end + end + + def test_delete_backup + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_backup_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_backup, name + assert_kind_of ::Google::Cloud::Sql::V1::DeleteBackupRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_backup_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete_backup({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete_backup name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete_backup ::Google::Cloud::Sql::V1::DeleteBackupRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete_backup({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete_backup(::Google::Cloud::Sql::V1::DeleteBackupRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_backup_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlBackupsService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlBackupsService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Sql::V1::SqlBackupsService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_connect_service_rest_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_connect_service_rest_test.rb new file mode 100644 index 000000000000..b8ab544232ba --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_connect_service_rest_test.rb @@ -0,0 +1,214 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/sql/v1/cloud_sql_connect_pb" +require "google/cloud/sql/v1/sql_connect_service/rest" + + +class ::Google::Cloud::Sql::V1::SqlConnectService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_get_connect_settings + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::ConnectSettings.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + read_time = {} + + get_connect_settings_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlConnectService::Rest::ServiceStub.stub :transcode_get_connect_settings_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_connect_settings_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_connect_settings({ instance: instance, project: project, read_time: read_time }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_connect_settings instance: instance, project: project, read_time: read_time do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_connect_settings ::Google::Cloud::Sql::V1::GetConnectSettingsRequest.new(instance: instance, project: project, read_time: read_time) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_connect_settings({ instance: instance, project: project, read_time: read_time }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_connect_settings(::Google::Cloud::Sql::V1::GetConnectSettingsRequest.new(instance: instance, project: project, read_time: read_time), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_connect_settings_client_stub.call_count + end + end + end + + def test_generate_ephemeral_cert + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + public_key = "hello world" + access_token = "hello world" + read_time = {} + valid_duration = {} + + generate_ephemeral_cert_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlConnectService::Rest::ServiceStub.stub :transcode_generate_ephemeral_cert_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, generate_ephemeral_cert_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.generate_ephemeral_cert({ instance: instance, project: project, public_key: public_key, access_token: access_token, read_time: read_time, valid_duration: valid_duration }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.generate_ephemeral_cert instance: instance, project: project, public_key: public_key, access_token: access_token, read_time: read_time, valid_duration: valid_duration do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.generate_ephemeral_cert ::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest.new(instance: instance, project: project, public_key: public_key, access_token: access_token, read_time: read_time, valid_duration: valid_duration) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.generate_ephemeral_cert({ instance: instance, project: project, public_key: public_key, access_token: access_token, read_time: read_time, valid_duration: valid_duration }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.generate_ephemeral_cert(::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest.new(instance: instance, project: project, public_key: public_key, access_token: access_token, read_time: read_time, valid_duration: valid_duration), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, generate_ephemeral_cert_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlConnectService::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_connect_service_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_connect_service_test.rb new file mode 100644 index 000000000000..7685ad469c2c --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_connect_service_test.rb @@ -0,0 +1,234 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/sql/v1/cloud_sql_connect_pb" +require "google/cloud/sql/v1/sql_connect_service" + +class ::Google::Cloud::Sql::V1::SqlConnectService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_get_connect_settings + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::ConnectSettings.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + read_time = {} + + get_connect_settings_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_connect_settings, name + assert_kind_of ::Google::Cloud::Sql::V1::GetConnectSettingsRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["read_time"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_connect_settings_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlConnectService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_connect_settings({ instance: instance, project: project, read_time: read_time }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_connect_settings instance: instance, project: project, read_time: read_time do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_connect_settings ::Google::Cloud::Sql::V1::GetConnectSettingsRequest.new(instance: instance, project: project, read_time: read_time) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_connect_settings({ instance: instance, project: project, read_time: read_time }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_connect_settings(::Google::Cloud::Sql::V1::GetConnectSettingsRequest.new(instance: instance, project: project, read_time: read_time), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_connect_settings_client_stub.call_rpc_count + end + end + + def test_generate_ephemeral_cert + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::GenerateEphemeralCertResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + public_key = "hello world" + access_token = "hello world" + read_time = {} + valid_duration = {} + + generate_ephemeral_cert_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :generate_ephemeral_cert, name + assert_kind_of ::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal "hello world", request["public_key"] + assert_equal "hello world", request["access_token"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["read_time"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["valid_duration"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, generate_ephemeral_cert_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlConnectService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.generate_ephemeral_cert({ instance: instance, project: project, public_key: public_key, access_token: access_token, read_time: read_time, valid_duration: valid_duration }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.generate_ephemeral_cert instance: instance, project: project, public_key: public_key, access_token: access_token, read_time: read_time, valid_duration: valid_duration do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.generate_ephemeral_cert ::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest.new(instance: instance, project: project, public_key: public_key, access_token: access_token, read_time: read_time, valid_duration: valid_duration) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.generate_ephemeral_cert({ instance: instance, project: project, public_key: public_key, access_token: access_token, read_time: read_time, valid_duration: valid_duration }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.generate_ephemeral_cert(::Google::Cloud::Sql::V1::GenerateEphemeralCertRequest.new(instance: instance, project: project, public_key: public_key, access_token: access_token, read_time: read_time, valid_duration: valid_duration), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, generate_ephemeral_cert_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlConnectService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlConnectService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlConnectService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Sql::V1::SqlConnectService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_databases_service_rest_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_databases_service_rest_test.rb new file mode 100644 index 000000000000..cc79972dea8c --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_databases_service_rest_test.rb @@ -0,0 +1,436 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/sql/v1/cloud_sql_databases_pb" +require "google/cloud/sql/v1/sql_databases_service/rest" + + +class ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_delete + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + database = "hello world" + instance = "hello world" + project = "hello world" + + delete_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::ServiceStub.stub :transcode_delete_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.delete({ database: database, instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.delete database: database, instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.delete ::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest.new(database: database, instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.delete({ database: database, instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.delete(::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest.new(database: database, instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_client_stub.call_count + end + end + end + + def test_get + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Database.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + database = "hello world" + instance = "hello world" + project = "hello world" + + get_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::ServiceStub.stub :transcode_get_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get({ database: database, instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get database: database, instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get ::Google::Cloud::Sql::V1::SqlDatabasesGetRequest.new(database: database, instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get({ database: database, instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get(::Google::Cloud::Sql::V1::SqlDatabasesGetRequest.new(database: database, instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_client_stub.call_count + end + end + end + + def test_insert + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + insert_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::ServiceStub.stub :transcode_insert_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, insert_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.insert({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.insert instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.insert ::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.insert({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.insert(::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, insert_client_stub.call_count + end + end + end + + def test_list + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::DatabasesListResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + list_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::ServiceStub.stub :transcode_list_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlDatabasesListRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlDatabasesListRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_client_stub.call_count + end + end + end + + def test_patch + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + database = "hello world" + instance = "hello world" + project = "hello world" + body = {} + + patch_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::ServiceStub.stub :transcode_patch_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, patch_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.patch({ database: database, instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.patch database: database, instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.patch ::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new(database: database, instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.patch({ database: database, instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.patch(::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new(database: database, instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, patch_client_stub.call_count + end + end + end + + def test_update + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + database = "hello world" + instance = "hello world" + project = "hello world" + body = {} + + update_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::ServiceStub.stub :transcode_update_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update({ database: database, instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update database: database, instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update ::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new(database: database, instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update({ database: database, instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update(::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new(database: database, instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlDatabasesService::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_databases_service_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_databases_service_test.rb new file mode 100644 index 000000000000..067971a73f17 --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_databases_service_test.rb @@ -0,0 +1,478 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/sql/v1/cloud_sql_databases_pb" +require "google/cloud/sql/v1/sql_databases_service" + +class ::Google::Cloud::Sql::V1::SqlDatabasesService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_delete + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + database = "hello world" + instance = "hello world" + project = "hello world" + + delete_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest, request + assert_equal "hello world", request["database"] + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete({ database: database, instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete database: database, instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete ::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest.new(database: database, instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete({ database: database, instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete(::Google::Cloud::Sql::V1::SqlDatabasesDeleteRequest.new(database: database, instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_client_stub.call_rpc_count + end + end + + def test_get + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Database.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + database = "hello world" + instance = "hello world" + project = "hello world" + + get_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlDatabasesGetRequest, request + assert_equal "hello world", request["database"] + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get({ database: database, instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get database: database, instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get ::Google::Cloud::Sql::V1::SqlDatabasesGetRequest.new(database: database, instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get({ database: database, instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get(::Google::Cloud::Sql::V1::SqlDatabasesGetRequest.new(database: database, instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_client_stub.call_rpc_count + end + end + + def test_insert + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + insert_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :insert, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::Database), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, insert_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.insert({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.insert instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.insert ::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.insert({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.insert(::Google::Cloud::Sql::V1::SqlDatabasesInsertRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, insert_client_stub.call_rpc_count + end + end + + def test_list + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::DatabasesListResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + list_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlDatabasesListRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlDatabasesListRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlDatabasesListRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_client_stub.call_rpc_count + end + end + + def test_patch + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + database = "hello world" + instance = "hello world" + project = "hello world" + body = {} + + patch_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :patch, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest, request + assert_equal "hello world", request["database"] + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::Database), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, patch_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.patch({ database: database, instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.patch database: database, instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.patch ::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new(database: database, instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.patch({ database: database, instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.patch(::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new(database: database, instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, patch_client_stub.call_rpc_count + end + end + + def test_update + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + database = "hello world" + instance = "hello world" + project = "hello world" + body = {} + + update_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest, request + assert_equal "hello world", request["database"] + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::Database), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update({ database: database, instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update database: database, instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update ::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new(database: database, instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update({ database: database, instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update(::Google::Cloud::Sql::V1::SqlDatabasesUpdateRequest.new(database: database, instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlDatabasesService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlDatabasesService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Sql::V1::SqlDatabasesService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_flags_service_rest_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_flags_service_rest_test.rb new file mode 100644 index 000000000000..53697d7ffa3c --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_flags_service_rest_test.rb @@ -0,0 +1,154 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/sql/v1/cloud_sql_flags_pb" +require "google/cloud/sql/v1/sql_flags_service/rest" + + +class ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::FlagsListResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + database_version = "hello world" + flag_scope = :SQL_FLAG_SCOPE_UNSPECIFIED + + list_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::ServiceStub.stub :transcode_list_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list({ database_version: database_version, flag_scope: flag_scope }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list database_version: database_version, flag_scope: flag_scope do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlFlagsListRequest.new(database_version: database_version, flag_scope: flag_scope) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list({ database_version: database_version, flag_scope: flag_scope }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlFlagsListRequest.new(database_version: database_version, flag_scope: flag_scope), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlFlagsService::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_flags_service_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_flags_service_test.rb new file mode 100644 index 000000000000..d3e908e45a11 --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_flags_service_test.rb @@ -0,0 +1,165 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/sql/v1/cloud_sql_flags_pb" +require "google/cloud/sql/v1/sql_flags_service" + +class ::Google::Cloud::Sql::V1::SqlFlagsService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::FlagsListResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + database_version = "hello world" + flag_scope = :SQL_FLAG_SCOPE_UNSPECIFIED + + list_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlFlagsListRequest, request + assert_equal "hello world", request["database_version"] + assert_equal :SQL_FLAG_SCOPE_UNSPECIFIED, request["flag_scope"] + assert request.has_flag_scope? + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlFlagsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list({ database_version: database_version, flag_scope: flag_scope }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list database_version: database_version, flag_scope: flag_scope do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlFlagsListRequest.new(database_version: database_version, flag_scope: flag_scope) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list({ database_version: database_version, flag_scope: flag_scope }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlFlagsListRequest.new(database_version: database_version, flag_scope: flag_scope), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlFlagsService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlFlagsService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlFlagsService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Sql::V1::SqlFlagsService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_instances_service_paths_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_instances_service_paths_test.rb new file mode 100644 index 000000000000..29fc4349d6a6 --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_instances_service_paths_test.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/sql/v1/sql_instances_service" + +class ::Google::Cloud::Sql::V1::SqlInstancesService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_backup_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.backup_path project: "value0", backup: "value1" + assert_equal "projects/value0/backups/value1", path + + path = client.backup_path project: "value0", location: "value1", backupvault: "value2", datasource: "value3", backup: "value4" + assert_equal "projects/value0/locations/value1/backupVaults/value2/dataSources/value3/backups/value4", path + end + end + + def test_network_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.network_path project: "value0", network: "value1" + assert_equal "projects/value0/global/networks/value1", path + end + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_instances_service_rest_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_instances_service_rest_test.rb new file mode 100644 index 000000000000..e9f384bd6101 --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_instances_service_rest_test.rb @@ -0,0 +1,2506 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/sql/v1/cloud_sql_instances_pb" +require "google/cloud/sql/v1/sql_instances_service/rest" + + +class ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_add_server_ca + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + add_server_ca_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_add_server_ca_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, add_server_ca_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.add_server_ca({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.add_server_ca instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.add_server_ca ::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.add_server_ca({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.add_server_ca(::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, add_server_ca_client_stub.call_count + end + end + end + + def test_add_server_certificate + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + add_server_certificate_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_add_server_certificate_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, add_server_certificate_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.add_server_certificate({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.add_server_certificate instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.add_server_certificate ::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.add_server_certificate({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.add_server_certificate(::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, add_server_certificate_client_stub.call_count + end + end + end + + def test_add_entra_id_certificate + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + add_entra_id_certificate_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_add_entra_id_certificate_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, add_entra_id_certificate_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.add_entra_id_certificate({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.add_entra_id_certificate instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.add_entra_id_certificate ::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.add_entra_id_certificate({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.add_entra_id_certificate(::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, add_entra_id_certificate_client_stub.call_count + end + end + end + + def test_call_clone + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + call_clone_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_call_clone_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, call_clone_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.call_clone({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.call_clone instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.call_clone ::Google::Cloud::Sql::V1::SqlInstancesCloneRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.call_clone({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.call_clone(::Google::Cloud::Sql::V1::SqlInstancesCloneRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, call_clone_client_stub.call_count + end + end + end + + def test_delete + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + enable_final_backup = true + final_backup_ttl_days = 42 + final_backup_description = "hello world" + + delete_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_delete_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.delete({ instance: instance, project: project, enable_final_backup: enable_final_backup, final_backup_ttl_days: final_backup_ttl_days, final_backup_description: final_backup_description }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.delete instance: instance, project: project, enable_final_backup: enable_final_backup, final_backup_ttl_days: final_backup_ttl_days, final_backup_description: final_backup_description do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.delete ::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest.new(instance: instance, project: project, enable_final_backup: enable_final_backup, final_backup_ttl_days: final_backup_ttl_days, final_backup_description: final_backup_description) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.delete({ instance: instance, project: project, enable_final_backup: enable_final_backup, final_backup_ttl_days: final_backup_ttl_days, final_backup_description: final_backup_description }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.delete(::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest.new(instance: instance, project: project, enable_final_backup: enable_final_backup, final_backup_ttl_days: final_backup_ttl_days, final_backup_description: final_backup_description), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_client_stub.call_count + end + end + end + + def test_demote_master + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + demote_master_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_demote_master_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, demote_master_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.demote_master({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.demote_master instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.demote_master ::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.demote_master({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.demote_master(::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, demote_master_client_stub.call_count + end + end + end + + def test_demote + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + demote_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_demote_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, demote_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.demote({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.demote instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.demote ::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.demote({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.demote(::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, demote_client_stub.call_count + end + end + end + + def test_export + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + export_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_export_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, export_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.export({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.export instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.export ::Google::Cloud::Sql::V1::SqlInstancesExportRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.export({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.export(::Google::Cloud::Sql::V1::SqlInstancesExportRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, export_client_stub.call_count + end + end + end + + def test_failover + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + failover_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_failover_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, failover_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.failover({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.failover instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.failover ::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.failover({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.failover(::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, failover_client_stub.call_count + end + end + end + + def test_reencrypt + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + reencrypt_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_reencrypt_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, reencrypt_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.reencrypt({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.reencrypt instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.reencrypt ::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.reencrypt({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.reencrypt(::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, reencrypt_client_stub.call_count + end + end + end + + def test_get + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::DatabaseInstance.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + get_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_get_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get ::Google::Cloud::Sql::V1::SqlInstancesGetRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get(::Google::Cloud::Sql::V1::SqlInstancesGetRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_client_stub.call_count + end + end + end + + def test_import + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + import_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_import_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, import_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.import({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.import instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.import ::Google::Cloud::Sql::V1::SqlInstancesImportRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.import({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.import(::Google::Cloud::Sql::V1::SqlInstancesImportRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, import_client_stub.call_count + end + end + end + + def test_insert + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + project = "hello world" + body = {} + + insert_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_insert_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, insert_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.insert({ project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.insert project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.insert ::Google::Cloud::Sql::V1::SqlInstancesInsertRequest.new(project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.insert({ project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.insert(::Google::Cloud::Sql::V1::SqlInstancesInsertRequest.new(project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, insert_client_stub.call_count + end + end + end + + def test_list + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::InstancesListResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + filter = "hello world" + max_results = 42 + page_token = "hello world" + project = "hello world" + + list_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_list_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list({ filter: filter, max_results: max_results, page_token: page_token, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list filter: filter, max_results: max_results, page_token: page_token, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlInstancesListRequest.new(filter: filter, max_results: max_results, page_token: page_token, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list({ filter: filter, max_results: max_results, page_token: page_token, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlInstancesListRequest.new(filter: filter, max_results: max_results, page_token: page_token, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_client_stub.call_count + end + end + end + + def test_list_server_cas + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::InstancesListServerCasResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + list_server_cas_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_list_server_cas_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_server_cas_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list_server_cas({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list_server_cas instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list_server_cas ::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list_server_cas({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list_server_cas(::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_server_cas_client_stub.call_count + end + end + end + + def test_list_server_certificates + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + list_server_certificates_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_list_server_certificates_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_server_certificates_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list_server_certificates({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list_server_certificates instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list_server_certificates ::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list_server_certificates({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list_server_certificates(::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_server_certificates_client_stub.call_count + end + end + end + + def test_list_entra_id_certificates + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + list_entra_id_certificates_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_list_entra_id_certificates_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_entra_id_certificates_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list_entra_id_certificates({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list_entra_id_certificates instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list_entra_id_certificates ::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list_entra_id_certificates({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list_entra_id_certificates(::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_entra_id_certificates_client_stub.call_count + end + end + end + + def test_patch + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + patch_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_patch_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, patch_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.patch({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.patch instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.patch ::Google::Cloud::Sql::V1::SqlInstancesPatchRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.patch({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.patch(::Google::Cloud::Sql::V1::SqlInstancesPatchRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, patch_client_stub.call_count + end + end + end + + def test_promote_replica + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + failover = true + + promote_replica_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_promote_replica_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, promote_replica_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.promote_replica({ instance: instance, project: project, failover: failover }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.promote_replica instance: instance, project: project, failover: failover do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.promote_replica ::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest.new(instance: instance, project: project, failover: failover) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.promote_replica({ instance: instance, project: project, failover: failover }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.promote_replica(::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest.new(instance: instance, project: project, failover: failover), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, promote_replica_client_stub.call_count + end + end + end + + def test_switchover + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + db_timeout = {} + + switchover_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_switchover_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, switchover_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.switchover({ instance: instance, project: project, db_timeout: db_timeout }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.switchover instance: instance, project: project, db_timeout: db_timeout do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.switchover ::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest.new(instance: instance, project: project, db_timeout: db_timeout) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.switchover({ instance: instance, project: project, db_timeout: db_timeout }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.switchover(::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest.new(instance: instance, project: project, db_timeout: db_timeout), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, switchover_client_stub.call_count + end + end + end + + def test_reset_ssl_config + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + mode = :RESET_SSL_MODE_UNSPECIFIED + + reset_ssl_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_reset_ssl_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, reset_ssl_config_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.reset_ssl_config({ instance: instance, project: project, mode: mode }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.reset_ssl_config instance: instance, project: project, mode: mode do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.reset_ssl_config ::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest.new(instance: instance, project: project, mode: mode) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.reset_ssl_config({ instance: instance, project: project, mode: mode }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.reset_ssl_config(::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest.new(instance: instance, project: project, mode: mode), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, reset_ssl_config_client_stub.call_count + end + end + end + + def test_restart + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + restart_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_restart_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, restart_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.restart({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.restart instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.restart ::Google::Cloud::Sql::V1::SqlInstancesRestartRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.restart({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.restart(::Google::Cloud::Sql::V1::SqlInstancesRestartRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, restart_client_stub.call_count + end + end + end + + def test_restore_backup + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + restore_backup_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_restore_backup_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, restore_backup_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.restore_backup({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.restore_backup instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.restore_backup ::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.restore_backup({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.restore_backup(::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, restore_backup_client_stub.call_count + end + end + end + + def test_rotate_server_ca + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + rotate_server_ca_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_rotate_server_ca_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, rotate_server_ca_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.rotate_server_ca({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.rotate_server_ca instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.rotate_server_ca ::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.rotate_server_ca({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.rotate_server_ca(::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, rotate_server_ca_client_stub.call_count + end + end + end + + def test_rotate_server_certificate + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + rotate_server_certificate_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_rotate_server_certificate_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, rotate_server_certificate_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.rotate_server_certificate({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.rotate_server_certificate instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.rotate_server_certificate ::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.rotate_server_certificate({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.rotate_server_certificate(::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, rotate_server_certificate_client_stub.call_count + end + end + end + + def test_rotate_entra_id_certificate + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + rotate_entra_id_certificate_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_rotate_entra_id_certificate_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, rotate_entra_id_certificate_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.rotate_entra_id_certificate({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.rotate_entra_id_certificate instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.rotate_entra_id_certificate ::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.rotate_entra_id_certificate({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.rotate_entra_id_certificate(::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, rotate_entra_id_certificate_client_stub.call_count + end + end + end + + def test_start_replica + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + start_replica_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_start_replica_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, start_replica_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.start_replica({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.start_replica instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.start_replica ::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.start_replica({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.start_replica(::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, start_replica_client_stub.call_count + end + end + end + + def test_stop_replica + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + stop_replica_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_stop_replica_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, stop_replica_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.stop_replica({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.stop_replica instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.stop_replica ::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.stop_replica({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.stop_replica(::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, stop_replica_client_stub.call_count + end + end + end + + def test_truncate_log + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + truncate_log_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_truncate_log_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, truncate_log_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.truncate_log({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.truncate_log instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.truncate_log ::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.truncate_log({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.truncate_log(::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, truncate_log_client_stub.call_count + end + end + end + + def test_update + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + update_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_update_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update ::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update(::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_client_stub.call_count + end + end + end + + def test_create_ephemeral + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::SslCert.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + create_ephemeral_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_create_ephemeral_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_ephemeral_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.create_ephemeral({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.create_ephemeral instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.create_ephemeral ::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.create_ephemeral({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.create_ephemeral(::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_ephemeral_client_stub.call_count + end + end + end + + def test_reschedule_maintenance + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + reschedule_maintenance_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_reschedule_maintenance_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, reschedule_maintenance_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.reschedule_maintenance({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.reschedule_maintenance instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.reschedule_maintenance ::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.reschedule_maintenance({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.reschedule_maintenance(::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, reschedule_maintenance_client_stub.call_count + end + end + end + + def test_verify_external_sync_settings + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + verify_connection_only = true + sync_mode = :EXTERNAL_SYNC_MODE_UNSPECIFIED + verify_replication_only = true + mysql_sync_config = {} + migration_type = :MIGRATION_TYPE_UNSPECIFIED + sync_parallel_level = :EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED + selected_objects = [{}] + + verify_external_sync_settings_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_verify_external_sync_settings_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, verify_external_sync_settings_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.verify_external_sync_settings({ instance: instance, project: project, verify_connection_only: verify_connection_only, sync_mode: sync_mode, verify_replication_only: verify_replication_only, mysql_sync_config: mysql_sync_config, migration_type: migration_type, sync_parallel_level: sync_parallel_level, selected_objects: selected_objects }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.verify_external_sync_settings instance: instance, project: project, verify_connection_only: verify_connection_only, sync_mode: sync_mode, verify_replication_only: verify_replication_only, mysql_sync_config: mysql_sync_config, migration_type: migration_type, sync_parallel_level: sync_parallel_level, selected_objects: selected_objects do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.verify_external_sync_settings ::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest.new(instance: instance, project: project, verify_connection_only: verify_connection_only, sync_mode: sync_mode, verify_replication_only: verify_replication_only, mysql_sync_config: mysql_sync_config, migration_type: migration_type, sync_parallel_level: sync_parallel_level, selected_objects: selected_objects) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.verify_external_sync_settings({ instance: instance, project: project, verify_connection_only: verify_connection_only, sync_mode: sync_mode, verify_replication_only: verify_replication_only, mysql_sync_config: mysql_sync_config, migration_type: migration_type, sync_parallel_level: sync_parallel_level, selected_objects: selected_objects }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.verify_external_sync_settings(::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest.new(instance: instance, project: project, verify_connection_only: verify_connection_only, sync_mode: sync_mode, verify_replication_only: verify_replication_only, mysql_sync_config: mysql_sync_config, migration_type: migration_type, sync_parallel_level: sync_parallel_level, selected_objects: selected_objects), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, verify_external_sync_settings_client_stub.call_count + end + end + end + + def test_start_external_sync + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + sync_mode = :EXTERNAL_SYNC_MODE_UNSPECIFIED + skip_verification = true + mysql_sync_config = {} + sync_parallel_level = :EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED + migration_type = :MIGRATION_TYPE_UNSPECIFIED + replica_overwrite_enabled = true + + start_external_sync_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_start_external_sync_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, start_external_sync_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.start_external_sync({ instance: instance, project: project, sync_mode: sync_mode, skip_verification: skip_verification, mysql_sync_config: mysql_sync_config, sync_parallel_level: sync_parallel_level, migration_type: migration_type, replica_overwrite_enabled: replica_overwrite_enabled }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.start_external_sync instance: instance, project: project, sync_mode: sync_mode, skip_verification: skip_verification, mysql_sync_config: mysql_sync_config, sync_parallel_level: sync_parallel_level, migration_type: migration_type, replica_overwrite_enabled: replica_overwrite_enabled do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.start_external_sync ::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest.new(instance: instance, project: project, sync_mode: sync_mode, skip_verification: skip_verification, mysql_sync_config: mysql_sync_config, sync_parallel_level: sync_parallel_level, migration_type: migration_type, replica_overwrite_enabled: replica_overwrite_enabled) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.start_external_sync({ instance: instance, project: project, sync_mode: sync_mode, skip_verification: skip_verification, mysql_sync_config: mysql_sync_config, sync_parallel_level: sync_parallel_level, migration_type: migration_type, replica_overwrite_enabled: replica_overwrite_enabled }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.start_external_sync(::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest.new(instance: instance, project: project, sync_mode: sync_mode, skip_verification: skip_verification, mysql_sync_config: mysql_sync_config, sync_parallel_level: sync_parallel_level, migration_type: migration_type, replica_overwrite_enabled: replica_overwrite_enabled), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, start_external_sync_client_stub.call_count + end + end + end + + def test_perform_disk_shrink + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + perform_disk_shrink_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_perform_disk_shrink_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, perform_disk_shrink_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.perform_disk_shrink({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.perform_disk_shrink instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.perform_disk_shrink ::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.perform_disk_shrink({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.perform_disk_shrink(::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, perform_disk_shrink_client_stub.call_count + end + end + end + + def test_get_disk_shrink_config + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + get_disk_shrink_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_get_disk_shrink_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_disk_shrink_config_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_disk_shrink_config({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_disk_shrink_config instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_disk_shrink_config ::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_disk_shrink_config({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_disk_shrink_config(::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_disk_shrink_config_client_stub.call_count + end + end + end + + def test_reset_replica_size + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + reset_replica_size_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_reset_replica_size_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, reset_replica_size_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.reset_replica_size({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.reset_replica_size instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.reset_replica_size ::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.reset_replica_size({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.reset_replica_size(::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, reset_replica_size_client_stub.call_count + end + end + end + + def test_get_latest_recovery_time + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + source_instance_deletion_time = {} + + get_latest_recovery_time_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_get_latest_recovery_time_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_latest_recovery_time_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_latest_recovery_time({ instance: instance, project: project, source_instance_deletion_time: source_instance_deletion_time }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_latest_recovery_time instance: instance, project: project, source_instance_deletion_time: source_instance_deletion_time do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_latest_recovery_time ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest.new(instance: instance, project: project, source_instance_deletion_time: source_instance_deletion_time) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_latest_recovery_time({ instance: instance, project: project, source_instance_deletion_time: source_instance_deletion_time }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_latest_recovery_time(::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest.new(instance: instance, project: project, source_instance_deletion_time: source_instance_deletion_time), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_latest_recovery_time_client_stub.call_count + end + end + end + + def test_execute_sql + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + execute_sql_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_execute_sql_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, execute_sql_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.execute_sql({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.execute_sql instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.execute_sql ::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.execute_sql({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.execute_sql(::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, execute_sql_client_stub.call_count + end + end + end + + def test_acquire_ssrs_lease + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + acquire_ssrs_lease_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_acquire_ssrs_lease_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, acquire_ssrs_lease_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.acquire_ssrs_lease({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.acquire_ssrs_lease instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.acquire_ssrs_lease ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.acquire_ssrs_lease({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.acquire_ssrs_lease(::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, acquire_ssrs_lease_client_stub.call_count + end + end + end + + def test_release_ssrs_lease + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + release_ssrs_lease_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_release_ssrs_lease_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, release_ssrs_lease_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.release_ssrs_lease({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.release_ssrs_lease instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.release_ssrs_lease ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.release_ssrs_lease({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.release_ssrs_lease(::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, release_ssrs_lease_client_stub.call_count + end + end + end + + def test_pre_check_major_version_upgrade + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + pre_check_major_version_upgrade_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_pre_check_major_version_upgrade_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, pre_check_major_version_upgrade_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.pre_check_major_version_upgrade({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.pre_check_major_version_upgrade instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.pre_check_major_version_upgrade ::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.pre_check_major_version_upgrade({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.pre_check_major_version_upgrade(::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, pre_check_major_version_upgrade_client_stub.call_count + end + end + end + + def test_point_in_time_restore + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + context = {} + + point_in_time_restore_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::ServiceStub.stub :transcode_point_in_time_restore_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, point_in_time_restore_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.point_in_time_restore({ parent: parent, context: context }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.point_in_time_restore parent: parent, context: context do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.point_in_time_restore ::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest.new(parent: parent, context: context) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.point_in_time_restore({ parent: parent, context: context }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.point_in_time_restore(::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest.new(parent: parent, context: context), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, point_in_time_restore_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesService::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_instances_service_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_instances_service_test.rb new file mode 100644 index 000000000000..fb77b721b03c --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_instances_service_test.rb @@ -0,0 +1,2773 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/sql/v1/cloud_sql_instances_pb" +require "google/cloud/sql/v1/sql_instances_service" + +class ::Google::Cloud::Sql::V1::SqlInstancesService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_add_server_ca + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + add_server_ca_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :add_server_ca, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, add_server_ca_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.add_server_ca({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.add_server_ca instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.add_server_ca ::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.add_server_ca({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.add_server_ca(::Google::Cloud::Sql::V1::SqlInstancesAddServerCaRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, add_server_ca_client_stub.call_rpc_count + end + end + + def test_add_server_certificate + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + add_server_certificate_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :add_server_certificate, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, add_server_certificate_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.add_server_certificate({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.add_server_certificate instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.add_server_certificate ::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.add_server_certificate({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.add_server_certificate(::Google::Cloud::Sql::V1::SqlInstancesAddServerCertificateRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, add_server_certificate_client_stub.call_rpc_count + end + end + + def test_add_entra_id_certificate + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + add_entra_id_certificate_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :add_entra_id_certificate, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, add_entra_id_certificate_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.add_entra_id_certificate({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.add_entra_id_certificate instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.add_entra_id_certificate ::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.add_entra_id_certificate({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.add_entra_id_certificate(::Google::Cloud::Sql::V1::SqlInstancesAddEntraIdCertificateRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, add_entra_id_certificate_client_stub.call_rpc_count + end + end + + def test_call_clone + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + call_clone_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :call_clone, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesCloneRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesCloneRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, call_clone_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.call_clone({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.call_clone instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.call_clone ::Google::Cloud::Sql::V1::SqlInstancesCloneRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.call_clone({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.call_clone(::Google::Cloud::Sql::V1::SqlInstancesCloneRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, call_clone_client_stub.call_rpc_count + end + end + + def test_delete + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + enable_final_backup = true + final_backup_ttl_days = 42 + final_backup_description = "hello world" + + delete_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal true, request["enable_final_backup"] + assert request.has_enable_final_backup? + assert_equal 42, request["final_backup_ttl_days"] + assert_equal :final_backup_ttl_days, request.expiration + assert_equal "hello world", request["final_backup_description"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete({ instance: instance, project: project, enable_final_backup: enable_final_backup, final_backup_ttl_days: final_backup_ttl_days, final_backup_description: final_backup_description }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete instance: instance, project: project, enable_final_backup: enable_final_backup, final_backup_ttl_days: final_backup_ttl_days, final_backup_description: final_backup_description do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete ::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest.new(instance: instance, project: project, enable_final_backup: enable_final_backup, final_backup_ttl_days: final_backup_ttl_days, final_backup_description: final_backup_description) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete({ instance: instance, project: project, enable_final_backup: enable_final_backup, final_backup_ttl_days: final_backup_ttl_days, final_backup_description: final_backup_description }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete(::Google::Cloud::Sql::V1::SqlInstancesDeleteRequest.new(instance: instance, project: project, enable_final_backup: enable_final_backup, final_backup_ttl_days: final_backup_ttl_days, final_backup_description: final_backup_description), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_client_stub.call_rpc_count + end + end + + def test_demote_master + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + demote_master_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :demote_master, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesDemoteMasterRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, demote_master_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.demote_master({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.demote_master instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.demote_master ::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.demote_master({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.demote_master(::Google::Cloud::Sql::V1::SqlInstancesDemoteMasterRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, demote_master_client_stub.call_rpc_count + end + end + + def test_demote + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + demote_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :demote, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesDemoteRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, demote_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.demote({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.demote instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.demote ::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.demote({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.demote(::Google::Cloud::Sql::V1::SqlInstancesDemoteRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, demote_client_stub.call_rpc_count + end + end + + def test_export + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + export_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :export, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesExportRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesExportRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, export_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.export({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.export instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.export ::Google::Cloud::Sql::V1::SqlInstancesExportRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.export({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.export(::Google::Cloud::Sql::V1::SqlInstancesExportRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, export_client_stub.call_rpc_count + end + end + + def test_failover + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + failover_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :failover, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesFailoverRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, failover_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.failover({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.failover instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.failover ::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.failover({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.failover(::Google::Cloud::Sql::V1::SqlInstancesFailoverRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, failover_client_stub.call_rpc_count + end + end + + def test_reencrypt + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + reencrypt_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :reencrypt, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesReencryptRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, reencrypt_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.reencrypt({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.reencrypt instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.reencrypt ::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.reencrypt({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.reencrypt(::Google::Cloud::Sql::V1::SqlInstancesReencryptRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, reencrypt_client_stub.call_rpc_count + end + end + + def test_get + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::DatabaseInstance.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + get_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesGetRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get ::Google::Cloud::Sql::V1::SqlInstancesGetRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get(::Google::Cloud::Sql::V1::SqlInstancesGetRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_client_stub.call_rpc_count + end + end + + def test_import + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + import_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :import, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesImportRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesImportRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, import_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.import({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.import instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.import ::Google::Cloud::Sql::V1::SqlInstancesImportRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.import({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.import(::Google::Cloud::Sql::V1::SqlInstancesImportRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, import_client_stub.call_rpc_count + end + end + + def test_insert + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + project = "hello world" + body = {} + + insert_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :insert, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesInsertRequest, request + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::DatabaseInstance), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, insert_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.insert({ project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.insert project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.insert ::Google::Cloud::Sql::V1::SqlInstancesInsertRequest.new(project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.insert({ project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.insert(::Google::Cloud::Sql::V1::SqlInstancesInsertRequest.new(project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, insert_client_stub.call_rpc_count + end + end + + def test_list + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::InstancesListResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + filter = "hello world" + max_results = 42 + page_token = "hello world" + project = "hello world" + + list_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesListRequest, request + assert_equal "hello world", request["filter"] + assert_equal 42, request["max_results"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list({ filter: filter, max_results: max_results, page_token: page_token, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list filter: filter, max_results: max_results, page_token: page_token, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlInstancesListRequest.new(filter: filter, max_results: max_results, page_token: page_token, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list({ filter: filter, max_results: max_results, page_token: page_token, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlInstancesListRequest.new(filter: filter, max_results: max_results, page_token: page_token, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_client_stub.call_rpc_count + end + end + + def test_list_server_cas + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::InstancesListServerCasResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + list_server_cas_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_server_cas, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_server_cas_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_server_cas({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_server_cas instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_server_cas ::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_server_cas({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_server_cas(::Google::Cloud::Sql::V1::SqlInstancesListServerCasRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_server_cas_client_stub.call_rpc_count + end + end + + def test_list_server_certificates + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::InstancesListServerCertificatesResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + list_server_certificates_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_server_certificates, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_server_certificates_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_server_certificates({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_server_certificates instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_server_certificates ::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_server_certificates({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_server_certificates(::Google::Cloud::Sql::V1::SqlInstancesListServerCertificatesRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_server_certificates_client_stub.call_rpc_count + end + end + + def test_list_entra_id_certificates + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::InstancesListEntraIdCertificatesResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + list_entra_id_certificates_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_entra_id_certificates, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_entra_id_certificates_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_entra_id_certificates({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_entra_id_certificates instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_entra_id_certificates ::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_entra_id_certificates({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_entra_id_certificates(::Google::Cloud::Sql::V1::SqlInstancesListEntraIdCertificatesRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_entra_id_certificates_client_stub.call_rpc_count + end + end + + def test_patch + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + patch_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :patch, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesPatchRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::DatabaseInstance), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, patch_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.patch({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.patch instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.patch ::Google::Cloud::Sql::V1::SqlInstancesPatchRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.patch({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.patch(::Google::Cloud::Sql::V1::SqlInstancesPatchRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, patch_client_stub.call_rpc_count + end + end + + def test_promote_replica + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + failover = true + + promote_replica_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :promote_replica, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal true, request["failover"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, promote_replica_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.promote_replica({ instance: instance, project: project, failover: failover }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.promote_replica instance: instance, project: project, failover: failover do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.promote_replica ::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest.new(instance: instance, project: project, failover: failover) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.promote_replica({ instance: instance, project: project, failover: failover }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.promote_replica(::Google::Cloud::Sql::V1::SqlInstancesPromoteReplicaRequest.new(instance: instance, project: project, failover: failover), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, promote_replica_client_stub.call_rpc_count + end + end + + def test_switchover + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + db_timeout = {} + + switchover_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :switchover, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["db_timeout"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, switchover_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.switchover({ instance: instance, project: project, db_timeout: db_timeout }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.switchover instance: instance, project: project, db_timeout: db_timeout do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.switchover ::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest.new(instance: instance, project: project, db_timeout: db_timeout) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.switchover({ instance: instance, project: project, db_timeout: db_timeout }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.switchover(::Google::Cloud::Sql::V1::SqlInstancesSwitchoverRequest.new(instance: instance, project: project, db_timeout: db_timeout), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, switchover_client_stub.call_rpc_count + end + end + + def test_reset_ssl_config + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + mode = :RESET_SSL_MODE_UNSPECIFIED + + reset_ssl_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :reset_ssl_config, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal :RESET_SSL_MODE_UNSPECIFIED, request["mode"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, reset_ssl_config_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.reset_ssl_config({ instance: instance, project: project, mode: mode }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.reset_ssl_config instance: instance, project: project, mode: mode do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.reset_ssl_config ::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest.new(instance: instance, project: project, mode: mode) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.reset_ssl_config({ instance: instance, project: project, mode: mode }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.reset_ssl_config(::Google::Cloud::Sql::V1::SqlInstancesResetSslConfigRequest.new(instance: instance, project: project, mode: mode), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, reset_ssl_config_client_stub.call_rpc_count + end + end + + def test_restart + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + restart_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :restart, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesRestartRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, restart_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.restart({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.restart instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.restart ::Google::Cloud::Sql::V1::SqlInstancesRestartRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.restart({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.restart(::Google::Cloud::Sql::V1::SqlInstancesRestartRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, restart_client_stub.call_rpc_count + end + end + + def test_restore_backup + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + restore_backup_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :restore_backup, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesRestoreBackupRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, restore_backup_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.restore_backup({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.restore_backup instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.restore_backup ::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.restore_backup({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.restore_backup(::Google::Cloud::Sql::V1::SqlInstancesRestoreBackupRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, restore_backup_client_stub.call_rpc_count + end + end + + def test_rotate_server_ca + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + rotate_server_ca_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :rotate_server_ca, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesRotateServerCaRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, rotate_server_ca_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.rotate_server_ca({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.rotate_server_ca instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.rotate_server_ca ::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.rotate_server_ca({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.rotate_server_ca(::Google::Cloud::Sql::V1::SqlInstancesRotateServerCaRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, rotate_server_ca_client_stub.call_rpc_count + end + end + + def test_rotate_server_certificate + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + rotate_server_certificate_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :rotate_server_certificate, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesRotateServerCertificateRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, rotate_server_certificate_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.rotate_server_certificate({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.rotate_server_certificate instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.rotate_server_certificate ::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.rotate_server_certificate({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.rotate_server_certificate(::Google::Cloud::Sql::V1::SqlInstancesRotateServerCertificateRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, rotate_server_certificate_client_stub.call_rpc_count + end + end + + def test_rotate_entra_id_certificate + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + rotate_entra_id_certificate_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :rotate_entra_id_certificate, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesRotateEntraIdCertificateRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, rotate_entra_id_certificate_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.rotate_entra_id_certificate({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.rotate_entra_id_certificate instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.rotate_entra_id_certificate ::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.rotate_entra_id_certificate({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.rotate_entra_id_certificate(::Google::Cloud::Sql::V1::SqlInstancesRotateEntraIdCertificateRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, rotate_entra_id_certificate_client_stub.call_rpc_count + end + end + + def test_start_replica + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + start_replica_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :start_replica, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, start_replica_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.start_replica({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.start_replica instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.start_replica ::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.start_replica({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.start_replica(::Google::Cloud::Sql::V1::SqlInstancesStartReplicaRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, start_replica_client_stub.call_rpc_count + end + end + + def test_stop_replica + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + stop_replica_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :stop_replica, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, stop_replica_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.stop_replica({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.stop_replica instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.stop_replica ::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.stop_replica({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.stop_replica(::Google::Cloud::Sql::V1::SqlInstancesStopReplicaRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, stop_replica_client_stub.call_rpc_count + end + end + + def test_truncate_log + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + truncate_log_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :truncate_log, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesTruncateLogRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, truncate_log_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.truncate_log({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.truncate_log instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.truncate_log ::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.truncate_log({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.truncate_log(::Google::Cloud::Sql::V1::SqlInstancesTruncateLogRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, truncate_log_client_stub.call_rpc_count + end + end + + def test_update + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + update_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::DatabaseInstance), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update ::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update(::Google::Cloud::Sql::V1::SqlInstancesUpdateRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_client_stub.call_rpc_count + end + end + + def test_create_ephemeral + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::SslCert.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + create_ephemeral_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_ephemeral, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::SslCertsCreateEphemeralRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_ephemeral_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.create_ephemeral({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.create_ephemeral instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.create_ephemeral ::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.create_ephemeral({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.create_ephemeral(::Google::Cloud::Sql::V1::SqlInstancesCreateEphemeralCertRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_ephemeral_client_stub.call_rpc_count + end + end + + def test_reschedule_maintenance + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + reschedule_maintenance_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :reschedule_maintenance, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequestBody), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, reschedule_maintenance_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.reschedule_maintenance({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.reschedule_maintenance instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.reschedule_maintenance ::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.reschedule_maintenance({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.reschedule_maintenance(::Google::Cloud::Sql::V1::SqlInstancesRescheduleMaintenanceRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, reschedule_maintenance_client_stub.call_rpc_count + end + end + + def test_verify_external_sync_settings + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + verify_connection_only = true + sync_mode = :EXTERNAL_SYNC_MODE_UNSPECIFIED + verify_replication_only = true + mysql_sync_config = {} + migration_type = :MIGRATION_TYPE_UNSPECIFIED + sync_parallel_level = :EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED + selected_objects = [{}] + + verify_external_sync_settings_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :verify_external_sync_settings, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal true, request["verify_connection_only"] + assert_equal :EXTERNAL_SYNC_MODE_UNSPECIFIED, request["sync_mode"] + assert_equal true, request["verify_replication_only"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::MySqlSyncConfig), request["mysql_sync_config"] + assert_equal :mysql_sync_config, request.sync_config + assert_equal :MIGRATION_TYPE_UNSPECIFIED, request["migration_type"] + assert_equal :EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED, request["sync_parallel_level"] + assert_kind_of ::Google::Cloud::Sql::V1::ExternalSyncSelectedObject, request["selected_objects"].first + refute_nil options + end + + Gapic::ServiceStub.stub :new, verify_external_sync_settings_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.verify_external_sync_settings({ instance: instance, project: project, verify_connection_only: verify_connection_only, sync_mode: sync_mode, verify_replication_only: verify_replication_only, mysql_sync_config: mysql_sync_config, migration_type: migration_type, sync_parallel_level: sync_parallel_level, selected_objects: selected_objects }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.verify_external_sync_settings instance: instance, project: project, verify_connection_only: verify_connection_only, sync_mode: sync_mode, verify_replication_only: verify_replication_only, mysql_sync_config: mysql_sync_config, migration_type: migration_type, sync_parallel_level: sync_parallel_level, selected_objects: selected_objects do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.verify_external_sync_settings ::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest.new(instance: instance, project: project, verify_connection_only: verify_connection_only, sync_mode: sync_mode, verify_replication_only: verify_replication_only, mysql_sync_config: mysql_sync_config, migration_type: migration_type, sync_parallel_level: sync_parallel_level, selected_objects: selected_objects) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.verify_external_sync_settings({ instance: instance, project: project, verify_connection_only: verify_connection_only, sync_mode: sync_mode, verify_replication_only: verify_replication_only, mysql_sync_config: mysql_sync_config, migration_type: migration_type, sync_parallel_level: sync_parallel_level, selected_objects: selected_objects }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.verify_external_sync_settings(::Google::Cloud::Sql::V1::SqlInstancesVerifyExternalSyncSettingsRequest.new(instance: instance, project: project, verify_connection_only: verify_connection_only, sync_mode: sync_mode, verify_replication_only: verify_replication_only, mysql_sync_config: mysql_sync_config, migration_type: migration_type, sync_parallel_level: sync_parallel_level, selected_objects: selected_objects), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, verify_external_sync_settings_client_stub.call_rpc_count + end + end + + def test_start_external_sync + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + sync_mode = :EXTERNAL_SYNC_MODE_UNSPECIFIED + skip_verification = true + mysql_sync_config = {} + sync_parallel_level = :EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED + migration_type = :MIGRATION_TYPE_UNSPECIFIED + replica_overwrite_enabled = true + + start_external_sync_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :start_external_sync, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal :EXTERNAL_SYNC_MODE_UNSPECIFIED, request["sync_mode"] + assert_equal true, request["skip_verification"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::MySqlSyncConfig), request["mysql_sync_config"] + assert_equal :mysql_sync_config, request.sync_config + assert_equal :EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED, request["sync_parallel_level"] + assert_equal :MIGRATION_TYPE_UNSPECIFIED, request["migration_type"] + assert_equal true, request["replica_overwrite_enabled"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, start_external_sync_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.start_external_sync({ instance: instance, project: project, sync_mode: sync_mode, skip_verification: skip_verification, mysql_sync_config: mysql_sync_config, sync_parallel_level: sync_parallel_level, migration_type: migration_type, replica_overwrite_enabled: replica_overwrite_enabled }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.start_external_sync instance: instance, project: project, sync_mode: sync_mode, skip_verification: skip_verification, mysql_sync_config: mysql_sync_config, sync_parallel_level: sync_parallel_level, migration_type: migration_type, replica_overwrite_enabled: replica_overwrite_enabled do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.start_external_sync ::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest.new(instance: instance, project: project, sync_mode: sync_mode, skip_verification: skip_verification, mysql_sync_config: mysql_sync_config, sync_parallel_level: sync_parallel_level, migration_type: migration_type, replica_overwrite_enabled: replica_overwrite_enabled) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.start_external_sync({ instance: instance, project: project, sync_mode: sync_mode, skip_verification: skip_verification, mysql_sync_config: mysql_sync_config, sync_parallel_level: sync_parallel_level, migration_type: migration_type, replica_overwrite_enabled: replica_overwrite_enabled }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.start_external_sync(::Google::Cloud::Sql::V1::SqlInstancesStartExternalSyncRequest.new(instance: instance, project: project, sync_mode: sync_mode, skip_verification: skip_verification, mysql_sync_config: mysql_sync_config, sync_parallel_level: sync_parallel_level, migration_type: migration_type, replica_overwrite_enabled: replica_overwrite_enabled), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, start_external_sync_client_stub.call_rpc_count + end + end + + def test_perform_disk_shrink + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + perform_disk_shrink_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :perform_disk_shrink, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::PerformDiskShrinkContext), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, perform_disk_shrink_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.perform_disk_shrink({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.perform_disk_shrink instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.perform_disk_shrink ::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.perform_disk_shrink({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.perform_disk_shrink(::Google::Cloud::Sql::V1::SqlInstancesPerformDiskShrinkRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, perform_disk_shrink_client_stub.call_rpc_count + end + end + + def test_get_disk_shrink_config + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + get_disk_shrink_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_disk_shrink_config, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_disk_shrink_config_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_disk_shrink_config({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_disk_shrink_config instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_disk_shrink_config ::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_disk_shrink_config({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_disk_shrink_config(::Google::Cloud::Sql::V1::SqlInstancesGetDiskShrinkConfigRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_disk_shrink_config_client_stub.call_rpc_count + end + end + + def test_reset_replica_size + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + reset_replica_size_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :reset_replica_size, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, reset_replica_size_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.reset_replica_size({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.reset_replica_size instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.reset_replica_size ::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.reset_replica_size({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.reset_replica_size(::Google::Cloud::Sql::V1::SqlInstancesResetReplicaSizeRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, reset_replica_size_client_stub.call_rpc_count + end + end + + def test_get_latest_recovery_time + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + source_instance_deletion_time = {} + + get_latest_recovery_time_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_latest_recovery_time, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["source_instance_deletion_time"] + assert request.has_source_instance_deletion_time? + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_latest_recovery_time_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_latest_recovery_time({ instance: instance, project: project, source_instance_deletion_time: source_instance_deletion_time }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_latest_recovery_time instance: instance, project: project, source_instance_deletion_time: source_instance_deletion_time do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_latest_recovery_time ::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest.new(instance: instance, project: project, source_instance_deletion_time: source_instance_deletion_time) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_latest_recovery_time({ instance: instance, project: project, source_instance_deletion_time: source_instance_deletion_time }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_latest_recovery_time(::Google::Cloud::Sql::V1::SqlInstancesGetLatestRecoveryTimeRequest.new(instance: instance, project: project, source_instance_deletion_time: source_instance_deletion_time), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_latest_recovery_time_client_stub.call_rpc_count + end + end + + def test_execute_sql + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + execute_sql_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :execute_sql, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::ExecuteSqlPayload), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, execute_sql_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.execute_sql({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.execute_sql instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.execute_sql ::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.execute_sql({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.execute_sql(::Google::Cloud::Sql::V1::SqlInstancesExecuteSqlRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, execute_sql_client_stub.call_rpc_count + end + end + + def test_acquire_ssrs_lease + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + acquire_ssrs_lease_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :acquire_ssrs_lease, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesAcquireSsrsLeaseRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, acquire_ssrs_lease_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.acquire_ssrs_lease({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.acquire_ssrs_lease instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.acquire_ssrs_lease ::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.acquire_ssrs_lease({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.acquire_ssrs_lease(::Google::Cloud::Sql::V1::SqlInstancesAcquireSsrsLeaseRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, acquire_ssrs_lease_client_stub.call_rpc_count + end + end + + def test_release_ssrs_lease + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + release_ssrs_lease_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :release_ssrs_lease, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, release_ssrs_lease_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.release_ssrs_lease({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.release_ssrs_lease instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.release_ssrs_lease ::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.release_ssrs_lease({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.release_ssrs_lease(::Google::Cloud::Sql::V1::SqlInstancesReleaseSsrsLeaseRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, release_ssrs_lease_client_stub.call_rpc_count + end + end + + def test_pre_check_major_version_upgrade + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + pre_check_major_version_upgrade_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :pre_check_major_version_upgrade, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::InstancesPreCheckMajorVersionUpgradeRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, pre_check_major_version_upgrade_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.pre_check_major_version_upgrade({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.pre_check_major_version_upgrade instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.pre_check_major_version_upgrade ::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.pre_check_major_version_upgrade({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.pre_check_major_version_upgrade(::Google::Cloud::Sql::V1::SqlInstancesPreCheckMajorVersionUpgradeRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, pre_check_major_version_upgrade_client_stub.call_rpc_count + end + end + + def test_point_in_time_restore + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + context = {} + + point_in_time_restore_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :point_in_time_restore, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::PointInTimeRestoreContext), request["context"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, point_in_time_restore_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.point_in_time_restore({ parent: parent, context: context }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.point_in_time_restore parent: parent, context: context do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.point_in_time_restore ::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest.new(parent: parent, context: context) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.point_in_time_restore({ parent: parent, context: context }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.point_in_time_restore(::Google::Cloud::Sql::V1::SqlInstancesPointInTimeRestoreRequest.new(parent: parent, context: context), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, point_in_time_restore_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlInstancesService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Sql::V1::SqlInstancesService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_operations_service_rest_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_operations_service_rest_test.rb new file mode 100644 index 000000000000..cfd2c718af4c --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_operations_service_rest_test.rb @@ -0,0 +1,266 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/sql/v1/cloud_sql_operations_pb" +require "google/cloud/sql/v1/sql_operations_service/rest" + + +class ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_get + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + operation = "hello world" + project = "hello world" + + get_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::ServiceStub.stub :transcode_get_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get({ operation: operation, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get operation: operation, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get ::Google::Cloud::Sql::V1::SqlOperationsGetRequest.new(operation: operation, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get({ operation: operation, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get(::Google::Cloud::Sql::V1::SqlOperationsGetRequest.new(operation: operation, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_client_stub.call_count + end + end + end + + def test_list + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::OperationsListResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + max_results = 42 + page_token = "hello world" + project = "hello world" + + list_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::ServiceStub.stub :transcode_list_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list({ instance: instance, max_results: max_results, page_token: page_token, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list instance: instance, max_results: max_results, page_token: page_token, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlOperationsListRequest.new(instance: instance, max_results: max_results, page_token: page_token, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list({ instance: instance, max_results: max_results, page_token: page_token, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlOperationsListRequest.new(instance: instance, max_results: max_results, page_token: page_token, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_client_stub.call_count + end + end + end + + def test_cancel + # Create test objects. + client_result = ::Google::Protobuf::Empty.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + operation = "hello world" + project = "hello world" + + cancel_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::ServiceStub.stub :transcode_cancel_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, cancel_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.cancel({ operation: operation, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.cancel operation: operation, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.cancel ::Google::Cloud::Sql::V1::SqlOperationsCancelRequest.new(operation: operation, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.cancel({ operation: operation, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.cancel(::Google::Cloud::Sql::V1::SqlOperationsCancelRequest.new(operation: operation, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, cancel_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlOperationsService::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_operations_service_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_operations_service_test.rb new file mode 100644 index 000000000000..cf37722174d5 --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_operations_service_test.rb @@ -0,0 +1,288 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/sql/v1/cloud_sql_operations_pb" +require "google/cloud/sql/v1/sql_operations_service" + +class ::Google::Cloud::Sql::V1::SqlOperationsService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_get + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + operation = "hello world" + project = "hello world" + + get_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlOperationsGetRequest, request + assert_equal "hello world", request["operation"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlOperationsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get({ operation: operation, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get operation: operation, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get ::Google::Cloud::Sql::V1::SqlOperationsGetRequest.new(operation: operation, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get({ operation: operation, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get(::Google::Cloud::Sql::V1::SqlOperationsGetRequest.new(operation: operation, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_client_stub.call_rpc_count + end + end + + def test_list + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::OperationsListResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + max_results = 42 + page_token = "hello world" + project = "hello world" + + list_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlOperationsListRequest, request + assert_equal "hello world", request["instance"] + assert_equal 42, request["max_results"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlOperationsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list({ instance: instance, max_results: max_results, page_token: page_token, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list instance: instance, max_results: max_results, page_token: page_token, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlOperationsListRequest.new(instance: instance, max_results: max_results, page_token: page_token, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list({ instance: instance, max_results: max_results, page_token: page_token, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlOperationsListRequest.new(instance: instance, max_results: max_results, page_token: page_token, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_client_stub.call_rpc_count + end + end + + def test_cancel + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + operation = "hello world" + project = "hello world" + + cancel_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :cancel, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlOperationsCancelRequest, request + assert_equal "hello world", request["operation"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, cancel_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlOperationsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.cancel({ operation: operation, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.cancel operation: operation, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.cancel ::Google::Cloud::Sql::V1::SqlOperationsCancelRequest.new(operation: operation, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.cancel({ operation: operation, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.cancel(::Google::Cloud::Sql::V1::SqlOperationsCancelRequest.new(operation: operation, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, cancel_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlOperationsService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlOperationsService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlOperationsService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Sql::V1::SqlOperationsService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_ssl_certs_service_rest_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_ssl_certs_service_rest_test.rb new file mode 100644 index 000000000000..914fe4788f77 --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_ssl_certs_service_rest_test.rb @@ -0,0 +1,322 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/sql/v1/cloud_sql_ssl_certs_pb" +require "google/cloud/sql/v1/sql_ssl_certs_service/rest" + + +class ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_delete + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + sha1_fingerprint = "hello world" + + delete_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::ServiceStub.stub :transcode_delete_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.delete({ instance: instance, project: project, sha1_fingerprint: sha1_fingerprint }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.delete instance: instance, project: project, sha1_fingerprint: sha1_fingerprint do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.delete ::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest.new(instance: instance, project: project, sha1_fingerprint: sha1_fingerprint) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.delete({ instance: instance, project: project, sha1_fingerprint: sha1_fingerprint }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.delete(::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest.new(instance: instance, project: project, sha1_fingerprint: sha1_fingerprint), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_client_stub.call_count + end + end + end + + def test_get + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::SslCert.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + sha1_fingerprint = "hello world" + + get_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::ServiceStub.stub :transcode_get_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get({ instance: instance, project: project, sha1_fingerprint: sha1_fingerprint }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get instance: instance, project: project, sha1_fingerprint: sha1_fingerprint do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get ::Google::Cloud::Sql::V1::SqlSslCertsGetRequest.new(instance: instance, project: project, sha1_fingerprint: sha1_fingerprint) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get({ instance: instance, project: project, sha1_fingerprint: sha1_fingerprint }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get(::Google::Cloud::Sql::V1::SqlSslCertsGetRequest.new(instance: instance, project: project, sha1_fingerprint: sha1_fingerprint), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_client_stub.call_count + end + end + end + + def test_insert + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::SslCertsInsertResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + insert_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::ServiceStub.stub :transcode_insert_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, insert_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.insert({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.insert instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.insert ::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.insert({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.insert(::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, insert_client_stub.call_count + end + end + end + + def test_list + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::SslCertsListResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + list_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::ServiceStub.stub :transcode_list_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlSslCertsListRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlSslCertsListRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlSslCertsService::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_ssl_certs_service_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_ssl_certs_service_test.rb new file mode 100644 index 000000000000..cfc9535de919 --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_ssl_certs_service_test.rb @@ -0,0 +1,350 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/sql/v1/cloud_sql_ssl_certs_pb" +require "google/cloud/sql/v1/sql_ssl_certs_service" + +class ::Google::Cloud::Sql::V1::SqlSslCertsService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_delete + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + sha1_fingerprint = "hello world" + + delete_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal "hello world", request["sha1_fingerprint"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete({ instance: instance, project: project, sha1_fingerprint: sha1_fingerprint }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete instance: instance, project: project, sha1_fingerprint: sha1_fingerprint do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete ::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest.new(instance: instance, project: project, sha1_fingerprint: sha1_fingerprint) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete({ instance: instance, project: project, sha1_fingerprint: sha1_fingerprint }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete(::Google::Cloud::Sql::V1::SqlSslCertsDeleteRequest.new(instance: instance, project: project, sha1_fingerprint: sha1_fingerprint), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_client_stub.call_rpc_count + end + end + + def test_get + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::SslCert.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + sha1_fingerprint = "hello world" + + get_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlSslCertsGetRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal "hello world", request["sha1_fingerprint"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get({ instance: instance, project: project, sha1_fingerprint: sha1_fingerprint }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get instance: instance, project: project, sha1_fingerprint: sha1_fingerprint do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get ::Google::Cloud::Sql::V1::SqlSslCertsGetRequest.new(instance: instance, project: project, sha1_fingerprint: sha1_fingerprint) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get({ instance: instance, project: project, sha1_fingerprint: sha1_fingerprint }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get(::Google::Cloud::Sql::V1::SqlSslCertsGetRequest.new(instance: instance, project: project, sha1_fingerprint: sha1_fingerprint), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_client_stub.call_rpc_count + end + end + + def test_insert + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::SslCertsInsertResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + insert_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :insert, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::SslCertsInsertRequest), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, insert_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.insert({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.insert instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.insert ::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.insert({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.insert(::Google::Cloud::Sql::V1::SqlSslCertsInsertRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, insert_client_stub.call_rpc_count + end + end + + def test_list + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::SslCertsListResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + list_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlSslCertsListRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlSslCertsListRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlSslCertsListRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlSslCertsService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlSslCertsService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Sql::V1::SqlSslCertsService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_tiers_service_rest_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_tiers_service_rest_test.rb new file mode 100644 index 000000000000..f04a9ea3c968 --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_tiers_service_rest_test.rb @@ -0,0 +1,153 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/sql/v1/cloud_sql_tiers_pb" +require "google/cloud/sql/v1/sql_tiers_service/rest" + + +class ::Google::Cloud::Sql::V1::SqlTiersService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::TiersListResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + project = "hello world" + + list_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlTiersService::Rest::ServiceStub.stub :transcode_list_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list({ project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlTiersListRequest.new(project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list({ project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlTiersListRequest.new(project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlTiersService::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_tiers_service_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_tiers_service_test.rb new file mode 100644 index 000000000000..86057bdaca11 --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_tiers_service_test.rb @@ -0,0 +1,162 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/sql/v1/cloud_sql_tiers_pb" +require "google/cloud/sql/v1/sql_tiers_service" + +class ::Google::Cloud::Sql::V1::SqlTiersService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::TiersListResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + project = "hello world" + + list_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlTiersListRequest, request + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlTiersService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list({ project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlTiersListRequest.new(project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list({ project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlTiersListRequest.new(project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlTiersService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlTiersService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlTiersService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Sql::V1::SqlTiersService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_users_service_rest_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_users_service_rest_test.rb new file mode 100644 index 000000000000..53e1ca402851 --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_users_service_rest_test.rb @@ -0,0 +1,384 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/sql/v1/cloud_sql_users_pb" +require "google/cloud/sql/v1/sql_users_service/rest" + + +class ::Google::Cloud::Sql::V1::SqlUsersService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_delete + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + host = "hello world" + instance = "hello world" + name = "hello world" + project = "hello world" + + delete_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlUsersService::Rest::ServiceStub.stub :transcode_delete_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.delete({ host: host, instance: instance, name: name, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.delete host: host, instance: instance, name: name, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.delete ::Google::Cloud::Sql::V1::SqlUsersDeleteRequest.new(host: host, instance: instance, name: name, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.delete({ host: host, instance: instance, name: name, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.delete(::Google::Cloud::Sql::V1::SqlUsersDeleteRequest.new(host: host, instance: instance, name: name, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_client_stub.call_count + end + end + end + + def test_get + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::User.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + name = "hello world" + project = "hello world" + host = "hello world" + + get_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlUsersService::Rest::ServiceStub.stub :transcode_get_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get({ instance: instance, name: name, project: project, host: host }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get instance: instance, name: name, project: project, host: host do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get ::Google::Cloud::Sql::V1::SqlUsersGetRequest.new(instance: instance, name: name, project: project, host: host) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get({ instance: instance, name: name, project: project, host: host }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get(::Google::Cloud::Sql::V1::SqlUsersGetRequest.new(instance: instance, name: name, project: project, host: host), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_client_stub.call_count + end + end + end + + def test_insert + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + insert_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlUsersService::Rest::ServiceStub.stub :transcode_insert_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, insert_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.insert({ instance: instance, project: project, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.insert instance: instance, project: project, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.insert ::Google::Cloud::Sql::V1::SqlUsersInsertRequest.new(instance: instance, project: project, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.insert({ instance: instance, project: project, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.insert(::Google::Cloud::Sql::V1::SqlUsersInsertRequest.new(instance: instance, project: project, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, insert_client_stub.call_count + end + end + end + + def test_list + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::UsersListResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + list_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlUsersService::Rest::ServiceStub.stub :transcode_list_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list({ instance: instance, project: project }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list instance: instance, project: project do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlUsersListRequest.new(instance: instance, project: project) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list({ instance: instance, project: project }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlUsersListRequest.new(instance: instance, project: project), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_client_stub.call_count + end + end + end + + def test_update + # Create test objects. + client_result = ::Google::Cloud::Sql::V1::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + host = "hello world" + instance = "hello world" + name = "hello world" + project = "hello world" + database_roles = ["hello world"] + revoke_existing_roles = true + body = {} + + update_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Sql::V1::SqlUsersService::Rest::ServiceStub.stub :transcode_update_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update({ host: host, instance: instance, name: name, project: project, database_roles: database_roles, revoke_existing_roles: revoke_existing_roles, body: body }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update host: host, instance: instance, name: name, project: project, database_roles: database_roles, revoke_existing_roles: revoke_existing_roles, body: body do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update ::Google::Cloud::Sql::V1::SqlUsersUpdateRequest.new(host: host, instance: instance, name: name, project: project, database_roles: database_roles, revoke_existing_roles: revoke_existing_roles, body: body) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update({ host: host, instance: instance, name: name, project: project, database_roles: database_roles, revoke_existing_roles: revoke_existing_roles, body: body }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update(::Google::Cloud::Sql::V1::SqlUsersUpdateRequest.new(host: host, instance: instance, name: name, project: project, database_roles: database_roles, revoke_existing_roles: revoke_existing_roles, body: body), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlUsersService::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_users_service_test.rb b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_users_service_test.rb new file mode 100644 index 000000000000..e747272fa4ff --- /dev/null +++ b/google-cloud-sql-v1/test/google/cloud/sql/v1/sql_users_service_test.rb @@ -0,0 +1,425 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/sql/v1/cloud_sql_users_pb" +require "google/cloud/sql/v1/sql_users_service" + +class ::Google::Cloud::Sql::V1::SqlUsersService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_delete + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + host = "hello world" + instance = "hello world" + name = "hello world" + project = "hello world" + + delete_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlUsersDeleteRequest, request + assert_equal "hello world", request["host"] + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["name"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlUsersService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete({ host: host, instance: instance, name: name, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete host: host, instance: instance, name: name, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete ::Google::Cloud::Sql::V1::SqlUsersDeleteRequest.new(host: host, instance: instance, name: name, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete({ host: host, instance: instance, name: name, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete(::Google::Cloud::Sql::V1::SqlUsersDeleteRequest.new(host: host, instance: instance, name: name, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_client_stub.call_rpc_count + end + end + + def test_get + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::User.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + name = "hello world" + project = "hello world" + host = "hello world" + + get_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlUsersGetRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["name"] + assert_equal "hello world", request["project"] + assert_equal "hello world", request["host"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlUsersService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get({ instance: instance, name: name, project: project, host: host }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get instance: instance, name: name, project: project, host: host do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get ::Google::Cloud::Sql::V1::SqlUsersGetRequest.new(instance: instance, name: name, project: project, host: host) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get({ instance: instance, name: name, project: project, host: host }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get(::Google::Cloud::Sql::V1::SqlUsersGetRequest.new(instance: instance, name: name, project: project, host: host), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_client_stub.call_rpc_count + end + end + + def test_insert + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + body = {} + + insert_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :insert, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlUsersInsertRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::User), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, insert_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlUsersService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.insert({ instance: instance, project: project, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.insert instance: instance, project: project, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.insert ::Google::Cloud::Sql::V1::SqlUsersInsertRequest.new(instance: instance, project: project, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.insert({ instance: instance, project: project, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.insert(::Google::Cloud::Sql::V1::SqlUsersInsertRequest.new(instance: instance, project: project, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, insert_client_stub.call_rpc_count + end + end + + def test_list + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::UsersListResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + project = "hello world" + + list_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlUsersListRequest, request + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["project"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlUsersService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list({ instance: instance, project: project }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list instance: instance, project: project do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list ::Google::Cloud::Sql::V1::SqlUsersListRequest.new(instance: instance, project: project) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list({ instance: instance, project: project }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list(::Google::Cloud::Sql::V1::SqlUsersListRequest.new(instance: instance, project: project), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_client_stub.call_rpc_count + end + end + + def test_update + # Create GRPC objects. + grpc_response = ::Google::Cloud::Sql::V1::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + host = "hello world" + instance = "hello world" + name = "hello world" + project = "hello world" + database_roles = ["hello world"] + revoke_existing_roles = true + body = {} + + update_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update, name + assert_kind_of ::Google::Cloud::Sql::V1::SqlUsersUpdateRequest, request + assert_equal "hello world", request["host"] + assert_equal "hello world", request["instance"] + assert_equal "hello world", request["name"] + assert_equal "hello world", request["project"] + assert_equal ["hello world"], request["database_roles"] + assert_equal true, request["revoke_existing_roles"] + assert request.has_revoke_existing_roles? + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Sql::V1::User), request["body"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_client_stub do + # Create client + c = ::Google::Cloud::Sql::V1::SqlUsersService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update({ host: host, instance: instance, name: name, project: project, database_roles: database_roles, revoke_existing_roles: revoke_existing_roles, body: body }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update host: host, instance: instance, name: name, project: project, database_roles: database_roles, revoke_existing_roles: revoke_existing_roles, body: body do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update ::Google::Cloud::Sql::V1::SqlUsersUpdateRequest.new(host: host, instance: instance, name: name, project: project, database_roles: database_roles, revoke_existing_roles: revoke_existing_roles, body: body) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update({ host: host, instance: instance, name: name, project: project, database_roles: database_roles, revoke_existing_roles: revoke_existing_roles, body: body }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update(::Google::Cloud::Sql::V1::SqlUsersUpdateRequest.new(host: host, instance: instance, name: name, project: project, database_roles: database_roles, revoke_existing_roles: revoke_existing_roles, body: body), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlUsersService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Sql::V1::SqlUsersService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Sql::V1::SqlUsersService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Sql::V1::SqlUsersService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/google-cloud-sql-v1/test/helper.rb b/google-cloud-sql-v1/test/helper.rb new file mode 100644 index 000000000000..672b337030e7 --- /dev/null +++ b/google-cloud-sql-v1/test/helper.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "minitest/autorun" +require "minitest/focus" +require "minitest/mock" +require "minitest/rg" + +require "grpc" + +require "ostruct" diff --git a/release-please-config.json b/release-please-config.json index 389989cb7e5d..7ce3f830bce6 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1635,6 +1635,10 @@ "component": "google-cloud-speech-v2", "version_file": "lib/google/cloud/speech/v2/version.rb" }, + "google-cloud-sql-v1": { + "component": "google-cloud-sql-v1", + "version_file": "lib/google/cloud/sql/v1/version.rb" + }, "google-cloud-storage": { "component": "google-cloud-storage", "version_file": "lib/google/cloud/storage/version.rb"