diff --git a/cli/src/commands/application/init.rs b/cli/src/commands/application/init.rs index 96a76850..3db613e0 100644 --- a/cli/src/commands/application/init.rs +++ b/cli/src/commands/application/init.rs @@ -15,24 +15,55 @@ use crate::{ }; use crossterm::style::Stylize; use heck::ToSnakeCase; -use inquire::{required, CustomType, Text}; +use inquire::{required, CustomType}; use std::fs; -use wukong_sdk::graphql::appsignal_apps_query::AppsignalAppsQueryAppsignalApps; +use wukong_sdk::{ + error::{APIError, WKError}, + graphql::{ + application_config_query::{self, ApplicationConfigQueryApplicationConfig}, + appsignal_apps_query::AppsignalAppsQueryAppsignalApps, + }, +}; pub async fn handle_application_init(context: Context) -> Result { let config = Config::load_from_default_path()?; let mut wk_client = WKClient::for_channel(&config, &context.channel)?; - let mut appsignall_apps = None; + let mut appsignal_apps = None; println!("Welcome! Initializing per-repo configuration for your application."); let mut application_configs = ApplicationConfigs::new(); + let mut name: String; - let name = Text::new("Name of your application") - .with_render_config(inquire_render_config()) - .with_validator(required!("Application name is required")) - .with_placeholder("my-first-application") - .prompt()?; + loop { + name = inquire::Text::new("Name of your application") + .with_render_config(inquire_render_config()) + .with_validator(required!("Application name is required")) + .with_placeholder("my-first-application") + .prompt()?; + + let fetch_loader = new_spinner(); + fetch_loader.set_message("Validating application name ..."); + + let has_application_config = get_application_config(&mut wk_client, &name) + .await? + .is_some(); + + fetch_loader.finish_and_clear(); + + if has_application_config { + println!( + "{}", + format!( + " Application '{}' already exists. Please choose a different name", + name + ) + .red() + ); + } else { + break; + } + } let workflows = get_workflows_from_current_dir()?; let mut excluded_workflows = Vec::new(); @@ -51,7 +82,7 @@ pub async fn handle_application_init(context: Context) -> Result = Vec::new(); namespaces - .push(configure_namespace("prod".to_string(), &mut wk_client, &mut appsignall_apps).await?); + .push(configure_namespace("prod".to_string(), &mut wk_client, &mut appsignal_apps).await?); let addons = ["Elixir Livebook"]; let selected_addons = inquire::MultiSelect::new("Addons", addons.to_vec()) @@ -71,8 +102,7 @@ pub async fn handle_application_init(context: Context) -> Result Result, WKCliError> { Ok(workflow_names) } + +async fn get_application_config( + wk_client: &mut WKClient, + name: &str, +) -> Result, WKCliError> { + let application_config = match wk_client.fetch_application_config(name).await { + Ok(resp) => Ok(resp), + Err(err) => match &err { + WKCliError::WKSdkError(WKError::APIError(APIError::ApplicationConfigNotFound)) => { + Ok(application_config_query::ResponseData { + application_config: None, + }) + } + _ => Err(err), + }, + }? + .application_config; + + Ok(application_config) +} diff --git a/cli/src/wukong_client.rs b/cli/src/wukong_client.rs index 1cfaaae3..92927d7b 100644 --- a/cli/src/wukong_client.rs +++ b/cli/src/wukong_client.rs @@ -7,13 +7,14 @@ use log::debug; use std::collections::HashMap; use wukong_sdk::{ graphql::{ - application_query, application_with_k8s_cluster_query, applications_query, - appsignal_apps_query, appsignal_average_error_rate_query, appsignal_average_latency_query, - appsignal_average_throughput_query, appsignal_deploy_markers_query, - appsignal_exception_incidents_query, cd_pipeline_for_rollback_query, - cd_pipeline_github_query, cd_pipeline_query, cd_pipelines_query, changelogs_query, - ci_status_query, deploy_livebook, deployment::cd_pipeline_status_query, destroy_livebook, - execute_cd_pipeline, is_authorized_query, kubernetes_pods_query, livebook_resource_query, + application_config_query, application_query, application_with_k8s_cluster_query, + applications_query, appsignal_apps_query, appsignal_average_error_rate_query, + appsignal_average_latency_query, appsignal_average_throughput_query, + appsignal_deploy_markers_query, appsignal_exception_incidents_query, + cd_pipeline_for_rollback_query, cd_pipeline_github_query, cd_pipeline_query, + cd_pipelines_query, changelogs_query, ci_status_query, deploy_livebook, + deployment::cd_pipeline_status_query, destroy_livebook, execute_cd_pipeline, + is_authorized_query, kubernetes_pods_query, livebook_resource_query, multi_branch_pipeline_query, pipeline_query, pipelines_query, AppsignalTimeFrame, }, services::{ @@ -452,4 +453,13 @@ impl WKClient { .fetch_gcloud_database_metrics(project_id, access_token) .await } + + #[wukong_telemetry(api_event = "fetch_application_config")] + pub async fn fetch_application_config( + &mut self, + name: &str, + ) -> Result { + self.check_and_refresh_tokens().await?; + self.inner.fetch_application_config(name).await + } } diff --git a/sdk/proto/googleapis b/sdk/proto/googleapis index a3770599..738ff24c 160000 --- a/sdk/proto/googleapis +++ b/sdk/proto/googleapis @@ -1 +1 @@ -Subproject commit a3770599794a8d319286df96f03343b6cd0e7f4f +Subproject commit 738ff24cb9c00be062dc200c10426df7b13d1e65 diff --git a/sdk/src/error.rs b/sdk/src/error.rs index e3f47b25..e5d13a57 100644 --- a/sdk/src/error.rs +++ b/sdk/src/error.rs @@ -86,6 +86,8 @@ pub enum APIError { BuildNotFound, #[error("Github Workflow not found.")] GithubWorkflowNotFound, + #[error("Failed to get the application config.")] + ApplicationConfigNotFound, } #[derive(Debug, ThisError)] diff --git a/sdk/src/graphql/application.rs b/sdk/src/graphql/application.rs index 76677e8b..12f09b1f 100644 --- a/sdk/src/graphql/application.rs +++ b/sdk/src/graphql/application.rs @@ -24,6 +24,14 @@ pub struct ApplicationWithK8sClusterQuery; )] pub struct ApplicationsQuery; +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "src/graphql/schema.json", + query_path = "src/graphql/query/application_config.graphql", + response_derives = "Debug, Serialize, Deserialize" +)] +pub struct ApplicationConfigQuery; + #[cfg(test)] mod test { use crate::{ApiChannel, WKClient, WKConfig}; diff --git a/sdk/src/graphql/mod.rs b/sdk/src/graphql/mod.rs index 8803f48e..785b2bd3 100644 --- a/sdk/src/graphql/mod.rs +++ b/sdk/src/graphql/mod.rs @@ -6,11 +6,14 @@ pub mod deployment_github; pub mod kubernetes; pub mod pipeline; -use self::deployment::{cd_pipeline_status_query, CdPipelineStatusQuery}; +use self::{ + application::ApplicationConfigQuery, + deployment::{cd_pipeline_status_query, CdPipelineStatusQuery}, +}; pub use self::{ application::{ - application_query, application_with_k8s_cluster_query, applications_query, - ApplicationQuery, ApplicationWithK8sClusterQuery, ApplicationsQuery, + application_config_query, application_query, application_with_k8s_cluster_query, + applications_query, ApplicationQuery, ApplicationWithK8sClusterQuery, ApplicationsQuery, }, appsignal::{ appsignal_apps_query, appsignal_average_error_rate_query, appsignal_average_latency_query, @@ -747,6 +750,23 @@ impl WKClient { .map_err(|err| err.into()) } + pub async fn fetch_application_config( + &self, + name: &str, + ) -> Result { + let gql_client = setup_gql_client(&self.access_token, &self.channel)?; + + gql_client + .post_graphql::( + &self.api_url, + application_config_query::Variables { + name: name.to_string(), + }, + ) + .await + .map_err(|err| err.into()) + } + /// Fetch the deploy markers from Appsignal /// the default value for `limit` is 1 pub async fn fetch_appsignal_deploy_markers( @@ -890,6 +910,7 @@ impl ErrorHandler for CanaryErrorHandler { // "github_ref_not_found" => {} // "github_commit_history_not_found" => {} "github_workflow_not_found" => APIError::GithubWorkflowNotFound, + "application_config_not_found" => APIError::ApplicationConfigNotFound, // "slack_webhook_not_configured" => {} _ => APIError::ResponseError { code: original_error_code.to_string(), diff --git a/sdk/src/graphql/query/application_config.graphql b/sdk/src/graphql/query/application_config.graphql new file mode 100644 index 00000000..30828e91 --- /dev/null +++ b/sdk/src/graphql/query/application_config.graphql @@ -0,0 +1,5 @@ +query ApplicationConfigQuery($name: String!) { + applicationConfig(name: $name) { + name + } +} diff --git a/sdk/src/graphql/schema.json b/sdk/src/graphql/schema.json index 53aeee63..a5c6c303 100644 --- a/sdk/src/graphql/schema.json +++ b/sdk/src/graphql/schema.json @@ -1129,6 +1129,458 @@ "name": "Application", "possibleTypes": null }, + { + "description": null, + "enumValues": null, + "fields": [ + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "addons", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "enable", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "name", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "namespaces", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ApplicationConfigNamespace", + "ofType": null + } + } + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "workflows", + "type": { + "kind": "OBJECT", + "name": "ApplicationConfigWorkflows", + "ofType": null + } + } + ], + "inputFields": null, + "interfaces": [], + "kind": "OBJECT", + "name": "ApplicationConfig", + "possibleTypes": null + }, + { + "description": null, + "enumValues": null, + "fields": [ + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "defaultNamespace", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "enable", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "environment", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + ], + "inputFields": null, + "interfaces": [], + "kind": "OBJECT", + "name": "ApplicationConfigAppsignal", + "possibleTypes": null + }, + { + "description": null, + "enumValues": null, + "fields": [ + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "buildWorkflow", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + ], + "inputFields": null, + "interfaces": [], + "kind": "OBJECT", + "name": "ApplicationConfigBuild", + "possibleTypes": null + }, + { + "description": null, + "enumValues": null, + "fields": [ + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "enable", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "projectId", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + ], + "inputFields": null, + "interfaces": [], + "kind": "OBJECT", + "name": "ApplicationConfigCloudSQL", + "possibleTypes": null + }, + { + "description": null, + "enumValues": null, + "fields": [ + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "baseReplica", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "rolloutStrategy", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "target", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + ], + "inputFields": null, + "interfaces": [], + "kind": "OBJECT", + "name": "ApplicationConfigDelivery", + "possibleTypes": null + }, + { + "description": null, + "enumValues": null, + "fields": [ + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "dataset", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "enable", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + } + } + ], + "inputFields": null, + "interfaces": [], + "kind": "OBJECT", + "name": "ApplicationConfigHoneycomb", + "possibleTypes": null + }, + { + "description": null, + "enumValues": null, + "fields": [ + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "appsignal", + "type": { + "kind": "OBJECT", + "name": "ApplicationConfigAppsignal", + "ofType": null + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "build", + "type": { + "kind": "OBJECT", + "name": "ApplicationConfigBuild", + "ofType": null + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "cloudsql", + "type": { + "kind": "OBJECT", + "name": "ApplicationConfigCloudSQL", + "ofType": null + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "delivery", + "type": { + "kind": "OBJECT", + "name": "ApplicationConfigDelivery", + "ofType": null + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "honeycomb", + "type": { + "kind": "OBJECT", + "name": "ApplicationConfigHoneycomb", + "ofType": null + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "type", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + ], + "inputFields": null, + "interfaces": [], + "kind": "OBJECT", + "name": "ApplicationConfigNamespace", + "possibleTypes": null + }, + { + "description": null, + "enumValues": null, + "fields": [ + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "excludedWorkflows", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + }, + { + "args": [], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "provider", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + ], + "inputFields": null, + "interfaces": [], + "kind": "OBJECT", + "name": "ApplicationConfigWorkflows", + "possibleTypes": null + }, { "description": null, "enumValues": null, @@ -3703,6 +4155,33 @@ "ofType": null } }, + { + "args": [ + { + "defaultValue": null, + "description": null, + "name": "name", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + ], + "deprecationReason": null, + "description": null, + "isDeprecated": false, + "name": "applicationConfig", + "type": { + "kind": "OBJECT", + "name": "ApplicationConfig", + "ofType": null + } + }, { "args": [], "deprecationReason": null, diff --git a/sdk/src/services/gcloud/api/google.api.rs b/sdk/src/services/gcloud/api/google.api.rs index e88eddc5..ec4c5566 100644 --- a/sdk/src/services/gcloud/api/google.api.rs +++ b/sdk/src/services/gcloud/api/google.api.rs @@ -719,6 +719,19 @@ pub struct MethodSettings { /// seconds: 54000 # 90 minutes #[prost(message, optional, tag = "2")] pub long_running: ::core::option::Option, + /// 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 + #[prost(string, repeated, tag = "3")] + pub auto_populated_fields: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// Nested message and enum types in `MethodSettings`. pub mod method_settings { @@ -884,6 +897,19 @@ pub enum FieldBehavior { /// a non-empty value will be returned. The user will not be aware of what /// non-empty value to expect. NonEmptyDefault = 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, } impl FieldBehavior { /// String value of the enum field names used in the ProtoBuf definition. @@ -900,6 +926,7 @@ impl FieldBehavior { FieldBehavior::Immutable => "IMMUTABLE", FieldBehavior::UnorderedList => "UNORDERED_LIST", FieldBehavior::NonEmptyDefault => "NON_EMPTY_DEFAULT", + FieldBehavior::Identifier => "IDENTIFIER", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -913,6 +940,7 @@ impl FieldBehavior { "IMMUTABLE" => Some(Self::Immutable), "UNORDERED_LIST" => Some(Self::UnorderedList), "NON_EMPTY_DEFAULT" => Some(Self::NonEmptyDefault), + "IDENTIFIER" => Some(Self::Identifier), _ => None, } } diff --git a/sdk/src/services/gcloud/api/google.cloud.sql.v1.rs b/sdk/src/services/gcloud/api/google.cloud.sql.v1.rs index 3302c836..731b8c56 100644 --- a/sdk/src/services/gcloud/api/google.cloud.sql.v1.rs +++ b/sdk/src/services/gcloud/api/google.cloud.sql.v1.rs @@ -33,7 +33,17 @@ pub struct ApiWarning { } /// Nested message and enum types in `ApiWarning`. pub mod api_warning { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum SqlApiWarningCode { /// An unknown or unset warning type from Cloud SQL API. @@ -44,6 +54,12 @@ pub mod api_warning { /// Warning when user provided maxResults parameter exceeds the limit. The /// returned result set may be incomplete. MaxResultsExceedsLimit = 2, + /// Warning when user tries to create/update a user with credentials that + /// have previously been compromised by a public data breach. + CompromisedCredentials = 3, + /// Warning when the operation succeeds but some non-critical workflow state + /// failed. + InternalStateFailure = 4, } impl SqlApiWarningCode { /// String value of the enum field names used in the ProtoBuf definition. @@ -55,6 +71,8 @@ pub mod api_warning { SqlApiWarningCode::Unspecified => "SQL_API_WARNING_CODE_UNSPECIFIED", SqlApiWarningCode::RegionUnreachable => "REGION_UNREACHABLE", SqlApiWarningCode::MaxResultsExceedsLimit => "MAX_RESULTS_EXCEEDS_LIMIT", + SqlApiWarningCode::CompromisedCredentials => "COMPROMISED_CREDENTIALS", + SqlApiWarningCode::InternalStateFailure => "INTERNAL_STATE_FAILURE", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -63,6 +81,8 @@ pub mod api_warning { "SQL_API_WARNING_CODE_UNSPECIFIED" => Some(Self::Unspecified), "REGION_UNREACHABLE" => Some(Self::RegionUnreachable), "MAX_RESULTS_EXCEEDS_LIMIT" => Some(Self::MaxResultsExceedsLimit), + "COMPROMISED_CREDENTIALS" => Some(Self::CompromisedCredentials), + "INTERNAL_STATE_FAILURE" => Some(Self::InternalStateFailure), _ => None, } } @@ -85,7 +105,17 @@ pub struct BackupRetentionSettings { /// Nested message and enum types in `BackupRetentionSettings`. pub mod backup_retention_settings { /// The units that retained_backups specifies, we only support COUNT. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum RetentionUnit { /// Backup retention unit is unspecified, will be treated as COUNT. @@ -291,7 +321,9 @@ pub struct DemoteMasterConfiguration { /// replication connection and is stored by MySQL in a file named /// `master.info` in the data directory. #[prost(message, optional, tag = "2")] - pub mysql_replica_configuration: ::core::option::Option, + pub mysql_replica_configuration: ::core::option::Option< + DemoteMasterMySqlReplicaConfiguration, + >, } /// Read-replica configuration specific to MySQL databases. #[allow(clippy::derive_partial_eq_without_eq)] @@ -398,7 +430,9 @@ pub mod export_context { #[prost(message, optional, tag = "2")] pub schema_only: ::core::option::Option, #[prost(message, optional, tag = "3")] - pub mysql_export_options: ::core::option::Option, + pub mysql_export_options: ::core::option::Option< + sql_export_options::MysqlExportOptions, + >, } /// Nested message and enum types in `SqlExportOptions`. pub mod sql_export_options { @@ -505,7 +539,9 @@ pub mod import_context { #[derive(Clone, PartialEq, ::prost::Message)] pub struct SqlBakImportOptions { #[prost(message, optional, tag = "1")] - pub encryption_options: ::core::option::Option, + pub encryption_options: ::core::option::Option< + sql_bak_import_options::EncryptionOptions, + >, /// Whether or not the backup set being restored is striped. /// Applies only to Cloud SQL for SQL Server. #[prost(message, optional, tag = "2")] @@ -524,6 +560,17 @@ pub mod import_context { /// Type of the bak content, FULL or DIFF #[prost(enumeration = "super::BakType", tag = "6")] pub bak_type: i32, + /// Optional. The timestamp when the import should stop. This timestamp is in + /// the [RFC 3339]() 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. + #[prost(message, optional, tag = "7")] + pub stop_at: ::core::option::Option<::prost_types::Timestamp>, + /// 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. + #[prost(string, tag = "8")] + pub stop_at_mark: ::prost::alloc::string::String, } /// Nested message and enum types in `SqlBakImportOptions`. pub mod sql_bak_import_options { @@ -559,7 +606,15 @@ pub struct IpConfiguration { /// be updated, but it cannot be removed after it is set. #[prost(string, tag = "2")] pub private_network: ::prost::alloc::string::String, - /// Whether SSL connections over IP are enforced or not. + /// Use `ssl_mode` instead for MySQL and PostgreSQL. SQL Server uses this flag. + /// + /// 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. #[prost(message, optional, tag = "3")] pub require_ssl: ::core::option::Option, /// The list of external networks that are allowed to connect to the instance @@ -579,6 +634,112 @@ pub struct IpConfiguration { /// such as BigQuery. #[prost(message, optional, tag = "7")] pub enable_private_path_for_google_cloud_services: ::core::option::Option, + /// Specify how SSL/TLS is enforced in database connections. MySQL and + /// PostgreSQL use the `ssl_mode` flag. If you must use the `require_ssl` flag + /// for backward compatibility, then only the following value pairs are valid: + /// + /// * `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` + /// + /// The value of `ssl_mode` gets priority over the value of `require_ssl`. For + /// example, for the pair `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=false`, + /// the `ssl_mode=ENCRYPTED_ONLY` means only accept SSL connections, while the + /// `require_ssl=false` means accept both non-SSL and SSL connections. MySQL + /// and PostgreSQL databases respect `ssl_mode` in this case and accept only + /// SSL connections. + /// + /// SQL Server uses the `require_ssl` flag. You can set the value for this flag + /// to `true` or `false`. + #[prost(enumeration = "ip_configuration::SslMode", tag = "8")] + pub ssl_mode: i32, + /// PSC settings for this instance. + #[prost(message, optional, tag = "9")] + pub psc_config: ::core::option::Option, +} +/// Nested message and enum types in `IpConfiguration`. +pub mod ip_configuration { + /// The SSL options for database connections. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum SslMode { + /// The SSL mode is unknown. + Unspecified = 0, + /// Allow non-SSL/non-TLS and SSL/TLS connections. For SSL/TLS connections, + /// the client certificate won't be verified. + /// When this value is used, the legacy `require_ssl` flag must be false or + /// cleared to avoid the conflict between values of two flags. + AllowUnencryptedAndEncrypted = 1, + /// Only allow connections encrypted with SSL/TLS. + /// When this value is used, the legacy `require_ssl` flag must be false or + /// cleared to avoid the conflict between values of two flags. + EncryptedOnly = 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. + TrustedClientCertificateRequired = 3, + } + impl SslMode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SslMode::Unspecified => "SSL_MODE_UNSPECIFIED", + SslMode::AllowUnencryptedAndEncrypted => { + "ALLOW_UNENCRYPTED_AND_ENCRYPTED" + } + SslMode::EncryptedOnly => "ENCRYPTED_ONLY", + SslMode::TrustedClientCertificateRequired => { + "TRUSTED_CLIENT_CERTIFICATE_REQUIRED" + } + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SSL_MODE_UNSPECIFIED" => Some(Self::Unspecified), + "ALLOW_UNENCRYPTED_AND_ENCRYPTED" => { + Some(Self::AllowUnencryptedAndEncrypted) + } + "ENCRYPTED_ONLY" => Some(Self::EncryptedOnly), + "TRUSTED_CLIENT_CERTIFICATE_REQUIRED" => { + Some(Self::TrustedClientCertificateRequired) + } + _ => None, + } + } + } +} +/// PSC settings for a Cloud SQL instance. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PscConfig { + /// Whether PSC connectivity is enabled for this instance. + #[prost(bool, optional, tag = "1")] + pub psc_enabled: ::core::option::Option, + /// 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). + #[prost(string, repeated, tag = "2")] + pub allowed_consumer_projects: ::prost::alloc::vec::Vec< + ::prost::alloc::string::String, + >, } /// Preferred location. This specifies where a Cloud SQL instance is located. /// Note that if the preferred location is not available, the instance will be @@ -598,6 +759,7 @@ pub struct LocationPreference { pub zone: ::prost::alloc::string::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'. #[prost(string, tag = "4")] pub secondary_zone: ::prost::alloc::string::String, /// This is always `sql#locationPreference`. @@ -739,7 +901,7 @@ pub struct DiskEncryptionStatus { #[prost(string, tag = "2")] pub kind: ::prost::alloc::string::String, } -/// Database instance IP Mapping. +/// Database instance IP mapping #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct IpMapping { @@ -795,6 +957,9 @@ pub struct Operation { /// populated. #[prost(message, optional, tag = "8")] pub error: ::core::option::Option, + /// An Admin API warning message. + #[prost(message, optional, tag = "19")] + pub api_warning: ::core::option::Option, /// The type of the operation. Valid values are: /// /// * `CREATE` @@ -838,7 +1003,17 @@ pub struct Operation { /// Nested message and enum types in `Operation`. pub mod operation { /// The type of Cloud SQL operation. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum SqlOperationType { /// Unknown operation type. @@ -1017,7 +1192,17 @@ pub mod operation { } } /// The status of an operation. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum SqlOperationStatus { /// The state of the operation is unknown. @@ -1102,11 +1287,25 @@ pub struct PasswordValidationPolicy { /// Whether the password policy is enabled or not. #[prost(message, optional, tag = "6")] pub enable_password_policy: ::core::option::Option, + /// Disallow credentials that have been previously compromised by a public data + /// breach. + #[prost(message, optional, tag = "7")] + pub disallow_compromised_credentials: ::core::option::Option, } /// Nested message and enum types in `PasswordValidationPolicy`. pub mod password_validation_policy { /// The complexity choices of the password. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum Complexity { /// Complexity check is not specified. @@ -1158,7 +1357,9 @@ pub struct Settings { /// (Deprecated) Applied to First Generation instances only. #[deprecated] #[prost(string, repeated, tag = "2")] - pub authorized_gae_applications: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + pub authorized_gae_applications: ::prost::alloc::vec::Vec< + ::prost::alloc::string::String, + >, /// The tier (or machine type) for this instance, for example /// `db-custom-1-3840`. WARNING: Changing this restarts the instance. #[prost(string, tag = "3")] @@ -1169,8 +1370,10 @@ pub struct Settings { /// User-provided labels, represented as a dictionary where each label is a /// single key value pair. #[prost(map = "string, string", tag = "5")] - pub user_labels: - ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, + pub user_labels: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, /// Availability type. Potential values: /// /// * `ZONAL`: The instance serves data from only one zone. Outages in that @@ -1298,7 +1501,17 @@ pub struct Settings { /// Nested message and enum types in `Settings`. pub mod settings { /// Specifies when the instance is activated. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum SqlActivationPolicy { /// Unknown activation plan. @@ -1335,7 +1548,17 @@ pub mod settings { } } /// The edition of the instance, can be ENTERPRISE or ENTERPRISE_PLUS. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum Edition { /// The instance did not specify the edition. @@ -1368,7 +1591,17 @@ pub mod settings { } } /// The options for enforcing Cloud SQL connectors in the instance. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum ConnectorEnforcement { /// The requirement for Cloud SQL connectors is unknown. @@ -1525,12 +1758,14 @@ impl SqlFileType { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum BakType { - /// default type. + /// Default type. Unspecified = 0, /// Full backup. Full = 1, /// Differential backup. Diff = 2, + /// Transaction Log backup + Tlog = 3, } impl BakType { /// String value of the enum field names used in the ProtoBuf definition. @@ -1542,6 +1777,7 @@ impl BakType { BakType::Unspecified => "BAK_TYPE_UNSPECIFIED", BakType::Full => "FULL", BakType::Diff => "DIFF", + BakType::Tlog => "TLOG", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -1550,6 +1786,7 @@ impl BakType { "BAK_TYPE_UNSPECIFIED" => Some(Self::Unspecified), "FULL" => Some(Self::Full), "DIFF" => Some(Self::Diff), + "TLOG" => Some(Self::Tlog), _ => None, } } @@ -1958,6 +2195,11 @@ pub enum SqlUpdateTrack { /// your instance prefer to let Cloud SQL choose the timing of restart (within /// its Maintenance window, if applicable). Stable = 2, + /// For instance update that requires a restart, this update track indicates + /// your instance prefer to let Cloud SQL choose the timing of restart (within + /// its Maintenance window, if applicable) to be at least 5 weeks after the + /// notification. + Week5 = 3, } impl SqlUpdateTrack { /// String value of the enum field names used in the ProtoBuf definition. @@ -1969,6 +2211,7 @@ impl SqlUpdateTrack { SqlUpdateTrack::Unspecified => "SQL_UPDATE_TRACK_UNSPECIFIED", SqlUpdateTrack::Canary => "canary", SqlUpdateTrack::Stable => "stable", + SqlUpdateTrack::Week5 => "week5", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -1977,6 +2220,7 @@ impl SqlUpdateTrack { "SQL_UPDATE_TRACK_UNSPECIFIED" => Some(Self::Unspecified), "canary" => Some(Self::Canary), "stable" => Some(Self::Stable), + "week5" => Some(Self::Week5), _ => None, } } @@ -2030,6 +2274,20 @@ pub struct SqlInstancesDemoteMasterRequest { #[prost(message, optional, tag = "100")] pub body: ::core::option::Option, } +/// Instance demote request. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SqlInstancesDemoteRequest { + /// Required. Cloud SQL instance name. + #[prost(string, tag = "1")] + pub instance: ::prost::alloc::string::String, + /// Required. ID of the project that contains the instance. + #[prost(string, tag = "2")] + pub project: ::prost::alloc::string::String, + /// Required. The request body. + #[prost(message, optional, tag = "100")] + pub body: ::core::option::Option, +} /// Instance export request. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -2089,7 +2347,7 @@ pub struct SqlInstancesInsertRequest { #[prost(string, tag = "1")] pub project: ::prost::alloc::string::String, #[prost(message, optional, tag = "100")] - pub body: ::core::option::Option, + pub body: ::core::option::Option, } /// Instance list request. #[allow(clippy::derive_partial_eq_without_eq)] @@ -2142,7 +2400,7 @@ pub struct SqlInstancesPatchRequest { #[prost(string, tag = "2")] pub project: ::prost::alloc::string::String, #[prost(message, optional, tag = "100")] - pub body: ::core::option::Option, + pub body: ::core::option::Option, } /// Instance promote replica request. #[allow(clippy::derive_partial_eq_without_eq)] @@ -2154,6 +2412,27 @@ pub struct SqlInstancesPromoteReplicaRequest { /// ID of the project that contains the read replica. #[prost(string, tag = "2")] pub project: ::prost::alloc::string::String, + /// Set to true if the promote operation should attempt to re-add the original + /// primary as a replica when it comes back online. Otherwise, if this value is + /// false or not set, the original primary will be a standalone instance. + #[prost(bool, tag = "3")] + pub failover: bool, +} +/// Instance switchover request. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SqlInstancesSwitchoverRequest { + /// Cloud SQL read replica instance name. + #[prost(string, tag = "1")] + pub instance: ::prost::alloc::string::String, + /// ID of the project that contains the replica. + #[prost(string, tag = "2")] + pub project: ::prost::alloc::string::String, + /// Optional. (MySQL 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. + #[prost(message, optional, tag = "3")] + pub db_timeout: ::core::option::Option<::prost_types::Duration>, } /// Instance reset SSL config request. #[allow(clippy::derive_partial_eq_without_eq)] @@ -2263,7 +2542,7 @@ pub struct SqlInstancesUpdateRequest { #[prost(string, tag = "2")] pub project: ::prost::alloc::string::String, #[prost(message, optional, tag = "100")] - pub body: ::core::option::Option, + pub body: ::core::option::Option, } /// Instance reschedule maintenance request. #[allow(clippy::derive_partial_eq_without_eq)] @@ -2308,17 +2587,23 @@ pub struct BackupReencryptionConfig { #[prost(int32, optional, tag = "1")] pub backup_limit: ::core::option::Option, /// Type of backups users want to re-encrypt. - #[prost( - enumeration = "backup_reencryption_config::BackupType", - optional, - tag = "2" - )] + #[prost(enumeration = "backup_reencryption_config::BackupType", optional, tag = "2")] pub backup_type: ::core::option::Option, } /// Nested message and enum types in `BackupReencryptionConfig`. pub mod backup_reencryption_config { /// Backup type for re-encryption - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum BackupType { /// Unknown backup type, will be defaulted to AUTOMATIC backup type @@ -2388,12 +2673,23 @@ pub struct SqlInstancesVerifyExternalSyncSettingsRequest { oneof = "sql_instances_verify_external_sync_settings_request::SyncConfig", tags = "6" )] - pub sync_config: - ::core::option::Option, + pub sync_config: ::core::option::Option< + sql_instances_verify_external_sync_settings_request::SyncConfig, + >, } /// Nested message and enum types in `SqlInstancesVerifyExternalSyncSettingsRequest`. pub mod sql_instances_verify_external_sync_settings_request { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum ExternalSyncMode { /// Unknown external sync mode, will be defaulted to ONLINE mode @@ -2456,58 +2752,15 @@ pub struct SqlInstancesStartExternalSyncRequest { pub skip_verification: bool, /// Optional. Parallel level for initial data sync. Currently only applicable /// for MySQL. - #[prost( - enumeration = "sql_instances_start_external_sync_request::ExternalSyncParallelLevel", - tag = "7" - )] + #[prost(enumeration = "ExternalSyncParallelLevel", tag = "7")] pub sync_parallel_level: i32, - #[prost( - oneof = "sql_instances_start_external_sync_request::SyncConfig", - tags = "6" - )] - pub sync_config: ::core::option::Option, + #[prost(oneof = "sql_instances_start_external_sync_request::SyncConfig", tags = "6")] + pub sync_config: ::core::option::Option< + sql_instances_start_external_sync_request::SyncConfig, + >, } /// Nested message and enum types in `SqlInstancesStartExternalSyncRequest`. pub mod sql_instances_start_external_sync_request { - /// External Sync parallel level. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum ExternalSyncParallelLevel { - /// Unknown sync parallel level. Will be defaulted to OPTIMAL. - Unspecified = 0, - /// Minimal parallel level. - Min = 1, - /// Optimal parallel level. - Optimal = 2, - /// Maximum parallel level. - Max = 3, - } - impl ExternalSyncParallelLevel { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - ExternalSyncParallelLevel::Unspecified => { - "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" - } - ExternalSyncParallelLevel::Min => "MIN", - ExternalSyncParallelLevel::Optimal => "OPTIMAL", - ExternalSyncParallelLevel::Max => "MAX", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" => Some(Self::Unspecified), - "MIN" => Some(Self::Min), - "OPTIMAL" => Some(Self::Optimal), - "MAX" => Some(Self::Max), - _ => None, - } - } - } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum SyncConfig { @@ -2556,6 +2809,15 @@ pub struct InstancesDemoteMasterRequest { #[prost(message, optional, tag = "1")] pub demote_master_context: ::core::option::Option, } +/// This request is used to demote an existing standalone instance to be a +/// Cloud SQL read replica for an external database server. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InstancesDemoteRequest { + /// Required. Contains details about the demote operation. + #[prost(message, optional, tag = "1")] + pub demote_context: ::core::option::Option, +} /// Database instance export request. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -2603,7 +2865,7 @@ pub struct InstancesListResponse { pub warnings: ::prost::alloc::vec::Vec, /// List of database instance resources. #[prost(message, repeated, tag = "3")] - pub items: ::prost::alloc::vec::Vec, + pub items: ::prost::alloc::vec::Vec, /// The continuation token, used to page through large result sets. Provide /// this value in a subsequent request to return the next page of results. #[prost(string, tag = "4")] @@ -2674,6 +2936,28 @@ pub struct SqlInstancesGetDiskShrinkConfigResponse { #[prost(string, tag = "3")] pub message: ::prost::alloc::string::String, } +/// Instance get latest recovery time request. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SqlInstancesGetLatestRecoveryTimeRequest { + /// Cloud SQL instance ID. This does not include the project ID. + #[prost(string, tag = "1")] + pub instance: ::prost::alloc::string::String, + /// Project ID of the project that contains the instance. + #[prost(string, tag = "2")] + pub project: ::prost::alloc::string::String, +} +/// Instance get latest recovery time response. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SqlInstancesGetLatestRecoveryTimeResponse { + /// This is always `sql#getLatestRecoveryTime`. + #[prost(string, tag = "1")] + pub kind: ::prost::alloc::string::String, + /// Timestamp, identifies the latest recovery time of the source instance. + #[prost(message, optional, tag = "2")] + pub latest_recovery_time: ::core::option::Option<::prost_types::Timestamp>, +} /// Database instance clone context. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -2709,6 +2993,11 @@ pub struct CloneContext { /// instance. Clone all databases if empty. #[prost(string, repeated, tag = "9")] pub database_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Optional. (Point-in-time recovery for PostgreSQL only) Clone to an instance + /// in the specified zone. If no zone is specified, clone to the same zone as + /// the source instance. + #[prost(string, optional, tag = "10")] + pub preferred_zone: ::core::option::Option<::prost::alloc::string::String>, } /// Binary log coordinates. #[allow(clippy::derive_partial_eq_without_eq)] @@ -2727,7 +3016,7 @@ pub struct BinLogCoordinates { /// A Cloud SQL instance resource. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct DatabaseMetrics { +pub struct DatabaseInstance { /// This is always `sql#instance`. #[prost(string, tag = "1")] pub kind: ::prost::alloc::string::String, @@ -2841,7 +3130,9 @@ pub struct DatabaseMetrics { pub secondary_gce_zone: ::prost::alloc::string::String, /// Disk encryption configuration specific to an instance. #[prost(message, optional, tag = "26")] - pub disk_encryption_configuration: ::core::option::Option, + pub disk_encryption_configuration: ::core::option::Option< + DiskEncryptionConfiguration, + >, /// Disk encryption status specific to an instance. #[prost(message, optional, tag = "27")] pub disk_encryption_status: ::core::option::Option, @@ -2851,7 +3142,9 @@ pub struct DatabaseMetrics { pub root_password: ::prost::alloc::string::String, /// The start time of any upcoming scheduled maintenance for this instance. #[prost(message, optional, tag = "30")] - pub scheduled_maintenance: ::core::option::Option, + pub scheduled_maintenance: ::core::option::Option< + database_instance::SqlScheduledMaintenance, + >, /// The status indicating if instance satisfiesPzs. /// Reserved for future use. #[prost(message, optional, tag = "35")] @@ -2868,7 +3161,9 @@ pub struct DatabaseMetrics { /// * Readers: /// * the proactive database wellness job #[prost(message, optional, tag = "38")] - pub out_of_disk_report: ::core::option::Option, + pub out_of_disk_report: ::core::option::Option< + database_instance::SqlOutOfDiskReport, + >, /// Output only. The time when the instance was created in /// [RFC 3339]() format, for example /// `2012-11-15T16:19:00.094Z`. @@ -2876,12 +3171,35 @@ pub struct DatabaseMetrics { pub create_time: ::core::option::Option<::prost_types::Timestamp>, /// Output only. List all maintenance versions applicable on the instance #[prost(string, repeated, tag = "41")] - pub available_maintenance_versions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + pub available_maintenance_versions: ::prost::alloc::vec::Vec< + ::prost::alloc::string::String, + >, /// The current software version on the instance. #[prost(string, tag = "42")] pub maintenance_version: ::prost::alloc::string::String, + #[prost( + enumeration = "database_instance::SqlNetworkArchitecture", + optional, + tag = "47" + )] + pub sql_network_architecture: ::core::option::Option, + /// Output only. The link to service attachment of PSC instance. + #[prost(string, optional, tag = "48")] + pub psc_service_attachment_link: ::core::option::Option< + ::prost::alloc::string::String, + >, + /// Output only. The dns name of the instance. + #[prost(string, optional, tag = "49")] + pub dns_name: ::core::option::Option<::prost::alloc::string::String>, + /// Output only. DEPRECATED: please use write_endpoint instead. + #[deprecated] + #[prost(string, optional, tag = "51")] + pub primary_dns_name: ::core::option::Option<::prost::alloc::string::String>, + /// Output only. The dns name of the primary instance in a replication group. + #[prost(string, optional, tag = "52")] + pub write_endpoint: ::core::option::Option<::prost::alloc::string::String>, } -/// Nested message and enum types in `DatabaseMetrics`. +/// Nested message and enum types in `DatabaseInstance`. pub mod database_instance { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -2944,7 +3262,15 @@ pub mod database_instance { pub mod sql_out_of_disk_report { /// This enum lists all possible states regarding out-of-disk issues. #[derive( - Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration )] #[repr(i32)] pub enum SqlOutOfDiskState { @@ -2980,7 +3306,17 @@ pub mod database_instance { } } /// The current serving state of the database instance. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum SqlInstanceState { /// The state of the instance is unknown. @@ -3033,6 +3369,54 @@ pub mod database_instance { } } } + /// The current SQL network architecture for the instance. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum SqlNetworkArchitecture { + Unspecified = 0, + /// Instance is a Tenancy Unit (TU) instance. + NewNetworkArchitecture = 1, + /// Instance is an Umbrella instance. + OldNetworkArchitecture = 2, + } + impl SqlNetworkArchitecture { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SqlNetworkArchitecture::Unspecified => { + "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED" + } + SqlNetworkArchitecture::NewNetworkArchitecture => { + "NEW_NETWORK_ARCHITECTURE" + } + SqlNetworkArchitecture::OldNetworkArchitecture => { + "OLD_NETWORK_ARCHITECTURE" + } + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED" => Some(Self::Unspecified), + "NEW_NETWORK_ARCHITECTURE" => Some(Self::NewNetworkArchitecture), + "OLD_NETWORK_ARCHITECTURE" => Some(Self::OldNetworkArchitecture), + _ => None, + } + } + } } /// Reschedule options for maintenance windows. #[allow(clippy::derive_partial_eq_without_eq)] @@ -3040,8 +3424,9 @@ pub mod database_instance { pub struct SqlInstancesRescheduleMaintenanceRequestBody { /// Required. The type of the reschedule the user wants. #[prost(message, optional, tag = "3")] - pub reschedule: - ::core::option::Option, + pub reschedule: ::core::option::Option< + sql_instances_reschedule_maintenance_request_body::Reschedule, + >, } /// Nested message and enum types in `SqlInstancesRescheduleMaintenanceRequestBody`. pub mod sql_instances_reschedule_maintenance_request_body { @@ -3058,7 +3443,17 @@ pub mod sql_instances_reschedule_maintenance_request_body { #[prost(message, optional, tag = "2")] pub schedule_time: ::core::option::Option<::prost_types::Timestamp>, } - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum RescheduleType { Unspecified = 0, @@ -3123,6 +3518,19 @@ pub struct DemoteMasterContext { #[prost(bool, tag = "5")] pub skip_replication_setup: bool, } +/// This context is used to demote an existing standalone instance to be +/// a Cloud SQL read replica for an external database server. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DemoteContext { + /// This is always `sql#demoteContext`. + #[prost(string, tag = "1")] + pub kind: ::prost::alloc::string::String, + /// Required. The name of the instance which acts as the on-premises primary + /// instance in the replication setup. + #[prost(string, tag = "2")] + pub source_representative_instance_name: ::prost::alloc::string::String, +} /// Database instance failover context. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -3197,7 +3605,17 @@ pub struct SqlExternalSyncSettingError { } /// Nested message and enum types in `SqlExternalSyncSettingError`. pub mod sql_external_sync_setting_error { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum SqlExternalSyncSettingErrorType { Unspecified = 0, @@ -3269,6 +3687,21 @@ pub mod sql_external_sync_setting_error { InvalidFileInfo = 32, /// The source instance has unsupported database settings for migration. UnsupportedDatabaseSettings = 33, + /// The replication user is missing parallel import specific privileges. + /// (e.g. LOCK TABLES) for MySQL. + MysqlParallelImportInsufficientPrivilege = 34, + /// The global variable local_infile is off on external server replica. + LocalInfileOff = 35, + /// This code instructs customers to turn on point-in-time recovery manually + /// for the instance after promoting the Cloud SQL for PostgreSQL instance. + TurnOnPitrAfterPromote = 36, + /// The minor version of replica database is incompatible with the source. + IncompatibleDatabaseMinorVersion = 37, + /// This warning message indicates that Cloud SQL uses the maximum number of + /// subscriptions to migrate data from the source to the destination. + SourceMaxSubscriptions = 38, + /// Unable to verify definers on the source for MySQL. + UnableToVerifyDefiners = 39, } impl SqlExternalSyncSettingErrorType { /// String value of the enum field names used in the ProtoBuf definition. @@ -3280,17 +3713,25 @@ pub mod sql_external_sync_setting_error { SqlExternalSyncSettingErrorType::Unspecified => { "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED" } - SqlExternalSyncSettingErrorType::ConnectionFailure => "CONNECTION_FAILURE", + SqlExternalSyncSettingErrorType::ConnectionFailure => { + "CONNECTION_FAILURE" + } SqlExternalSyncSettingErrorType::BinlogNotEnabled => "BINLOG_NOT_ENABLED", SqlExternalSyncSettingErrorType::IncompatibleDatabaseVersion => { "INCOMPATIBLE_DATABASE_VERSION" } - SqlExternalSyncSettingErrorType::ReplicaAlreadySetup => "REPLICA_ALREADY_SETUP", - SqlExternalSyncSettingErrorType::InsufficientPrivilege => "INSUFFICIENT_PRIVILEGE", + SqlExternalSyncSettingErrorType::ReplicaAlreadySetup => { + "REPLICA_ALREADY_SETUP" + } + SqlExternalSyncSettingErrorType::InsufficientPrivilege => { + "INSUFFICIENT_PRIVILEGE" + } SqlExternalSyncSettingErrorType::UnsupportedMigrationType => { "UNSUPPORTED_MIGRATION_TYPE" } - SqlExternalSyncSettingErrorType::NoPglogicalInstalled => "NO_PGLOGICAL_INSTALLED", + SqlExternalSyncSettingErrorType::NoPglogicalInstalled => { + "NO_PGLOGICAL_INSTALLED" + } SqlExternalSyncSettingErrorType::PglogicalNodeAlreadyExists => { "PGLOGICAL_NODE_ALREADY_EXISTS" } @@ -3307,24 +3748,34 @@ pub mod sql_external_sync_setting_error { SqlExternalSyncSettingErrorType::InsufficientMaxWorkerProcesses => { "INSUFFICIENT_MAX_WORKER_PROCESSES" } - SqlExternalSyncSettingErrorType::UnsupportedExtensions => "UNSUPPORTED_EXTENSIONS", + SqlExternalSyncSettingErrorType::UnsupportedExtensions => { + "UNSUPPORTED_EXTENSIONS" + } SqlExternalSyncSettingErrorType::InvalidRdsLogicalReplication => { "INVALID_RDS_LOGICAL_REPLICATION" } - SqlExternalSyncSettingErrorType::InvalidLoggingSetup => "INVALID_LOGGING_SETUP", + SqlExternalSyncSettingErrorType::InvalidLoggingSetup => { + "INVALID_LOGGING_SETUP" + } SqlExternalSyncSettingErrorType::InvalidDbParam => "INVALID_DB_PARAM", - SqlExternalSyncSettingErrorType::UnsupportedGtidMode => "UNSUPPORTED_GTID_MODE", + SqlExternalSyncSettingErrorType::UnsupportedGtidMode => { + "UNSUPPORTED_GTID_MODE" + } SqlExternalSyncSettingErrorType::SqlserverAgentNotRunning => { "SQLSERVER_AGENT_NOT_RUNNING" } SqlExternalSyncSettingErrorType::UnsupportedTableDefinition => { "UNSUPPORTED_TABLE_DEFINITION" } - SqlExternalSyncSettingErrorType::UnsupportedDefiner => "UNSUPPORTED_DEFINER", + SqlExternalSyncSettingErrorType::UnsupportedDefiner => { + "UNSUPPORTED_DEFINER" + } SqlExternalSyncSettingErrorType::SqlserverServernameMismatch => { "SQLSERVER_SERVERNAME_MISMATCH" } - SqlExternalSyncSettingErrorType::PrimaryAlreadySetup => "PRIMARY_ALREADY_SETUP", + SqlExternalSyncSettingErrorType::PrimaryAlreadySetup => { + "PRIMARY_ALREADY_SETUP" + } SqlExternalSyncSettingErrorType::UnsupportedBinlogFormat => { "UNSUPPORTED_BINLOG_FORMAT" } @@ -3334,7 +3785,9 @@ pub mod sql_external_sync_setting_error { SqlExternalSyncSettingErrorType::UnsupportedStorageEngine => { "UNSUPPORTED_STORAGE_ENGINE" } - SqlExternalSyncSettingErrorType::LimitedSupportTables => "LIMITED_SUPPORT_TABLES", + SqlExternalSyncSettingErrorType::LimitedSupportTables => { + "LIMITED_SUPPORT_TABLES" + } SqlExternalSyncSettingErrorType::ExistingDataInReplica => { "EXISTING_DATA_IN_REPLICA" } @@ -3351,34 +3804,64 @@ pub mod sql_external_sync_setting_error { SqlExternalSyncSettingErrorType::UnsupportedDatabaseSettings => { "UNSUPPORTED_DATABASE_SETTINGS" } + SqlExternalSyncSettingErrorType::MysqlParallelImportInsufficientPrivilege => { + "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE" + } + SqlExternalSyncSettingErrorType::LocalInfileOff => "LOCAL_INFILE_OFF", + SqlExternalSyncSettingErrorType::TurnOnPitrAfterPromote => { + "TURN_ON_PITR_AFTER_PROMOTE" + } + SqlExternalSyncSettingErrorType::IncompatibleDatabaseMinorVersion => { + "INCOMPATIBLE_DATABASE_MINOR_VERSION" + } + SqlExternalSyncSettingErrorType::SourceMaxSubscriptions => { + "SOURCE_MAX_SUBSCRIPTIONS" + } + SqlExternalSyncSettingErrorType::UnableToVerifyDefiners => { + "UNABLE_TO_VERIFY_DEFINERS" + } } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { - "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED" => { + Some(Self::Unspecified) + } "CONNECTION_FAILURE" => Some(Self::ConnectionFailure), "BINLOG_NOT_ENABLED" => Some(Self::BinlogNotEnabled), - "INCOMPATIBLE_DATABASE_VERSION" => Some(Self::IncompatibleDatabaseVersion), + "INCOMPATIBLE_DATABASE_VERSION" => { + Some(Self::IncompatibleDatabaseVersion) + } "REPLICA_ALREADY_SETUP" => Some(Self::ReplicaAlreadySetup), "INSUFFICIENT_PRIVILEGE" => Some(Self::InsufficientPrivilege), "UNSUPPORTED_MIGRATION_TYPE" => Some(Self::UnsupportedMigrationType), "NO_PGLOGICAL_INSTALLED" => Some(Self::NoPglogicalInstalled), "PGLOGICAL_NODE_ALREADY_EXISTS" => Some(Self::PglogicalNodeAlreadyExists), "INVALID_WAL_LEVEL" => Some(Self::InvalidWalLevel), - "INVALID_SHARED_PRELOAD_LIBRARY" => Some(Self::InvalidSharedPreloadLibrary), - "INSUFFICIENT_MAX_REPLICATION_SLOTS" => Some(Self::InsufficientMaxReplicationSlots), + "INVALID_SHARED_PRELOAD_LIBRARY" => { + Some(Self::InvalidSharedPreloadLibrary) + } + "INSUFFICIENT_MAX_REPLICATION_SLOTS" => { + Some(Self::InsufficientMaxReplicationSlots) + } "INSUFFICIENT_MAX_WAL_SENDERS" => Some(Self::InsufficientMaxWalSenders), - "INSUFFICIENT_MAX_WORKER_PROCESSES" => Some(Self::InsufficientMaxWorkerProcesses), + "INSUFFICIENT_MAX_WORKER_PROCESSES" => { + Some(Self::InsufficientMaxWorkerProcesses) + } "UNSUPPORTED_EXTENSIONS" => Some(Self::UnsupportedExtensions), - "INVALID_RDS_LOGICAL_REPLICATION" => Some(Self::InvalidRdsLogicalReplication), + "INVALID_RDS_LOGICAL_REPLICATION" => { + Some(Self::InvalidRdsLogicalReplication) + } "INVALID_LOGGING_SETUP" => Some(Self::InvalidLoggingSetup), "INVALID_DB_PARAM" => Some(Self::InvalidDbParam), "UNSUPPORTED_GTID_MODE" => Some(Self::UnsupportedGtidMode), "SQLSERVER_AGENT_NOT_RUNNING" => Some(Self::SqlserverAgentNotRunning), "UNSUPPORTED_TABLE_DEFINITION" => Some(Self::UnsupportedTableDefinition), "UNSUPPORTED_DEFINER" => Some(Self::UnsupportedDefiner), - "SQLSERVER_SERVERNAME_MISMATCH" => Some(Self::SqlserverServernameMismatch), + "SQLSERVER_SERVERNAME_MISMATCH" => { + Some(Self::SqlserverServernameMismatch) + } "PRIMARY_ALREADY_SETUP" => Some(Self::PrimaryAlreadySetup), "UNSUPPORTED_BINLOG_FORMAT" => Some(Self::UnsupportedBinlogFormat), "BINLOG_RETENTION_SETTING" => Some(Self::BinlogRetentionSetting), @@ -3389,7 +3872,19 @@ pub mod sql_external_sync_setting_error { "RISKY_BACKUP_ADMIN_PRIVILEGE" => Some(Self::RiskyBackupAdminPrivilege), "INSUFFICIENT_GCS_PERMISSIONS" => Some(Self::InsufficientGcsPermissions), "INVALID_FILE_INFO" => Some(Self::InvalidFileInfo), - "UNSUPPORTED_DATABASE_SETTINGS" => Some(Self::UnsupportedDatabaseSettings), + "UNSUPPORTED_DATABASE_SETTINGS" => { + Some(Self::UnsupportedDatabaseSettings) + } + "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE" => { + Some(Self::MysqlParallelImportInsufficientPrivilege) + } + "LOCAL_INFILE_OFF" => Some(Self::LocalInfileOff), + "TURN_ON_PITR_AFTER_PROMOTE" => Some(Self::TurnOnPitrAfterPromote), + "INCOMPATIBLE_DATABASE_MINOR_VERSION" => { + Some(Self::IncompatibleDatabaseMinorVersion) + } + "SOURCE_MAX_SUBSCRIPTIONS" => Some(Self::SourceMaxSubscriptions), + "UNABLE_TO_VERIFY_DEFINERS" => Some(Self::UnableToVerifyDefiners), _ => None, } } @@ -3450,6 +3945,50 @@ pub struct ReplicaConfiguration { /// the replica has to be in different zone with the primary instance. #[prost(message, optional, tag = "3")] pub failover_target: ::core::option::Option, + /// 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. + #[prost(message, optional, tag = "5")] + pub cascadable_replica: ::core::option::Option, +} +/// External Sync parallel level. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ExternalSyncParallelLevel { + /// Unknown sync parallel level. Will be defaulted to OPTIMAL. + Unspecified = 0, + /// Minimal parallel level. + Min = 1, + /// Optimal parallel level. + Optimal = 2, + /// Maximum parallel level. + Max = 3, +} +impl ExternalSyncParallelLevel { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ExternalSyncParallelLevel::Unspecified => { + "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" + } + ExternalSyncParallelLevel::Min => "MIN", + ExternalSyncParallelLevel::Optimal => "OPTIMAL", + ExternalSyncParallelLevel::Max => "MAX", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" => Some(Self::Unspecified), + "MIN" => Some(Self::Min), + "OPTIMAL" => Some(Self::Optimal), + "MAX" => Some(Self::Max), + _ => None, + } + } } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] @@ -3536,8 +4075,8 @@ impl SqlSuspensionReason { /// Generated client implementations. pub mod sql_instances_service_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::http::Uri; use tonic::codegen::*; + use tonic::codegen::http::Uri; /// Service to manage Cloud SQL instances. #[derive(Debug, Clone)] pub struct SqlInstancesServiceClient { @@ -3582,8 +4121,9 @@ pub mod sql_instances_service_client { >::ResponseBody, >, >, - >>::Error: - Into + Send + Sync, + , + >>::Error: Into + Send + Sync, { SqlInstancesServiceClient::new(InterceptedService::new(inner, interceptor)) } @@ -3627,21 +4167,27 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/AddServerCa", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "AddServerCa", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "AddServerCa", + ), + ); self.inner.unary(req, path, codec).await } /// Creates a Cloud SQL instance as a clone of the source instance. Using this @@ -3650,21 +4196,24 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/Clone", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "Clone", - )); + req.extensions_mut() + .insert( + GrpcMethod::new("google.cloud.sql.v1.SqlInstancesService", "Clone"), + ); self.inner.unary(req, path, codec).await } /// Deletes a Cloud SQL instance. @@ -3672,21 +4221,24 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/Delete", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "Delete", - )); + req.extensions_mut() + .insert( + GrpcMethod::new("google.cloud.sql.v1.SqlInstancesService", "Delete"), + ); self.inner.unary(req, path, codec).await } /// Demotes the stand-alone instance to be a Cloud SQL read replica for an @@ -3695,21 +4247,53 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/DemoteMaster", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "DemoteMaster", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "DemoteMaster", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Demotes an existing standalone instance to be a Cloud SQL read replica + /// for an external database server. + pub async fn demote( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/google.cloud.sql.v1.SqlInstancesService/Demote", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("google.cloud.sql.v1.SqlInstancesService", "Demote"), + ); self.inner.unary(req, path, codec).await } /// Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL @@ -3718,21 +4302,24 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/Export", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "Export", - )); + req.extensions_mut() + .insert( + GrpcMethod::new("google.cloud.sql.v1.SqlInstancesService", "Export"), + ); self.inner.unary(req, path, codec).await } /// Initiates a manual failover of a high availability (HA) primary instance @@ -3747,21 +4334,27 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/Failover", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "Failover", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "Failover", + ), + ); self.inner.unary(req, path, codec).await } /// Reencrypt CMEK instance with latest key version. @@ -3769,43 +4362,55 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/Reencrypt", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "Reencrypt", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "Reencrypt", + ), + ); self.inner.unary(req, path, codec).await } /// Retrieves a resource containing information about a Cloud SQL instance. pub async fn get( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/Get", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "Get", - )); + req.extensions_mut() + .insert( + GrpcMethod::new("google.cloud.sql.v1.SqlInstancesService", "Get"), + ); self.inner.unary(req, path, codec).await } /// Imports data into a Cloud SQL instance from a SQL dump or CSV file in @@ -3814,21 +4419,24 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/Import", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "Import", - )); + req.extensions_mut() + .insert( + GrpcMethod::new("google.cloud.sql.v1.SqlInstancesService", "Import"), + ); self.inner.unary(req, path, codec).await } /// Creates a new Cloud SQL instance. @@ -3836,44 +4444,52 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/Insert", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "Insert", - )); + req.extensions_mut() + .insert( + GrpcMethod::new("google.cloud.sql.v1.SqlInstancesService", "Insert"), + ); self.inner.unary(req, path, codec).await } /// Lists instances under a given project. pub async fn list( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> - { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/List", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "List", - )); + req.extensions_mut() + .insert( + GrpcMethod::new("google.cloud.sql.v1.SqlInstancesService", "List"), + ); self.inner.unary(req, path, codec).await } /// Lists all of the trusted Certificate Authorities (CAs) for the specified @@ -3888,21 +4504,27 @@ pub mod sql_instances_service_client { tonic::Response, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/ListServerCas", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "ListServerCas", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "ListServerCas", + ), + ); self.inner.unary(req, path, codec).await } /// Partially updates settings of a Cloud SQL instance by merging the request @@ -3911,21 +4533,24 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/Patch", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "Patch", - )); + req.extensions_mut() + .insert( + GrpcMethod::new("google.cloud.sql.v1.SqlInstancesService", "Patch"), + ); self.inner.unary(req, path, codec).await } /// Promotes the read replica instance to be a stand-alone Cloud SQL instance. @@ -3934,21 +4559,55 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/PromoteReplica", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "PromoteReplica", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "PromoteReplica", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Switches over from the primary instance to the replica instance. + pub async fn switchover( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/google.cloud.sql.v1.SqlInstancesService/Switchover", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "Switchover", + ), + ); self.inner.unary(req, path, codec).await } /// Deletes all client certificates and generates a new server SSL certificate @@ -3957,21 +4616,27 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/ResetSslConfig", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "ResetSslConfig", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "ResetSslConfig", + ), + ); self.inner.unary(req, path, codec).await } /// Restarts a Cloud SQL instance. @@ -3979,21 +4644,24 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/Restart", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "Restart", - )); + req.extensions_mut() + .insert( + GrpcMethod::new("google.cloud.sql.v1.SqlInstancesService", "Restart"), + ); self.inner.unary(req, path, codec).await } /// Restores a backup of a Cloud SQL instance. Using this operation might cause @@ -4002,21 +4670,27 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/RestoreBackup", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "RestoreBackup", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "RestoreBackup", + ), + ); self.inner.unary(req, path, codec).await } /// Rotates the server certificate to one signed by the Certificate Authority @@ -4025,21 +4699,27 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/RotateServerCa", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "RotateServerCa", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "RotateServerCa", + ), + ); self.inner.unary(req, path, codec).await } /// Starts the replication in the read replica instance. @@ -4047,21 +4727,27 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/StartReplica", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "StartReplica", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "StartReplica", + ), + ); self.inner.unary(req, path, codec).await } /// Stops the replication in the read replica instance. @@ -4069,21 +4755,27 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/StopReplica", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "StopReplica", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "StopReplica", + ), + ); self.inner.unary(req, path, codec).await } /// Truncate MySQL general and slow query log tables @@ -4092,21 +4784,27 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/TruncateLog", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "TruncateLog", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "TruncateLog", + ), + ); self.inner.unary(req, path, codec).await } /// Updates settings of a Cloud SQL instance. Using this operation might cause @@ -4115,21 +4813,24 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/Update", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "Update", - )); + req.extensions_mut() + .insert( + GrpcMethod::new("google.cloud.sql.v1.SqlInstancesService", "Update"), + ); self.inner.unary(req, path, codec).await } /// Generates a short-lived X509 certificate containing the provided public key @@ -4138,70 +4839,94 @@ pub mod sql_instances_service_client { /// database. pub async fn create_ephemeral( &mut self, - request: impl tonic::IntoRequest, + request: impl tonic::IntoRequest< + super::SqlInstancesCreateEphemeralCertRequest, + >, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/CreateEphemeral", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "CreateEphemeral", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "CreateEphemeral", + ), + ); self.inner.unary(req, path, codec).await } /// Reschedules the maintenance on the given instance. pub async fn reschedule_maintenance( &mut self, - request: impl tonic::IntoRequest, + request: impl tonic::IntoRequest< + super::SqlInstancesRescheduleMaintenanceRequest, + >, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/RescheduleMaintenance", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "RescheduleMaintenance", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "RescheduleMaintenance", + ), + ); self.inner.unary(req, path, codec).await } /// Verify External primary instance external sync settings. pub async fn verify_external_sync_settings( &mut self, - request: impl tonic::IntoRequest, + request: impl tonic::IntoRequest< + super::SqlInstancesVerifyExternalSyncSettingsRequest, + >, ) -> std::result::Result< tonic::Response, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/VerifyExternalSyncSettings", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "VerifyExternalSyncSettings", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "VerifyExternalSyncSettings", + ), + ); self.inner.unary(req, path, codec).await } /// Start External primary instance migration. @@ -4209,21 +4934,27 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/StartExternalSync", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "StartExternalSync", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "StartExternalSync", + ), + ); self.inner.unary(req, path, codec).await } /// Perform Disk Shrink on primary instance. @@ -4231,46 +4962,60 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/PerformDiskShrink", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "PerformDiskShrink", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "PerformDiskShrink", + ), + ); self.inner.unary(req, path, codec).await } /// Get Disk Shrink Config for a given instance. pub async fn get_disk_shrink_config( &mut self, - request: impl tonic::IntoRequest, + request: impl tonic::IntoRequest< + super::SqlInstancesGetDiskShrinkConfigRequest, + >, ) -> std::result::Result< tonic::Response, tonic::Status, > { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/GetDiskShrinkConfig", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "GetDiskShrinkConfig", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "GetDiskShrinkConfig", + ), + ); self.inner.unary(req, path, codec).await } /// Reset Replica Size to primary instance disk size. @@ -4278,21 +5023,60 @@ pub mod sql_instances_service_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/google.cloud.sql.v1.SqlInstancesService/ResetReplicaSize", ); let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new( - "google.cloud.sql.v1.SqlInstancesService", - "ResetReplicaSize", - )); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "ResetReplicaSize", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Get Latest Recovery Time for a given instance. + pub async fn get_latest_recovery_time( + &mut self, + request: impl tonic::IntoRequest< + super::SqlInstancesGetLatestRecoveryTimeRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/google.cloud.sql.v1.SqlInstancesService/GetLatestRecoveryTime", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "google.cloud.sql.v1.SqlInstancesService", + "GetLatestRecoveryTime", + ), + ); self.inner.unary(req, path, codec).await } }