diff --git a/.typos.toml b/.typos.toml index 24751a3de..264110d55 100644 --- a/.typos.toml +++ b/.typos.toml @@ -32,3 +32,5 @@ advices = "advices" # In the code, too late to fix. readablity = "readablity" # The upstream comments for src/generated/type say "Requestor", `typos` recommends `Requester`. requestor = "requestor" +# src/generated/cloud/sql/v1 has a typo, needs to be fixed upstream. +corresponsing = "corresponsing" diff --git a/src/generated/cloud/sql/v1/.sidekick.toml b/src/generated/cloud/sql/v1/.sidekick.toml new file mode 100644 index 000000000..d833c2467 --- /dev/null +++ b/src/generated/cloud/sql/v1/.sidekick.toml @@ -0,0 +1,21 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[general] +language = 'rust' +specification-source = 'google/cloud/sql/v1' +service-config = 'google/cloud/sql/v1/sqladmin_v1.yaml' + +[codec] +copyright-year = '2025' diff --git a/src/generated/cloud/sql/v1/Cargo.toml b/src/generated/cloud/sql/v1/Cargo.toml new file mode 100644 index 000000000..d7971c20c --- /dev/null +++ b/src/generated/cloud/sql/v1/Cargo.toml @@ -0,0 +1,38 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by sidekick. DO NOT EDIT. + +[package] +name = "gcp-sdk-sql-v1" +version = "0.1.0" +description = "Google Cloud Client Libraries for Rust - Cloud SQL Admin API" +edition.workspace = true +authors.workspace = true +license.workspace = true +repository.workspace = true +keywords.workspace = true +categories.workspace = true + +[dependencies] +async-trait = { version = "0.1.84" } +bytes = { version = "1.8.0", features = ["serde"] } +gax = { version = "0.1.0", path = "../../../../../src/gax", package = "gcp-sdk-gax", features = ["unstable-sdk-client"] } +lazy_static = { version = "1.5.0" } +reqwest = { version = "0.12.12", features = ["json"] } +serde = { version = "1.0.216", features = ["serde_derive"] } +serde_json = { version = "1.0.134" } +serde_with = { version = "3.12.0", default-features = false, features = ["base64", "macros", "std"] } +tracing = { version = "0.1.41" } +wkt = { version = "0.1.0", path = "../../../../../src/wkt", package = "gcp-sdk-wkt" } diff --git a/src/generated/cloud/sql/v1/README.md b/src/generated/cloud/sql/v1/README.md new file mode 100755 index 000000000..b57132f00 --- /dev/null +++ b/src/generated/cloud/sql/v1/README.md @@ -0,0 +1,28 @@ +# Google Cloud Client Libraries for Rust - Cloud SQL Admin API + + + +**WARNING:** this crate is under active development. We expect multiple breaking +changes in the upcoming releases. Testing is also incomplete, we do **not** +recommend that you use this crate in production. We welcome feedback about the +APIs, documentation, missing features, bugs, etc. + +API for Cloud SQL database instance management + +## Quickstart + +The main types to work with this crate are the clients: + +* [SqlBackupRunsService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlBackupRunsService.html) +* [SqlConnectService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlConnectService.html) +* [SqlDatabasesService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlDatabasesService.html) +* [SqlFlagsService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlFlagsService.html) +* [SqlInstancesService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlInstancesService.html) +* [SqlOperationsService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlOperationsService.html) +* [SqlSslCertsService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlSslCertsService.html) +* [SqlTiersService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlTiersService.html) +* [SqlUsersService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlUsersService.html) + +## More Information + +* Read the [crate's documentation](https://docs.rs/gcp-sdk-sql-v1/latest/gcp-sdk-sql-v1) diff --git a/src/generated/cloud/sql/v1/src/builders.rs b/src/generated/cloud/sql/v1/src/builders.rs new file mode 100755 index 000000000..ae42a8ee5 --- /dev/null +++ b/src/generated/cloud/sql/v1/src/builders.rs @@ -0,0 +1,3414 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by sidekick. DO NOT EDIT. + +pub mod sql_backup_runs_service { + use crate::Result; + use std::sync::Arc; + + /// Common implementation for [crate::client::SqlBackupRunsService] request builders. + #[derive(Clone, Debug)] + pub struct RequestBuilder { + stub: Arc, + request: R, + options: gax::options::RequestOptions, + } + + impl RequestBuilder + where R: std::default::Default { + pub(crate) fn new(stub: Arc) -> Self { + Self { + stub, + request: R::default(), + options: gax::options::RequestOptions::default(), + } + } + } + + /// The request builder for a SqlBackupRunsService::delete call. + #[derive(Clone, Debug)] + pub struct Delete(RequestBuilder); + + impl Delete { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).delete(self.0.request, self.0.options).await + } + + /// Sets the value of `id`. + pub fn set_id>(mut self, v: T) -> Self { + self.0.request.id = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Delete { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlBackupRunsService::get call. + #[derive(Clone, Debug)] + pub struct Get(RequestBuilder); + + impl Get { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).get(self.0.request, self.0.options).await + } + + /// Sets the value of `id`. + pub fn set_id>(mut self, v: T) -> Self { + self.0.request.id = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Get { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlBackupRunsService::insert call. + #[derive(Clone, Debug)] + pub struct Insert(RequestBuilder); + + impl Insert { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).insert(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Insert { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlBackupRunsService::list call. + #[derive(Clone, Debug)] + pub struct List(RequestBuilder); + + impl List { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).list(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `max_results`. + pub fn set_max_results>(mut self, v: T) -> Self { + self.0.request.max_results = v.into(); + self + } + + /// Sets the value of `page_token`. + pub fn set_page_token>(mut self, v: T) -> Self { + self.0.request.page_token = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for List { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + +} + +pub mod sql_connect_service { + use crate::Result; + use std::sync::Arc; + + /// Common implementation for [crate::client::SqlConnectService] request builders. + #[derive(Clone, Debug)] + pub struct RequestBuilder { + stub: Arc, + request: R, + options: gax::options::RequestOptions, + } + + impl RequestBuilder + where R: std::default::Default { + pub(crate) fn new(stub: Arc) -> Self { + Self { + stub, + request: R::default(), + options: gax::options::RequestOptions::default(), + } + } + } + + /// The request builder for a SqlConnectService::get_connect_settings call. + #[derive(Clone, Debug)] + pub struct GetConnectSettings(RequestBuilder); + + impl GetConnectSettings { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).get_connect_settings(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `read_time`. + pub fn set_read_time>>(mut self, v: T) -> Self { + self.0.request.read_time = v.into(); + self + } + } + + impl gax::options::RequestBuilder for GetConnectSettings { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlConnectService::generate_ephemeral_cert call. + #[derive(Clone, Debug)] + pub struct GenerateEphemeralCert(RequestBuilder); + + impl GenerateEphemeralCert { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).generate_ephemeral_cert(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `public_key`. + pub fn set_public_key>(mut self, v: T) -> Self { + self.0.request.public_key = v.into(); + self + } + + /// Sets the value of `access_token`. + pub fn set_access_token>(mut self, v: T) -> Self { + self.0.request.access_token = v.into(); + self + } + + /// Sets the value of `read_time`. + pub fn set_read_time>>(mut self, v: T) -> Self { + self.0.request.read_time = v.into(); + self + } + + /// Sets the value of `valid_duration`. + pub fn set_valid_duration>>(mut self, v: T) -> Self { + self.0.request.valid_duration = v.into(); + self + } + } + + impl gax::options::RequestBuilder for GenerateEphemeralCert { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + +} + +pub mod sql_databases_service { + use crate::Result; + use std::sync::Arc; + + /// Common implementation for [crate::client::SqlDatabasesService] request builders. + #[derive(Clone, Debug)] + pub struct RequestBuilder { + stub: Arc, + request: R, + options: gax::options::RequestOptions, + } + + impl RequestBuilder + where R: std::default::Default { + pub(crate) fn new(stub: Arc) -> Self { + Self { + stub, + request: R::default(), + options: gax::options::RequestOptions::default(), + } + } + } + + /// The request builder for a SqlDatabasesService::delete call. + #[derive(Clone, Debug)] + pub struct Delete(RequestBuilder); + + impl Delete { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).delete(self.0.request, self.0.options).await + } + + /// Sets the value of `database`. + pub fn set_database>(mut self, v: T) -> Self { + self.0.request.database = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Delete { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlDatabasesService::get call. + #[derive(Clone, Debug)] + pub struct Get(RequestBuilder); + + impl Get { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).get(self.0.request, self.0.options).await + } + + /// Sets the value of `database`. + pub fn set_database>(mut self, v: T) -> Self { + self.0.request.database = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Get { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlDatabasesService::insert call. + #[derive(Clone, Debug)] + pub struct Insert(RequestBuilder); + + impl Insert { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).insert(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Insert { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlDatabasesService::list call. + #[derive(Clone, Debug)] + pub struct List(RequestBuilder); + + impl List { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).list(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for List { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlDatabasesService::patch call. + #[derive(Clone, Debug)] + pub struct Patch(RequestBuilder); + + impl Patch { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).patch(self.0.request, self.0.options).await + } + + /// Sets the value of `database`. + pub fn set_database>(mut self, v: T) -> Self { + self.0.request.database = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Patch { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlDatabasesService::update call. + #[derive(Clone, Debug)] + pub struct Update(RequestBuilder); + + impl Update { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).update(self.0.request, self.0.options).await + } + + /// Sets the value of `database`. + pub fn set_database>(mut self, v: T) -> Self { + self.0.request.database = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Update { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + +} + +pub mod sql_flags_service { + use crate::Result; + use std::sync::Arc; + + /// Common implementation for [crate::client::SqlFlagsService] request builders. + #[derive(Clone, Debug)] + pub struct RequestBuilder { + stub: Arc, + request: R, + options: gax::options::RequestOptions, + } + + impl RequestBuilder + where R: std::default::Default { + pub(crate) fn new(stub: Arc) -> Self { + Self { + stub, + request: R::default(), + options: gax::options::RequestOptions::default(), + } + } + } + + /// The request builder for a SqlFlagsService::list call. + #[derive(Clone, Debug)] + pub struct List(RequestBuilder); + + impl List { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).list(self.0.request, self.0.options).await + } + + /// Sets the value of `database_version`. + pub fn set_database_version>(mut self, v: T) -> Self { + self.0.request.database_version = v.into(); + self + } + } + + impl gax::options::RequestBuilder for List { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + +} + +pub mod sql_instances_service { + use crate::Result; + use std::sync::Arc; + + /// Common implementation for [crate::client::SqlInstancesService] request builders. + #[derive(Clone, Debug)] + pub struct RequestBuilder { + stub: Arc, + request: R, + options: gax::options::RequestOptions, + } + + impl RequestBuilder + where R: std::default::Default { + pub(crate) fn new(stub: Arc) -> Self { + Self { + stub, + request: R::default(), + options: gax::options::RequestOptions::default(), + } + } + } + + /// The request builder for a SqlInstancesService::add_server_ca call. + #[derive(Clone, Debug)] + pub struct AddServerCa(RequestBuilder); + + impl AddServerCa { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).add_server_ca(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for AddServerCa { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::clone call. + #[derive(Clone, Debug)] + pub struct Clone(RequestBuilder); + + impl Clone { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).clone(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Clone { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::delete call. + #[derive(Clone, Debug)] + pub struct Delete(RequestBuilder); + + impl Delete { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).delete(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Delete { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::demote_master call. + #[derive(Clone, Debug)] + pub struct DemoteMaster(RequestBuilder); + + impl DemoteMaster { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).demote_master(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for DemoteMaster { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::demote call. + #[derive(Clone, Debug)] + pub struct Demote(RequestBuilder); + + impl Demote { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).demote(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Demote { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::export call. + #[derive(Clone, Debug)] + pub struct Export(RequestBuilder); + + impl Export { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).export(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Export { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::failover call. + #[derive(Clone, Debug)] + pub struct Failover(RequestBuilder); + + impl Failover { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).failover(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Failover { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::reencrypt call. + #[derive(Clone, Debug)] + pub struct Reencrypt(RequestBuilder); + + impl Reencrypt { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).reencrypt(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Reencrypt { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::get call. + #[derive(Clone, Debug)] + pub struct Get(RequestBuilder); + + impl Get { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).get(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Get { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::import call. + #[derive(Clone, Debug)] + pub struct Import(RequestBuilder); + + impl Import { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).import(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Import { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::insert call. + #[derive(Clone, Debug)] + pub struct Insert(RequestBuilder); + + impl Insert { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).insert(self.0.request, self.0.options).await + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Insert { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::list call. + #[derive(Clone, Debug)] + pub struct List(RequestBuilder); + + impl List { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).list(self.0.request, self.0.options).await + } + + /// Sets the value of `filter`. + pub fn set_filter>(mut self, v: T) -> Self { + self.0.request.filter = v.into(); + self + } + + /// Sets the value of `max_results`. + pub fn set_max_results>(mut self, v: T) -> Self { + self.0.request.max_results = v.into(); + self + } + + /// Sets the value of `page_token`. + pub fn set_page_token>(mut self, v: T) -> Self { + self.0.request.page_token = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for List { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::list_server_cas call. + #[derive(Clone, Debug)] + pub struct ListServerCas(RequestBuilder); + + impl ListServerCas { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).list_server_cas(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for ListServerCas { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::patch call. + #[derive(Clone, Debug)] + pub struct Patch(RequestBuilder); + + impl Patch { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).patch(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Patch { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::promote_replica call. + #[derive(Clone, Debug)] + pub struct PromoteReplica(RequestBuilder); + + impl PromoteReplica { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).promote_replica(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `failover`. + pub fn set_failover>(mut self, v: T) -> Self { + self.0.request.failover = v.into(); + self + } + } + + impl gax::options::RequestBuilder for PromoteReplica { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::switchover call. + #[derive(Clone, Debug)] + pub struct Switchover(RequestBuilder); + + impl Switchover { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).switchover(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `db_timeout`. + pub fn set_db_timeout>>(mut self, v: T) -> Self { + self.0.request.db_timeout = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Switchover { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::reset_ssl_config call. + #[derive(Clone, Debug)] + pub struct ResetSslConfig(RequestBuilder); + + impl ResetSslConfig { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).reset_ssl_config(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for ResetSslConfig { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::restart call. + #[derive(Clone, Debug)] + pub struct Restart(RequestBuilder); + + impl Restart { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).restart(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Restart { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::restore_backup call. + #[derive(Clone, Debug)] + pub struct RestoreBackup(RequestBuilder); + + impl RestoreBackup { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).restore_backup(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for RestoreBackup { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::rotate_server_ca call. + #[derive(Clone, Debug)] + pub struct RotateServerCa(RequestBuilder); + + impl RotateServerCa { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).rotate_server_ca(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for RotateServerCa { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::start_replica call. + #[derive(Clone, Debug)] + pub struct StartReplica(RequestBuilder); + + impl StartReplica { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).start_replica(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for StartReplica { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::stop_replica call. + #[derive(Clone, Debug)] + pub struct StopReplica(RequestBuilder); + + impl StopReplica { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).stop_replica(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for StopReplica { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::truncate_log call. + #[derive(Clone, Debug)] + pub struct TruncateLog(RequestBuilder); + + impl TruncateLog { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).truncate_log(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for TruncateLog { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::update call. + #[derive(Clone, Debug)] + pub struct Update(RequestBuilder); + + impl Update { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).update(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Update { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::create_ephemeral call. + #[derive(Clone, Debug)] + pub struct CreateEphemeral(RequestBuilder); + + impl CreateEphemeral { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).create_ephemeral(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for CreateEphemeral { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::reschedule_maintenance call. + #[derive(Clone, Debug)] + pub struct RescheduleMaintenance(RequestBuilder); + + impl RescheduleMaintenance { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).reschedule_maintenance(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for RescheduleMaintenance { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::verify_external_sync_settings call. + #[derive(Clone, Debug)] + pub struct VerifyExternalSyncSettings(RequestBuilder); + + impl VerifyExternalSyncSettings { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).verify_external_sync_settings(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `verify_connection_only`. + pub fn set_verify_connection_only>(mut self, v: T) -> Self { + self.0.request.verify_connection_only = v.into(); + self + } + + /// Sets the value of `sync_mode`. + pub fn set_sync_mode>(mut self, v: T) -> Self { + self.0.request.sync_mode = v.into(); + self + } + + /// Sets the value of `verify_replication_only`. + pub fn set_verify_replication_only>(mut self, v: T) -> Self { + self.0.request.verify_replication_only = v.into(); + self + } + + /// Sets the value of `migration_type`. + pub fn set_migration_type>(mut self, v: T) -> Self { + self.0.request.migration_type = v.into(); + self + } + + /// Sets the value of `sync_parallel_level`. + pub fn set_sync_parallel_level>(mut self, v: T) -> Self { + self.0.request.sync_parallel_level = v.into(); + self + } + + /// Sets the value of `sync_config`. + pub fn set_sync_config>>(mut self, v: T) ->Self { + self.0.request.sync_config = v.into(); + self + } + } + + impl gax::options::RequestBuilder for VerifyExternalSyncSettings { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::start_external_sync call. + #[derive(Clone, Debug)] + pub struct StartExternalSync(RequestBuilder); + + impl StartExternalSync { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).start_external_sync(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `sync_mode`. + pub fn set_sync_mode>(mut self, v: T) -> Self { + self.0.request.sync_mode = v.into(); + self + } + + /// Sets the value of `skip_verification`. + pub fn set_skip_verification>(mut self, v: T) -> Self { + self.0.request.skip_verification = v.into(); + self + } + + /// Sets the value of `sync_parallel_level`. + pub fn set_sync_parallel_level>(mut self, v: T) -> Self { + self.0.request.sync_parallel_level = v.into(); + self + } + + /// Sets the value of `migration_type`. + pub fn set_migration_type>(mut self, v: T) -> Self { + self.0.request.migration_type = v.into(); + self + } + + /// Sets the value of `sync_config`. + pub fn set_sync_config>>(mut self, v: T) ->Self { + self.0.request.sync_config = v.into(); + self + } + } + + impl gax::options::RequestBuilder for StartExternalSync { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::perform_disk_shrink call. + #[derive(Clone, Debug)] + pub struct PerformDiskShrink(RequestBuilder); + + impl PerformDiskShrink { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).perform_disk_shrink(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for PerformDiskShrink { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::get_disk_shrink_config call. + #[derive(Clone, Debug)] + pub struct GetDiskShrinkConfig(RequestBuilder); + + impl GetDiskShrinkConfig { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).get_disk_shrink_config(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for GetDiskShrinkConfig { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::reset_replica_size call. + #[derive(Clone, Debug)] + pub struct ResetReplicaSize(RequestBuilder); + + impl ResetReplicaSize { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).reset_replica_size(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for ResetReplicaSize { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::get_latest_recovery_time call. + #[derive(Clone, Debug)] + pub struct GetLatestRecoveryTime(RequestBuilder); + + impl GetLatestRecoveryTime { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).get_latest_recovery_time(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for GetLatestRecoveryTime { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::acquire_ssrs_lease call. + #[derive(Clone, Debug)] + pub struct AcquireSsrsLease(RequestBuilder); + + impl AcquireSsrsLease { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).acquire_ssrs_lease(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for AcquireSsrsLease { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlInstancesService::release_ssrs_lease call. + #[derive(Clone, Debug)] + pub struct ReleaseSsrsLease(RequestBuilder); + + impl ReleaseSsrsLease { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).release_ssrs_lease(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for ReleaseSsrsLease { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + +} + +pub mod sql_operations_service { + use crate::Result; + use std::sync::Arc; + + /// Common implementation for [crate::client::SqlOperationsService] request builders. + #[derive(Clone, Debug)] + pub struct RequestBuilder { + stub: Arc, + request: R, + options: gax::options::RequestOptions, + } + + impl RequestBuilder + where R: std::default::Default { + pub(crate) fn new(stub: Arc) -> Self { + Self { + stub, + request: R::default(), + options: gax::options::RequestOptions::default(), + } + } + } + + /// The request builder for a SqlOperationsService::get call. + #[derive(Clone, Debug)] + pub struct Get(RequestBuilder); + + impl Get { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).get(self.0.request, self.0.options).await + } + + /// Sets the value of `operation`. + pub fn set_operation>(mut self, v: T) -> Self { + self.0.request.operation = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Get { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlOperationsService::list call. + #[derive(Clone, Debug)] + pub struct List(RequestBuilder); + + impl List { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).list(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `max_results`. + pub fn set_max_results>(mut self, v: T) -> Self { + self.0.request.max_results = v.into(); + self + } + + /// Sets the value of `page_token`. + pub fn set_page_token>(mut self, v: T) -> Self { + self.0.request.page_token = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for List { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlOperationsService::cancel call. + #[derive(Clone, Debug)] + pub struct Cancel(RequestBuilder); + + impl Cancel { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).cancel(self.0.request, self.0.options).await + } + + /// Sets the value of `operation`. + pub fn set_operation>(mut self, v: T) -> Self { + self.0.request.operation = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Cancel { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + +} + +pub mod sql_ssl_certs_service { + use crate::Result; + use std::sync::Arc; + + /// Common implementation for [crate::client::SqlSslCertsService] request builders. + #[derive(Clone, Debug)] + pub struct RequestBuilder { + stub: Arc, + request: R, + options: gax::options::RequestOptions, + } + + impl RequestBuilder + where R: std::default::Default { + pub(crate) fn new(stub: Arc) -> Self { + Self { + stub, + request: R::default(), + options: gax::options::RequestOptions::default(), + } + } + } + + /// The request builder for a SqlSslCertsService::delete call. + #[derive(Clone, Debug)] + pub struct Delete(RequestBuilder); + + impl Delete { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).delete(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `sha1_fingerprint`. + pub fn set_sha1_fingerprint>(mut self, v: T) -> Self { + self.0.request.sha1_fingerprint = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Delete { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlSslCertsService::get call. + #[derive(Clone, Debug)] + pub struct Get(RequestBuilder); + + impl Get { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).get(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `sha1_fingerprint`. + pub fn set_sha1_fingerprint>(mut self, v: T) -> Self { + self.0.request.sha1_fingerprint = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Get { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlSslCertsService::insert call. + #[derive(Clone, Debug)] + pub struct Insert(RequestBuilder); + + impl Insert { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).insert(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Insert { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlSslCertsService::list call. + #[derive(Clone, Debug)] + pub struct List(RequestBuilder); + + impl List { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).list(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for List { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + +} + +pub mod sql_tiers_service { + use crate::Result; + use std::sync::Arc; + + /// Common implementation for [crate::client::SqlTiersService] request builders. + #[derive(Clone, Debug)] + pub struct RequestBuilder { + stub: Arc, + request: R, + options: gax::options::RequestOptions, + } + + impl RequestBuilder + where R: std::default::Default { + pub(crate) fn new(stub: Arc) -> Self { + Self { + stub, + request: R::default(), + options: gax::options::RequestOptions::default(), + } + } + } + + /// The request builder for a SqlTiersService::list call. + #[derive(Clone, Debug)] + pub struct List(RequestBuilder); + + impl List { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).list(self.0.request, self.0.options).await + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for List { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + +} + +pub mod sql_users_service { + use crate::Result; + use std::sync::Arc; + + /// Common implementation for [crate::client::SqlUsersService] request builders. + #[derive(Clone, Debug)] + pub struct RequestBuilder { + stub: Arc, + request: R, + options: gax::options::RequestOptions, + } + + impl RequestBuilder + where R: std::default::Default { + pub(crate) fn new(stub: Arc) -> Self { + Self { + stub, + request: R::default(), + options: gax::options::RequestOptions::default(), + } + } + } + + /// The request builder for a SqlUsersService::delete call. + #[derive(Clone, Debug)] + pub struct Delete(RequestBuilder); + + impl Delete { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).delete(self.0.request, self.0.options).await + } + + /// Sets the value of `host`. + pub fn set_host>(mut self, v: T) -> Self { + self.0.request.host = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.0.request.name = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Delete { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlUsersService::get call. + #[derive(Clone, Debug)] + pub struct Get(RequestBuilder); + + impl Get { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).get(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.0.request.name = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `host`. + pub fn set_host>(mut self, v: T) -> Self { + self.0.request.host = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Get { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlUsersService::insert call. + #[derive(Clone, Debug)] + pub struct Insert(RequestBuilder); + + impl Insert { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).insert(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Insert { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlUsersService::list call. + #[derive(Clone, Debug)] + pub struct List(RequestBuilder); + + impl List { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).list(self.0.request, self.0.options).await + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + } + + impl gax::options::RequestBuilder for List { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + + /// The request builder for a SqlUsersService::update call. + #[derive(Clone, Debug)] + pub struct Update(RequestBuilder); + + impl Update { + pub(crate) fn new(stub: Arc) -> Self { + Self( + RequestBuilder::new(stub) + ) + } + + /// Sets the full request, replacing any prior values. + pub fn with_request>(mut self, v: V) -> Self { + self.0.request = v.into(); + self + } + + /// Sets all the options, replacing any prior values. + pub fn with_options>(mut self, v: V) -> Self { + self.0.options = v.into(); + self + } + + /// Sends the request. + pub async fn send(self) -> Result { + (*self.0.stub).update(self.0.request, self.0.options).await + } + + /// Sets the value of `host`. + pub fn set_host>(mut self, v: T) -> Self { + self.0.request.host = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.0.request.instance = v.into(); + self + } + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.0.request.name = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.0.request.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.0.request.body = v.into(); + self + } + } + + impl gax::options::RequestBuilder for Update { + fn request_options(&mut self) -> &mut gax::options::RequestOptions { + &mut self.0.options + } + } + +} diff --git a/src/generated/cloud/sql/v1/src/client.rs b/src/generated/cloud/sql/v1/src/client.rs new file mode 100755 index 000000000..583ce7f9f --- /dev/null +++ b/src/generated/cloud/sql/v1/src/client.rs @@ -0,0 +1,1285 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by sidekick. DO NOT EDIT. + +use crate::Result; +use std::sync::Arc; + +/// An implementation of [crate::traits::SqlBackupRunsService] to make requests with. +/// +/// `SqlBackupRunsService` has various configuration parameters, but the defaults +/// are set to work with most applications. +/// +/// `SqlBackupRunsService` holds a connection pool internally, it is advised to +/// create one and the reuse it. You do not need to wrap `SqlBackupRunsService` in +/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc` +/// internally. +/// +/// Service for managing database backups. +#[derive(Clone, Debug)] +pub struct SqlBackupRunsService { + inner: Arc, +} + +impl SqlBackupRunsService { + /// Creates a new client with the default configuration. + pub async fn new() -> Result { + Self::new_with_config(gax::options::ClientConfig::default()).await + } + + /// Creates a new client with the specified configuration. + pub async fn new_with_config(conf: gax::options::ClientConfig) -> Result { + let inner = Self::build_inner(conf).await?; + Ok(Self { inner }) + } + + /// Creates a new client from the provided stub. + /// + /// The most common case for calling this function is when mocking the + /// client. + pub fn from_stub(stub: T) -> Self + where T: crate::traits::SqlBackupRunsService + 'static { + Self { inner: Arc::new(stub) } + } + + async fn build_inner(conf: gax::options::ClientConfig) -> Result> { + if conf.tracing_enabled() { + return Ok(Arc::new(Self::build_with_tracing(conf).await?)); + } + Ok(Arc::new(Self::build_transport(conf).await?)) + } + + async fn build_transport(conf: gax::options::ClientConfig) -> Result { + crate::transport::SqlBackupRunsService::new(conf).await + } + + async fn build_with_tracing(conf: gax::options::ClientConfig) -> Result { + Self::build_transport(conf).await.map(crate::tracing::SqlBackupRunsService::new) + } + + /// Deletes the backup taken by a backup run. + pub fn delete( + &self, + project: impl Into, + instance: impl Into, + id: impl Into, + ) -> crate::builders::sql_backup_runs_service::Delete + { + crate::builders::sql_backup_runs_service::Delete::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + .set_id ( id.into() ) + } + + /// Retrieves a resource containing information about a backup run. + pub fn get( + &self, + project: impl Into, + instance: impl Into, + id: impl Into, + ) -> crate::builders::sql_backup_runs_service::Get + { + crate::builders::sql_backup_runs_service::Get::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + .set_id ( id.into() ) + } + + /// Creates a new backup run on demand. + pub fn insert( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_backup_runs_service::Insert + { + crate::builders::sql_backup_runs_service::Insert::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Lists all backup runs associated with the project or a given instance + /// and configuration in the reverse chronological order of the backup + /// initiation time. + pub fn list( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_backup_runs_service::List + { + crate::builders::sql_backup_runs_service::List::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + +} + +/// An implementation of [crate::traits::SqlConnectService] to make requests with. +/// +/// `SqlConnectService` has various configuration parameters, but the defaults +/// are set to work with most applications. +/// +/// `SqlConnectService` holds a connection pool internally, it is advised to +/// create one and the reuse it. You do not need to wrap `SqlConnectService` in +/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc` +/// internally. +/// +/// Cloud SQL connect service. +#[derive(Clone, Debug)] +pub struct SqlConnectService { + inner: Arc, +} + +impl SqlConnectService { + /// Creates a new client with the default configuration. + pub async fn new() -> Result { + Self::new_with_config(gax::options::ClientConfig::default()).await + } + + /// Creates a new client with the specified configuration. + pub async fn new_with_config(conf: gax::options::ClientConfig) -> Result { + let inner = Self::build_inner(conf).await?; + Ok(Self { inner }) + } + + /// Creates a new client from the provided stub. + /// + /// The most common case for calling this function is when mocking the + /// client. + pub fn from_stub(stub: T) -> Self + where T: crate::traits::SqlConnectService + 'static { + Self { inner: Arc::new(stub) } + } + + async fn build_inner(conf: gax::options::ClientConfig) -> Result> { + if conf.tracing_enabled() { + return Ok(Arc::new(Self::build_with_tracing(conf).await?)); + } + Ok(Arc::new(Self::build_transport(conf).await?)) + } + + async fn build_transport(conf: gax::options::ClientConfig) -> Result { + crate::transport::SqlConnectService::new(conf).await + } + + async fn build_with_tracing(conf: gax::options::ClientConfig) -> Result { + Self::build_transport(conf).await.map(crate::tracing::SqlConnectService::new) + } + + /// Retrieves connect settings about a Cloud SQL instance. + pub fn get_connect_settings( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_connect_service::GetConnectSettings + { + crate::builders::sql_connect_service::GetConnectSettings::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Generates a short-lived X509 certificate containing the provided public key + /// and signed by a private key specific to the target instance. Users may use + /// the certificate to authenticate as themselves when connecting to the + /// database. + pub fn generate_ephemeral_cert( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_connect_service::GenerateEphemeralCert + { + crate::builders::sql_connect_service::GenerateEphemeralCert::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + +} + +/// An implementation of [crate::traits::SqlDatabasesService] to make requests with. +/// +/// `SqlDatabasesService` has various configuration parameters, but the defaults +/// are set to work with most applications. +/// +/// `SqlDatabasesService` holds a connection pool internally, it is advised to +/// create one and the reuse it. You do not need to wrap `SqlDatabasesService` in +/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc` +/// internally. +/// +/// Service to manage databases. +#[derive(Clone, Debug)] +pub struct SqlDatabasesService { + inner: Arc, +} + +impl SqlDatabasesService { + /// Creates a new client with the default configuration. + pub async fn new() -> Result { + Self::new_with_config(gax::options::ClientConfig::default()).await + } + + /// Creates a new client with the specified configuration. + pub async fn new_with_config(conf: gax::options::ClientConfig) -> Result { + let inner = Self::build_inner(conf).await?; + Ok(Self { inner }) + } + + /// Creates a new client from the provided stub. + /// + /// The most common case for calling this function is when mocking the + /// client. + pub fn from_stub(stub: T) -> Self + where T: crate::traits::SqlDatabasesService + 'static { + Self { inner: Arc::new(stub) } + } + + async fn build_inner(conf: gax::options::ClientConfig) -> Result> { + if conf.tracing_enabled() { + return Ok(Arc::new(Self::build_with_tracing(conf).await?)); + } + Ok(Arc::new(Self::build_transport(conf).await?)) + } + + async fn build_transport(conf: gax::options::ClientConfig) -> Result { + crate::transport::SqlDatabasesService::new(conf).await + } + + async fn build_with_tracing(conf: gax::options::ClientConfig) -> Result { + Self::build_transport(conf).await.map(crate::tracing::SqlDatabasesService::new) + } + + /// Deletes a database from a Cloud SQL instance. + pub fn delete( + &self, + project: impl Into, + instance: impl Into, + database: impl Into, + ) -> crate::builders::sql_databases_service::Delete + { + crate::builders::sql_databases_service::Delete::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + .set_database ( database.into() ) + } + + /// Retrieves a resource containing information about a database inside a Cloud + /// SQL instance. + pub fn get( + &self, + project: impl Into, + instance: impl Into, + database: impl Into, + ) -> crate::builders::sql_databases_service::Get + { + crate::builders::sql_databases_service::Get::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + .set_database ( database.into() ) + } + + /// Inserts a resource containing information about a database inside a Cloud + /// SQL instance. + /// + /// **Note:** You can't modify the default character set and collation. + pub fn insert( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_databases_service::Insert + { + crate::builders::sql_databases_service::Insert::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Lists databases in the specified Cloud SQL instance. + pub fn list( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_databases_service::List + { + crate::builders::sql_databases_service::List::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Partially updates a resource containing information about a database inside + /// a Cloud SQL instance. This method supports patch semantics. + pub fn patch( + &self, + project: impl Into, + instance: impl Into, + database: impl Into, + ) -> crate::builders::sql_databases_service::Patch + { + crate::builders::sql_databases_service::Patch::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + .set_database ( database.into() ) + } + + /// Updates a resource containing information about a database inside a Cloud + /// SQL instance. + pub fn update( + &self, + project: impl Into, + instance: impl Into, + database: impl Into, + ) -> crate::builders::sql_databases_service::Update + { + crate::builders::sql_databases_service::Update::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + .set_database ( database.into() ) + } + +} + +/// An implementation of [crate::traits::SqlFlagsService] to make requests with. +/// +/// `SqlFlagsService` has various configuration parameters, but the defaults +/// are set to work with most applications. +/// +/// `SqlFlagsService` holds a connection pool internally, it is advised to +/// create one and the reuse it. You do not need to wrap `SqlFlagsService` in +/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc` +/// internally. +/// +/// Service to manage database flags for Cloud SQL instances. +#[derive(Clone, Debug)] +pub struct SqlFlagsService { + inner: Arc, +} + +impl SqlFlagsService { + /// Creates a new client with the default configuration. + pub async fn new() -> Result { + Self::new_with_config(gax::options::ClientConfig::default()).await + } + + /// Creates a new client with the specified configuration. + pub async fn new_with_config(conf: gax::options::ClientConfig) -> Result { + let inner = Self::build_inner(conf).await?; + Ok(Self { inner }) + } + + /// Creates a new client from the provided stub. + /// + /// The most common case for calling this function is when mocking the + /// client. + pub fn from_stub(stub: T) -> Self + where T: crate::traits::SqlFlagsService + 'static { + Self { inner: Arc::new(stub) } + } + + async fn build_inner(conf: gax::options::ClientConfig) -> Result> { + if conf.tracing_enabled() { + return Ok(Arc::new(Self::build_with_tracing(conf).await?)); + } + Ok(Arc::new(Self::build_transport(conf).await?)) + } + + async fn build_transport(conf: gax::options::ClientConfig) -> Result { + crate::transport::SqlFlagsService::new(conf).await + } + + async fn build_with_tracing(conf: gax::options::ClientConfig) -> Result { + Self::build_transport(conf).await.map(crate::tracing::SqlFlagsService::new) + } + + /// Lists all available database flags for Cloud SQL instances. + pub fn list( + &self, + ) -> crate::builders::sql_flags_service::List + { + crate::builders::sql_flags_service::List::new(self.inner.clone()) + } + +} + +/// An implementation of [crate::traits::SqlInstancesService] to make requests with. +/// +/// `SqlInstancesService` has various configuration parameters, but the defaults +/// are set to work with most applications. +/// +/// `SqlInstancesService` holds a connection pool internally, it is advised to +/// create one and the reuse it. You do not need to wrap `SqlInstancesService` in +/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc` +/// internally. +/// +/// Service to manage Cloud SQL instances. +#[derive(Clone, Debug)] +pub struct SqlInstancesService { + inner: Arc, +} + +impl SqlInstancesService { + /// Creates a new client with the default configuration. + pub async fn new() -> Result { + Self::new_with_config(gax::options::ClientConfig::default()).await + } + + /// Creates a new client with the specified configuration. + pub async fn new_with_config(conf: gax::options::ClientConfig) -> Result { + let inner = Self::build_inner(conf).await?; + Ok(Self { inner }) + } + + /// Creates a new client from the provided stub. + /// + /// The most common case for calling this function is when mocking the + /// client. + pub fn from_stub(stub: T) -> Self + where T: crate::traits::SqlInstancesService + 'static { + Self { inner: Arc::new(stub) } + } + + async fn build_inner(conf: gax::options::ClientConfig) -> Result> { + if conf.tracing_enabled() { + return Ok(Arc::new(Self::build_with_tracing(conf).await?)); + } + Ok(Arc::new(Self::build_transport(conf).await?)) + } + + async fn build_transport(conf: gax::options::ClientConfig) -> Result { + crate::transport::SqlInstancesService::new(conf).await + } + + async fn build_with_tracing(conf: gax::options::ClientConfig) -> Result { + Self::build_transport(conf).await.map(crate::tracing::SqlInstancesService::new) + } + + /// Adds a new trusted Certificate Authority (CA) version for the specified + /// instance. Required to prepare for a certificate rotation. If a CA version + /// was previously added but never used in a certificate rotation, this + /// operation replaces that version. There cannot be more than one CA version + /// waiting to be rotated in. For instances that have enabled Certificate + /// Authority Service (CAS) based server CA, please use AddServerCertificate to + /// add a new server certificate. + pub fn add_server_ca( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::AddServerCa + { + crate::builders::sql_instances_service::AddServerCa::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Creates a Cloud SQL instance as a clone of the source instance. Using this + /// operation might cause your instance to restart. + pub fn clone( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::Clone + { + crate::builders::sql_instances_service::Clone::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Deletes a Cloud SQL instance. + pub fn delete( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::Delete + { + crate::builders::sql_instances_service::Delete::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Demotes the stand-alone instance to be a Cloud SQL read replica for an + /// external database server. + pub fn demote_master( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::DemoteMaster + { + crate::builders::sql_instances_service::DemoteMaster::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Demotes an existing standalone instance to be a Cloud SQL read replica + /// for an external database server. + pub fn demote( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::Demote + { + crate::builders::sql_instances_service::Demote::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL + /// dump or CSV file. + pub fn export( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::Export + { + crate::builders::sql_instances_service::Export::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Initiates a manual failover of a high availability (HA) primary instance + /// to a standby instance, which becomes the primary instance. Users are + /// then rerouted to the new primary. For more information, see the + /// [Overview of high + /// availability](https://cloud.google.com/sql/docs/mysql/high-availability) + /// page in the Cloud SQL documentation. + /// If using Legacy HA (MySQL only), this causes the instance to failover to + /// its failover replica instance. + pub fn failover( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::Failover + { + crate::builders::sql_instances_service::Failover::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Reencrypt CMEK instance with latest key version. + pub fn reencrypt( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::Reencrypt + { + crate::builders::sql_instances_service::Reencrypt::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Retrieves a resource containing information about a Cloud SQL instance. + pub fn get( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::Get + { + crate::builders::sql_instances_service::Get::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Imports data into a Cloud SQL instance from a SQL dump or CSV file in + /// Cloud Storage. + pub fn import( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::Import + { + crate::builders::sql_instances_service::Import::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Creates a new Cloud SQL instance. + pub fn insert( + &self, + project: impl Into, + ) -> crate::builders::sql_instances_service::Insert + { + crate::builders::sql_instances_service::Insert::new(self.inner.clone()) + .set_project ( project.into() ) + } + + /// Lists instances under a given project. + pub fn list( + &self, + project: impl Into, + ) -> crate::builders::sql_instances_service::List + { + crate::builders::sql_instances_service::List::new(self.inner.clone()) + .set_project ( project.into() ) + } + + /// Lists all of the trusted Certificate Authorities (CAs) for the specified + /// instance. There can be up to three CAs listed: the CA that was used to sign + /// the certificate that is currently in use, a CA that has been added but not + /// yet used to sign a certificate, and a CA used to sign a certificate that + /// has previously rotated out. + pub fn list_server_cas( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::ListServerCas + { + crate::builders::sql_instances_service::ListServerCas::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Partially updates settings of a Cloud SQL instance by merging the request + /// with the current configuration. This method supports patch semantics. + pub fn patch( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::Patch + { + crate::builders::sql_instances_service::Patch::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Promotes the read replica instance to be an independent Cloud SQL + /// primary instance. + /// Using this operation might cause your instance to restart. + pub fn promote_replica( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::PromoteReplica + { + crate::builders::sql_instances_service::PromoteReplica::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Switches over from the primary instance to the designated DR replica + /// instance. + pub fn switchover( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::Switchover + { + crate::builders::sql_instances_service::Switchover::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Deletes all client certificates and generates a new server SSL certificate + /// for the instance. + pub fn reset_ssl_config( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::ResetSslConfig + { + crate::builders::sql_instances_service::ResetSslConfig::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Restarts a Cloud SQL instance. + pub fn restart( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::Restart + { + crate::builders::sql_instances_service::Restart::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Restores a backup of a Cloud SQL instance. Using this operation might cause + /// your instance to restart. + pub fn restore_backup( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::RestoreBackup + { + crate::builders::sql_instances_service::RestoreBackup::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Rotates the server certificate to one signed by the Certificate Authority + /// (CA) version previously added with the addServerCA method. For instances + /// that have enabled Certificate Authority Service (CAS) based server CA, + /// please use RotateServerCertificate to rotate the server certificate. + pub fn rotate_server_ca( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::RotateServerCa + { + crate::builders::sql_instances_service::RotateServerCa::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Starts the replication in the read replica instance. + pub fn start_replica( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::StartReplica + { + crate::builders::sql_instances_service::StartReplica::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Stops the replication in the read replica instance. + pub fn stop_replica( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::StopReplica + { + crate::builders::sql_instances_service::StopReplica::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Truncate MySQL general and slow query log tables + /// MySQL only. + pub fn truncate_log( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::TruncateLog + { + crate::builders::sql_instances_service::TruncateLog::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Updates settings of a Cloud SQL instance. Using this operation might cause + /// your instance to restart. + pub fn update( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::Update + { + crate::builders::sql_instances_service::Update::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Generates a short-lived X509 certificate containing the provided public key + /// and signed by a private key specific to the target instance. Users may use + /// the certificate to authenticate as themselves when connecting to the + /// database. + pub fn create_ephemeral( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::CreateEphemeral + { + crate::builders::sql_instances_service::CreateEphemeral::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Reschedules the maintenance on the given instance. + pub fn reschedule_maintenance( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::RescheduleMaintenance + { + crate::builders::sql_instances_service::RescheduleMaintenance::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Verify External primary instance external sync settings. + pub fn verify_external_sync_settings( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::VerifyExternalSyncSettings + { + crate::builders::sql_instances_service::VerifyExternalSyncSettings::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Start External primary instance migration. + pub fn start_external_sync( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::StartExternalSync + { + crate::builders::sql_instances_service::StartExternalSync::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Perform Disk Shrink on primary instance. + pub fn perform_disk_shrink( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::PerformDiskShrink + { + crate::builders::sql_instances_service::PerformDiskShrink::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Get Disk Shrink Config for a given instance. + pub fn get_disk_shrink_config( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::GetDiskShrinkConfig + { + crate::builders::sql_instances_service::GetDiskShrinkConfig::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Reset Replica Size to primary instance disk size. + pub fn reset_replica_size( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::ResetReplicaSize + { + crate::builders::sql_instances_service::ResetReplicaSize::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Get Latest Recovery Time for a given instance. + pub fn get_latest_recovery_time( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::GetLatestRecoveryTime + { + crate::builders::sql_instances_service::GetLatestRecoveryTime::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + pub fn acquire_ssrs_lease( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::AcquireSsrsLease + { + crate::builders::sql_instances_service::AcquireSsrsLease::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Release a lease for the setup of SQL Server Reporting Services (SSRS). + pub fn release_ssrs_lease( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_instances_service::ReleaseSsrsLease + { + crate::builders::sql_instances_service::ReleaseSsrsLease::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + +} + +/// An implementation of [crate::traits::SqlOperationsService] to make requests with. +/// +/// `SqlOperationsService` has various configuration parameters, but the defaults +/// are set to work with most applications. +/// +/// `SqlOperationsService` holds a connection pool internally, it is advised to +/// create one and the reuse it. You do not need to wrap `SqlOperationsService` in +/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc` +/// internally. +/// +/// Service to fetch operations for database instances. +#[derive(Clone, Debug)] +pub struct SqlOperationsService { + inner: Arc, +} + +impl SqlOperationsService { + /// Creates a new client with the default configuration. + pub async fn new() -> Result { + Self::new_with_config(gax::options::ClientConfig::default()).await + } + + /// Creates a new client with the specified configuration. + pub async fn new_with_config(conf: gax::options::ClientConfig) -> Result { + let inner = Self::build_inner(conf).await?; + Ok(Self { inner }) + } + + /// Creates a new client from the provided stub. + /// + /// The most common case for calling this function is when mocking the + /// client. + pub fn from_stub(stub: T) -> Self + where T: crate::traits::SqlOperationsService + 'static { + Self { inner: Arc::new(stub) } + } + + async fn build_inner(conf: gax::options::ClientConfig) -> Result> { + if conf.tracing_enabled() { + return Ok(Arc::new(Self::build_with_tracing(conf).await?)); + } + Ok(Arc::new(Self::build_transport(conf).await?)) + } + + async fn build_transport(conf: gax::options::ClientConfig) -> Result { + crate::transport::SqlOperationsService::new(conf).await + } + + async fn build_with_tracing(conf: gax::options::ClientConfig) -> Result { + Self::build_transport(conf).await.map(crate::tracing::SqlOperationsService::new) + } + + /// Retrieves an instance operation that has been performed on an instance. + pub fn get( + &self, + project: impl Into, + operation: impl Into, + ) -> crate::builders::sql_operations_service::Get + { + crate::builders::sql_operations_service::Get::new(self.inner.clone()) + .set_project ( project.into() ) + .set_operation ( operation.into() ) + } + + /// Lists all instance operations that have been performed on the given Cloud + /// SQL instance in the reverse chronological order of the start time. + pub fn list( + &self, + project: impl Into, + ) -> crate::builders::sql_operations_service::List + { + crate::builders::sql_operations_service::List::new(self.inner.clone()) + .set_project ( project.into() ) + } + + /// Cancels an instance operation that has been performed on an instance. + pub fn cancel( + &self, + project: impl Into, + operation: impl Into, + ) -> crate::builders::sql_operations_service::Cancel + { + crate::builders::sql_operations_service::Cancel::new(self.inner.clone()) + .set_project ( project.into() ) + .set_operation ( operation.into() ) + } + +} + +/// An implementation of [crate::traits::SqlSslCertsService] to make requests with. +/// +/// `SqlSslCertsService` has various configuration parameters, but the defaults +/// are set to work with most applications. +/// +/// `SqlSslCertsService` holds a connection pool internally, it is advised to +/// create one and the reuse it. You do not need to wrap `SqlSslCertsService` in +/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc` +/// internally. +/// +/// Service to manage SSL certs for Cloud SQL instances. +#[derive(Clone, Debug)] +pub struct SqlSslCertsService { + inner: Arc, +} + +impl SqlSslCertsService { + /// Creates a new client with the default configuration. + pub async fn new() -> Result { + Self::new_with_config(gax::options::ClientConfig::default()).await + } + + /// Creates a new client with the specified configuration. + pub async fn new_with_config(conf: gax::options::ClientConfig) -> Result { + let inner = Self::build_inner(conf).await?; + Ok(Self { inner }) + } + + /// Creates a new client from the provided stub. + /// + /// The most common case for calling this function is when mocking the + /// client. + pub fn from_stub(stub: T) -> Self + where T: crate::traits::SqlSslCertsService + 'static { + Self { inner: Arc::new(stub) } + } + + async fn build_inner(conf: gax::options::ClientConfig) -> Result> { + if conf.tracing_enabled() { + return Ok(Arc::new(Self::build_with_tracing(conf).await?)); + } + Ok(Arc::new(Self::build_transport(conf).await?)) + } + + async fn build_transport(conf: gax::options::ClientConfig) -> Result { + crate::transport::SqlSslCertsService::new(conf).await + } + + async fn build_with_tracing(conf: gax::options::ClientConfig) -> Result { + Self::build_transport(conf).await.map(crate::tracing::SqlSslCertsService::new) + } + + /// Deletes the SSL certificate. For First Generation instances, the + /// certificate remains valid until the instance is restarted. + pub fn delete( + &self, + project: impl Into, + instance: impl Into, + sha1_fingerprint: impl Into, + ) -> crate::builders::sql_ssl_certs_service::Delete + { + crate::builders::sql_ssl_certs_service::Delete::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + .set_sha1_fingerprint ( sha1_fingerprint.into() ) + } + + /// Retrieves a particular SSL certificate. Does not include the private key + /// (required for usage). The private key must be saved from the response to + /// initial creation. + pub fn get( + &self, + project: impl Into, + instance: impl Into, + sha1_fingerprint: impl Into, + ) -> crate::builders::sql_ssl_certs_service::Get + { + crate::builders::sql_ssl_certs_service::Get::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + .set_sha1_fingerprint ( sha1_fingerprint.into() ) + } + + /// Creates an SSL certificate and returns it along with the private key and + /// server certificate authority. The new certificate will not be usable until + /// the instance is restarted. + pub fn insert( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_ssl_certs_service::Insert + { + crate::builders::sql_ssl_certs_service::Insert::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Lists all of the current SSL certificates for the instance. + pub fn list( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_ssl_certs_service::List + { + crate::builders::sql_ssl_certs_service::List::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + +} + +/// An implementation of [crate::traits::SqlTiersService] to make requests with. +/// +/// `SqlTiersService` has various configuration parameters, but the defaults +/// are set to work with most applications. +/// +/// `SqlTiersService` holds a connection pool internally, it is advised to +/// create one and the reuse it. You do not need to wrap `SqlTiersService` in +/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc` +/// internally. +/// +/// Service for providing machine types (tiers) for Cloud SQL instances. +#[derive(Clone, Debug)] +pub struct SqlTiersService { + inner: Arc, +} + +impl SqlTiersService { + /// Creates a new client with the default configuration. + pub async fn new() -> Result { + Self::new_with_config(gax::options::ClientConfig::default()).await + } + + /// Creates a new client with the specified configuration. + pub async fn new_with_config(conf: gax::options::ClientConfig) -> Result { + let inner = Self::build_inner(conf).await?; + Ok(Self { inner }) + } + + /// Creates a new client from the provided stub. + /// + /// The most common case for calling this function is when mocking the + /// client. + pub fn from_stub(stub: T) -> Self + where T: crate::traits::SqlTiersService + 'static { + Self { inner: Arc::new(stub) } + } + + async fn build_inner(conf: gax::options::ClientConfig) -> Result> { + if conf.tracing_enabled() { + return Ok(Arc::new(Self::build_with_tracing(conf).await?)); + } + Ok(Arc::new(Self::build_transport(conf).await?)) + } + + async fn build_transport(conf: gax::options::ClientConfig) -> Result { + crate::transport::SqlTiersService::new(conf).await + } + + async fn build_with_tracing(conf: gax::options::ClientConfig) -> Result { + Self::build_transport(conf).await.map(crate::tracing::SqlTiersService::new) + } + + /// Lists all available machine types (tiers) for Cloud SQL, for example, + /// `db-custom-1-3840`. For more information, see + /// . + pub fn list( + &self, + project: impl Into, + ) -> crate::builders::sql_tiers_service::List + { + crate::builders::sql_tiers_service::List::new(self.inner.clone()) + .set_project ( project.into() ) + } + +} + +/// An implementation of [crate::traits::SqlUsersService] to make requests with. +/// +/// `SqlUsersService` has various configuration parameters, but the defaults +/// are set to work with most applications. +/// +/// `SqlUsersService` holds a connection pool internally, it is advised to +/// create one and the reuse it. You do not need to wrap `SqlUsersService` in +/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc` +/// internally. +/// +/// Cloud SQL users service. +#[derive(Clone, Debug)] +pub struct SqlUsersService { + inner: Arc, +} + +impl SqlUsersService { + /// Creates a new client with the default configuration. + pub async fn new() -> Result { + Self::new_with_config(gax::options::ClientConfig::default()).await + } + + /// Creates a new client with the specified configuration. + pub async fn new_with_config(conf: gax::options::ClientConfig) -> Result { + let inner = Self::build_inner(conf).await?; + Ok(Self { inner }) + } + + /// Creates a new client from the provided stub. + /// + /// The most common case for calling this function is when mocking the + /// client. + pub fn from_stub(stub: T) -> Self + where T: crate::traits::SqlUsersService + 'static { + Self { inner: Arc::new(stub) } + } + + async fn build_inner(conf: gax::options::ClientConfig) -> Result> { + if conf.tracing_enabled() { + return Ok(Arc::new(Self::build_with_tracing(conf).await?)); + } + Ok(Arc::new(Self::build_transport(conf).await?)) + } + + async fn build_transport(conf: gax::options::ClientConfig) -> Result { + crate::transport::SqlUsersService::new(conf).await + } + + async fn build_with_tracing(conf: gax::options::ClientConfig) -> Result { + Self::build_transport(conf).await.map(crate::tracing::SqlUsersService::new) + } + + /// Deletes a user from a Cloud SQL instance. + pub fn delete( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_users_service::Delete + { + crate::builders::sql_users_service::Delete::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Retrieves a resource containing information about a user. + pub fn get( + &self, + project: impl Into, + instance: impl Into, + name: impl Into, + ) -> crate::builders::sql_users_service::Get + { + crate::builders::sql_users_service::Get::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + .set_name ( name.into() ) + } + + /// Creates a new user in a Cloud SQL instance. + pub fn insert( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_users_service::Insert + { + crate::builders::sql_users_service::Insert::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Lists users in the specified Cloud SQL instance. + pub fn list( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_users_service::List + { + crate::builders::sql_users_service::List::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + + /// Updates an existing user in a Cloud SQL instance. + pub fn update( + &self, + project: impl Into, + instance: impl Into, + ) -> crate::builders::sql_users_service::Update + { + crate::builders::sql_users_service::Update::new(self.inner.clone()) + .set_project ( project.into() ) + .set_instance ( instance.into() ) + } + +} diff --git a/src/generated/cloud/sql/v1/src/lib.rs b/src/generated/cloud/sql/v1/src/lib.rs new file mode 100644 index 000000000..fdfab3b68 --- /dev/null +++ b/src/generated/cloud/sql/v1/src/lib.rs @@ -0,0 +1,77 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by sidekick. DO NOT EDIT. + +//! Google Cloud Client Libraries for Rust - Cloud SQL Admin API +//! +//! **WARNING:** this crate is under active development. We expect multiple +//! breaking changes in the upcoming releases. Testing is also incomplete, we do +//! **not** recommend that you use this crate in production. We welcome feedback +//! about the APIs, documentation, missing features, bugs, etc. +//! +//! This crate contains traits, types, and functions to interact with Cloud SQL Admin API +//! Most applications will use the structs defined in the [client] module. +//! More specifically: +//! +//! * [SqlBackupRunsService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlBackupRunsService.html) +//! * [SqlConnectService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlConnectService.html) +//! * [SqlDatabasesService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlDatabasesService.html) +//! * [SqlFlagsService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlFlagsService.html) +//! * [SqlInstancesService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlInstancesService.html) +//! * [SqlOperationsService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlOperationsService.html) +//! * [SqlSslCertsService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlSslCertsService.html) +//! * [SqlTiersService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlTiersService.html) +//! * [SqlUsersService](https://docs.rs/gcp-sdk-sql-v1/latest/gcp_sdk_sql_v1/client/struct.SqlUsersService.html) + +/// The messages and enums that are part of this client library. +pub mod model; + +pub(crate) use gax::Result; + +/// The traits implemented by this client library. +#[allow(rustdoc::invalid_html_tags)] +#[allow(rustdoc::redundant_explicit_links)] +pub mod traits; + +/// Concrete implementations of this client library traits. +pub mod client; + +/// Request builders. +pub mod builders; + +#[doc(hidden)] +pub(crate) mod tracing; + +#[doc(hidden)] +pub(crate) mod transport; + +/// The default host used by the service. +const DEFAULT_HOST: &str = "https://sqladmin.googleapis.com/"; + +pub(crate) mod info { + const NAME: &str = env!("CARGO_PKG_NAME"); + const VERSION: &str = env!("CARGO_PKG_VERSION"); + lazy_static::lazy_static! { + pub(crate) static ref X_GOOG_API_CLIENT_HEADER: String = { + let ac = gax::api_header::XGoogApiClient{ + name: NAME, + version: VERSION, + library_type: gax::api_header::GAPIC, + }; + ac.header_value() + }; + } +} + diff --git a/src/generated/cloud/sql/v1/src/model.rs b/src/generated/cloud/sql/v1/src/model.rs new file mode 100755 index 000000000..74f99cd47 --- /dev/null +++ b/src/generated/cloud/sql/v1/src/model.rs @@ -0,0 +1,11599 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by sidekick. DO NOT EDIT. + +#![allow(rustdoc::invalid_html_tags)] +#![allow(rustdoc::redundant_explicit_links)] +#![allow(rustdoc::broken_intra_doc_links)] +#![no_implicit_prelude] +extern crate std; +extern crate async_trait; +extern crate bytes; +extern crate gax; +extern crate lazy_static; +extern crate reqwest; +extern crate serde; +extern crate serde_json; +extern crate serde_with; +extern crate tracing; +extern crate wkt; + +/// Backup runs delete request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlBackupRunsDeleteRequest { + + /// The ID of the backup run to delete. To find a backup run ID, use the + /// [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1/backupRuns/list) + /// method. + #[serde_as(as = "serde_with::DisplayFromStr")] + pub id: i64, + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlBackupRunsDeleteRequest { + + /// Sets the value of `id`. + pub fn set_id>(mut self, v: T) -> Self { + self.id = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlBackupRunsDeleteRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlBackupRunsDeleteRequest" + } +} + +/// Backup runs get request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlBackupRunsGetRequest { + + /// The ID of this backup run. + #[serde_as(as = "serde_with::DisplayFromStr")] + pub id: i64, + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlBackupRunsGetRequest { + + /// Sets the value of `id`. + pub fn set_id>(mut self, v: T) -> Self { + self.id = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlBackupRunsGetRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlBackupRunsGetRequest" + } +} + +/// Backup runs insert request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlBackupRunsInsertRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlBackupRunsInsertRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlBackupRunsInsertRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlBackupRunsInsertRequest" + } +} + +/// Backup runs list request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlBackupRunsListRequest { + + /// Cloud SQL instance ID, or "-" for all instances. This does not include + /// the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Maximum number of backup runs per response. + pub max_results: i32, + + /// A previously-returned page token representing part of the larger set of + /// results to view. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub page_token: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlBackupRunsListRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `max_results`. + pub fn set_max_results>(mut self, v: T) -> Self { + self.max_results = v.into(); + self + } + + /// Sets the value of `page_token`. + pub fn set_page_token>(mut self, v: T) -> Self { + self.page_token = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlBackupRunsListRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlBackupRunsListRequest" + } +} + +/// A BackupRun resource. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct BackupRun { + + /// This is always `sql#backupRun`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The status of this run. + pub status: crate::model::SqlBackupRunStatus, + + /// The time the run was enqueued in UTC timezone in + /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + /// `2012-11-15T16:19:00.094Z`. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub enqueued_time: std::option::Option, + + /// The identifier for this backup run. Unique only for a specific Cloud SQL + /// instance. + #[serde_as(as = "serde_with::DisplayFromStr")] + pub id: i64, + + /// The time the backup operation actually started in UTC timezone in + /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + /// `2012-11-15T16:19:00.094Z`. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub start_time: std::option::Option, + + /// The time the backup operation completed in UTC timezone in + /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + /// `2012-11-15T16:19:00.094Z`. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub end_time: std::option::Option, + + /// Information about why the backup operation failed. This is only present if + /// the run has the FAILED status. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub error: std::option::Option, + + /// The type of this run; can be either "AUTOMATED" or "ON_DEMAND" or "FINAL". + /// This field defaults to "ON_DEMAND" and is ignored, when specified for + /// insert requests. + #[serde(rename = "type")] + pub r#type: crate::model::SqlBackupRunType, + + /// The description of this run, only applicable to on-demand backups. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub description: std::string::String, + + /// The start time of the backup window during which this the backup was + /// attempted in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for + /// example `2012-11-15T16:19:00.094Z`. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub window_start_time: std::option::Option, + + /// Name of the database instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// The URI of this resource. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub self_link: std::string::String, + + /// Location of the backups. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub location: std::string::String, + + /// Encryption configuration specific to a backup. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub disk_encryption_configuration: std::option::Option, + + /// Encryption status specific to a backup. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub disk_encryption_status: std::option::Option, + + /// Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT. + pub backup_kind: crate::model::SqlBackupKind, + + /// Backup time zone to prevent restores to an instance with + /// a different time zone. Now relevant only for SQL Server. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub time_zone: std::string::String, + + /// Output only. The maximum chargeable bytes for the backup. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde_as(as = "std::option::Option")] + pub max_chargeable_bytes: std::option::Option, +} + +impl BackupRun { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `status`. + pub fn set_status>(mut self, v: T) -> Self { + self.status = v.into(); + self + } + + /// Sets the value of `enqueued_time`. + pub fn set_enqueued_time>>(mut self, v: T) -> Self { + self.enqueued_time = v.into(); + self + } + + /// Sets the value of `id`. + pub fn set_id>(mut self, v: T) -> Self { + self.id = v.into(); + self + } + + /// Sets the value of `start_time`. + pub fn set_start_time>>(mut self, v: T) -> Self { + self.start_time = v.into(); + self + } + + /// Sets the value of `end_time`. + pub fn set_end_time>>(mut self, v: T) -> Self { + self.end_time = v.into(); + self + } + + /// Sets the value of `error`. + pub fn set_error>>(mut self, v: T) -> Self { + self.error = v.into(); + self + } + + /// Sets the value of `r#type`. + pub fn set_type>(mut self, v: T) -> Self { + self.r#type = v.into(); + self + } + + /// Sets the value of `description`. + pub fn set_description>(mut self, v: T) -> Self { + self.description = v.into(); + self + } + + /// Sets the value of `window_start_time`. + pub fn set_window_start_time>>(mut self, v: T) -> Self { + self.window_start_time = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `self_link`. + pub fn set_self_link>(mut self, v: T) -> Self { + self.self_link = v.into(); + self + } + + /// Sets the value of `location`. + pub fn set_location>(mut self, v: T) -> Self { + self.location = v.into(); + self + } + + /// Sets the value of `disk_encryption_configuration`. + pub fn set_disk_encryption_configuration>>(mut self, v: T) -> Self { + self.disk_encryption_configuration = v.into(); + self + } + + /// Sets the value of `disk_encryption_status`. + pub fn set_disk_encryption_status>>(mut self, v: T) -> Self { + self.disk_encryption_status = v.into(); + self + } + + /// Sets the value of `backup_kind`. + pub fn set_backup_kind>(mut self, v: T) -> Self { + self.backup_kind = v.into(); + self + } + + /// Sets the value of `time_zone`. + pub fn set_time_zone>(mut self, v: T) -> Self { + self.time_zone = v.into(); + self + } + + /// Sets the value of `max_chargeable_bytes`. + pub fn set_max_chargeable_bytes>>(mut self, v: T) -> Self { + self.max_chargeable_bytes = v.into(); + self + } +} + +impl wkt::message::Message for BackupRun { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.BackupRun" + } +} + +/// Backup run list results. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct BackupRunsListResponse { + + /// This is always `sql#backupRunsList`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// A list of backup runs in reverse chronological order of the enqueued time. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub items: std::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. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub next_page_token: std::string::String, +} + +impl BackupRunsListResponse { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `items`. + pub fn set_items>>(mut self, v: T) -> Self { + self.items = v.into(); + self + } + + /// Sets the value of `next_page_token`. + pub fn set_next_page_token>(mut self, v: T) -> Self { + self.next_page_token = v.into(); + self + } +} + +impl wkt::message::Message for BackupRunsListResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.BackupRunsListResponse" + } +} + +/// Connect settings retrieval request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct GetConnectSettingsRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// Optional. Optional snapshot read timestamp to trade freshness for + /// performance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub read_time: std::option::Option, +} + +impl GetConnectSettingsRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `read_time`. + pub fn set_read_time>>(mut self, v: T) -> Self { + self.read_time = v.into(); + self + } +} + +impl wkt::message::Message for GetConnectSettingsRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.GetConnectSettingsRequest" + } +} + +/// Connect settings retrieval response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct ConnectSettings { + + /// This is always `sql#connectSettings`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// SSL configuration. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub server_ca_cert: std::option::Option, + + /// The assigned IP addresses for the instance. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub ip_addresses: std::vec::Vec, + + /// The cloud region for the instance. For example, `us-central1`, + /// `europe-west1`. The region cannot be changed after instance creation. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub region: std::string::String, + + /// The database engine type and version. The `databaseVersion` + /// field cannot be changed after instance creation. + /// MySQL instances: `MYSQL_8_0`, `MYSQL_5_7` (default), + /// or `MYSQL_5_6`. + /// PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`, + /// `POSTGRES_11`, `POSTGRES_12` (default), `POSTGRES_13`, or `POSTGRES_14`. + /// SQL Server instances: `SQLSERVER_2017_STANDARD` (default), + /// `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`, + /// `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`, + /// `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or + /// `SQLSERVER_2019_WEB`. + pub database_version: crate::model::SqlDatabaseVersion, + + /// `SECOND_GEN`: Cloud SQL database instance. + /// `EXTERNAL`: A database server that is not managed by Google. + /// This property is read-only; use the `tier` property in the `settings` + /// object to determine the database type. + pub backend_type: crate::model::SqlBackendType, + + /// Whether PSC connectivity is enabled for this instance. + pub psc_enabled: bool, + + /// The dns name of the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub dns_name: std::string::String, + + /// Specify what type of CA is used for the server certificate. + pub server_ca_mode: crate::model::connect_settings::CaMode, +} + +impl ConnectSettings { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `server_ca_cert`. + pub fn set_server_ca_cert>>(mut self, v: T) -> Self { + self.server_ca_cert = v.into(); + self + } + + /// Sets the value of `ip_addresses`. + pub fn set_ip_addresses>>(mut self, v: T) -> Self { + self.ip_addresses = v.into(); + self + } + + /// Sets the value of `region`. + pub fn set_region>(mut self, v: T) -> Self { + self.region = v.into(); + self + } + + /// Sets the value of `database_version`. + pub fn set_database_version>(mut self, v: T) -> Self { + self.database_version = v.into(); + self + } + + /// Sets the value of `backend_type`. + pub fn set_backend_type>(mut self, v: T) -> Self { + self.backend_type = v.into(); + self + } + + /// Sets the value of `psc_enabled`. + pub fn set_psc_enabled>(mut self, v: T) -> Self { + self.psc_enabled = v.into(); + self + } + + /// Sets the value of `dns_name`. + pub fn set_dns_name>(mut self, v: T) -> Self { + self.dns_name = v.into(); + self + } + + /// Sets the value of `server_ca_mode`. + pub fn set_server_ca_mode>(mut self, v: T) -> Self { + self.server_ca_mode = v.into(); + self + } +} + +impl wkt::message::Message for ConnectSettings { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ConnectSettings" + } +} + +/// Defines additional types related to ConnectSettings +pub mod connect_settings { + #[allow(unused_imports)] + use super::*; + + + /// Various Certificate Authority (CA) modes for certificate signing. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct CaMode(std::string::String); + + impl CaMode { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [CaMode](CaMode) + pub mod ca_mode { + + /// CA mode is unknown. + pub const CA_MODE_UNSPECIFIED: &str = "CA_MODE_UNSPECIFIED"; + + /// Google-managed self-signed internal CA. + pub const GOOGLE_MANAGED_INTERNAL_CA: &str = "GOOGLE_MANAGED_INTERNAL_CA"; + + /// Google-managed regional CA part of root CA hierarchy hosted on Google + /// Cloud's Certificate Authority Service (CAS). + pub const GOOGLE_MANAGED_CAS_CA: &str = "GOOGLE_MANAGED_CAS_CA"; + } +} + +/// Ephemeral certificate creation request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct GenerateEphemeralCertRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// PEM encoded public key to include in the signed certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub public_key: std::string::String, + + /// Optional. Access token to include in the signed certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub access_token: std::string::String, + + /// Optional. Optional snapshot read timestamp to trade freshness for + /// performance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub read_time: std::option::Option, + + /// Optional. If set, it will contain the cert valid duration. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub valid_duration: std::option::Option, +} + +impl GenerateEphemeralCertRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `public_key`. + pub fn set_public_key>(mut self, v: T) -> Self { + self.public_key = v.into(); + self + } + + /// Sets the value of `access_token`. + pub fn set_access_token>(mut self, v: T) -> Self { + self.access_token = v.into(); + self + } + + /// Sets the value of `read_time`. + pub fn set_read_time>>(mut self, v: T) -> Self { + self.read_time = v.into(); + self + } + + /// Sets the value of `valid_duration`. + pub fn set_valid_duration>>(mut self, v: T) -> Self { + self.valid_duration = v.into(); + self + } +} + +impl wkt::message::Message for GenerateEphemeralCertRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.GenerateEphemeralCertRequest" + } +} + +/// Ephemeral certificate creation request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct GenerateEphemeralCertResponse { + + /// Generated cert + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub ephemeral_cert: std::option::Option, +} + +impl GenerateEphemeralCertResponse { + + /// Sets the value of `ephemeral_cert`. + pub fn set_ephemeral_cert>>(mut self, v: T) -> Self { + self.ephemeral_cert = v.into(); + self + } +} + +impl wkt::message::Message for GenerateEphemeralCertResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.GenerateEphemeralCertResponse" + } +} + +/// Database delete request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlDatabasesDeleteRequest { + + /// Name of the database to be deleted in the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub database: std::string::String, + + /// Database instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlDatabasesDeleteRequest { + + /// Sets the value of `database`. + pub fn set_database>(mut self, v: T) -> Self { + self.database = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlDatabasesDeleteRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesDeleteRequest" + } +} + +/// Database get request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlDatabasesGetRequest { + + /// Name of the database in the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub database: std::string::String, + + /// Database instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlDatabasesGetRequest { + + /// Sets the value of `database`. + pub fn set_database>(mut self, v: T) -> Self { + self.database = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlDatabasesGetRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesGetRequest" + } +} + +/// Database insert request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlDatabasesInsertRequest { + + /// Database instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlDatabasesInsertRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlDatabasesInsertRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesInsertRequest" + } +} + +/// Database list request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlDatabasesListRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlDatabasesListRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlDatabasesListRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesListRequest" + } +} + +/// Database update request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlDatabasesUpdateRequest { + + /// Name of the database to be updated in the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub database: std::string::String, + + /// Database instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlDatabasesUpdateRequest { + + /// Sets the value of `database`. + pub fn set_database>(mut self, v: T) -> Self { + self.database = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlDatabasesUpdateRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesUpdateRequest" + } +} + +/// Database list response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct DatabasesListResponse { + + /// This is always `sql#databasesList`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// List of database resources in the instance. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub items: std::vec::Vec, +} + +impl DatabasesListResponse { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `items`. + pub fn set_items>>(mut self, v: T) -> Self { + self.items = v.into(); + self + } +} + +impl wkt::message::Message for DatabasesListResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DatabasesListResponse" + } +} + +/// Flags list request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlFlagsListRequest { + + /// Database type and version you want to retrieve flags for. By default, this + /// method returns flags for all database types and versions. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub database_version: std::string::String, +} + +impl SqlFlagsListRequest { + + /// Sets the value of `database_version`. + pub fn set_database_version>(mut self, v: T) -> Self { + self.database_version = v.into(); + self + } +} + +impl wkt::message::Message for SqlFlagsListRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlFlagsListRequest" + } +} + +/// Flags list response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct FlagsListResponse { + + /// This is always `sql#flagsList`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// List of flags. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub items: std::vec::Vec, +} + +impl FlagsListResponse { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `items`. + pub fn set_items>>(mut self, v: T) -> Self { + self.items = v.into(); + self + } +} + +impl wkt::message::Message for FlagsListResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.FlagsListResponse" + } +} + +/// A flag resource. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct Flag { + + /// This is the name of the flag. Flag names always use underscores, not + /// hyphens, for example: `max_allowed_packet` + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// The type of the flag. Flags are typed to being `BOOLEAN`, `STRING`, + /// `INTEGER` or `NONE`. `NONE` is used for flags that do not take a + /// value, such as `skip_grant_tables`. + #[serde(rename = "type")] + pub r#type: crate::model::SqlFlagType, + + /// The database version this flag applies to. Can be + /// MySQL instances: `MYSQL_8_0`, `MYSQL_8_0_18`, `MYSQL_8_0_26`, `MYSQL_5_7`, + /// or `MYSQL_5_6`. PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`, + /// `POSTGRES_11` or `POSTGRES_12`. SQL Server instances: + /// `SQLSERVER_2017_STANDARD`, `SQLSERVER_2017_ENTERPRISE`, + /// `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`, + /// `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or + /// `SQLSERVER_2019_WEB`. + /// See [the complete + /// list](/sql/docs/mysql/admin-api/rest/v1/SqlDatabaseVersion). + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub applies_to: std::vec::Vec, + + /// For `STRING` flags, a list of strings that the value can be set to. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub allowed_string_values: std::vec::Vec, + + /// For `INTEGER` flags, the minimum allowed value. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde_as(as = "std::option::Option")] + pub min_value: std::option::Option, + + /// For `INTEGER` flags, the maximum allowed value. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde_as(as = "std::option::Option")] + pub max_value: std::option::Option, + + /// Indicates whether changing this flag will trigger a database restart. Only + /// applicable to Second Generation instances. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub requires_restart: std::option::Option, + + /// This is always `sql#flag`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// Whether or not the flag is considered in beta. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub in_beta: std::option::Option, + + /// Use this field if only certain integers are accepted. Can be combined + /// with min_value and max_value to add additional values. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + #[serde_as(as = "std::vec::Vec")] + pub allowed_int_values: std::vec::Vec, +} + +impl Flag { + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `r#type`. + pub fn set_type>(mut self, v: T) -> Self { + self.r#type = v.into(); + self + } + + /// Sets the value of `applies_to`. + pub fn set_applies_to>>(mut self, v: T) -> Self { + self.applies_to = v.into(); + self + } + + /// Sets the value of `allowed_string_values`. + pub fn set_allowed_string_values>>(mut self, v: T) -> Self { + self.allowed_string_values = v.into(); + self + } + + /// Sets the value of `min_value`. + pub fn set_min_value>>(mut self, v: T) -> Self { + self.min_value = v.into(); + self + } + + /// Sets the value of `max_value`. + pub fn set_max_value>>(mut self, v: T) -> Self { + self.max_value = v.into(); + self + } + + /// Sets the value of `requires_restart`. + pub fn set_requires_restart>>(mut self, v: T) -> Self { + self.requires_restart = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `in_beta`. + pub fn set_in_beta>>(mut self, v: T) -> Self { + self.in_beta = v.into(); + self + } + + /// Sets the value of `allowed_int_values`. + pub fn set_allowed_int_values>>(mut self, v: T) -> Self { + self.allowed_int_values = v.into(); + self + } +} + +impl wkt::message::Message for Flag { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.Flag" + } +} + +/// Instance add server CA request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesAddServerCaRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesAddServerCaRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesAddServerCaRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesAddServerCaRequest" + } +} + +/// Instance clone request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesCloneRequest { + + /// The ID of the Cloud SQL instance to be cloned (source). This does not + /// include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the source as well as the clone Cloud SQL instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesCloneRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesCloneRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesCloneRequest" + } +} + +/// Instance delete request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesDeleteRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance to be deleted. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesDeleteRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesDeleteRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesDeleteRequest" + } +} + +/// Instance demote master request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesDemoteMasterRequest { + + /// Cloud SQL instance name. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesDemoteMasterRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesDemoteMasterRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesDemoteMasterRequest" + } +} + +/// Instance demote request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesDemoteRequest { + + /// Required. Cloud SQL instance name. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Required. ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// Required. The request body. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesDemoteRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesDemoteRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesDemoteRequest" + } +} + +/// Instance export request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesExportRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance to be exported. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesExportRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesExportRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesExportRequest" + } +} + +/// Instance failover request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesFailoverRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// ID of the project that contains the read replica. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesFailoverRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesFailoverRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesFailoverRequest" + } +} + +/// Instance get request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesGetRequest { + + /// Database instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesGetRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesGetRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetRequest" + } +} + +/// Instance import request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesImportRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesImportRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesImportRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesImportRequest" + } +} + +/// Instance insert request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesInsertRequest { + + /// Project ID of the project to which the newly created Cloud SQL instances + /// should belong. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesInsertRequest { + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesInsertRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesInsertRequest" + } +} + +/// Instance list request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesListRequest { + + /// A filter expression that filters resources listed in the response. + /// The expression is in the form of field:value. For example, + /// 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per + /// their JSON representation, such as 'settings.userLabels.auto_start:true'. + /// + /// Multiple filter queries are space-separated. For example. + /// 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each + /// expression is an AND expression. However, you can include AND and OR + /// expressions explicitly. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub filter: std::string::String, + + /// The maximum number of instances to return. The service may return fewer + /// than this value. + /// If unspecified, at most 500 instances are returned. + /// The maximum value is 1000; values above 1000 are coerced to 1000. + pub max_results: u32, + + /// A previously-returned page token representing part of the larger set of + /// results to view. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub page_token: std::string::String, + + /// Project ID of the project for which to list Cloud SQL instances. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesListRequest { + + /// Sets the value of `filter`. + pub fn set_filter>(mut self, v: T) -> Self { + self.filter = v.into(); + self + } + + /// Sets the value of `max_results`. + pub fn set_max_results>(mut self, v: T) -> Self { + self.max_results = v.into(); + self + } + + /// Sets the value of `page_token`. + pub fn set_page_token>(mut self, v: T) -> Self { + self.page_token = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesListRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesListRequest" + } +} + +/// Instance list server CAs request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesListServerCasRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesListServerCasRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesListServerCasRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesListServerCasRequest" + } +} + +/// Instance patch request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesPatchRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesPatchRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesPatchRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesPatchRequest" + } +} + +/// Instance promote replica request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesPromoteReplicaRequest { + + /// Cloud SQL read replica instance name. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// ID of the project that contains the read replica. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// Set to true to invoke a replica failover to the designated DR + /// replica. As part of replica failover, the promote operation attempts + /// to add the original primary instance as a replica of the promoted + /// DR replica when the original primary instance comes back online. + /// If set to false or not specified, then the original primary + /// instance becomes an independent Cloud SQL primary instance. + /// Only applicable to MySQL. + pub failover: bool, +} + +impl SqlInstancesPromoteReplicaRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `failover`. + pub fn set_failover>(mut self, v: T) -> Self { + self.failover = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesPromoteReplicaRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest" + } +} + +/// Instance switchover request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesSwitchoverRequest { + + /// Cloud SQL read replica instance name. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// ID of the project that contains the replica. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::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. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub db_timeout: std::option::Option, +} + +impl SqlInstancesSwitchoverRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `db_timeout`. + pub fn set_db_timeout>>(mut self, v: T) -> Self { + self.db_timeout = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesSwitchoverRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesSwitchoverRequest" + } +} + +/// Instance reset SSL config request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesResetSslConfigRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesResetSslConfigRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesResetSslConfigRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesResetSslConfigRequest" + } +} + +/// Instance restart request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesRestartRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance to be restarted. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesRestartRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesRestartRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRestartRequest" + } +} + +/// Instance restore backup request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesRestoreBackupRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesRestoreBackupRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesRestoreBackupRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRestoreBackupRequest" + } +} + +/// Instance rotate server CA request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesRotateServerCaRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesRotateServerCaRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesRotateServerCaRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRotateServerCaRequest" + } +} + +/// Instance start replica request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesStartReplicaRequest { + + /// Cloud SQL read replica instance name. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// ID of the project that contains the read replica. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesStartReplicaRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesStartReplicaRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesStartReplicaRequest" + } +} + +/// Instance stop replica request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesStopReplicaRequest { + + /// Cloud SQL read replica instance name. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// ID of the project that contains the read replica. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesStopReplicaRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesStopReplicaRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesStopReplicaRequest" + } +} + +/// Instance truncate log request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesTruncateLogRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the Cloud SQL project. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesTruncateLogRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesTruncateLogRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesTruncateLogRequest" + } +} + +/// Instance perform disk shrink request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesPerformDiskShrinkRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// Perform disk shrink context. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesPerformDiskShrinkRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesPerformDiskShrinkRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest" + } +} + +/// Instance update request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesUpdateRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesUpdateRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesUpdateRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesUpdateRequest" + } +} + +/// Instance reschedule maintenance request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesRescheduleMaintenanceRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesRescheduleMaintenanceRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesRescheduleMaintenanceRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest" + } +} + +/// Instance reencrypt request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesReencryptRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// Reencrypt body that users request + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesReencryptRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesReencryptRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesReencryptRequest" + } +} + +/// Database Instance reencrypt request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesReencryptRequest { + + /// Configuration specific to backup re-encryption + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub backup_reencryption_config: std::option::Option, +} + +impl InstancesReencryptRequest { + + /// Sets the value of `backup_reencryption_config`. + pub fn set_backup_reencryption_config>>(mut self, v: T) -> Self { + self.backup_reencryption_config = v.into(); + self + } +} + +impl wkt::message::Message for InstancesReencryptRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesReencryptRequest" + } +} + +/// Backup Reencryption Config +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct BackupReencryptionConfig { + + /// Backup re-encryption limit + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub backup_limit: std::option::Option, + + /// Type of backups users want to re-encrypt. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub backup_type: std::option::Option, +} + +impl BackupReencryptionConfig { + + /// Sets the value of `backup_limit`. + pub fn set_backup_limit>>(mut self, v: T) -> Self { + self.backup_limit = v.into(); + self + } + + /// Sets the value of `backup_type`. + pub fn set_backup_type>>(mut self, v: T) -> Self { + self.backup_type = v.into(); + self + } +} + +impl wkt::message::Message for BackupReencryptionConfig { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.BackupReencryptionConfig" + } +} + +/// Defines additional types related to BackupReencryptionConfig +pub mod backup_reencryption_config { + #[allow(unused_imports)] + use super::*; + + + /// Backup type for re-encryption + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct BackupType(std::string::String); + + impl BackupType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [BackupType](BackupType) + pub mod backup_type { + + /// Unknown backup type, will be defaulted to AUTOMATIC backup type + pub const BACKUP_TYPE_UNSPECIFIED: &str = "BACKUP_TYPE_UNSPECIFIED"; + + /// Reencrypt automatic backups + pub const AUTOMATED: &str = "AUTOMATED"; + + /// Reencrypt on-demand backups + pub const ON_DEMAND: &str = "ON_DEMAND"; + } +} + +/// Instance get disk shrink config request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesGetDiskShrinkConfigRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesGetDiskShrinkConfigRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesGetDiskShrinkConfigRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest" + } +} + +/// Instance verify external sync settings request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesVerifyExternalSyncSettingsRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// Flag to enable verifying connection only + pub verify_connection_only: bool, + + /// External sync mode + pub sync_mode: crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode, + + /// Optional. Flag to verify settings required by replication setup only + pub verify_replication_only: bool, + + /// Optional. MigrationType configures the migration to use physical files or + /// logical dump files. If not set, then the logical dump file configuration is + /// used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + pub migration_type: crate::model::sql_instances_verify_external_sync_settings_request::MigrationType, + + /// Optional. Parallel level for initial data sync. Only applicable for + /// PostgreSQL. + pub sync_parallel_level: crate::model::ExternalSyncParallelLevel, + + #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")] + pub sync_config: std::option::Option, +} + +impl SqlInstancesVerifyExternalSyncSettingsRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `verify_connection_only`. + pub fn set_verify_connection_only>(mut self, v: T) -> Self { + self.verify_connection_only = v.into(); + self + } + + /// Sets the value of `sync_mode`. + pub fn set_sync_mode>(mut self, v: T) -> Self { + self.sync_mode = v.into(); + self + } + + /// Sets the value of `verify_replication_only`. + pub fn set_verify_replication_only>(mut self, v: T) -> Self { + self.verify_replication_only = v.into(); + self + } + + /// Sets the value of `migration_type`. + pub fn set_migration_type>(mut self, v: T) -> Self { + self.migration_type = v.into(); + self + } + + /// Sets the value of `sync_parallel_level`. + pub fn set_sync_parallel_level>(mut self, v: T) -> Self { + self.sync_parallel_level = v.into(); + self + } + + /// Sets the value of `sync_config`. + pub fn set_sync_config>>(mut self, v: T) ->Self { + self.sync_config = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesVerifyExternalSyncSettingsRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest" + } +} + +/// Defines additional types related to SqlInstancesVerifyExternalSyncSettingsRequest +pub mod sql_instances_verify_external_sync_settings_request { + #[allow(unused_imports)] + use super::*; + + + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct ExternalSyncMode(std::string::String); + + impl ExternalSyncMode { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [ExternalSyncMode](ExternalSyncMode) + pub mod external_sync_mode { + + /// Unknown external sync mode, will be defaulted to ONLINE mode + pub const EXTERNAL_SYNC_MODE_UNSPECIFIED: &str = "EXTERNAL_SYNC_MODE_UNSPECIFIED"; + + /// Online external sync will set up replication after initial data external + /// sync + pub const ONLINE: &str = "ONLINE"; + + /// Offline external sync only dumps and loads a one-time snapshot of + /// the primary instance's data + pub const OFFLINE: &str = "OFFLINE"; + } + + /// MigrationType determines whether the migration is a physical file-based + /// migration or a logical dump file-based migration. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct MigrationType(std::string::String); + + impl MigrationType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [MigrationType](MigrationType) + pub mod migration_type { + + /// Default value is a logical dump file-based migration + pub const MIGRATION_TYPE_UNSPECIFIED: &str = "MIGRATION_TYPE_UNSPECIFIED"; + + /// Logical dump file-based migration + pub const LOGICAL: &str = "LOGICAL"; + + /// Physical file-based migration + pub const PHYSICAL: &str = "PHYSICAL"; + } + + #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(rename_all = "camelCase")] + #[non_exhaustive] + pub enum SyncConfig { + /// Optional. MySQL-specific settings for start external sync. + MysqlSyncConfig(crate::model::MySqlSyncConfig), + } +} + +/// Instance start external sync request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesStartExternalSyncRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// External sync mode. + pub sync_mode: crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode, + + /// Whether to skip the verification step (VESS). + pub skip_verification: bool, + + /// Optional. Parallel level for initial data sync. Currently only applicable + /// for MySQL. + pub sync_parallel_level: crate::model::ExternalSyncParallelLevel, + + /// Optional. MigrationType configures the migration to use physical files or + /// logical dump files. If not set, then the logical dump file configuration is + /// used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + pub migration_type: crate::model::sql_instances_verify_external_sync_settings_request::MigrationType, + + #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")] + pub sync_config: std::option::Option, +} + +impl SqlInstancesStartExternalSyncRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `sync_mode`. + pub fn set_sync_mode>(mut self, v: T) -> Self { + self.sync_mode = v.into(); + self + } + + /// Sets the value of `skip_verification`. + pub fn set_skip_verification>(mut self, v: T) -> Self { + self.skip_verification = v.into(); + self + } + + /// Sets the value of `sync_parallel_level`. + pub fn set_sync_parallel_level>(mut self, v: T) -> Self { + self.sync_parallel_level = v.into(); + self + } + + /// Sets the value of `migration_type`. + pub fn set_migration_type>(mut self, v: T) -> Self { + self.migration_type = v.into(); + self + } + + /// Sets the value of `sync_config`. + pub fn set_sync_config>>(mut self, v: T) ->Self { + self.sync_config = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesStartExternalSyncRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest" + } +} + +/// Defines additional types related to SqlInstancesStartExternalSyncRequest +pub mod sql_instances_start_external_sync_request { + #[allow(unused_imports)] + use super::*; + + + #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(rename_all = "camelCase")] + #[non_exhaustive] + pub enum SyncConfig { + /// MySQL-specific settings for start external sync. + MysqlSyncConfig(crate::model::MySqlSyncConfig), + } +} + +/// Instance reset replica size request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesResetReplicaSizeRequest { + + /// Cloud SQL read replica instance name. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// ID of the project that contains the read replica. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesResetReplicaSizeRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesResetReplicaSizeRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest" + } +} + +/// Instance create ephemeral certificate request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesCreateEphemeralCertRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the Cloud SQL project. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesCreateEphemeralCertRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesCreateEphemeralCertRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest" + } +} + +/// Database instance clone request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesCloneRequest { + + /// Contains details about the clone operation. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub clone_context: std::option::Option, +} + +impl InstancesCloneRequest { + + /// Sets the value of `clone_context`. + pub fn set_clone_context>>(mut self, v: T) -> Self { + self.clone_context = v.into(); + self + } +} + +impl wkt::message::Message for InstancesCloneRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesCloneRequest" + } +} + +/// Database demote primary instance request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesDemoteMasterRequest { + + /// Contains details about the demoteMaster operation. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub demote_master_context: std::option::Option, +} + +impl InstancesDemoteMasterRequest { + + /// Sets the value of `demote_master_context`. + pub fn set_demote_master_context>>(mut self, v: T) -> Self { + self.demote_master_context = v.into(); + self + } +} + +impl wkt::message::Message for InstancesDemoteMasterRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesDemoteMasterRequest" + } +} + +/// This request is used to demote an existing standalone instance to be a +/// Cloud SQL read replica for an external database server. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesDemoteRequest { + + /// Required. Contains details about the demote operation. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub demote_context: std::option::Option, +} + +impl InstancesDemoteRequest { + + /// Sets the value of `demote_context`. + pub fn set_demote_context>>(mut self, v: T) -> Self { + self.demote_context = v.into(); + self + } +} + +impl wkt::message::Message for InstancesDemoteRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesDemoteRequest" + } +} + +/// Database instance export request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesExportRequest { + + /// Contains details about the export operation. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub export_context: std::option::Option, +} + +impl InstancesExportRequest { + + /// Sets the value of `export_context`. + pub fn set_export_context>>(mut self, v: T) -> Self { + self.export_context = v.into(); + self + } +} + +impl wkt::message::Message for InstancesExportRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesExportRequest" + } +} + +/// Instance failover request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesFailoverRequest { + + /// Failover Context. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub failover_context: std::option::Option, +} + +impl InstancesFailoverRequest { + + /// Sets the value of `failover_context`. + pub fn set_failover_context>>(mut self, v: T) -> Self { + self.failover_context = v.into(); + self + } +} + +impl wkt::message::Message for InstancesFailoverRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesFailoverRequest" + } +} + +/// SslCerts create ephemeral certificate request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SslCertsCreateEphemeralRequest { + + /// PEM encoded public key to include in the signed certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub public_key: std::string::String, + + /// Access token to include in the signed certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub access_token: std::string::String, +} + +impl SslCertsCreateEphemeralRequest { + + /// Sets the value of `public_key`. + pub fn set_public_key>(mut self, v: T) -> Self { + self.public_key = v.into(); + self + } + + /// Sets the value of `access_token`. + pub fn set_access_token>(mut self, v: T) -> Self { + self.access_token = v.into(); + self + } +} + +impl wkt::message::Message for SslCertsCreateEphemeralRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SslCertsCreateEphemeralRequest" + } +} + +/// Database instance import request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesImportRequest { + + /// Contains details about the import operation. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub import_context: std::option::Option, +} + +impl InstancesImportRequest { + + /// Sets the value of `import_context`. + pub fn set_import_context>>(mut self, v: T) -> Self { + self.import_context = v.into(); + self + } +} + +impl wkt::message::Message for InstancesImportRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesImportRequest" + } +} + +/// Database instances list response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesListResponse { + + /// This is always `sql#instancesList`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// List of warnings that occurred while handling the request. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub warnings: std::vec::Vec, + + /// List of database instance resources. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub items: std::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. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub next_page_token: std::string::String, +} + +impl InstancesListResponse { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `warnings`. + pub fn set_warnings>>(mut self, v: T) -> Self { + self.warnings = v.into(); + self + } + + /// Sets the value of `items`. + pub fn set_items>>(mut self, v: T) -> Self { + self.items = v.into(); + self + } + + /// Sets the value of `next_page_token`. + pub fn set_next_page_token>(mut self, v: T) -> Self { + self.next_page_token = v.into(); + self + } +} + +impl wkt::message::Message for InstancesListResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesListResponse" + } +} + +/// Instances ListServerCas response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesListServerCasResponse { + + /// List of server CA certificates for the instance. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub certs: std::vec::Vec, + + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub active_version: std::string::String, + + /// This is always `sql#instancesListServerCas`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, +} + +impl InstancesListServerCasResponse { + + /// Sets the value of `certs`. + pub fn set_certs>>(mut self, v: T) -> Self { + self.certs = v.into(); + self + } + + /// Sets the value of `active_version`. + pub fn set_active_version>(mut self, v: T) -> Self { + self.active_version = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } +} + +impl wkt::message::Message for InstancesListServerCasResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesListServerCasResponse" + } +} + +/// Database instance restore backup request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesRestoreBackupRequest { + + /// Parameters required to perform the restore backup operation. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub restore_backup_context: std::option::Option, +} + +impl InstancesRestoreBackupRequest { + + /// Sets the value of `restore_backup_context`. + pub fn set_restore_backup_context>>(mut self, v: T) -> Self { + self.restore_backup_context = v.into(); + self + } +} + +impl wkt::message::Message for InstancesRestoreBackupRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesRestoreBackupRequest" + } +} + +/// Rotate server CA request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesRotateServerCaRequest { + + /// Contains details about the rotate server CA operation. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub rotate_server_ca_context: std::option::Option, +} + +impl InstancesRotateServerCaRequest { + + /// Sets the value of `rotate_server_ca_context`. + pub fn set_rotate_server_ca_context>>(mut self, v: T) -> Self { + self.rotate_server_ca_context = v.into(); + self + } +} + +impl wkt::message::Message for InstancesRotateServerCaRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesRotateServerCaRequest" + } +} + +/// Instance truncate log request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesTruncateLogRequest { + + /// Contains details about the truncate log operation. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub truncate_log_context: std::option::Option, +} + +impl InstancesTruncateLogRequest { + + /// Sets the value of `truncate_log_context`. + pub fn set_truncate_log_context>>(mut self, v: T) -> Self { + self.truncate_log_context = v.into(); + self + } +} + +impl wkt::message::Message for InstancesTruncateLogRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesTruncateLogRequest" + } +} + +/// Request to acquire a lease for SSRS. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstancesAcquireSsrsLeaseRequest { + + /// Contains details about the acquire SSRS lease operation. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub acquire_ssrs_lease_context: std::option::Option, +} + +impl InstancesAcquireSsrsLeaseRequest { + + /// Sets the value of `acquire_ssrs_lease_context`. + pub fn set_acquire_ssrs_lease_context>>(mut self, v: T) -> Self { + self.acquire_ssrs_lease_context = v.into(); + self + } +} + +impl wkt::message::Message for InstancesAcquireSsrsLeaseRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest" + } +} + +/// Instance verify external sync settings response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesVerifyExternalSyncSettingsResponse { + + /// This is always `sql#migrationSettingErrorList`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// List of migration violations. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub errors: std::vec::Vec, + + /// List of migration warnings. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub warnings: std::vec::Vec, +} + +impl SqlInstancesVerifyExternalSyncSettingsResponse { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `errors`. + pub fn set_errors>>(mut self, v: T) -> Self { + self.errors = v.into(); + self + } + + /// Sets the value of `warnings`. + pub fn set_warnings>>(mut self, v: T) -> Self { + self.warnings = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesVerifyExternalSyncSettingsResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse" + } +} + +/// Instance get disk shrink config response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesGetDiskShrinkConfigResponse { + + /// This is always `sql#getDiskShrinkConfig`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The minimum size to which a disk can be shrunk in GigaBytes. + #[serde_as(as = "serde_with::DisplayFromStr")] + pub minimal_target_size_gb: i64, + + /// Additional message to customers. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub message: std::string::String, +} + +impl SqlInstancesGetDiskShrinkConfigResponse { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `minimal_target_size_gb`. + pub fn set_minimal_target_size_gb>(mut self, v: T) -> Self { + self.minimal_target_size_gb = v.into(); + self + } + + /// Sets the value of `message`. + pub fn set_message>(mut self, v: T) -> Self { + self.message = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesGetDiskShrinkConfigResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse" + } +} + +/// Instance get latest recovery time request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesGetLatestRecoveryTimeRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesGetLatestRecoveryTimeRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesGetLatestRecoveryTimeRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest" + } +} + +/// Instance get latest recovery time response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesGetLatestRecoveryTimeResponse { + + /// This is always `sql#getLatestRecoveryTime`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// Timestamp, identifies the latest recovery time of the source instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub latest_recovery_time: std::option::Option, +} + +impl SqlInstancesGetLatestRecoveryTimeResponse { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `latest_recovery_time`. + pub fn set_latest_recovery_time>>(mut self, v: T) -> Self { + self.latest_recovery_time = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesGetLatestRecoveryTimeResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse" + } +} + +/// Database instance clone context. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct CloneContext { + + /// This is always `sql#cloneContext`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// Reserved for future use. + #[serde_as(as = "serde_with::DisplayFromStr")] + pub pitr_timestamp_ms: i64, + + /// Name of the Cloud SQL instance to be created as a clone. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub destination_instance_name: std::string::String, + + /// Binary log coordinates, if specified, identify the position up to which the + /// source instance is cloned. If not specified, the source instance is + /// cloned up to the most recent binary log coordinates. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub bin_log_coordinates: std::option::Option, + + /// Timestamp, if specified, identifies the time to which the source instance + /// is cloned. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub point_in_time: std::option::Option, + + /// The name of the allocated ip range for the private ip Cloud SQL instance. + /// For example: "google-managed-services-default". If set, the cloned instance + /// ip will be created in the allocated range. The range name must comply with + /// [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name + /// must be 1-63 characters long and match the regular expression + /// [a-z]([-a-z0-9]*[a-z0-9])?. + /// Reserved for future use. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub allocated_ip_range: std::string::String, + + /// (SQL Server only) Clone only the specified databases from the source + /// instance. Clone all databases if empty. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub database_names: std::vec::Vec, + + /// Optional. Copy clone and point-in-time recovery clone of an instance to the + /// specified zone. If no zone is specified, clone to the same primary zone as + /// the source instance. This field applies to all DB types. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub preferred_zone: std::option::Option, +} + +impl CloneContext { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `pitr_timestamp_ms`. + pub fn set_pitr_timestamp_ms>(mut self, v: T) -> Self { + self.pitr_timestamp_ms = v.into(); + self + } + + /// Sets the value of `destination_instance_name`. + pub fn set_destination_instance_name>(mut self, v: T) -> Self { + self.destination_instance_name = v.into(); + self + } + + /// Sets the value of `bin_log_coordinates`. + pub fn set_bin_log_coordinates>>(mut self, v: T) -> Self { + self.bin_log_coordinates = v.into(); + self + } + + /// Sets the value of `point_in_time`. + pub fn set_point_in_time>>(mut self, v: T) -> Self { + self.point_in_time = v.into(); + self + } + + /// Sets the value of `allocated_ip_range`. + pub fn set_allocated_ip_range>(mut self, v: T) -> Self { + self.allocated_ip_range = v.into(); + self + } + + /// Sets the value of `database_names`. + pub fn set_database_names>>(mut self, v: T) -> Self { + self.database_names = v.into(); + self + } + + /// Sets the value of `preferred_zone`. + pub fn set_preferred_zone>>(mut self, v: T) -> Self { + self.preferred_zone = v.into(); + self + } +} + +impl wkt::message::Message for CloneContext { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.CloneContext" + } +} + +/// Binary log coordinates. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct BinLogCoordinates { + + /// Name of the binary log file for a Cloud SQL instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub bin_log_file_name: std::string::String, + + /// Position (offset) within the binary log file. + #[serde_as(as = "serde_with::DisplayFromStr")] + pub bin_log_position: i64, + + /// This is always `sql#binLogCoordinates`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, +} + +impl BinLogCoordinates { + + /// Sets the value of `bin_log_file_name`. + pub fn set_bin_log_file_name>(mut self, v: T) -> Self { + self.bin_log_file_name = v.into(); + self + } + + /// Sets the value of `bin_log_position`. + pub fn set_bin_log_position>(mut self, v: T) -> Self { + self.bin_log_position = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } +} + +impl wkt::message::Message for BinLogCoordinates { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.BinLogCoordinates" + } +} + +/// A Cloud SQL instance resource. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct DatabaseInstance { + + /// This is always `sql#instance`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The current serving state of the Cloud SQL instance. + pub state: crate::model::database_instance::SqlInstanceState, + + /// The database engine type and version. The `databaseVersion` field cannot + /// be changed after instance creation. + pub database_version: crate::model::SqlDatabaseVersion, + + /// The user settings. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub settings: std::option::Option, + + /// This field is deprecated and will be removed from a future version of the + /// API. Use the `settings.settingsVersion` field instead. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub etag: std::string::String, + + /// The name and status of the failover replica. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub failover_replica: std::option::Option, + + /// The name of the instance which will act as primary in the replication + /// setup. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub master_instance_name: std::string::String, + + /// The replicas of the instance. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub replica_names: std::vec::Vec, + + /// The maximum disk size of the instance in bytes. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde_as(as = "std::option::Option")] + pub max_disk_size: std::option::Option, + + /// The current disk usage of the instance in bytes. This property has been + /// deprecated. Use the + /// "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud + /// Monitoring API instead. Please see [this + /// announcement](https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ) + /// for details. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde_as(as = "std::option::Option")] + pub current_disk_size: std::option::Option, + + /// The assigned IP addresses for the instance. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub ip_addresses: std::vec::Vec, + + /// SSL configuration. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub server_ca_cert: std::option::Option, + + /// The instance type. + pub instance_type: crate::model::SqlInstanceType, + + /// The project ID of the project containing the Cloud SQL instance. The Google + /// apps domain is prefixed if applicable. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// The IPv6 address assigned to the instance. + /// (Deprecated) This property was applicable only + /// to First Generation instances. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub ipv6_address: std::string::String, + + /// The service account email address assigned to the instance.\This + /// property is read-only. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub service_account_email_address: std::string::String, + + /// Configuration specific to on-premises instances. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub on_premises_configuration: std::option::Option, + + /// Configuration specific to failover replicas and read replicas. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub replica_configuration: std::option::Option, + + /// The backend type. + /// `SECOND_GEN`: Cloud SQL database instance. + /// `EXTERNAL`: A database server that is not managed by Google. + /// + /// This property is read-only; use the `tier` property in the `settings` + /// object to determine the database type. + pub backend_type: crate::model::SqlBackendType, + + /// The URI of this resource. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub self_link: std::string::String, + + /// If the instance state is SUSPENDED, the reason for the suspension. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub suspension_reason: std::vec::Vec, + + /// Connection name of the Cloud SQL instance used in connection strings. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub connection_name: std::string::String, + + /// Name of the Cloud SQL instance. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// The geographical region of the Cloud SQL instance. + /// + /// It can be one of the + /// [regions](https://cloud.google.com/sql/docs/mysql/locations#location-r) + /// where Cloud SQL operates: + /// + /// For example, `asia-east1`, `europe-west1`, and `us-central1`. + /// The default value is `us-central1`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub region: std::string::String, + + /// The Compute Engine zone that the instance is currently serving from. This + /// value could be different from the zone that was specified when the instance + /// was created if the instance has failed over to its secondary zone. WARNING: + /// Changing this might restart the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub gce_zone: std::string::String, + + /// The Compute Engine zone that the failover instance is currently serving + /// from for a regional instance. This value could be different + /// from the zone that was specified when the instance + /// was created if the instance has failed over to its secondary/failover zone. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub secondary_gce_zone: std::string::String, + + /// Disk encryption configuration specific to an instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub disk_encryption_configuration: std::option::Option, + + /// Disk encryption status specific to an instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub disk_encryption_status: std::option::Option, + + /// Initial root password. Use only on creation. You must set root passwords + /// before you can connect to PostgreSQL instances. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub root_password: std::string::String, + + /// The start time of any upcoming scheduled maintenance for this instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub scheduled_maintenance: std::option::Option, + + /// This status indicates whether the instance satisfies PZS. + /// + /// The status is reserved for future use. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub satisfies_pzs: std::option::Option, + + /// Output only. Stores the current database version running on the instance + /// including minor version such as `MYSQL_8_0_18`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub database_installed_version: std::string::String, + + /// This field represents the report generated by the proactive database + /// wellness job for OutOfDisk issues. + /// + /// * Writers: + /// * the proactive database wellness job for OOD. + /// * Readers: + /// * the proactive database wellness job + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub out_of_disk_report: std::option::Option, + + /// Output only. The time when the instance was created in + /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + /// `2012-11-15T16:19:00.094Z`. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub create_time: std::option::Option, + + /// Output only. List all maintenance versions applicable on the instance + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub available_maintenance_versions: std::vec::Vec, + + /// The current software version on the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub maintenance_version: std::string::String, + + /// Output only. All database versions that are available for upgrade. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub upgradable_database_versions: std::vec::Vec, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub sql_network_architecture: std::option::Option, + + /// Output only. The link to service attachment of PSC instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub psc_service_attachment_link: std::option::Option, + + /// Output only. The dns name of the instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub dns_name: std::option::Option, + + /// Output only. DEPRECATED: please use write_endpoint instead. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub primary_dns_name: std::option::Option, + + /// Output only. The dns name of the primary instance in a replication group. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub write_endpoint: std::option::Option, + + /// Optional. A primary instance and disaster recovery (DR) replica pair. + /// A DR replica is a cross-region replica that you designate + /// for failover in the event that the primary instance + /// experiences regional failure. Only applicable to MySQL. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub replication_cluster: std::option::Option, + + /// Gemini instance configuration. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub gemini_config: std::option::Option, + + /// Output only. This status indicates whether the instance satisfies PZI. + /// + /// The status is reserved for future use. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub satisfies_pzi: std::option::Option, + + /// Input only. Whether Cloud SQL is enabled to switch storing point-in-time + /// recovery log files from a data disk to Cloud Storage. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub switch_transaction_logs_to_cloud_storage_enabled: std::option::Option, +} + +impl DatabaseInstance { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `state`. + pub fn set_state>(mut self, v: T) -> Self { + self.state = v.into(); + self + } + + /// Sets the value of `database_version`. + pub fn set_database_version>(mut self, v: T) -> Self { + self.database_version = v.into(); + self + } + + /// Sets the value of `settings`. + pub fn set_settings>>(mut self, v: T) -> Self { + self.settings = v.into(); + self + } + + /// Sets the value of `etag`. + pub fn set_etag>(mut self, v: T) -> Self { + self.etag = v.into(); + self + } + + /// Sets the value of `failover_replica`. + pub fn set_failover_replica>>(mut self, v: T) -> Self { + self.failover_replica = v.into(); + self + } + + /// Sets the value of `master_instance_name`. + pub fn set_master_instance_name>(mut self, v: T) -> Self { + self.master_instance_name = v.into(); + self + } + + /// Sets the value of `replica_names`. + pub fn set_replica_names>>(mut self, v: T) -> Self { + self.replica_names = v.into(); + self + } + + /// Sets the value of `max_disk_size`. + pub fn set_max_disk_size>>(mut self, v: T) -> Self { + self.max_disk_size = v.into(); + self + } + + /// Sets the value of `current_disk_size`. + pub fn set_current_disk_size>>(mut self, v: T) -> Self { + self.current_disk_size = v.into(); + self + } + + /// Sets the value of `ip_addresses`. + pub fn set_ip_addresses>>(mut self, v: T) -> Self { + self.ip_addresses = v.into(); + self + } + + /// Sets the value of `server_ca_cert`. + pub fn set_server_ca_cert>>(mut self, v: T) -> Self { + self.server_ca_cert = v.into(); + self + } + + /// Sets the value of `instance_type`. + pub fn set_instance_type>(mut self, v: T) -> Self { + self.instance_type = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `ipv6_address`. + pub fn set_ipv6_address>(mut self, v: T) -> Self { + self.ipv6_address = v.into(); + self + } + + /// Sets the value of `service_account_email_address`. + pub fn set_service_account_email_address>(mut self, v: T) -> Self { + self.service_account_email_address = v.into(); + self + } + + /// Sets the value of `on_premises_configuration`. + pub fn set_on_premises_configuration>>(mut self, v: T) -> Self { + self.on_premises_configuration = v.into(); + self + } + + /// Sets the value of `replica_configuration`. + pub fn set_replica_configuration>>(mut self, v: T) -> Self { + self.replica_configuration = v.into(); + self + } + + /// Sets the value of `backend_type`. + pub fn set_backend_type>(mut self, v: T) -> Self { + self.backend_type = v.into(); + self + } + + /// Sets the value of `self_link`. + pub fn set_self_link>(mut self, v: T) -> Self { + self.self_link = v.into(); + self + } + + /// Sets the value of `suspension_reason`. + pub fn set_suspension_reason>>(mut self, v: T) -> Self { + self.suspension_reason = v.into(); + self + } + + /// Sets the value of `connection_name`. + pub fn set_connection_name>(mut self, v: T) -> Self { + self.connection_name = v.into(); + self + } + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `region`. + pub fn set_region>(mut self, v: T) -> Self { + self.region = v.into(); + self + } + + /// Sets the value of `gce_zone`. + pub fn set_gce_zone>(mut self, v: T) -> Self { + self.gce_zone = v.into(); + self + } + + /// Sets the value of `secondary_gce_zone`. + pub fn set_secondary_gce_zone>(mut self, v: T) -> Self { + self.secondary_gce_zone = v.into(); + self + } + + /// Sets the value of `disk_encryption_configuration`. + pub fn set_disk_encryption_configuration>>(mut self, v: T) -> Self { + self.disk_encryption_configuration = v.into(); + self + } + + /// Sets the value of `disk_encryption_status`. + pub fn set_disk_encryption_status>>(mut self, v: T) -> Self { + self.disk_encryption_status = v.into(); + self + } + + /// Sets the value of `root_password`. + pub fn set_root_password>(mut self, v: T) -> Self { + self.root_password = v.into(); + self + } + + /// Sets the value of `scheduled_maintenance`. + pub fn set_scheduled_maintenance>>(mut self, v: T) -> Self { + self.scheduled_maintenance = v.into(); + self + } + + /// Sets the value of `satisfies_pzs`. + pub fn set_satisfies_pzs>>(mut self, v: T) -> Self { + self.satisfies_pzs = v.into(); + self + } + + /// Sets the value of `database_installed_version`. + pub fn set_database_installed_version>(mut self, v: T) -> Self { + self.database_installed_version = v.into(); + self + } + + /// Sets the value of `out_of_disk_report`. + pub fn set_out_of_disk_report>>(mut self, v: T) -> Self { + self.out_of_disk_report = v.into(); + self + } + + /// Sets the value of `create_time`. + pub fn set_create_time>>(mut self, v: T) -> Self { + self.create_time = v.into(); + self + } + + /// Sets the value of `available_maintenance_versions`. + pub fn set_available_maintenance_versions>>(mut self, v: T) -> Self { + self.available_maintenance_versions = v.into(); + self + } + + /// Sets the value of `maintenance_version`. + pub fn set_maintenance_version>(mut self, v: T) -> Self { + self.maintenance_version = v.into(); + self + } + + /// Sets the value of `upgradable_database_versions`. + pub fn set_upgradable_database_versions>>(mut self, v: T) -> Self { + self.upgradable_database_versions = v.into(); + self + } + + /// Sets the value of `sql_network_architecture`. + pub fn set_sql_network_architecture>>(mut self, v: T) -> Self { + self.sql_network_architecture = v.into(); + self + } + + /// Sets the value of `psc_service_attachment_link`. + pub fn set_psc_service_attachment_link>>(mut self, v: T) -> Self { + self.psc_service_attachment_link = v.into(); + self + } + + /// Sets the value of `dns_name`. + pub fn set_dns_name>>(mut self, v: T) -> Self { + self.dns_name = v.into(); + self + } + + /// Sets the value of `primary_dns_name`. + pub fn set_primary_dns_name>>(mut self, v: T) -> Self { + self.primary_dns_name = v.into(); + self + } + + /// Sets the value of `write_endpoint`. + pub fn set_write_endpoint>>(mut self, v: T) -> Self { + self.write_endpoint = v.into(); + self + } + + /// Sets the value of `replication_cluster`. + pub fn set_replication_cluster>>(mut self, v: T) -> Self { + self.replication_cluster = v.into(); + self + } + + /// Sets the value of `gemini_config`. + pub fn set_gemini_config>>(mut self, v: T) -> Self { + self.gemini_config = v.into(); + self + } + + /// Sets the value of `satisfies_pzi`. + pub fn set_satisfies_pzi>>(mut self, v: T) -> Self { + self.satisfies_pzi = v.into(); + self + } + + /// Sets the value of `switch_transaction_logs_to_cloud_storage_enabled`. + pub fn set_switch_transaction_logs_to_cloud_storage_enabled>>(mut self, v: T) -> Self { + self.switch_transaction_logs_to_cloud_storage_enabled = v.into(); + self + } +} + +impl wkt::message::Message for DatabaseInstance { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DatabaseInstance" + } +} + +/// Defines additional types related to DatabaseInstance +pub mod database_instance { + #[allow(unused_imports)] + use super::*; + + + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct SqlFailoverReplica { + + /// The name of the failover replica. If specified at instance creation, a + /// failover replica is created for the instance. The name + /// doesn't include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// The availability status of the failover replica. A false status indicates + /// that the failover replica is out of sync. The primary instance can only + /// failover to the failover replica when the status is true. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub available: std::option::Option, + } + + impl SqlFailoverReplica { + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `available`. + pub fn set_available>>(mut self, v: T) -> Self { + self.available = v.into(); + self + } + } + + impl wkt::message::Message for SqlFailoverReplica { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica" + } + } + + /// Any scheduled maintenance for this instance. + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct SqlScheduledMaintenance { + + /// The start time of any upcoming scheduled maintenance for this instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub start_time: std::option::Option, + + pub can_defer: bool, + + /// If the scheduled maintenance can be rescheduled. + pub can_reschedule: bool, + + /// Maintenance cannot be rescheduled to start beyond this deadline. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub schedule_deadline_time: std::option::Option, + } + + impl SqlScheduledMaintenance { + + /// Sets the value of `start_time`. + pub fn set_start_time>>(mut self, v: T) -> Self { + self.start_time = v.into(); + self + } + + /// Sets the value of `can_defer`. + pub fn set_can_defer>(mut self, v: T) -> Self { + self.can_defer = v.into(); + self + } + + /// Sets the value of `can_reschedule`. + pub fn set_can_reschedule>(mut self, v: T) -> Self { + self.can_reschedule = v.into(); + self + } + + /// Sets the value of `schedule_deadline_time`. + pub fn set_schedule_deadline_time>>(mut self, v: T) -> Self { + self.schedule_deadline_time = v.into(); + self + } + } + + impl wkt::message::Message for SqlScheduledMaintenance { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance" + } + } + + /// This message wraps up the information written by out-of-disk detection job. + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct SqlOutOfDiskReport { + + /// This field represents the state generated by the proactive database + /// wellness job for OutOfDisk issues. + /// + /// * Writers: + /// * the proactive database wellness job for OOD. + /// * Readers: + /// * the proactive database wellness job + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub sql_out_of_disk_state: std::option::Option, + + /// The minimum recommended increase size in GigaBytes + /// This field is consumed by the frontend + /// + /// * Writers: + /// * the proactive database wellness job for OOD. + /// * Readers: + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub sql_min_recommended_increase_size_gb: std::option::Option, + } + + impl SqlOutOfDiskReport { + + /// Sets the value of `sql_out_of_disk_state`. + pub fn set_sql_out_of_disk_state>>(mut self, v: T) -> Self { + self.sql_out_of_disk_state = v.into(); + self + } + + /// Sets the value of `sql_min_recommended_increase_size_gb`. + pub fn set_sql_min_recommended_increase_size_gb>>(mut self, v: T) -> Self { + self.sql_min_recommended_increase_size_gb = v.into(); + self + } + } + + impl wkt::message::Message for SqlOutOfDiskReport { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport" + } + } + + /// Defines additional types related to SqlOutOfDiskReport + pub mod sql_out_of_disk_report { + #[allow(unused_imports)] + use super::*; + + + /// This enum lists all possible states regarding out-of-disk issues. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct SqlOutOfDiskState(std::string::String); + + impl SqlOutOfDiskState { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [SqlOutOfDiskState](SqlOutOfDiskState) + pub mod sql_out_of_disk_state { + + /// Unspecified state + pub const SQL_OUT_OF_DISK_STATE_UNSPECIFIED: &str = "SQL_OUT_OF_DISK_STATE_UNSPECIFIED"; + + /// The instance has plenty space on data disk + pub const NORMAL: &str = "NORMAL"; + + /// Data disk is almost used up. It is shutdown to prevent data + /// corruption. + pub const SOFT_SHUTDOWN: &str = "SOFT_SHUTDOWN"; + } + } + + /// The current serving state of the database instance. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct SqlInstanceState(std::string::String); + + impl SqlInstanceState { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [SqlInstanceState](SqlInstanceState) + pub mod sql_instance_state { + + /// The state of the instance is unknown. + pub const SQL_INSTANCE_STATE_UNSPECIFIED: &str = "SQL_INSTANCE_STATE_UNSPECIFIED"; + + /// The instance is running, or has been stopped by owner. + pub const RUNNABLE: &str = "RUNNABLE"; + + /// The instance is not available, for example due to problems with billing. + pub const SUSPENDED: &str = "SUSPENDED"; + + /// The instance is being deleted. + pub const PENDING_DELETE: &str = "PENDING_DELETE"; + + /// The instance is being created. + pub const PENDING_CREATE: &str = "PENDING_CREATE"; + + /// The instance is down for maintenance. + pub const MAINTENANCE: &str = "MAINTENANCE"; + + /// The creation of the instance failed or a fatal error occurred during + /// maintenance. + pub const FAILED: &str = "FAILED"; + + /// Deprecated + pub const ONLINE_MAINTENANCE: &str = "ONLINE_MAINTENANCE"; + } + + /// The SQL network architecture for the instance. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct SqlNetworkArchitecture(std::string::String); + + impl SqlNetworkArchitecture { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [SqlNetworkArchitecture](SqlNetworkArchitecture) + pub mod sql_network_architecture { + + pub const SQL_NETWORK_ARCHITECTURE_UNSPECIFIED: &str = "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED"; + + /// The instance uses the new network architecture. + pub const NEW_NETWORK_ARCHITECTURE: &str = "NEW_NETWORK_ARCHITECTURE"; + + /// The instance uses the old network architecture. + pub const OLD_NETWORK_ARCHITECTURE: &str = "OLD_NETWORK_ARCHITECTURE"; + } +} + +/// Gemini instance configuration. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct GeminiInstanceConfig { + + /// Output only. Whether Gemini is enabled. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub entitled: std::option::Option, + + /// Output only. Whether the vacuum management is enabled. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub google_vacuum_mgmt_enabled: std::option::Option, + + /// Output only. Whether canceling the out-of-memory (OOM) session is enabled. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub oom_session_cancel_enabled: std::option::Option, + + /// Output only. Whether the active query is enabled. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub active_query_enabled: std::option::Option, + + /// Output only. Whether the index advisor is enabled. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub index_advisor_enabled: std::option::Option, + + /// Output only. Whether the flag recommender is enabled. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub flag_recommender_enabled: std::option::Option, +} + +impl GeminiInstanceConfig { + + /// Sets the value of `entitled`. + pub fn set_entitled>>(mut self, v: T) -> Self { + self.entitled = v.into(); + self + } + + /// Sets the value of `google_vacuum_mgmt_enabled`. + pub fn set_google_vacuum_mgmt_enabled>>(mut self, v: T) -> Self { + self.google_vacuum_mgmt_enabled = v.into(); + self + } + + /// Sets the value of `oom_session_cancel_enabled`. + pub fn set_oom_session_cancel_enabled>>(mut self, v: T) -> Self { + self.oom_session_cancel_enabled = v.into(); + self + } + + /// Sets the value of `active_query_enabled`. + pub fn set_active_query_enabled>>(mut self, v: T) -> Self { + self.active_query_enabled = v.into(); + self + } + + /// Sets the value of `index_advisor_enabled`. + pub fn set_index_advisor_enabled>>(mut self, v: T) -> Self { + self.index_advisor_enabled = v.into(); + self + } + + /// Sets the value of `flag_recommender_enabled`. + pub fn set_flag_recommender_enabled>>(mut self, v: T) -> Self { + self.flag_recommender_enabled = v.into(); + self + } +} + +impl wkt::message::Message for GeminiInstanceConfig { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.GeminiInstanceConfig" + } +} + +/// A primary instance and disaster recovery (DR) replica pair. +/// A DR replica is a cross-region replica that you designate for failover in +/// the event that the primary instance experiences regional failure. +/// Only applicable to MySQL. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct ReplicationCluster { + + /// Output only. If set, it indicates this instance has a private service + /// access (PSA) dns endpoint that is pointing to the primary instance of the + /// cluster. If this instance is the primary, the dns should be pointing to + /// this instance. After Switchover or Replica failover, this DNS endpoint + /// points to the promoted instance. This is a read-only field, returned to the + /// user as information. This field can exist even if a standalone instance + /// does not yet have a replica, or had a DR replica that was deleted. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub psa_write_endpoint: std::string::String, + + /// Optional. If the instance is a primary instance, then this field identifies + /// the disaster recovery (DR) replica. A DR replica is an optional + /// configuration for Enterprise Plus edition instances. If the instance is a + /// read replica, then the field is not set. Set this field to a replica name + /// to designate a DR replica for a primary instance. Remove the replica name + /// to remove the DR replica designation. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub failover_dr_replica_name: std::string::String, + + /// Output only. Read-only field that indicates whether the replica is a DR + /// replica. This field is not set if the instance is a primary instance. + pub dr_replica: bool, +} + +impl ReplicationCluster { + + /// Sets the value of `psa_write_endpoint`. + pub fn set_psa_write_endpoint>(mut self, v: T) -> Self { + self.psa_write_endpoint = v.into(); + self + } + + /// Sets the value of `failover_dr_replica_name`. + pub fn set_failover_dr_replica_name>(mut self, v: T) -> Self { + self.failover_dr_replica_name = v.into(); + self + } + + /// Sets the value of `dr_replica`. + pub fn set_dr_replica>(mut self, v: T) -> Self { + self.dr_replica = v.into(); + self + } +} + +impl wkt::message::Message for ReplicationCluster { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ReplicationCluster" + } +} + +/// An available database version. It can be a major or a minor version. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct AvailableDatabaseVersion { + + /// The version's major version name. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub major_version: std::option::Option, + + /// The database version name. For MySQL 8.0, this string provides the database + /// major and minor version. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub name: std::option::Option, + + /// The database version's display name. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub display_name: std::option::Option, +} + +impl AvailableDatabaseVersion { + + /// Sets the value of `major_version`. + pub fn set_major_version>>(mut self, v: T) -> Self { + self.major_version = v.into(); + self + } + + /// Sets the value of `name`. + pub fn set_name>>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `display_name`. + pub fn set_display_name>>(mut self, v: T) -> Self { + self.display_name = v.into(); + self + } +} + +impl wkt::message::Message for AvailableDatabaseVersion { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.AvailableDatabaseVersion" + } +} + +/// Reschedule options for maintenance windows. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesRescheduleMaintenanceRequestBody { + + /// Required. The type of the reschedule the user wants. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub reschedule: std::option::Option, +} + +impl SqlInstancesRescheduleMaintenanceRequestBody { + + /// Sets the value of `reschedule`. + pub fn set_reschedule>>(mut self, v: T) -> Self { + self.reschedule = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesRescheduleMaintenanceRequestBody { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody" + } +} + +/// Defines additional types related to SqlInstancesRescheduleMaintenanceRequestBody +pub mod sql_instances_reschedule_maintenance_request_body { + #[allow(unused_imports)] + use super::*; + + + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct Reschedule { + + /// Required. The type of the reschedule. + pub reschedule_type: crate::model::sql_instances_reschedule_maintenance_request_body::RescheduleType, + + /// Optional. Timestamp when the maintenance shall be rescheduled to if + /// reschedule_type=SPECIFIC_TIME, in + /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + /// `2012-11-15T16:19:00.094Z`. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub schedule_time: std::option::Option, + } + + impl Reschedule { + + /// Sets the value of `reschedule_type`. + pub fn set_reschedule_type>(mut self, v: T) -> Self { + self.reschedule_type = v.into(); + self + } + + /// Sets the value of `schedule_time`. + pub fn set_schedule_time>>(mut self, v: T) -> Self { + self.schedule_time = v.into(); + self + } + } + + impl wkt::message::Message for Reschedule { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule" + } + } + + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct RescheduleType(std::string::String); + + impl RescheduleType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [RescheduleType](RescheduleType) + pub mod reschedule_type { + + pub const RESCHEDULE_TYPE_UNSPECIFIED: &str = "RESCHEDULE_TYPE_UNSPECIFIED"; + + /// Reschedules maintenance to happen now (within 5 minutes). + pub const IMMEDIATE: &str = "IMMEDIATE"; + + /// Reschedules maintenance to occur within one week from the originally + /// scheduled day and time. + pub const NEXT_AVAILABLE_WINDOW: &str = "NEXT_AVAILABLE_WINDOW"; + + /// Reschedules maintenance to a specific time and day. + pub const SPECIFIC_TIME: &str = "SPECIFIC_TIME"; + } +} + +/// Database instance demote primary instance context. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct DemoteMasterContext { + + /// This is always `sql#demoteMasterContext`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// Verify the GTID consistency for demote operation. Default value: + /// `True`. Setting this flag to `false` enables you to bypass the GTID + /// consistency check between on-premises primary instance and Cloud SQL + /// instance during the demotion operation but also exposes you to the risk of + /// future replication failures. Change the value only if you know the reason + /// for the GTID divergence and are confident that doing so will not cause any + /// replication issues. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub verify_gtid_consistency: std::option::Option, + + /// The name of the instance which will act as on-premises primary instance + /// in the replication setup. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub master_instance_name: std::string::String, + + /// Configuration specific to read-replicas replicating from the on-premises + /// primary instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub replica_configuration: std::option::Option, + + /// Flag to skip replication setup on the instance. + pub skip_replication_setup: bool, +} + +impl DemoteMasterContext { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `verify_gtid_consistency`. + pub fn set_verify_gtid_consistency>>(mut self, v: T) -> Self { + self.verify_gtid_consistency = v.into(); + self + } + + /// Sets the value of `master_instance_name`. + pub fn set_master_instance_name>(mut self, v: T) -> Self { + self.master_instance_name = v.into(); + self + } + + /// Sets the value of `replica_configuration`. + pub fn set_replica_configuration>>(mut self, v: T) -> Self { + self.replica_configuration = v.into(); + self + } + + /// Sets the value of `skip_replication_setup`. + pub fn set_skip_replication_setup>(mut self, v: T) -> Self { + self.skip_replication_setup = v.into(); + self + } +} + +impl wkt::message::Message for DemoteMasterContext { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DemoteMasterContext" + } +} + +/// This context is used to demote an existing standalone instance to be +/// a Cloud SQL read replica for an external database server. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct DemoteContext { + + /// This is always `sql#demoteContext`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// Required. The name of the instance which acts as the on-premises primary + /// instance in the replication setup. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub source_representative_instance_name: std::string::String, +} + +impl DemoteContext { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `source_representative_instance_name`. + pub fn set_source_representative_instance_name>(mut self, v: T) -> Self { + self.source_representative_instance_name = v.into(); + self + } +} + +impl wkt::message::Message for DemoteContext { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DemoteContext" + } +} + +/// Database instance failover context. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct FailoverContext { + + /// The current settings version of this instance. Request will be rejected if + /// this version doesn't match the current settings version. + #[serde_as(as = "serde_with::DisplayFromStr")] + pub settings_version: i64, + + /// This is always `sql#failoverContext`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, +} + +impl FailoverContext { + + /// Sets the value of `settings_version`. + pub fn set_settings_version>(mut self, v: T) -> Self { + self.settings_version = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } +} + +impl wkt::message::Message for FailoverContext { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.FailoverContext" + } +} + +/// Database instance restore from backup context. +/// Backup context contains source instance id and project id. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct RestoreBackupContext { + + /// This is always `sql#restoreBackupContext`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The ID of the backup run to restore from. + #[serde_as(as = "serde_with::DisplayFromStr")] + pub backup_run_id: i64, + + /// The ID of the instance that the backup was taken from. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance_id: std::string::String, + + /// The full project ID of the source instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl RestoreBackupContext { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `backup_run_id`. + pub fn set_backup_run_id>(mut self, v: T) -> Self { + self.backup_run_id = v.into(); + self + } + + /// Sets the value of `instance_id`. + pub fn set_instance_id>(mut self, v: T) -> Self { + self.instance_id = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for RestoreBackupContext { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.RestoreBackupContext" + } +} + +/// Instance rotate server CA context. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct RotateServerCaContext { + + /// This is always `sql#rotateServerCaContext`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The fingerprint of the next version to be rotated to. If left unspecified, + /// will be rotated to the most recently added server CA version. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub next_version: std::string::String, +} + +impl RotateServerCaContext { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `next_version`. + pub fn set_next_version>(mut self, v: T) -> Self { + self.next_version = v.into(); + self + } +} + +impl wkt::message::Message for RotateServerCaContext { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.RotateServerCaContext" + } +} + +/// Database Instance truncate log context. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct TruncateLogContext { + + /// This is always `sql#truncateLogContext`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The type of log to truncate. Valid values are `MYSQL_GENERAL_TABLE` and + /// `MYSQL_SLOW_TABLE`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub log_type: std::string::String, +} + +impl TruncateLogContext { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `log_type`. + pub fn set_log_type>(mut self, v: T) -> Self { + self.log_type = v.into(); + self + } +} + +impl wkt::message::Message for TruncateLogContext { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.TruncateLogContext" + } +} + +/// External primary instance migration setting error/warning. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlExternalSyncSettingError { + + /// Can be `sql#externalSyncSettingError` or + /// `sql#externalSyncSettingWarning`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// Identifies the specific error that occurred. + #[serde(rename = "type")] + pub r#type: crate::model::sql_external_sync_setting_error::SqlExternalSyncSettingErrorType, + + /// Additional information about the error encountered. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub detail: std::string::String, +} + +impl SqlExternalSyncSettingError { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `r#type`. + pub fn set_type>(mut self, v: T) -> Self { + self.r#type = v.into(); + self + } + + /// Sets the value of `detail`. + pub fn set_detail>(mut self, v: T) -> Self { + self.detail = v.into(); + self + } +} + +impl wkt::message::Message for SqlExternalSyncSettingError { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlExternalSyncSettingError" + } +} + +/// Defines additional types related to SqlExternalSyncSettingError +pub mod sql_external_sync_setting_error { + #[allow(unused_imports)] + use super::*; + + + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct SqlExternalSyncSettingErrorType(std::string::String); + + impl SqlExternalSyncSettingErrorType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [SqlExternalSyncSettingErrorType](SqlExternalSyncSettingErrorType) + pub mod sql_external_sync_setting_error_type { + + pub const SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED: &str = "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED"; + + pub const CONNECTION_FAILURE: &str = "CONNECTION_FAILURE"; + + pub const BINLOG_NOT_ENABLED: &str = "BINLOG_NOT_ENABLED"; + + pub const INCOMPATIBLE_DATABASE_VERSION: &str = "INCOMPATIBLE_DATABASE_VERSION"; + + pub const REPLICA_ALREADY_SETUP: &str = "REPLICA_ALREADY_SETUP"; + + /// The replication user is missing privileges that are required. + pub const INSUFFICIENT_PRIVILEGE: &str = "INSUFFICIENT_PRIVILEGE"; + + /// Unsupported migration type. + pub const UNSUPPORTED_MIGRATION_TYPE: &str = "UNSUPPORTED_MIGRATION_TYPE"; + + /// No pglogical extension installed on databases, applicable for postgres. + pub const NO_PGLOGICAL_INSTALLED: &str = "NO_PGLOGICAL_INSTALLED"; + + /// pglogical node already exists on databases, applicable for postgres. + pub const PGLOGICAL_NODE_ALREADY_EXISTS: &str = "PGLOGICAL_NODE_ALREADY_EXISTS"; + + /// The value of parameter wal_level is not set to logical. + pub const INVALID_WAL_LEVEL: &str = "INVALID_WAL_LEVEL"; + + /// The value of parameter shared_preload_libraries does not include + /// pglogical. + pub const INVALID_SHARED_PRELOAD_LIBRARY: &str = "INVALID_SHARED_PRELOAD_LIBRARY"; + + /// The value of parameter max_replication_slots is not sufficient. + pub const INSUFFICIENT_MAX_REPLICATION_SLOTS: &str = "INSUFFICIENT_MAX_REPLICATION_SLOTS"; + + /// The value of parameter max_wal_senders is not sufficient. + pub const INSUFFICIENT_MAX_WAL_SENDERS: &str = "INSUFFICIENT_MAX_WAL_SENDERS"; + + /// The value of parameter max_worker_processes is not sufficient. + pub const INSUFFICIENT_MAX_WORKER_PROCESSES: &str = "INSUFFICIENT_MAX_WORKER_PROCESSES"; + + /// Extensions installed are either not supported or having unsupported + /// versions. + pub const UNSUPPORTED_EXTENSIONS: &str = "UNSUPPORTED_EXTENSIONS"; + + /// The value of parameter rds.logical_replication is not set to 1. + pub const INVALID_RDS_LOGICAL_REPLICATION: &str = "INVALID_RDS_LOGICAL_REPLICATION"; + + /// The primary instance logging setup doesn't allow EM sync. + pub const INVALID_LOGGING_SETUP: &str = "INVALID_LOGGING_SETUP"; + + /// The primary instance database parameter setup doesn't allow EM sync. + pub const INVALID_DB_PARAM: &str = "INVALID_DB_PARAM"; + + /// The gtid_mode is not supported, applicable for MySQL. + pub const UNSUPPORTED_GTID_MODE: &str = "UNSUPPORTED_GTID_MODE"; + + /// SQL Server Agent is not running. + pub const SQLSERVER_AGENT_NOT_RUNNING: &str = "SQLSERVER_AGENT_NOT_RUNNING"; + + /// The table definition is not support due to missing primary key or replica + /// identity, applicable for postgres. + pub const UNSUPPORTED_TABLE_DEFINITION: &str = "UNSUPPORTED_TABLE_DEFINITION"; + + /// The customer has a definer that will break EM setup. + pub const UNSUPPORTED_DEFINER: &str = "UNSUPPORTED_DEFINER"; + + /// SQL Server @@SERVERNAME does not match actual host name. + pub const SQLSERVER_SERVERNAME_MISMATCH: &str = "SQLSERVER_SERVERNAME_MISMATCH"; + + /// The primary instance has been setup and will fail the setup. + pub const PRIMARY_ALREADY_SETUP: &str = "PRIMARY_ALREADY_SETUP"; + + /// The primary instance has unsupported binary log format. + pub const UNSUPPORTED_BINLOG_FORMAT: &str = "UNSUPPORTED_BINLOG_FORMAT"; + + /// The primary instance's binary log retention setting. + pub const BINLOG_RETENTION_SETTING: &str = "BINLOG_RETENTION_SETTING"; + + /// The primary instance has tables with unsupported storage engine. + pub const UNSUPPORTED_STORAGE_ENGINE: &str = "UNSUPPORTED_STORAGE_ENGINE"; + + /// Source has tables with limited support + /// eg: PostgreSQL tables without primary keys. + pub const LIMITED_SUPPORT_TABLES: &str = "LIMITED_SUPPORT_TABLES"; + + /// The replica instance contains existing data. + pub const EXISTING_DATA_IN_REPLICA: &str = "EXISTING_DATA_IN_REPLICA"; + + /// The replication user is missing privileges that are optional. + pub const MISSING_OPTIONAL_PRIVILEGES: &str = "MISSING_OPTIONAL_PRIVILEGES"; + + /// Additional BACKUP_ADMIN privilege is granted to the replication user + /// which may lock source MySQL 8 instance for DDLs during initial sync. + pub const RISKY_BACKUP_ADMIN_PRIVILEGE: &str = "RISKY_BACKUP_ADMIN_PRIVILEGE"; + + /// The Cloud Storage bucket is missing necessary permissions. + pub const INSUFFICIENT_GCS_PERMISSIONS: &str = "INSUFFICIENT_GCS_PERMISSIONS"; + + /// The Cloud Storage bucket has an error in the file or contains invalid + /// file information. + pub const INVALID_FILE_INFO: &str = "INVALID_FILE_INFO"; + + /// The source instance has unsupported database settings for migration. + pub const UNSUPPORTED_DATABASE_SETTINGS: &str = "UNSUPPORTED_DATABASE_SETTINGS"; + + /// The replication user is missing parallel import specific privileges. + /// (e.g. LOCK TABLES) for MySQL. + pub const MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE: &str = "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE"; + + /// The global variable local_infile is off on external server replica. + pub const LOCAL_INFILE_OFF: &str = "LOCAL_INFILE_OFF"; + + /// This code instructs customers to turn on point-in-time recovery manually + /// for the instance after promoting the Cloud SQL for PostgreSQL instance. + pub const TURN_ON_PITR_AFTER_PROMOTE: &str = "TURN_ON_PITR_AFTER_PROMOTE"; + + /// The minor version of replica database is incompatible with the source. + pub const INCOMPATIBLE_DATABASE_MINOR_VERSION: &str = "INCOMPATIBLE_DATABASE_MINOR_VERSION"; + + /// This warning message indicates that Cloud SQL uses the maximum number of + /// subscriptions to migrate data from the source to the destination. + pub const SOURCE_MAX_SUBSCRIPTIONS: &str = "SOURCE_MAX_SUBSCRIPTIONS"; + + /// Unable to verify definers on the source for MySQL. + pub const UNABLE_TO_VERIFY_DEFINERS: &str = "UNABLE_TO_VERIFY_DEFINERS"; + + /// If a time out occurs while the subscription counts are calculated, then + /// this value is set to 1. Otherwise, this value is set to 2. + pub const SUBSCRIPTION_CALCULATION_STATUS: &str = "SUBSCRIPTION_CALCULATION_STATUS"; + + /// Count of subscriptions needed to sync source data for PostgreSQL + /// database. + pub const PG_SUBSCRIPTION_COUNT: &str = "PG_SUBSCRIPTION_COUNT"; + + /// Final parallel level that is used to do migration. + pub const PG_SYNC_PARALLEL_LEVEL: &str = "PG_SYNC_PARALLEL_LEVEL"; + + /// The disk size of the replica instance is smaller than the data size of + /// the source instance. + pub const INSUFFICIENT_DISK_SIZE: &str = "INSUFFICIENT_DISK_SIZE"; + + /// The data size of the source instance is greater than 1 TB, the number of + /// cores of the replica instance is less than 8, and the memory of the + /// replica is less than 32 GB. + pub const INSUFFICIENT_MACHINE_TIER: &str = "INSUFFICIENT_MACHINE_TIER"; + + /// The warning message indicates the unsupported extensions will not be + /// migrated to the destination. + pub const UNSUPPORTED_EXTENSIONS_NOT_MIGRATED: &str = "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED"; + + /// The warning message indicates the pg_cron extension and settings will not + /// be migrated to the destination. + pub const EXTENSIONS_NOT_MIGRATED: &str = "EXTENSIONS_NOT_MIGRATED"; + + /// The error message indicates that pg_cron flags are enabled on the + /// destination which is not supported during the migration. + pub const PG_CRON_FLAG_ENABLED_IN_REPLICA: &str = "PG_CRON_FLAG_ENABLED_IN_REPLICA"; + + /// This error message indicates that the specified extensions are not + /// enabled on destination instance. For example, before you can migrate + /// data to the destination instance, you must enable the PGAudit extension + /// on the instance. + pub const EXTENSIONS_NOT_ENABLED_IN_REPLICA: &str = "EXTENSIONS_NOT_ENABLED_IN_REPLICA"; + + /// The source database has generated columns that can't be migrated. Please + /// change them to regular columns before migration. + pub const UNSUPPORTED_COLUMNS: &str = "UNSUPPORTED_COLUMNS"; + } +} + +/// On-premises instance configuration. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct OnPremisesConfiguration { + + /// The host and port of the on-premises instance in host:port format + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub host_port: std::string::String, + + /// This is always `sql#onPremisesConfiguration`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The username for connecting to on-premises instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub username: std::string::String, + + /// The password for connecting to on-premises instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub password: std::string::String, + + /// PEM representation of the trusted CA's x509 certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub ca_certificate: std::string::String, + + /// PEM representation of the replica's x509 certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub client_certificate: std::string::String, + + /// PEM representation of the replica's private key. The corresponsing public + /// key is encoded in the client's certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub client_key: std::string::String, + + /// The dump file to create the Cloud SQL replica. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub dump_file_path: std::string::String, + + /// The reference to Cloud SQL instance if the source is Cloud SQL. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub source_instance: std::option::Option, +} + +impl OnPremisesConfiguration { + + /// Sets the value of `host_port`. + pub fn set_host_port>(mut self, v: T) -> Self { + self.host_port = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `username`. + pub fn set_username>(mut self, v: T) -> Self { + self.username = v.into(); + self + } + + /// Sets the value of `password`. + pub fn set_password>(mut self, v: T) -> Self { + self.password = v.into(); + self + } + + /// Sets the value of `ca_certificate`. + pub fn set_ca_certificate>(mut self, v: T) -> Self { + self.ca_certificate = v.into(); + self + } + + /// Sets the value of `client_certificate`. + pub fn set_client_certificate>(mut self, v: T) -> Self { + self.client_certificate = v.into(); + self + } + + /// Sets the value of `client_key`. + pub fn set_client_key>(mut self, v: T) -> Self { + self.client_key = v.into(); + self + } + + /// Sets the value of `dump_file_path`. + pub fn set_dump_file_path>(mut self, v: T) -> Self { + self.dump_file_path = v.into(); + self + } + + /// Sets the value of `source_instance`. + pub fn set_source_instance>>(mut self, v: T) -> Self { + self.source_instance = v.into(); + self + } +} + +impl wkt::message::Message for OnPremisesConfiguration { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.OnPremisesConfiguration" + } +} + +/// Read-replica configuration for connecting to the primary instance. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct ReplicaConfiguration { + + /// This is always `sql#replicaConfiguration`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// MySQL specific configuration when replicating from a MySQL on-premises + /// primary instance. Replication configuration information such as the + /// username, password, certificates, and keys are not stored in the instance + /// metadata. The configuration information is used only to set up the + /// replication connection and is stored by MySQL in a file named + /// `master.info` in the data directory. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub mysql_replica_configuration: std::option::Option, + + /// Specifies if the replica is the failover target. If the field is set to + /// `true`, the replica will be designated as a failover replica. In case the + /// primary instance fails, the replica instance will be promoted as the new + /// primary instance. Only one replica can be specified as failover target, and + /// the replica has to be in different zone with the primary instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub failover_target: std::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. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub cascadable_replica: std::option::Option, +} + +impl ReplicaConfiguration { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `mysql_replica_configuration`. + pub fn set_mysql_replica_configuration>>(mut self, v: T) -> Self { + self.mysql_replica_configuration = v.into(); + self + } + + /// Sets the value of `failover_target`. + pub fn set_failover_target>>(mut self, v: T) -> Self { + self.failover_target = v.into(); + self + } + + /// Sets the value of `cascadable_replica`. + pub fn set_cascadable_replica>>(mut self, v: T) -> Self { + self.cascadable_replica = v.into(); + self + } +} + +impl wkt::message::Message for ReplicaConfiguration { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ReplicaConfiguration" + } +} + +/// Request to acquire a lease for SSRS. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesAcquireSsrsLeaseRequest { + + /// Required. Cloud SQL instance ID. This doesn't include the project ID. It's + /// composed of lowercase letters, numbers, and hyphens, and it must start with + /// a letter. The total length must be 98 characters or less (Example: + /// instance-id). + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Required. Project ID of the project that contains the instance (Example: + /// project-id). + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// Required. The request body. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlInstancesAcquireSsrsLeaseRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesAcquireSsrsLeaseRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest" + } +} + +/// Response for the acquire SSRS lease request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesAcquireSsrsLeaseResponse { + + /// The unique identifier for this operation. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub operation_id: std::string::String, +} + +impl SqlInstancesAcquireSsrsLeaseResponse { + + /// Sets the value of `operation_id`. + pub fn set_operation_id>(mut self, v: T) -> Self { + self.operation_id = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesAcquireSsrsLeaseResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse" + } +} + +/// Request to release a lease for SSRS. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesReleaseSsrsLeaseRequest { + + /// Required. The Cloud SQL instance ID. This doesn't include the project ID. + /// The instance ID contains lowercase letters, numbers, and hyphens, and it + /// must start with a letter. This ID can have a maximum length of 98 + /// characters. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Required. The project ID that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlInstancesReleaseSsrsLeaseRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesReleaseSsrsLeaseRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest" + } +} + +/// Response for the release SSRS lease request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlInstancesReleaseSsrsLeaseResponse { + + /// The unique identifier for this operation. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub operation_id: std::string::String, +} + +impl SqlInstancesReleaseSsrsLeaseResponse { + + /// Sets the value of `operation_id`. + pub fn set_operation_id>(mut self, v: T) -> Self { + self.operation_id = v.into(); + self + } +} + +impl wkt::message::Message for SqlInstancesReleaseSsrsLeaseResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse" + } +} + +/// Operations get request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlOperationsGetRequest { + + /// Instance operation ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub operation: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlOperationsGetRequest { + + /// Sets the value of `operation`. + pub fn set_operation>(mut self, v: T) -> Self { + self.operation = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlOperationsGetRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlOperationsGetRequest" + } +} + +/// Operations list request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlOperationsListRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Maximum number of operations per response. + pub max_results: u32, + + /// A previously-returned page token representing part of the larger set of + /// results to view. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub page_token: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlOperationsListRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `max_results`. + pub fn set_max_results>(mut self, v: T) -> Self { + self.max_results = v.into(); + self + } + + /// Sets the value of `page_token`. + pub fn set_page_token>(mut self, v: T) -> Self { + self.page_token = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlOperationsListRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlOperationsListRequest" + } +} + +/// Operations list response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct OperationsListResponse { + + /// This is always `sql#operationsList`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// List of operation resources. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub items: std::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. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub next_page_token: std::string::String, +} + +impl OperationsListResponse { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `items`. + pub fn set_items>>(mut self, v: T) -> Self { + self.items = v.into(); + self + } + + /// Sets the value of `next_page_token`. + pub fn set_next_page_token>(mut self, v: T) -> Self { + self.next_page_token = v.into(); + self + } +} + +impl wkt::message::Message for OperationsListResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.OperationsListResponse" + } +} + +/// Operations cancel request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlOperationsCancelRequest { + + /// Instance operation ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub operation: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlOperationsCancelRequest { + + /// Sets the value of `operation`. + pub fn set_operation>(mut self, v: T) -> Self { + self.operation = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlOperationsCancelRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlOperationsCancelRequest" + } +} + +/// An entry for an Access Control list. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct AclEntry { + + /// The allowlisted value for the access control list. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub value: std::string::String, + + /// The time when this access control entry expires in + /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + /// `2012-11-15T16:19:00.094Z`. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub expiration_time: std::option::Option, + + /// Optional. A label to identify this entry. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// This is always `sql#aclEntry`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, +} + +impl AclEntry { + + /// Sets the value of `value`. + pub fn set_value>(mut self, v: T) -> Self { + self.value = v.into(); + self + } + + /// Sets the value of `expiration_time`. + pub fn set_expiration_time>>(mut self, v: T) -> Self { + self.expiration_time = v.into(); + self + } + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } +} + +impl wkt::message::Message for AclEntry { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.AclEntry" + } +} + +/// An Admin API warning message. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct ApiWarning { + + /// Code to uniquely identify the warning type. + pub code: crate::model::api_warning::SqlApiWarningCode, + + /// The warning message. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub message: std::string::String, + + /// The region name for REGION_UNREACHABLE warning. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub region: std::string::String, +} + +impl ApiWarning { + + /// Sets the value of `code`. + pub fn set_code>(mut self, v: T) -> Self { + self.code = v.into(); + self + } + + /// Sets the value of `message`. + pub fn set_message>(mut self, v: T) -> Self { + self.message = v.into(); + self + } + + /// Sets the value of `region`. + pub fn set_region>(mut self, v: T) -> Self { + self.region = v.into(); + self + } +} + +impl wkt::message::Message for ApiWarning { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ApiWarning" + } +} + +/// Defines additional types related to ApiWarning +pub mod api_warning { + #[allow(unused_imports)] + use super::*; + + + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct SqlApiWarningCode(std::string::String); + + impl SqlApiWarningCode { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [SqlApiWarningCode](SqlApiWarningCode) + pub mod sql_api_warning_code { + + /// An unknown or unset warning type from Cloud SQL API. + pub const SQL_API_WARNING_CODE_UNSPECIFIED: &str = "SQL_API_WARNING_CODE_UNSPECIFIED"; + + /// Warning when one or more regions are not reachable. The returned result + /// set may be incomplete. + pub const REGION_UNREACHABLE: &str = "REGION_UNREACHABLE"; + + /// Warning when user provided maxResults parameter exceeds the limit. The + /// returned result set may be incomplete. + pub const MAX_RESULTS_EXCEEDS_LIMIT: &str = "MAX_RESULTS_EXCEEDS_LIMIT"; + + /// Warning when user tries to create/update a user with credentials that + /// have previously been compromised by a public data breach. + pub const COMPROMISED_CREDENTIALS: &str = "COMPROMISED_CREDENTIALS"; + + /// Warning when the operation succeeds but some non-critical workflow state + /// failed. + pub const INTERNAL_STATE_FAILURE: &str = "INTERNAL_STATE_FAILURE"; + } +} + +/// We currently only support backup retention by specifying the number +/// of backups we will retain. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct BackupRetentionSettings { + + /// The unit that 'retained_backups' represents. + pub retention_unit: crate::model::backup_retention_settings::RetentionUnit, + + /// Depending on the value of retention_unit, this is used to determine + /// if a backup needs to be deleted. If retention_unit is 'COUNT', we will + /// retain this many backups. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub retained_backups: std::option::Option, +} + +impl BackupRetentionSettings { + + /// Sets the value of `retention_unit`. + pub fn set_retention_unit>(mut self, v: T) -> Self { + self.retention_unit = v.into(); + self + } + + /// Sets the value of `retained_backups`. + pub fn set_retained_backups>>(mut self, v: T) -> Self { + self.retained_backups = v.into(); + self + } +} + +impl wkt::message::Message for BackupRetentionSettings { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.BackupRetentionSettings" + } +} + +/// Defines additional types related to BackupRetentionSettings +pub mod backup_retention_settings { + #[allow(unused_imports)] + use super::*; + + + /// The units that retained_backups specifies, we only support COUNT. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct RetentionUnit(std::string::String); + + impl RetentionUnit { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [RetentionUnit](RetentionUnit) + pub mod retention_unit { + + /// Backup retention unit is unspecified, will be treated as COUNT. + pub const RETENTION_UNIT_UNSPECIFIED: &str = "RETENTION_UNIT_UNSPECIFIED"; + + /// Retention will be by count, eg. "retain the most recent 7 backups". + pub const COUNT: &str = "COUNT"; + } +} + +/// Database instance backup configuration. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct BackupConfiguration { + + /// Start time for the daily backup configuration in UTC timezone in the 24 + /// hour format - `HH:MM`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub start_time: std::string::String, + + /// Whether this configuration is enabled. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub enabled: std::option::Option, + + /// This is always `sql#backupConfiguration`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// (MySQL only) Whether binary log is enabled. If backup configuration is + /// disabled, binarylog must be disabled as well. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub binary_log_enabled: std::option::Option, + + /// Reserved for future use. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub replication_log_archiving_enabled: std::option::Option, + + /// Location of the backup + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub location: std::string::String, + + /// Whether point in time recovery is enabled. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub point_in_time_recovery_enabled: std::option::Option, + + /// Backup retention settings. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub backup_retention_settings: std::option::Option, + + /// The number of days of transaction logs we retain for point in time + /// restore, from 1-7. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub transaction_log_retention_days: std::option::Option, + + /// Output only. This value contains the storage location of transactional logs + /// used to perform point-in-time recovery (PITR) for the database. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub transactional_log_storage_state: std::option::Option, +} + +impl BackupConfiguration { + + /// Sets the value of `start_time`. + pub fn set_start_time>(mut self, v: T) -> Self { + self.start_time = v.into(); + self + } + + /// Sets the value of `enabled`. + pub fn set_enabled>>(mut self, v: T) -> Self { + self.enabled = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `binary_log_enabled`. + pub fn set_binary_log_enabled>>(mut self, v: T) -> Self { + self.binary_log_enabled = v.into(); + self + } + + /// Sets the value of `replication_log_archiving_enabled`. + pub fn set_replication_log_archiving_enabled>>(mut self, v: T) -> Self { + self.replication_log_archiving_enabled = v.into(); + self + } + + /// Sets the value of `location`. + pub fn set_location>(mut self, v: T) -> Self { + self.location = v.into(); + self + } + + /// Sets the value of `point_in_time_recovery_enabled`. + pub fn set_point_in_time_recovery_enabled>>(mut self, v: T) -> Self { + self.point_in_time_recovery_enabled = v.into(); + self + } + + /// Sets the value of `backup_retention_settings`. + pub fn set_backup_retention_settings>>(mut self, v: T) -> Self { + self.backup_retention_settings = v.into(); + self + } + + /// Sets the value of `transaction_log_retention_days`. + pub fn set_transaction_log_retention_days>>(mut self, v: T) -> Self { + self.transaction_log_retention_days = v.into(); + self + } + + /// Sets the value of `transactional_log_storage_state`. + pub fn set_transactional_log_storage_state>>(mut self, v: T) -> Self { + self.transactional_log_storage_state = v.into(); + self + } +} + +impl wkt::message::Message for BackupConfiguration { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.BackupConfiguration" + } +} + +/// Defines additional types related to BackupConfiguration +pub mod backup_configuration { + #[allow(unused_imports)] + use super::*; + + + /// This value contains the storage location of the transactional logs + /// used to perform point-in-time recovery (PITR) for the database. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct TransactionalLogStorageState(std::string::String); + + impl TransactionalLogStorageState { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [TransactionalLogStorageState](TransactionalLogStorageState) + pub mod transactional_log_storage_state { + + /// Unspecified. + pub const TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED: &str = "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED"; + + /// The transaction logs used for PITR for the instance are stored + /// on a data disk. + pub const DISK: &str = "DISK"; + + /// The transaction logs used for PITR for the instance are switching from + /// being stored on a data disk to being stored in Cloud Storage. + /// Only applicable to MySQL. + pub const SWITCHING_TO_CLOUD_STORAGE: &str = "SWITCHING_TO_CLOUD_STORAGE"; + + /// The transaction logs used for PITR for the instance are now stored + /// in Cloud Storage. Previously, they were stored on a data disk. + /// Only applicable to MySQL. + pub const SWITCHED_TO_CLOUD_STORAGE: &str = "SWITCHED_TO_CLOUD_STORAGE"; + + /// The transaction logs used for PITR for the instance are stored in + /// Cloud Storage. Only applicable to MySQL and PostgreSQL. + pub const CLOUD_STORAGE: &str = "CLOUD_STORAGE"; + } +} + +/// Perform disk shrink context. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct PerformDiskShrinkContext { + + /// The target disk shrink size in GigaBytes. + #[serde_as(as = "serde_with::DisplayFromStr")] + pub target_size_gb: i64, +} + +impl PerformDiskShrinkContext { + + /// Sets the value of `target_size_gb`. + pub fn set_target_size_gb>(mut self, v: T) -> Self { + self.target_size_gb = v.into(); + self + } +} + +impl wkt::message::Message for PerformDiskShrinkContext { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.PerformDiskShrinkContext" + } +} + +/// Backup context. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct BackupContext { + + /// The identifier of the backup. + #[serde_as(as = "serde_with::DisplayFromStr")] + pub backup_id: i64, + + /// This is always `sql#backupContext`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, +} + +impl BackupContext { + + /// Sets the value of `backup_id`. + pub fn set_backup_id>(mut self, v: T) -> Self { + self.backup_id = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } +} + +impl wkt::message::Message for BackupContext { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.BackupContext" + } +} + +/// Represents a SQL database on the Cloud SQL instance. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct Database { + + /// This is always `sql#database`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The Cloud SQL charset value. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub charset: std::string::String, + + /// The Cloud SQL collation value. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub collation: std::string::String, + + /// This field is deprecated and will be removed from a future version of the + /// API. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub etag: std::string::String, + + /// The name of the database in the Cloud SQL instance. This does not include + /// the project ID or instance name. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// The name of the Cloud SQL instance. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// The URI of this resource. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub self_link: std::string::String, + + /// The project ID of the project containing the Cloud SQL database. The Google + /// apps domain is prefixed if applicable. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")] + pub database_details: std::option::Option, +} + +impl Database { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `charset`. + pub fn set_charset>(mut self, v: T) -> Self { + self.charset = v.into(); + self + } + + /// Sets the value of `collation`. + pub fn set_collation>(mut self, v: T) -> Self { + self.collation = v.into(); + self + } + + /// Sets the value of `etag`. + pub fn set_etag>(mut self, v: T) -> Self { + self.etag = v.into(); + self + } + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `self_link`. + pub fn set_self_link>(mut self, v: T) -> Self { + self.self_link = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `database_details`. + pub fn set_database_details>>(mut self, v: T) ->Self { + self.database_details = v.into(); + self + } +} + +impl wkt::message::Message for Database { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.Database" + } +} + +/// Defines additional types related to Database +pub mod database { + #[allow(unused_imports)] + use super::*; + + + #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(rename_all = "camelCase")] + #[non_exhaustive] + pub enum DatabaseDetails { + SqlserverDatabaseDetails(crate::model::SqlServerDatabaseDetails), + } +} + +/// Represents a Sql Server database on the Cloud SQL instance. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlServerDatabaseDetails { + + /// The version of SQL Server with which the database is to be made compatible + pub compatibility_level: i32, + + /// The recovery model of a SQL Server database + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub recovery_model: std::string::String, +} + +impl SqlServerDatabaseDetails { + + /// Sets the value of `compatibility_level`. + pub fn set_compatibility_level>(mut self, v: T) -> Self { + self.compatibility_level = v.into(); + self + } + + /// Sets the value of `recovery_model`. + pub fn set_recovery_model>(mut self, v: T) -> Self { + self.recovery_model = v.into(); + self + } +} + +impl wkt::message::Message for SqlServerDatabaseDetails { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlServerDatabaseDetails" + } +} + +/// Database flags for Cloud SQL instances. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct DatabaseFlags { + + /// The name of the flag. These flags are passed at instance startup, so + /// include both server options and system variables. Flags are + /// specified with underscores, not hyphens. For more information, see + /// [Configuring Database Flags](https://cloud.google.com/sql/docs/mysql/flags) + /// in the Cloud SQL documentation. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// The value of the flag. Boolean flags are set to `on` for true + /// and `off` for false. This field must be omitted if the flag + /// doesn't take a value. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub value: std::string::String, +} + +impl DatabaseFlags { + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `value`. + pub fn set_value>(mut self, v: T) -> Self { + self.value = v.into(); + self + } +} + +impl wkt::message::Message for DatabaseFlags { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DatabaseFlags" + } +} + +/// MySQL-specific external server sync settings. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct MySqlSyncConfig { + + /// Flags to use for the initial dump. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub initial_sync_flags: std::vec::Vec, +} + +impl MySqlSyncConfig { + + /// Sets the value of `initial_sync_flags`. + pub fn set_initial_sync_flags>>(mut self, v: T) -> Self { + self.initial_sync_flags = v.into(); + self + } +} + +impl wkt::message::Message for MySqlSyncConfig { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.MySqlSyncConfig" + } +} + +/// Initial sync flags for certain Cloud SQL APIs. +/// Currently used for the MySQL external server initial dump. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SyncFlags { + + /// The name of the flag. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// The value of the flag. This field must be omitted if the flag + /// doesn't take a value. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub value: std::string::String, +} + +impl SyncFlags { + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `value`. + pub fn set_value>(mut self, v: T) -> Self { + self.value = v.into(); + self + } +} + +impl wkt::message::Message for SyncFlags { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SyncFlags" + } +} + +/// Reference to another Cloud SQL instance. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InstanceReference { + + /// The name of the Cloud SQL instance being referenced. + /// This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// The region of the Cloud SQL instance being referenced. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub region: std::string::String, + + /// The project ID of the Cloud SQL instance being referenced. + /// The default is the same project ID as the instance references it. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl InstanceReference { + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `region`. + pub fn set_region>(mut self, v: T) -> Self { + self.region = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for InstanceReference { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InstanceReference" + } +} + +/// Read-replica configuration for connecting to the on-premises primary +/// instance. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct DemoteMasterConfiguration { + + /// This is always `sql#demoteMasterConfiguration`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// MySQL specific configuration when replicating from a MySQL on-premises + /// primary instance. Replication configuration information such as the + /// username, password, certificates, and keys are not stored in the instance + /// metadata. The configuration information is used only to set up the + /// replication connection and is stored by MySQL in a file named + /// `master.info` in the data directory. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub mysql_replica_configuration: std::option::Option, +} + +impl DemoteMasterConfiguration { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `mysql_replica_configuration`. + pub fn set_mysql_replica_configuration>>(mut self, v: T) -> Self { + self.mysql_replica_configuration = v.into(); + self + } +} + +impl wkt::message::Message for DemoteMasterConfiguration { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DemoteMasterConfiguration" + } +} + +/// Read-replica configuration specific to MySQL databases. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct DemoteMasterMySqlReplicaConfiguration { + + /// This is always `sql#demoteMasterMysqlReplicaConfiguration`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The username for the replication connection. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub username: std::string::String, + + /// The password for the replication connection. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub password: std::string::String, + + /// PEM representation of the replica's private key. The corresponsing public + /// key is encoded in the client's certificate. The format of the replica's + /// private key can be either PKCS #1 or PKCS #8. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub client_key: std::string::String, + + /// PEM representation of the replica's x509 certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub client_certificate: std::string::String, + + /// PEM representation of the trusted CA's x509 certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub ca_certificate: std::string::String, +} + +impl DemoteMasterMySqlReplicaConfiguration { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `username`. + pub fn set_username>(mut self, v: T) -> Self { + self.username = v.into(); + self + } + + /// Sets the value of `password`. + pub fn set_password>(mut self, v: T) -> Self { + self.password = v.into(); + self + } + + /// Sets the value of `client_key`. + pub fn set_client_key>(mut self, v: T) -> Self { + self.client_key = v.into(); + self + } + + /// Sets the value of `client_certificate`. + pub fn set_client_certificate>(mut self, v: T) -> Self { + self.client_certificate = v.into(); + self + } + + /// Sets the value of `ca_certificate`. + pub fn set_ca_certificate>(mut self, v: T) -> Self { + self.ca_certificate = v.into(); + self + } +} + +impl wkt::message::Message for DemoteMasterMySqlReplicaConfiguration { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration" + } +} + +/// Database instance export context. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct ExportContext { + + /// The path to the file in Google Cloud Storage where the export will be + /// stored. The URI is in the form `gs://bucketName/fileName`. If the file + /// already exists, the request succeeds, but the operation fails. If + /// `fileType` is `SQL` and the filename ends with .gz, + /// the contents are compressed. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub uri: std::string::String, + + /// Databases to be exported.
`MySQL instances:` If + /// `fileType` is `SQL` and no database is specified, all + /// databases are exported, except for the `mysql` system database. + /// If `fileType` is `CSV`, you can specify one database, + /// either by using this property or by using the + /// `csvExportOptions.selectQuery` property, which takes precedence + /// over this property.
`PostgreSQL instances:` You must specify + /// one database to be exported. If `fileType` is `CSV`, + /// this database must match the one specified in the + /// `csvExportOptions.selectQuery` property.
`SQL Server + /// instances:` You must specify one database to be exported, and the + /// `fileType` must be `BAK`. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub databases: std::vec::Vec, + + /// This is always `sql#exportContext`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// Options for exporting data as SQL statements. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub sql_export_options: std::option::Option, + + /// Options for exporting data as CSV. `MySQL` and `PostgreSQL` + /// instances only. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub csv_export_options: std::option::Option, + + /// The file type for the specified uri. + pub file_type: crate::model::SqlFileType, + + /// Option for export offload. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub offload: std::option::Option, + + /// Options for exporting data as BAK files. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub bak_export_options: std::option::Option, +} + +impl ExportContext { + + /// Sets the value of `uri`. + pub fn set_uri>(mut self, v: T) -> Self { + self.uri = v.into(); + self + } + + /// Sets the value of `databases`. + pub fn set_databases>>(mut self, v: T) -> Self { + self.databases = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `sql_export_options`. + pub fn set_sql_export_options>>(mut self, v: T) -> Self { + self.sql_export_options = v.into(); + self + } + + /// Sets the value of `csv_export_options`. + pub fn set_csv_export_options>>(mut self, v: T) -> Self { + self.csv_export_options = v.into(); + self + } + + /// Sets the value of `file_type`. + pub fn set_file_type>(mut self, v: T) -> Self { + self.file_type = v.into(); + self + } + + /// Sets the value of `offload`. + pub fn set_offload>>(mut self, v: T) -> Self { + self.offload = v.into(); + self + } + + /// Sets the value of `bak_export_options`. + pub fn set_bak_export_options>>(mut self, v: T) -> Self { + self.bak_export_options = v.into(); + self + } +} + +impl wkt::message::Message for ExportContext { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ExportContext" + } +} + +/// Defines additional types related to ExportContext +pub mod export_context { + #[allow(unused_imports)] + use super::*; + + + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct SqlCsvExportOptions { + + /// The select query used to extract the data. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub select_query: std::string::String, + + /// Specifies the character that should appear before a data character that + /// needs to be escaped. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub escape_character: std::string::String, + + /// Specifies the quoting character to be used when a data value is quoted. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub quote_character: std::string::String, + + /// Specifies the character that separates columns within each row (line) of + /// the file. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub fields_terminated_by: std::string::String, + + /// This is used to separate lines. If a line does not contain all fields, + /// the rest of the columns are set to their default values. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub lines_terminated_by: std::string::String, + } + + impl SqlCsvExportOptions { + + /// Sets the value of `select_query`. + pub fn set_select_query>(mut self, v: T) -> Self { + self.select_query = v.into(); + self + } + + /// Sets the value of `escape_character`. + pub fn set_escape_character>(mut self, v: T) -> Self { + self.escape_character = v.into(); + self + } + + /// Sets the value of `quote_character`. + pub fn set_quote_character>(mut self, v: T) -> Self { + self.quote_character = v.into(); + self + } + + /// Sets the value of `fields_terminated_by`. + pub fn set_fields_terminated_by>(mut self, v: T) -> Self { + self.fields_terminated_by = v.into(); + self + } + + /// Sets the value of `lines_terminated_by`. + pub fn set_lines_terminated_by>(mut self, v: T) -> Self { + self.lines_terminated_by = v.into(); + self + } + } + + impl wkt::message::Message for SqlCsvExportOptions { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlCsvExportOptions" + } + } + + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct SqlExportOptions { + + /// Tables to export, or that were exported, from the specified database. If + /// you specify tables, specify one and only one database. For PostgreSQL + /// instances, you can specify only one table. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub tables: std::vec::Vec, + + /// Export only schemas. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub schema_only: std::option::Option, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub mysql_export_options: std::option::Option, + + /// Optional. The number of threads to use for parallel export. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub threads: std::option::Option, + + /// Optional. Whether or not the export should be parallel. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub parallel: std::option::Option, + + /// Optional. Options for exporting from a Cloud SQL for PostgreSQL instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub postgres_export_options: std::option::Option, + } + + impl SqlExportOptions { + + /// Sets the value of `tables`. + pub fn set_tables>>(mut self, v: T) -> Self { + self.tables = v.into(); + self + } + + /// Sets the value of `schema_only`. + pub fn set_schema_only>>(mut self, v: T) -> Self { + self.schema_only = v.into(); + self + } + + /// Sets the value of `mysql_export_options`. + pub fn set_mysql_export_options>>(mut self, v: T) -> Self { + self.mysql_export_options = v.into(); + self + } + + /// Sets the value of `threads`. + pub fn set_threads>>(mut self, v: T) -> Self { + self.threads = v.into(); + self + } + + /// Sets the value of `parallel`. + pub fn set_parallel>>(mut self, v: T) -> Self { + self.parallel = v.into(); + self + } + + /// Sets the value of `postgres_export_options`. + pub fn set_postgres_export_options>>(mut self, v: T) -> Self { + self.postgres_export_options = v.into(); + self + } + } + + impl wkt::message::Message for SqlExportOptions { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlExportOptions" + } + } + + /// Defines additional types related to SqlExportOptions + pub mod sql_export_options { + #[allow(unused_imports)] + use super::*; + + + /// Options for exporting from MySQL. + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct MysqlExportOptions { + + /// Option to include SQL statement required to set up replication. If set + /// to `1`, the dump file includes a CHANGE MASTER TO statement with the + /// binary log coordinates, and --set-gtid-purged is set to ON. If set to + /// `2`, the CHANGE MASTER TO statement is written as a SQL comment and + /// has no effect. If set to any value other than `1`, --set-gtid-purged + /// is set to OFF. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub master_data: std::option::Option, + } + + impl MysqlExportOptions { + + /// Sets the value of `master_data`. + pub fn set_master_data>>(mut self, v: T) -> Self { + self.master_data = v.into(); + self + } + } + + impl wkt::message::Message for MysqlExportOptions { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions" + } + } + + /// Options for exporting from a Cloud SQL for PostgreSQL instance. + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct PostgresExportOptions { + + /// Optional. Use this option to include DROP SQL statements. + /// These statements are used to delete database objects before running the + /// import operation. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub clean: std::option::Option, + + /// Optional. Option to include an IF EXISTS SQL statement with each DROP + /// statement produced by clean. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub if_exists: std::option::Option, + } + + impl PostgresExportOptions { + + /// Sets the value of `clean`. + pub fn set_clean>>(mut self, v: T) -> Self { + self.clean = v.into(); + self + } + + /// Sets the value of `if_exists`. + pub fn set_if_exists>>(mut self, v: T) -> Self { + self.if_exists = v.into(); + self + } + } + + impl wkt::message::Message for PostgresExportOptions { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions" + } + } + } + + /// Options for exporting BAK files (SQL Server-only) + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct SqlBakExportOptions { + + /// Whether or not the export should be striped. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub striped: std::option::Option, + + /// Option for specifying how many stripes to use for the export. + /// If blank, and the value of the striped field is true, + /// the number of stripes is automatically chosen. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub stripe_count: std::option::Option, + + /// Type of this bak file will be export, FULL or DIFF, SQL Server only + pub bak_type: crate::model::BakType, + + /// Deprecated: copy_only is deprecated. Use differential_base instead + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub copy_only: std::option::Option, + + /// Whether or not the backup can be used as a differential base + /// copy_only backup can not be served as differential base + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub differential_base: std::option::Option, + } + + impl SqlBakExportOptions { + + /// Sets the value of `striped`. + pub fn set_striped>>(mut self, v: T) -> Self { + self.striped = v.into(); + self + } + + /// Sets the value of `stripe_count`. + pub fn set_stripe_count>>(mut self, v: T) -> Self { + self.stripe_count = v.into(); + self + } + + /// Sets the value of `bak_type`. + pub fn set_bak_type>(mut self, v: T) -> Self { + self.bak_type = v.into(); + self + } + + /// Sets the value of `copy_only`. + pub fn set_copy_only>>(mut self, v: T) -> Self { + self.copy_only = v.into(); + self + } + + /// Sets the value of `differential_base`. + pub fn set_differential_base>>(mut self, v: T) -> Self { + self.differential_base = v.into(); + self + } + } + + impl wkt::message::Message for SqlBakExportOptions { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlBakExportOptions" + } + } +} + +/// Database instance import context. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct ImportContext { + + /// Path to the import file in Cloud Storage, in the form + /// `gs://bucketName/fileName`. Compressed gzip files (.gz) are supported + /// when `fileType` is `SQL`. The instance must have + /// write permissions to the bucket and read access to the file. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub uri: std::string::String, + + /// The target database for the import. If `fileType` is `SQL`, this field + /// is required only if the import file does not specify a database, and is + /// overridden by any database specification in the import file. If + /// `fileType` is `CSV`, one database must be specified. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub database: std::string::String, + + /// This is always `sql#importContext`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The file type for the specified uri.\`SQL`: The file + /// contains SQL statements. \`CSV`: The file contains CSV data. + pub file_type: crate::model::SqlFileType, + + /// Options for importing data as CSV. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub csv_import_options: std::option::Option, + + /// The PostgreSQL user for this import operation. PostgreSQL instances only. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub import_user: std::string::String, + + /// Import parameters specific to SQL Server .BAK files + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub bak_import_options: std::option::Option, + + /// Optional. Options for importing data from SQL statements. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub sql_import_options: std::option::Option, +} + +impl ImportContext { + + /// Sets the value of `uri`. + pub fn set_uri>(mut self, v: T) -> Self { + self.uri = v.into(); + self + } + + /// Sets the value of `database`. + pub fn set_database>(mut self, v: T) -> Self { + self.database = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `file_type`. + pub fn set_file_type>(mut self, v: T) -> Self { + self.file_type = v.into(); + self + } + + /// Sets the value of `csv_import_options`. + pub fn set_csv_import_options>>(mut self, v: T) -> Self { + self.csv_import_options = v.into(); + self + } + + /// Sets the value of `import_user`. + pub fn set_import_user>(mut self, v: T) -> Self { + self.import_user = v.into(); + self + } + + /// Sets the value of `bak_import_options`. + pub fn set_bak_import_options>>(mut self, v: T) -> Self { + self.bak_import_options = v.into(); + self + } + + /// Sets the value of `sql_import_options`. + pub fn set_sql_import_options>>(mut self, v: T) -> Self { + self.sql_import_options = v.into(); + self + } +} + +impl wkt::message::Message for ImportContext { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ImportContext" + } +} + +/// Defines additional types related to ImportContext +pub mod import_context { + #[allow(unused_imports)] + use super::*; + + + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct SqlImportOptions { + + /// Optional. The number of threads to use for parallel import. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub threads: std::option::Option, + + /// Optional. Whether or not the import should be parallel. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub parallel: std::option::Option, + + /// Optional. Options for importing from a Cloud SQL for PostgreSQL instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub postgres_import_options: std::option::Option, + } + + impl SqlImportOptions { + + /// Sets the value of `threads`. + pub fn set_threads>>(mut self, v: T) -> Self { + self.threads = v.into(); + self + } + + /// Sets the value of `parallel`. + pub fn set_parallel>>(mut self, v: T) -> Self { + self.parallel = v.into(); + self + } + + /// Sets the value of `postgres_import_options`. + pub fn set_postgres_import_options>>(mut self, v: T) -> Self { + self.postgres_import_options = v.into(); + self + } + } + + impl wkt::message::Message for SqlImportOptions { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlImportOptions" + } + } + + /// Defines additional types related to SqlImportOptions + pub mod sql_import_options { + #[allow(unused_imports)] + use super::*; + + + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct PostgresImportOptions { + + /// Optional. The --clean flag for the pg_restore utility. This flag + /// applies only if you enabled Cloud SQL to import files in parallel. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub clean: std::option::Option, + + /// Optional. The --if-exists flag for the pg_restore utility. This flag + /// applies only if you enabled Cloud SQL to import files in parallel. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub if_exists: std::option::Option, + } + + impl PostgresImportOptions { + + /// Sets the value of `clean`. + pub fn set_clean>>(mut self, v: T) -> Self { + self.clean = v.into(); + self + } + + /// Sets the value of `if_exists`. + pub fn set_if_exists>>(mut self, v: T) -> Self { + self.if_exists = v.into(); + self + } + } + + impl wkt::message::Message for PostgresImportOptions { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions" + } + } + } + + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct SqlCsvImportOptions { + + /// The table to which CSV data is imported. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub table: std::string::String, + + /// The columns to which CSV data is imported. If not specified, all columns + /// of the database table are loaded with CSV data. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub columns: std::vec::Vec, + + /// Specifies the character that should appear before a data character that + /// needs to be escaped. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub escape_character: std::string::String, + + /// Specifies the quoting character to be used when a data value is quoted. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub quote_character: std::string::String, + + /// Specifies the character that separates columns within each row (line) of + /// the file. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub fields_terminated_by: std::string::String, + + /// This is used to separate lines. If a line does not contain all fields, + /// the rest of the columns are set to their default values. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub lines_terminated_by: std::string::String, + } + + impl SqlCsvImportOptions { + + /// Sets the value of `table`. + pub fn set_table>(mut self, v: T) -> Self { + self.table = v.into(); + self + } + + /// Sets the value of `columns`. + pub fn set_columns>>(mut self, v: T) -> Self { + self.columns = v.into(); + self + } + + /// Sets the value of `escape_character`. + pub fn set_escape_character>(mut self, v: T) -> Self { + self.escape_character = v.into(); + self + } + + /// Sets the value of `quote_character`. + pub fn set_quote_character>(mut self, v: T) -> Self { + self.quote_character = v.into(); + self + } + + /// Sets the value of `fields_terminated_by`. + pub fn set_fields_terminated_by>(mut self, v: T) -> Self { + self.fields_terminated_by = v.into(); + self + } + + /// Sets the value of `lines_terminated_by`. + pub fn set_lines_terminated_by>(mut self, v: T) -> Self { + self.lines_terminated_by = v.into(); + self + } + } + + impl wkt::message::Message for SqlCsvImportOptions { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlCsvImportOptions" + } + } + + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct SqlBakImportOptions { + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub encryption_options: std::option::Option, + + /// Whether or not the backup set being restored is striped. + /// Applies only to Cloud SQL for SQL Server. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub striped: std::option::Option, + + /// Whether or not the backup importing will restore database + /// with NORECOVERY option + /// Applies only to Cloud SQL for SQL Server. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub no_recovery: std::option::Option, + + /// Whether or not the backup importing request will just bring database + /// online without downloading Bak content only one of "no_recovery" and + /// "recovery_only" can be true otherwise error will return. Applies only to + /// Cloud SQL for SQL Server. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub recovery_only: std::option::Option, + + /// Type of the bak content, FULL or DIFF + pub bak_type: crate::model::BakType, + + /// Optional. The timestamp when the import should stop. This timestamp is in + /// the [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, + /// `2023-10-01T16:19:00.094`). This field is equivalent to the STOPAT + /// keyword and applies to Cloud SQL for SQL Server only. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub stop_at: std::option::Option, + + /// 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. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub stop_at_mark: std::string::String, + } + + impl SqlBakImportOptions { + + /// Sets the value of `encryption_options`. + pub fn set_encryption_options>>(mut self, v: T) -> Self { + self.encryption_options = v.into(); + self + } + + /// Sets the value of `striped`. + pub fn set_striped>>(mut self, v: T) -> Self { + self.striped = v.into(); + self + } + + /// Sets the value of `no_recovery`. + pub fn set_no_recovery>>(mut self, v: T) -> Self { + self.no_recovery = v.into(); + self + } + + /// Sets the value of `recovery_only`. + pub fn set_recovery_only>>(mut self, v: T) -> Self { + self.recovery_only = v.into(); + self + } + + /// Sets the value of `bak_type`. + pub fn set_bak_type>(mut self, v: T) -> Self { + self.bak_type = v.into(); + self + } + + /// Sets the value of `stop_at`. + pub fn set_stop_at>>(mut self, v: T) -> Self { + self.stop_at = v.into(); + self + } + + /// Sets the value of `stop_at_mark`. + pub fn set_stop_at_mark>(mut self, v: T) -> Self { + self.stop_at_mark = v.into(); + self + } + } + + impl wkt::message::Message for SqlBakImportOptions { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlBakImportOptions" + } + } + + /// Defines additional types related to SqlBakImportOptions + pub mod sql_bak_import_options { + #[allow(unused_imports)] + use super::*; + + + #[serde_with::serde_as] + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(default, rename_all = "camelCase")] + #[non_exhaustive] + pub struct EncryptionOptions { + + /// Path to the Certificate (.cer) in Cloud Storage, in the form + /// `gs://bucketName/fileName`. The instance must have + /// write permissions to the bucket and read access to the file. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub cert_path: std::string::String, + + /// Path to the Certificate Private Key (.pvk) in Cloud Storage, in the + /// form `gs://bucketName/fileName`. The instance must have + /// write permissions to the bucket and read access to the file. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub pvk_path: std::string::String, + + /// Password that encrypts the private key + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub pvk_password: std::string::String, + } + + impl EncryptionOptions { + + /// Sets the value of `cert_path`. + pub fn set_cert_path>(mut self, v: T) -> Self { + self.cert_path = v.into(); + self + } + + /// Sets the value of `pvk_path`. + pub fn set_pvk_path>(mut self, v: T) -> Self { + self.pvk_path = v.into(); + self + } + + /// Sets the value of `pvk_password`. + pub fn set_pvk_password>(mut self, v: T) -> Self { + self.pvk_password = v.into(); + self + } + } + + impl wkt::message::Message for EncryptionOptions { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions" + } + } + } +} + +/// IP Management configuration. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct IpConfiguration { + + /// Whether the instance is assigned a public IP address or not. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub ipv4_enabled: std::option::Option, + + /// The resource link for the VPC network from which the Cloud SQL instance is + /// accessible for private IP. For example, + /// `/projects/myProject/global/networks/default`. This setting can + /// be updated, but it cannot be removed after it is set. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub private_network: std::string::String, + + /// Use `ssl_mode` instead. + /// + /// Whether SSL/TLS connections over IP are enforced. + /// If set to false, then allow both non-SSL/non-TLS and SSL/TLS connections. + /// For SSL/TLS connections, the client certificate won't be verified. If + /// set to true, then only allow connections encrypted with SSL/TLS and with + /// valid client certificates. If you want to enforce SSL/TLS without enforcing + /// the requirement for valid client certificates, then use the `ssl_mode` flag + /// instead of the `require_ssl` flag. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub require_ssl: std::option::Option, + + /// The list of external networks that are allowed to connect to the instance + /// using the IP. In 'CIDR' notation, also known as 'slash' notation (for + /// example: `157.197.200.0/24`). + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub authorized_networks: std::vec::Vec, + + /// The name of the allocated ip range for the private ip Cloud SQL instance. + /// For example: "google-managed-services-default". If set, the instance ip + /// will be created in the allocated range. The range name must comply with + /// [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name + /// must be 1-63 characters long and match the regular expression + /// `[a-z]([-a-z0-9]*[a-z0-9])?.` + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub allocated_ip_range: std::string::String, + + /// Controls connectivity to private IP instances from Google services, + /// such as BigQuery. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub enable_private_path_for_google_cloud_services: std::option::Option, + + /// Specify how SSL/TLS is enforced in database connections. If you must use + /// the `require_ssl` flag for backward compatibility, then only the following + /// value pairs are valid: + /// + /// For PostgreSQL and MySQL: + /// + /// * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false` + /// * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=false` + /// * `ssl_mode=TRUSTED_CLIENT_CERTIFICATE_REQUIRED` and `require_ssl=true` + /// + /// For SQL Server: + /// + /// * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false` + /// * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=true` + /// + /// The value of `ssl_mode` has priority over the value of `require_ssl`. + /// + /// For example, for the pair `ssl_mode=ENCRYPTED_ONLY` and + /// `require_ssl=false`, `ssl_mode=ENCRYPTED_ONLY` means accept only SSL + /// connections, while `require_ssl=false` means accept both non-SSL + /// and SSL connections. In this case, MySQL and PostgreSQL databases respect + /// `ssl_mode` and accepts only SSL connections. + pub ssl_mode: crate::model::ip_configuration::SslMode, + + /// PSC settings for this instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub psc_config: std::option::Option, + + /// Specify what type of CA is used for the server certificate. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub server_ca_mode: std::option::Option, +} + +impl IpConfiguration { + + /// Sets the value of `ipv4_enabled`. + pub fn set_ipv4_enabled>>(mut self, v: T) -> Self { + self.ipv4_enabled = v.into(); + self + } + + /// Sets the value of `private_network`. + pub fn set_private_network>(mut self, v: T) -> Self { + self.private_network = v.into(); + self + } + + /// Sets the value of `require_ssl`. + pub fn set_require_ssl>>(mut self, v: T) -> Self { + self.require_ssl = v.into(); + self + } + + /// Sets the value of `authorized_networks`. + pub fn set_authorized_networks>>(mut self, v: T) -> Self { + self.authorized_networks = v.into(); + self + } + + /// Sets the value of `allocated_ip_range`. + pub fn set_allocated_ip_range>(mut self, v: T) -> Self { + self.allocated_ip_range = v.into(); + self + } + + /// Sets the value of `enable_private_path_for_google_cloud_services`. + pub fn set_enable_private_path_for_google_cloud_services>>(mut self, v: T) -> Self { + self.enable_private_path_for_google_cloud_services = v.into(); + self + } + + /// Sets the value of `ssl_mode`. + pub fn set_ssl_mode>(mut self, v: T) -> Self { + self.ssl_mode = v.into(); + self + } + + /// Sets the value of `psc_config`. + pub fn set_psc_config>>(mut self, v: T) -> Self { + self.psc_config = v.into(); + self + } + + /// Sets the value of `server_ca_mode`. + pub fn set_server_ca_mode>>(mut self, v: T) -> Self { + self.server_ca_mode = v.into(); + self + } +} + +impl wkt::message::Message for IpConfiguration { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.IpConfiguration" + } +} + +/// Defines additional types related to IpConfiguration +pub mod ip_configuration { + #[allow(unused_imports)] + use super::*; + + + /// The SSL options for database connections. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct SslMode(std::string::String); + + impl SslMode { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [SslMode](SslMode) + pub mod ssl_mode { + + /// The SSL mode is unknown. + pub const SSL_MODE_UNSPECIFIED: &str = "SSL_MODE_UNSPECIFIED"; + + /// Allow non-SSL/non-TLS and SSL/TLS connections. + /// For SSL connections to MySQL and PostgreSQL, the client certificate + /// isn't verified. + /// + /// When this value is used, the legacy `require_ssl` flag must be false or + /// cleared to avoid a conflict between the values of the two flags. + pub const ALLOW_UNENCRYPTED_AND_ENCRYPTED: &str = "ALLOW_UNENCRYPTED_AND_ENCRYPTED"; + + /// Only allow connections encrypted with SSL/TLS. + /// For SSL connections to MySQL and PostgreSQL, the client certificate + /// isn't verified. + /// + /// When this value is used, the legacy `require_ssl` flag must be false or + /// cleared to avoid a conflict between the values of the two flags. + pub const ENCRYPTED_ONLY: &str = "ENCRYPTED_ONLY"; + + /// Only allow connections encrypted with SSL/TLS and with valid + /// client certificates. + /// + /// When this value is used, the legacy `require_ssl` flag must be true or + /// cleared to avoid the conflict between values of two flags. + /// PostgreSQL clients or users that connect using IAM database + /// authentication must use either the + /// [Cloud SQL Auth + /// Proxy](https://cloud.google.com/sql/docs/postgres/connect-auth-proxy) or + /// [Cloud SQL + /// Connectors](https://cloud.google.com/sql/docs/postgres/connect-connectors) + /// to enforce client identity verification. + /// + /// Only applicable to MySQL and PostgreSQL. Not applicable to SQL Server. + pub const TRUSTED_CLIENT_CERTIFICATE_REQUIRED: &str = "TRUSTED_CLIENT_CERTIFICATE_REQUIRED"; + } + + /// Various Certificate Authority (CA) modes for certificate signing. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct CaMode(std::string::String); + + impl CaMode { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [CaMode](CaMode) + pub mod ca_mode { + + /// CA mode is unknown. + pub const CA_MODE_UNSPECIFIED: &str = "CA_MODE_UNSPECIFIED"; + + /// Google-managed self-signed internal CA. + pub const GOOGLE_MANAGED_INTERNAL_CA: &str = "GOOGLE_MANAGED_INTERNAL_CA"; + + /// Google-managed regional CA part of root CA hierarchy hosted on Google + /// Cloud's Certificate Authority Service (CAS). + pub const GOOGLE_MANAGED_CAS_CA: &str = "GOOGLE_MANAGED_CAS_CA"; + } +} + +/// PSC settings for a Cloud SQL instance. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct PscConfig { + + /// Whether PSC connectivity is enabled for this instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub psc_enabled: std::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). + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub allowed_consumer_projects: std::vec::Vec, +} + +impl PscConfig { + + /// Sets the value of `psc_enabled`. + pub fn set_psc_enabled>>(mut self, v: T) -> Self { + self.psc_enabled = v.into(); + self + } + + /// Sets the value of `allowed_consumer_projects`. + pub fn set_allowed_consumer_projects>>(mut self, v: T) -> Self { + self.allowed_consumer_projects = v.into(); + self + } +} + +impl wkt::message::Message for PscConfig { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.PscConfig" + } +} + +/// Preferred location. This specifies where a Cloud SQL instance is located. +/// Note that if the preferred location is not available, the instance will be +/// located as close as possible within the region. Only one location may be +/// specified. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct LocationPreference { + + /// The App Engine application to follow, it must be in the same region as the + /// Cloud SQL instance. WARNING: Changing this might restart the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub follow_gae_application: std::string::String, + + /// The preferred Compute Engine zone (for example: us-central1-a, + /// us-central1-b, etc.). WARNING: Changing this might restart the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub zone: std::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'. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub secondary_zone: std::string::String, + + /// This is always `sql#locationPreference`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, +} + +impl LocationPreference { + + /// Sets the value of `follow_gae_application`. + pub fn set_follow_gae_application>(mut self, v: T) -> Self { + self.follow_gae_application = v.into(); + self + } + + /// Sets the value of `zone`. + pub fn set_zone>(mut self, v: T) -> Self { + self.zone = v.into(); + self + } + + /// Sets the value of `secondary_zone`. + pub fn set_secondary_zone>(mut self, v: T) -> Self { + self.secondary_zone = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } +} + +impl wkt::message::Message for LocationPreference { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.LocationPreference" + } +} + +/// Maintenance window. This specifies when a Cloud SQL instance is +/// restarted for system maintenance purposes. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct MaintenanceWindow { + + /// Hour of day - 0 to 23. Specify in the UTC time zone. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub hour: std::option::Option, + + /// Day of week - `MONDAY`, `TUESDAY`, `WEDNESDAY`, `THURSDAY`, `FRIDAY`, + /// `SATURDAY`, or `SUNDAY`. Specify in the UTC time zone. + /// Returned in output as an integer, 1 to 7, where `1` equals Monday. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub day: std::option::Option, + + /// Maintenance timing settings: `canary`, `stable`, or `week5`. + /// For more information, see [About maintenance on Cloud SQL + /// instances](https://cloud.google.com/sql/docs/mysql/maintenance). + pub update_track: crate::model::SqlUpdateTrack, + + /// This is always `sql#maintenanceWindow`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, +} + +impl MaintenanceWindow { + + /// Sets the value of `hour`. + pub fn set_hour>>(mut self, v: T) -> Self { + self.hour = v.into(); + self + } + + /// Sets the value of `day`. + pub fn set_day>>(mut self, v: T) -> Self { + self.day = v.into(); + self + } + + /// Sets the value of `update_track`. + pub fn set_update_track>(mut self, v: T) -> Self { + self.update_track = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } +} + +impl wkt::message::Message for MaintenanceWindow { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.MaintenanceWindow" + } +} + +/// Deny maintenance Periods. This specifies a date range during when all CSA +/// rollout will be denied. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct DenyMaintenancePeriod { + + /// "deny maintenance period" start date. If the year of the start date is + /// empty, the year of the end date also must be empty. In this case, it means + /// the deny maintenance period recurs every year. The date is in format + /// yyyy-mm-dd i.e., 2020-11-01, or mm-dd, i.e., 11-01 + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub start_date: std::string::String, + + /// "deny maintenance period" end date. If the year of the end date is empty, + /// the year of the start date also must be empty. In this case, it means the + /// no maintenance interval recurs every year. The date is in format yyyy-mm-dd + /// i.e., 2020-11-01, or mm-dd, i.e., 11-01 + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub end_date: std::string::String, + + /// Time in UTC when the "deny maintenance period" starts on start_date and + /// ends on end_date. The time is in format: HH:mm:SS, i.e., 00:00:00 + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub time: std::string::String, +} + +impl DenyMaintenancePeriod { + + /// Sets the value of `start_date`. + pub fn set_start_date>(mut self, v: T) -> Self { + self.start_date = v.into(); + self + } + + /// Sets the value of `end_date`. + pub fn set_end_date>(mut self, v: T) -> Self { + self.end_date = v.into(); + self + } + + /// Sets the value of `time`. + pub fn set_time>(mut self, v: T) -> Self { + self.time = v.into(); + self + } +} + +impl wkt::message::Message for DenyMaintenancePeriod { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DenyMaintenancePeriod" + } +} + +/// Insights configuration. This specifies when Cloud SQL Insights feature is +/// enabled and optional configuration. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct InsightsConfig { + + /// Whether Query Insights feature is enabled. + pub query_insights_enabled: bool, + + /// Whether Query Insights will record client address when enabled. + pub record_client_address: bool, + + /// Whether Query Insights will record application tags from query when + /// enabled. + pub record_application_tags: bool, + + /// Maximum query length stored in bytes. Default value: 1024 bytes. + /// Range: 256-4500 bytes. Query length more than this field value will be + /// truncated to this value. When unset, query length will be the default + /// value. Changing query length will restart the database. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub query_string_length: std::option::Option, + + /// Number of query execution plans captured by Insights per minute + /// for all queries combined. Default is 5. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub query_plans_per_minute: std::option::Option, +} + +impl InsightsConfig { + + /// Sets the value of `query_insights_enabled`. + pub fn set_query_insights_enabled>(mut self, v: T) -> Self { + self.query_insights_enabled = v.into(); + self + } + + /// Sets the value of `record_client_address`. + pub fn set_record_client_address>(mut self, v: T) -> Self { + self.record_client_address = v.into(); + self + } + + /// Sets the value of `record_application_tags`. + pub fn set_record_application_tags>(mut self, v: T) -> Self { + self.record_application_tags = v.into(); + self + } + + /// Sets the value of `query_string_length`. + pub fn set_query_string_length>>(mut self, v: T) -> Self { + self.query_string_length = v.into(); + self + } + + /// Sets the value of `query_plans_per_minute`. + pub fn set_query_plans_per_minute>>(mut self, v: T) -> Self { + self.query_plans_per_minute = v.into(); + self + } +} + +impl wkt::message::Message for InsightsConfig { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.InsightsConfig" + } +} + +/// Read-replica configuration specific to MySQL databases. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct MySqlReplicaConfiguration { + + /// Path to a SQL dump file in Google Cloud Storage from which the replica + /// instance is to be created. The URI is in the form gs://bucketName/fileName. + /// Compressed gzip files (.gz) are also supported. + /// Dumps have the binlog co-ordinates from which replication + /// begins. This can be accomplished by setting --master-data to 1 when using + /// mysqldump. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub dump_file_path: std::string::String, + + /// The username for the replication connection. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub username: std::string::String, + + /// The password for the replication connection. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub password: std::string::String, + + /// Seconds to wait between connect retries. MySQL's default is 60 seconds. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub connect_retry_interval: std::option::Option, + + /// Interval in milliseconds between replication heartbeats. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde_as(as = "std::option::Option")] + pub master_heartbeat_period: std::option::Option, + + /// PEM representation of the trusted CA's x509 certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub ca_certificate: std::string::String, + + /// PEM representation of the replica's x509 certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub client_certificate: std::string::String, + + /// PEM representation of the replica's private key. The corresponsing public + /// key is encoded in the client's certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub client_key: std::string::String, + + /// A list of permissible ciphers to use for SSL encryption. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub ssl_cipher: std::string::String, + + /// Whether or not to check the primary instance's Common Name value in the + /// certificate that it sends during the SSL handshake. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub verify_server_certificate: std::option::Option, + + /// This is always `sql#mysqlReplicaConfiguration`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, +} + +impl MySqlReplicaConfiguration { + + /// Sets the value of `dump_file_path`. + pub fn set_dump_file_path>(mut self, v: T) -> Self { + self.dump_file_path = v.into(); + self + } + + /// Sets the value of `username`. + pub fn set_username>(mut self, v: T) -> Self { + self.username = v.into(); + self + } + + /// Sets the value of `password`. + pub fn set_password>(mut self, v: T) -> Self { + self.password = v.into(); + self + } + + /// Sets the value of `connect_retry_interval`. + pub fn set_connect_retry_interval>>(mut self, v: T) -> Self { + self.connect_retry_interval = v.into(); + self + } + + /// Sets the value of `master_heartbeat_period`. + pub fn set_master_heartbeat_period>>(mut self, v: T) -> Self { + self.master_heartbeat_period = v.into(); + self + } + + /// Sets the value of `ca_certificate`. + pub fn set_ca_certificate>(mut self, v: T) -> Self { + self.ca_certificate = v.into(); + self + } + + /// Sets the value of `client_certificate`. + pub fn set_client_certificate>(mut self, v: T) -> Self { + self.client_certificate = v.into(); + self + } + + /// Sets the value of `client_key`. + pub fn set_client_key>(mut self, v: T) -> Self { + self.client_key = v.into(); + self + } + + /// Sets the value of `ssl_cipher`. + pub fn set_ssl_cipher>(mut self, v: T) -> Self { + self.ssl_cipher = v.into(); + self + } + + /// Sets the value of `verify_server_certificate`. + pub fn set_verify_server_certificate>>(mut self, v: T) -> Self { + self.verify_server_certificate = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } +} + +impl wkt::message::Message for MySqlReplicaConfiguration { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.MySqlReplicaConfiguration" + } +} + +/// Disk encryption configuration for an instance. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct DiskEncryptionConfiguration { + + /// Resource name of KMS key for disk encryption + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kms_key_name: std::string::String, + + /// This is always `sql#diskEncryptionConfiguration`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, +} + +impl DiskEncryptionConfiguration { + + /// Sets the value of `kms_key_name`. + pub fn set_kms_key_name>(mut self, v: T) -> Self { + self.kms_key_name = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } +} + +impl wkt::message::Message for DiskEncryptionConfiguration { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DiskEncryptionConfiguration" + } +} + +/// Disk encryption status for an instance. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct DiskEncryptionStatus { + + /// KMS key version used to encrypt the Cloud SQL instance resource + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kms_key_version_name: std::string::String, + + /// This is always `sql#diskEncryptionStatus`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, +} + +impl DiskEncryptionStatus { + + /// Sets the value of `kms_key_version_name`. + pub fn set_kms_key_version_name>(mut self, v: T) -> Self { + self.kms_key_version_name = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } +} + +impl wkt::message::Message for DiskEncryptionStatus { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DiskEncryptionStatus" + } +} + +/// Database instance IP mapping +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct IpMapping { + + /// The type of this IP address. A `PRIMARY` address is a public address that + /// can accept incoming connections. A `PRIVATE` address is a private address + /// that can accept incoming connections. An `OUTGOING` address is the source + /// address of connections originating from the instance, if supported. + #[serde(rename = "type")] + pub r#type: crate::model::SqlIpAddressType, + + /// The IP address assigned. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub ip_address: std::string::String, + + /// The due time for this IP to be retired in + /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + /// `2012-11-15T16:19:00.094Z`. This field is only available when + /// the IP is scheduled to be retired. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub time_to_retire: std::option::Option, +} + +impl IpMapping { + + /// Sets the value of `r#type`. + pub fn set_type>(mut self, v: T) -> Self { + self.r#type = v.into(); + self + } + + /// Sets the value of `ip_address`. + pub fn set_ip_address>(mut self, v: T) -> Self { + self.ip_address = v.into(); + self + } + + /// Sets the value of `time_to_retire`. + pub fn set_time_to_retire>>(mut self, v: T) -> Self { + self.time_to_retire = v.into(); + self + } +} + +impl wkt::message::Message for IpMapping { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.IpMapping" + } +} + +/// An Operation resource. For successful operations that return an +/// Operation resource, only the fields relevant to the operation are populated +/// in the resource. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct Operation { + + /// This is always `sql#operation`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub target_link: std::string::String, + + /// The status of an operation. + pub status: crate::model::operation::SqlOperationStatus, + + /// The email address of the user who initiated this operation. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub user: std::string::String, + + /// The time this operation was enqueued in UTC timezone in [RFC + /// 3339](https://tools.ietf.org/html/rfc3339) format, for example + /// `2012-11-15T16:19:00.094Z`. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub insert_time: std::option::Option, + + /// The time this operation actually started in UTC timezone in [RFC + /// 3339](https://tools.ietf.org/html/rfc3339) format, for example + /// `2012-11-15T16:19:00.094Z`. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub start_time: std::option::Option, + + /// The time this operation finished in UTC timezone in [RFC + /// 3339](https://tools.ietf.org/html/rfc3339) format, for example + /// `2012-11-15T16:19:00.094Z`. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub end_time: std::option::Option, + + /// If errors occurred during processing of this operation, this field will be + /// populated. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub error: std::option::Option, + + /// An Admin API warning message. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub api_warning: std::option::Option, + + /// The type of the operation. Valid values are: + /// + /// * `CREATE` + /// * `DELETE` + /// * `UPDATE` + /// * `RESTART` + /// * `IMPORT` + /// * `EXPORT` + /// * `BACKUP_VOLUME` + /// * `RESTORE_VOLUME` + /// * `CREATE_USER` + /// * `DELETE_USER` + /// * `CREATE_DATABASE` + /// * `DELETE_DATABASE` + pub operation_type: crate::model::operation::SqlOperationType, + + /// The context for import operation, if applicable. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub import_context: std::option::Option, + + /// The context for export operation, if applicable. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub export_context: std::option::Option, + + /// The context for backup operation, if applicable. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub backup_context: std::option::Option, + + /// An identifier that uniquely identifies the operation. You can use this + /// identifier to retrieve the Operations resource that has information about + /// the operation. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// Name of the database instance related to this operation. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub target_id: std::string::String, + + /// The URI of this resource. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub self_link: std::string::String, + + /// The project ID of the target instance related to this operation. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub target_project: std::string::String, + + /// The context for acquire SSRS lease operation, if applicable. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub acquire_ssrs_lease_context: std::option::Option, +} + +impl Operation { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `target_link`. + pub fn set_target_link>(mut self, v: T) -> Self { + self.target_link = v.into(); + self + } + + /// Sets the value of `status`. + pub fn set_status>(mut self, v: T) -> Self { + self.status = v.into(); + self + } + + /// Sets the value of `user`. + pub fn set_user>(mut self, v: T) -> Self { + self.user = v.into(); + self + } + + /// Sets the value of `insert_time`. + pub fn set_insert_time>>(mut self, v: T) -> Self { + self.insert_time = v.into(); + self + } + + /// Sets the value of `start_time`. + pub fn set_start_time>>(mut self, v: T) -> Self { + self.start_time = v.into(); + self + } + + /// Sets the value of `end_time`. + pub fn set_end_time>>(mut self, v: T) -> Self { + self.end_time = v.into(); + self + } + + /// Sets the value of `error`. + pub fn set_error>>(mut self, v: T) -> Self { + self.error = v.into(); + self + } + + /// Sets the value of `api_warning`. + pub fn set_api_warning>>(mut self, v: T) -> Self { + self.api_warning = v.into(); + self + } + + /// Sets the value of `operation_type`. + pub fn set_operation_type>(mut self, v: T) -> Self { + self.operation_type = v.into(); + self + } + + /// Sets the value of `import_context`. + pub fn set_import_context>>(mut self, v: T) -> Self { + self.import_context = v.into(); + self + } + + /// Sets the value of `export_context`. + pub fn set_export_context>>(mut self, v: T) -> Self { + self.export_context = v.into(); + self + } + + /// Sets the value of `backup_context`. + pub fn set_backup_context>>(mut self, v: T) -> Self { + self.backup_context = v.into(); + self + } + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `target_id`. + pub fn set_target_id>(mut self, v: T) -> Self { + self.target_id = v.into(); + self + } + + /// Sets the value of `self_link`. + pub fn set_self_link>(mut self, v: T) -> Self { + self.self_link = v.into(); + self + } + + /// Sets the value of `target_project`. + pub fn set_target_project>(mut self, v: T) -> Self { + self.target_project = v.into(); + self + } + + /// Sets the value of `acquire_ssrs_lease_context`. + pub fn set_acquire_ssrs_lease_context>>(mut self, v: T) -> Self { + self.acquire_ssrs_lease_context = v.into(); + self + } +} + +impl wkt::message::Message for Operation { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.Operation" + } +} + +/// Defines additional types related to Operation +pub mod operation { + #[allow(unused_imports)] + use super::*; + + + /// The type of Cloud SQL operation. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct SqlOperationType(std::string::String); + + impl SqlOperationType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [SqlOperationType](SqlOperationType) + pub mod sql_operation_type { + + /// Unknown operation type. + pub const SQL_OPERATION_TYPE_UNSPECIFIED: &str = "SQL_OPERATION_TYPE_UNSPECIFIED"; + + /// Imports data into a Cloud SQL instance. + pub const IMPORT: &str = "IMPORT"; + + /// Exports data from a Cloud SQL instance to a Cloud Storage + /// bucket. + pub const EXPORT: &str = "EXPORT"; + + /// Creates a new Cloud SQL instance. + pub const CREATE: &str = "CREATE"; + + /// Updates the settings of a Cloud SQL instance. + pub const UPDATE: &str = "UPDATE"; + + /// Deletes a Cloud SQL instance. + pub const DELETE: &str = "DELETE"; + + /// Restarts the Cloud SQL instance. + pub const RESTART: &str = "RESTART"; + + pub const BACKUP: &str = "BACKUP"; + + pub const SNAPSHOT: &str = "SNAPSHOT"; + + /// Performs instance backup. + pub const BACKUP_VOLUME: &str = "BACKUP_VOLUME"; + + /// Deletes an instance backup. + pub const DELETE_VOLUME: &str = "DELETE_VOLUME"; + + /// Restores an instance backup. + pub const RESTORE_VOLUME: &str = "RESTORE_VOLUME"; + + /// Injects a privileged user in mysql for MOB instances. + pub const INJECT_USER: &str = "INJECT_USER"; + + /// Clones a Cloud SQL instance. + pub const CLONE: &str = "CLONE"; + + /// Stops replication on a Cloud SQL read replica instance. + pub const STOP_REPLICA: &str = "STOP_REPLICA"; + + /// Starts replication on a Cloud SQL read replica instance. + pub const START_REPLICA: &str = "START_REPLICA"; + + /// Promotes a Cloud SQL replica instance. + pub const PROMOTE_REPLICA: &str = "PROMOTE_REPLICA"; + + /// Creates a Cloud SQL replica instance. + pub const CREATE_REPLICA: &str = "CREATE_REPLICA"; + + /// Creates a new user in a Cloud SQL instance. + pub const CREATE_USER: &str = "CREATE_USER"; + + /// Deletes a user from a Cloud SQL instance. + pub const DELETE_USER: &str = "DELETE_USER"; + + /// Updates an existing user in a Cloud SQL instance. + pub const UPDATE_USER: &str = "UPDATE_USER"; + + /// Creates a database in the Cloud SQL instance. + pub const CREATE_DATABASE: &str = "CREATE_DATABASE"; + + /// Deletes a database in the Cloud SQL instance. + pub const DELETE_DATABASE: &str = "DELETE_DATABASE"; + + /// Updates a database in the Cloud SQL instance. + pub const UPDATE_DATABASE: &str = "UPDATE_DATABASE"; + + /// Performs failover of an HA-enabled Cloud SQL + /// failover replica. + pub const FAILOVER: &str = "FAILOVER"; + + /// Deletes the backup taken by a backup run. + pub const DELETE_BACKUP: &str = "DELETE_BACKUP"; + + pub const RECREATE_REPLICA: &str = "RECREATE_REPLICA"; + + /// Truncates a general or slow log table in MySQL. + pub const TRUNCATE_LOG: &str = "TRUNCATE_LOG"; + + /// Demotes the stand-alone instance to be a Cloud SQL + /// read replica for an external database server. + pub const DEMOTE_MASTER: &str = "DEMOTE_MASTER"; + + /// Indicates that the instance is currently in maintenance. Maintenance + /// typically causes the instance to be unavailable for 1-3 minutes. + pub const MAINTENANCE: &str = "MAINTENANCE"; + + /// This field is deprecated, and will be removed in future version of API. + pub const ENABLE_PRIVATE_IP: &str = "ENABLE_PRIVATE_IP"; + + pub const DEFER_MAINTENANCE: &str = "DEFER_MAINTENANCE"; + + /// Creates clone instance. + pub const CREATE_CLONE: &str = "CREATE_CLONE"; + + /// Reschedule maintenance to another time. + pub const RESCHEDULE_MAINTENANCE: &str = "RESCHEDULE_MAINTENANCE"; + + /// Starts external sync of a Cloud SQL EM replica to an external primary + /// instance. + pub const START_EXTERNAL_SYNC: &str = "START_EXTERNAL_SYNC"; + + /// Recovers logs from an instance's old data disk. + pub const LOG_CLEANUP: &str = "LOG_CLEANUP"; + + /// Performs auto-restart of an HA-enabled Cloud SQL database for auto + /// recovery. + pub const AUTO_RESTART: &str = "AUTO_RESTART"; + + /// Re-encrypts CMEK instances with latest key version. + pub const REENCRYPT: &str = "REENCRYPT"; + + /// Switches the roles of the primary and replica pair. The target instance + /// should be the replica. + pub const SWITCHOVER: &str = "SWITCHOVER"; + + /// Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + pub const ACQUIRE_SSRS_LEASE: &str = "ACQUIRE_SSRS_LEASE"; + + /// Release a lease for the setup of SQL Server Reporting Services (SSRS). + pub const RELEASE_SSRS_LEASE: &str = "RELEASE_SSRS_LEASE"; + + /// Reconfigures old primary after a promote replica operation. Effect of a + /// promote operation to the old primary is executed in this operation, + /// asynchronously from the promote replica operation executed to the + /// replica. + pub const RECONFIGURE_OLD_PRIMARY: &str = "RECONFIGURE_OLD_PRIMARY"; + + /// Indicates that the instance, its read replicas, and its cascading + /// replicas are in maintenance. Maintenance typically gets initiated on + /// groups of replicas first, followed by the primary instance. For each + /// instance, maintenance typically causes the instance to be unavailable for + /// 1-3 minutes. + pub const CLUSTER_MAINTENANCE: &str = "CLUSTER_MAINTENANCE"; + + /// Indicates that the instance (and any of its replicas) are currently in + /// maintenance. This is initiated as a self-service request by using SSM. + /// Maintenance typically causes the instance to be unavailable for 1-3 + /// minutes. + pub const SELF_SERVICE_MAINTENANCE: &str = "SELF_SERVICE_MAINTENANCE"; + + /// Switches a primary instance to a replica. This operation runs as part of + /// a switchover operation to the original primary instance. + pub const SWITCHOVER_TO_REPLICA: &str = "SWITCHOVER_TO_REPLICA"; + + /// Updates the major version of a Cloud SQL instance. + pub const MAJOR_VERSION_UPGRADE: &str = "MAJOR_VERSION_UPGRADE"; + } + + /// The status of an operation. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct SqlOperationStatus(std::string::String); + + impl SqlOperationStatus { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [SqlOperationStatus](SqlOperationStatus) + pub mod sql_operation_status { + + /// The state of the operation is unknown. + pub const SQL_OPERATION_STATUS_UNSPECIFIED: &str = "SQL_OPERATION_STATUS_UNSPECIFIED"; + + /// The operation has been queued, but has not started yet. + pub const PENDING: &str = "PENDING"; + + /// The operation is running. + pub const RUNNING: &str = "RUNNING"; + + /// The operation completed. + pub const DONE: &str = "DONE"; + } +} + +/// Database instance operation error. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct OperationError { + + /// This is always `sql#operationError`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// Identifies the specific error that occurred. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub code: std::string::String, + + /// Additional information about the error encountered. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub message: std::string::String, +} + +impl OperationError { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `code`. + pub fn set_code>(mut self, v: T) -> Self { + self.code = v.into(); + self + } + + /// Sets the value of `message`. + pub fn set_message>(mut self, v: T) -> Self { + self.message = v.into(); + self + } +} + +impl wkt::message::Message for OperationError { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.OperationError" + } +} + +/// Database instance operation errors list wrapper. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct OperationErrors { + + /// This is always `sql#operationErrors`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The list of errors encountered while processing this operation. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub errors: std::vec::Vec, +} + +impl OperationErrors { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `errors`. + pub fn set_errors>>(mut self, v: T) -> Self { + self.errors = v.into(); + self + } +} + +impl wkt::message::Message for OperationErrors { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.OperationErrors" + } +} + +/// Database instance local user password validation policy +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct PasswordValidationPolicy { + + /// Minimum number of characters allowed. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub min_length: std::option::Option, + + /// The complexity of the password. + pub complexity: crate::model::password_validation_policy::Complexity, + + /// Number of previous passwords that cannot be reused. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub reuse_interval: std::option::Option, + + /// Disallow username as a part of the password. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub disallow_username_substring: std::option::Option, + + /// Minimum interval after which the password can be changed. This flag is only + /// supported for PostgreSQL. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub password_change_interval: std::option::Option, + + /// Whether the password policy is enabled or not. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub enable_password_policy: std::option::Option, + + /// This field is deprecated and will be removed in a future version of the + /// API. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub disallow_compromised_credentials: std::option::Option, +} + +impl PasswordValidationPolicy { + + /// Sets the value of `min_length`. + pub fn set_min_length>>(mut self, v: T) -> Self { + self.min_length = v.into(); + self + } + + /// Sets the value of `complexity`. + pub fn set_complexity>(mut self, v: T) -> Self { + self.complexity = v.into(); + self + } + + /// Sets the value of `reuse_interval`. + pub fn set_reuse_interval>>(mut self, v: T) -> Self { + self.reuse_interval = v.into(); + self + } + + /// Sets the value of `disallow_username_substring`. + pub fn set_disallow_username_substring>>(mut self, v: T) -> Self { + self.disallow_username_substring = v.into(); + self + } + + /// Sets the value of `password_change_interval`. + pub fn set_password_change_interval>>(mut self, v: T) -> Self { + self.password_change_interval = v.into(); + self + } + + /// Sets the value of `enable_password_policy`. + pub fn set_enable_password_policy>>(mut self, v: T) -> Self { + self.enable_password_policy = v.into(); + self + } + + /// Sets the value of `disallow_compromised_credentials`. + pub fn set_disallow_compromised_credentials>>(mut self, v: T) -> Self { + self.disallow_compromised_credentials = v.into(); + self + } +} + +impl wkt::message::Message for PasswordValidationPolicy { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.PasswordValidationPolicy" + } +} + +/// Defines additional types related to PasswordValidationPolicy +pub mod password_validation_policy { + #[allow(unused_imports)] + use super::*; + + + /// The complexity choices of the password. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct Complexity(std::string::String); + + impl Complexity { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [Complexity](Complexity) + pub mod complexity { + + /// Complexity check is not specified. + pub const COMPLEXITY_UNSPECIFIED: &str = "COMPLEXITY_UNSPECIFIED"; + + /// A combination of lowercase, uppercase, numeric, and non-alphanumeric + /// characters. + pub const COMPLEXITY_DEFAULT: &str = "COMPLEXITY_DEFAULT"; + } +} + +/// Data cache configurations. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct DataCacheConfig { + + /// Whether data cache is enabled for the instance. + pub data_cache_enabled: bool, +} + +impl DataCacheConfig { + + /// Sets the value of `data_cache_enabled`. + pub fn set_data_cache_enabled>(mut self, v: T) -> Self { + self.data_cache_enabled = v.into(); + self + } +} + +impl wkt::message::Message for DataCacheConfig { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.DataCacheConfig" + } +} + +/// Database instance settings. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct Settings { + + /// The version of instance settings. This is a required field for update + /// method to make sure concurrent updates are handled properly. During update, + /// use the most recent settingsVersion value for this instance and do not try + /// to update this value. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde_as(as = "std::option::Option")] + pub settings_version: std::option::Option, + + /// The App Engine app IDs that can access this instance. + /// (Deprecated) Applied to First Generation instances only. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub authorized_gae_applications: std::vec::Vec, + + /// The tier (or machine type) for this instance, for example + /// `db-custom-1-3840`. WARNING: Changing this restarts the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub tier: std::string::String, + + /// This is always `sql#settings`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// User-provided labels, represented as a dictionary where each label is a + /// single key value pair. + #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")] + pub user_labels: std::collections::HashMap, + + /// Availability type. Potential values: + /// + /// * `ZONAL`: The instance serves data from only one zone. Outages in that + /// zone affect data accessibility. + /// * `REGIONAL`: The instance can serve data from more than one zone in a + /// region (it is highly available)./ + /// + /// For more information, see [Overview of the High Availability + /// Configuration](https://cloud.google.com/sql/docs/mysql/high-availability). + pub availability_type: crate::model::SqlAvailabilityType, + + /// The pricing plan for this instance. This can be either `PER_USE` or + /// `PACKAGE`. Only `PER_USE` is supported for Second Generation instances. + pub pricing_plan: crate::model::SqlPricingPlan, + + /// The type of replication this instance uses. This can be either + /// `ASYNCHRONOUS` or `SYNCHRONOUS`. (Deprecated) This property was only + /// applicable to First Generation instances. + pub replication_type: crate::model::SqlReplicationType, + + /// The maximum size to which storage capacity can be automatically increased. + /// The default value is 0, which specifies that there is no limit. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde_as(as = "std::option::Option")] + pub storage_auto_resize_limit: std::option::Option, + + /// The activation policy specifies when the instance is activated; it is + /// applicable only when the instance state is RUNNABLE. Valid values: + /// + /// * `ALWAYS`: The instance is on, and remains so even in the absence of + /// connection requests. + /// * `NEVER`: The instance is off; it is not activated, even if a + /// connection request arrives. + pub activation_policy: crate::model::settings::SqlActivationPolicy, + + /// The settings for IP Management. This allows to enable or disable the + /// instance IP and manage which external networks can connect to the instance. + /// The IPv4 address cannot be disabled for Second Generation instances. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub ip_configuration: std::option::Option, + + /// Configuration to increase storage size automatically. The default value is + /// true. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub storage_auto_resize: std::option::Option, + + /// The location preference settings. This allows the instance to be located as + /// near as possible to either an App Engine app or Compute Engine zone for + /// better performance. App Engine co-location was only applicable to First + /// Generation instances. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub location_preference: std::option::Option, + + /// The database flags passed to the instance at startup. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub database_flags: std::vec::Vec, + + /// The type of data disk: `PD_SSD` (default) or `PD_HDD`. Not used for + /// First Generation instances. + pub data_disk_type: crate::model::SqlDataDiskType, + + /// The maintenance window for this instance. This specifies when the instance + /// can be restarted for maintenance purposes. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub maintenance_window: std::option::Option, + + /// The daily backup configuration for the instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub backup_configuration: std::option::Option, + + /// Configuration specific to read replica instances. Indicates whether + /// replication is enabled or not. WARNING: Changing this restarts the + /// instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub database_replication_enabled: std::option::Option, + + /// Configuration specific to read replica instances. Indicates whether + /// database flags for crash-safe replication are enabled. This property was + /// only applicable to First Generation instances. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub crash_safe_replication_enabled: std::option::Option, + + /// The size of data disk, in GB. The data disk size minimum is 10GB. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde_as(as = "std::option::Option")] + pub data_disk_size_gb: std::option::Option, + + /// Active Directory configuration, relevant only for Cloud SQL for SQL Server. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub active_directory_config: std::option::Option, + + /// The name of server Instance collation. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub collation: std::string::String, + + /// Deny maintenance periods + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub deny_maintenance_periods: std::vec::Vec, + + /// Insights configuration, for now relevant only for Postgres. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub insights_config: std::option::Option, + + /// The local user password validation policy of the instance. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub password_validation_policy: std::option::Option, + + /// SQL Server specific audit configuration. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub sql_server_audit_config: std::option::Option, + + /// Optional. The edition of the instance. + pub edition: crate::model::settings::Edition, + + /// Specifies if connections must use Cloud SQL connectors. + /// Option values include the following: `NOT_REQUIRED` (Cloud SQL instances + /// can be connected without Cloud SQL + /// Connectors) and `REQUIRED` (Only allow connections that use Cloud SQL + /// Connectors). + /// + /// Note that using REQUIRED disables all existing authorized networks. If + /// this field is not specified when creating a new instance, NOT_REQUIRED is + /// used. If this field is not specified when patching or updating an existing + /// instance, it is left unchanged in the instance. + pub connector_enforcement: crate::model::settings::ConnectorEnforcement, + + /// Configuration to protect against accidental instance deletion. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub deletion_protection_enabled: std::option::Option, + + /// Server timezone, relevant only for Cloud SQL for SQL Server. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub time_zone: std::string::String, + + /// Specifies advanced machine configuration for the instances relevant only + /// for SQL Server. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub advanced_machine_features: std::option::Option, + + /// Configuration for data cache. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub data_cache_config: std::option::Option, + + /// Optional. When this parameter is set to true, Cloud SQL instances can + /// connect to Vertex AI to pass requests for real-time predictions and + /// insights to the AI. The default value is false. This applies only to Cloud + /// SQL for PostgreSQL instances. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub enable_google_ml_integration: std::option::Option, + + /// Optional. By default, Cloud SQL instances have schema extraction disabled + /// for Dataplex. When this parameter is set to true, schema extraction for + /// Dataplex on Cloud SQL instances is activated. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub enable_dataplex_integration: std::option::Option, +} + +impl Settings { + + /// Sets the value of `settings_version`. + pub fn set_settings_version>>(mut self, v: T) -> Self { + self.settings_version = v.into(); + self + } + + /// Sets the value of `authorized_gae_applications`. + pub fn set_authorized_gae_applications>>(mut self, v: T) -> Self { + self.authorized_gae_applications = v.into(); + self + } + + /// Sets the value of `tier`. + pub fn set_tier>(mut self, v: T) -> Self { + self.tier = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `user_labels`. + pub fn set_user_labels>>(mut self, v: T) -> Self { + self.user_labels = v.into(); + self + } + + /// Sets the value of `availability_type`. + pub fn set_availability_type>(mut self, v: T) -> Self { + self.availability_type = v.into(); + self + } + + /// Sets the value of `pricing_plan`. + pub fn set_pricing_plan>(mut self, v: T) -> Self { + self.pricing_plan = v.into(); + self + } + + /// Sets the value of `replication_type`. + pub fn set_replication_type>(mut self, v: T) -> Self { + self.replication_type = v.into(); + self + } + + /// Sets the value of `storage_auto_resize_limit`. + pub fn set_storage_auto_resize_limit>>(mut self, v: T) -> Self { + self.storage_auto_resize_limit = v.into(); + self + } + + /// Sets the value of `activation_policy`. + pub fn set_activation_policy>(mut self, v: T) -> Self { + self.activation_policy = v.into(); + self + } + + /// Sets the value of `ip_configuration`. + pub fn set_ip_configuration>>(mut self, v: T) -> Self { + self.ip_configuration = v.into(); + self + } + + /// Sets the value of `storage_auto_resize`. + pub fn set_storage_auto_resize>>(mut self, v: T) -> Self { + self.storage_auto_resize = v.into(); + self + } + + /// Sets the value of `location_preference`. + pub fn set_location_preference>>(mut self, v: T) -> Self { + self.location_preference = v.into(); + self + } + + /// Sets the value of `database_flags`. + pub fn set_database_flags>>(mut self, v: T) -> Self { + self.database_flags = v.into(); + self + } + + /// Sets the value of `data_disk_type`. + pub fn set_data_disk_type>(mut self, v: T) -> Self { + self.data_disk_type = v.into(); + self + } + + /// Sets the value of `maintenance_window`. + pub fn set_maintenance_window>>(mut self, v: T) -> Self { + self.maintenance_window = v.into(); + self + } + + /// Sets the value of `backup_configuration`. + pub fn set_backup_configuration>>(mut self, v: T) -> Self { + self.backup_configuration = v.into(); + self + } + + /// Sets the value of `database_replication_enabled`. + pub fn set_database_replication_enabled>>(mut self, v: T) -> Self { + self.database_replication_enabled = v.into(); + self + } + + /// Sets the value of `crash_safe_replication_enabled`. + pub fn set_crash_safe_replication_enabled>>(mut self, v: T) -> Self { + self.crash_safe_replication_enabled = v.into(); + self + } + + /// Sets the value of `data_disk_size_gb`. + pub fn set_data_disk_size_gb>>(mut self, v: T) -> Self { + self.data_disk_size_gb = v.into(); + self + } + + /// Sets the value of `active_directory_config`. + pub fn set_active_directory_config>>(mut self, v: T) -> Self { + self.active_directory_config = v.into(); + self + } + + /// Sets the value of `collation`. + pub fn set_collation>(mut self, v: T) -> Self { + self.collation = v.into(); + self + } + + /// Sets the value of `deny_maintenance_periods`. + pub fn set_deny_maintenance_periods>>(mut self, v: T) -> Self { + self.deny_maintenance_periods = v.into(); + self + } + + /// Sets the value of `insights_config`. + pub fn set_insights_config>>(mut self, v: T) -> Self { + self.insights_config = v.into(); + self + } + + /// Sets the value of `password_validation_policy`. + pub fn set_password_validation_policy>>(mut self, v: T) -> Self { + self.password_validation_policy = v.into(); + self + } + + /// Sets the value of `sql_server_audit_config`. + pub fn set_sql_server_audit_config>>(mut self, v: T) -> Self { + self.sql_server_audit_config = v.into(); + self + } + + /// Sets the value of `edition`. + pub fn set_edition>(mut self, v: T) -> Self { + self.edition = v.into(); + self + } + + /// Sets the value of `connector_enforcement`. + pub fn set_connector_enforcement>(mut self, v: T) -> Self { + self.connector_enforcement = v.into(); + self + } + + /// Sets the value of `deletion_protection_enabled`. + pub fn set_deletion_protection_enabled>>(mut self, v: T) -> Self { + self.deletion_protection_enabled = v.into(); + self + } + + /// Sets the value of `time_zone`. + pub fn set_time_zone>(mut self, v: T) -> Self { + self.time_zone = v.into(); + self + } + + /// Sets the value of `advanced_machine_features`. + pub fn set_advanced_machine_features>>(mut self, v: T) -> Self { + self.advanced_machine_features = v.into(); + self + } + + /// Sets the value of `data_cache_config`. + pub fn set_data_cache_config>>(mut self, v: T) -> Self { + self.data_cache_config = v.into(); + self + } + + /// Sets the value of `enable_google_ml_integration`. + pub fn set_enable_google_ml_integration>>(mut self, v: T) -> Self { + self.enable_google_ml_integration = v.into(); + self + } + + /// Sets the value of `enable_dataplex_integration`. + pub fn set_enable_dataplex_integration>>(mut self, v: T) -> Self { + self.enable_dataplex_integration = v.into(); + self + } +} + +impl wkt::message::Message for Settings { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.Settings" + } +} + +/// Defines additional types related to Settings +pub mod settings { + #[allow(unused_imports)] + use super::*; + + + /// Specifies when the instance is activated. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct SqlActivationPolicy(std::string::String); + + impl SqlActivationPolicy { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [SqlActivationPolicy](SqlActivationPolicy) + pub mod sql_activation_policy { + + /// Unknown activation plan. + pub const SQL_ACTIVATION_POLICY_UNSPECIFIED: &str = "SQL_ACTIVATION_POLICY_UNSPECIFIED"; + + /// The instance is always up and running. + pub const ALWAYS: &str = "ALWAYS"; + + /// The instance never starts. + pub const NEVER: &str = "NEVER"; + + /// The instance starts upon receiving requests. + pub const ON_DEMAND: &str = "ON_DEMAND"; + } + + /// The edition of the instance, can be ENTERPRISE or ENTERPRISE_PLUS. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct Edition(std::string::String); + + impl Edition { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [Edition](Edition) + pub mod edition { + + /// The instance did not specify the edition. + pub const EDITION_UNSPECIFIED: &str = "EDITION_UNSPECIFIED"; + + /// The instance is an enterprise edition. + pub const ENTERPRISE: &str = "ENTERPRISE"; + + /// The instance is an Enterprise Plus edition. + pub const ENTERPRISE_PLUS: &str = "ENTERPRISE_PLUS"; + } + + /// The options for enforcing Cloud SQL connectors in the instance. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct ConnectorEnforcement(std::string::String); + + impl ConnectorEnforcement { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [ConnectorEnforcement](ConnectorEnforcement) + pub mod connector_enforcement { + + /// The requirement for Cloud SQL connectors is unknown. + pub const CONNECTOR_ENFORCEMENT_UNSPECIFIED: &str = "CONNECTOR_ENFORCEMENT_UNSPECIFIED"; + + /// Do not require Cloud SQL connectors. + pub const NOT_REQUIRED: &str = "NOT_REQUIRED"; + + /// Require all connections to use Cloud SQL connectors, including the + /// Cloud SQL Auth Proxy and Cloud SQL Java, Python, and Go connectors. + /// Note: This disables all existing authorized networks. + pub const REQUIRED: &str = "REQUIRED"; + } +} + +/// Specifies options for controlling advanced machine features. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct AdvancedMachineFeatures { + + /// The number of threads per physical core. + pub threads_per_core: i32, +} + +impl AdvancedMachineFeatures { + + /// Sets the value of `threads_per_core`. + pub fn set_threads_per_core>(mut self, v: T) -> Self { + self.threads_per_core = v.into(); + self + } +} + +impl wkt::message::Message for AdvancedMachineFeatures { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.AdvancedMachineFeatures" + } +} + +/// SslCerts Resource +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SslCert { + + /// This is always `sql#sslCert`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// Serial number, as extracted from the certificate. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub cert_serial_number: std::string::String, + + /// PEM representation. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub cert: std::string::String, + + /// The time when the certificate was created in [RFC + /// 3339](https://tools.ietf.org/html/rfc3339) format, for example + /// `2012-11-15T16:19:00.094Z` + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub create_time: std::option::Option, + + /// User supplied name. Constrained to [a-zA-Z.-_ ]+. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub common_name: std::string::String, + + /// The time when the certificate expires in [RFC + /// 3339](https://tools.ietf.org/html/rfc3339) format, for example + /// `2012-11-15T16:19:00.094Z`. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub expiration_time: std::option::Option, + + /// Sha1 Fingerprint. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub sha1_fingerprint: std::string::String, + + /// Name of the database instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// The URI of this resource. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub self_link: std::string::String, +} + +impl SslCert { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `cert_serial_number`. + pub fn set_cert_serial_number>(mut self, v: T) -> Self { + self.cert_serial_number = v.into(); + self + } + + /// Sets the value of `cert`. + pub fn set_cert>(mut self, v: T) -> Self { + self.cert = v.into(); + self + } + + /// Sets the value of `create_time`. + pub fn set_create_time>>(mut self, v: T) -> Self { + self.create_time = v.into(); + self + } + + /// Sets the value of `common_name`. + pub fn set_common_name>(mut self, v: T) -> Self { + self.common_name = v.into(); + self + } + + /// Sets the value of `expiration_time`. + pub fn set_expiration_time>>(mut self, v: T) -> Self { + self.expiration_time = v.into(); + self + } + + /// Sets the value of `sha1_fingerprint`. + pub fn set_sha1_fingerprint>(mut self, v: T) -> Self { + self.sha1_fingerprint = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `self_link`. + pub fn set_self_link>(mut self, v: T) -> Self { + self.self_link = v.into(); + self + } +} + +impl wkt::message::Message for SslCert { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SslCert" + } +} + +/// SslCertDetail. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SslCertDetail { + + /// The public information about the cert. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub cert_info: std::option::Option, + + /// The private key for the client cert, in pem format. Keep private in order + /// to protect your security. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub cert_private_key: std::string::String, +} + +impl SslCertDetail { + + /// Sets the value of `cert_info`. + pub fn set_cert_info>>(mut self, v: T) -> Self { + self.cert_info = v.into(); + self + } + + /// Sets the value of `cert_private_key`. + pub fn set_cert_private_key>(mut self, v: T) -> Self { + self.cert_private_key = v.into(); + self + } +} + +impl wkt::message::Message for SslCertDetail { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SslCertDetail" + } +} + +/// Active Directory configuration, relevant only for Cloud SQL for SQL Server. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlActiveDirectoryConfig { + + /// This is always sql#activeDirectoryConfig. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The name of the domain (e.g., mydomain.com). + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub domain: std::string::String, +} + +impl SqlActiveDirectoryConfig { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `domain`. + pub fn set_domain>(mut self, v: T) -> Self { + self.domain = v.into(); + self + } +} + +impl wkt::message::Message for SqlActiveDirectoryConfig { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlActiveDirectoryConfig" + } +} + +/// SQL Server specific audit configuration. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlServerAuditConfig { + + /// This is always sql#sqlServerAuditConfig + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The name of the destination bucket (e.g., gs://mybucket). + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub bucket: std::string::String, + + /// How long to keep generated audit files. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub retention_interval: std::option::Option, + + /// How often to upload generated audit files. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub upload_interval: std::option::Option, +} + +impl SqlServerAuditConfig { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `bucket`. + pub fn set_bucket>(mut self, v: T) -> Self { + self.bucket = v.into(); + self + } + + /// Sets the value of `retention_interval`. + pub fn set_retention_interval>>(mut self, v: T) -> Self { + self.retention_interval = v.into(); + self + } + + /// Sets the value of `upload_interval`. + pub fn set_upload_interval>>(mut self, v: T) -> Self { + self.upload_interval = v.into(); + self + } +} + +impl wkt::message::Message for SqlServerAuditConfig { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlServerAuditConfig" + } +} + +/// Acquire SSRS lease context. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct AcquireSsrsLeaseContext { + + /// The username to be used as the setup login to connect to the database + /// server for SSRS setup. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub setup_login: std::option::Option, + + /// The username to be used as the service login to connect to the report + /// database for SSRS setup. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub service_login: std::option::Option, + + /// The report database to be used for SSRS setup. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub report_database: std::option::Option, + + /// Lease duration needed for SSRS setup. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub duration: std::option::Option, +} + +impl AcquireSsrsLeaseContext { + + /// Sets the value of `setup_login`. + pub fn set_setup_login>>(mut self, v: T) -> Self { + self.setup_login = v.into(); + self + } + + /// Sets the value of `service_login`. + pub fn set_service_login>>(mut self, v: T) -> Self { + self.service_login = v.into(); + self + } + + /// Sets the value of `report_database`. + pub fn set_report_database>>(mut self, v: T) -> Self { + self.report_database = v.into(); + self + } + + /// Sets the value of `duration`. + pub fn set_duration>>(mut self, v: T) -> Self { + self.duration = v.into(); + self + } +} + +impl wkt::message::Message for AcquireSsrsLeaseContext { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.AcquireSsrsLeaseContext" + } +} + +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlSslCertsDeleteRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// Sha1 FingerPrint. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub sha1_fingerprint: std::string::String, +} + +impl SqlSslCertsDeleteRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `sha1_fingerprint`. + pub fn set_sha1_fingerprint>(mut self, v: T) -> Self { + self.sha1_fingerprint = v.into(); + self + } +} + +impl wkt::message::Message for SqlSslCertsDeleteRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlSslCertsDeleteRequest" + } +} + +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlSslCertsGetRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// Sha1 FingerPrint. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub sha1_fingerprint: std::string::String, +} + +impl SqlSslCertsGetRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `sha1_fingerprint`. + pub fn set_sha1_fingerprint>(mut self, v: T) -> Self { + self.sha1_fingerprint = v.into(); + self + } +} + +impl wkt::message::Message for SqlSslCertsGetRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlSslCertsGetRequest" + } +} + +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlSslCertsInsertRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlSslCertsInsertRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlSslCertsInsertRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlSslCertsInsertRequest" + } +} + +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlSslCertsListRequest { + + /// Cloud SQL instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlSslCertsListRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlSslCertsListRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlSslCertsListRequest" + } +} + +/// SslCerts insert request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SslCertsInsertRequest { + + /// User supplied name. Must be a distinct name from the other certificates + /// for this instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub common_name: std::string::String, +} + +impl SslCertsInsertRequest { + + /// Sets the value of `common_name`. + pub fn set_common_name>(mut self, v: T) -> Self { + self.common_name = v.into(); + self + } +} + +impl wkt::message::Message for SslCertsInsertRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SslCertsInsertRequest" + } +} + +/// SslCert insert response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SslCertsInsertResponse { + + /// This is always `sql#sslCertsInsert`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The operation to track the ssl certs insert request. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub operation: std::option::Option, + + /// The server Certificate Authority's certificate. If this is missing you can + /// force a new one to be generated by calling resetSslConfig method on + /// instances resource. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub server_ca_cert: std::option::Option, + + /// The new client certificate and private key. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub client_cert: std::option::Option, +} + +impl SslCertsInsertResponse { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `operation`. + pub fn set_operation>>(mut self, v: T) -> Self { + self.operation = v.into(); + self + } + + /// Sets the value of `server_ca_cert`. + pub fn set_server_ca_cert>>(mut self, v: T) -> Self { + self.server_ca_cert = v.into(); + self + } + + /// Sets the value of `client_cert`. + pub fn set_client_cert>>(mut self, v: T) -> Self { + self.client_cert = v.into(); + self + } +} + +impl wkt::message::Message for SslCertsInsertResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SslCertsInsertResponse" + } +} + +/// SslCerts list response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SslCertsListResponse { + + /// This is always `sql#sslCertsList`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// List of client certificates for the instance. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub items: std::vec::Vec, +} + +impl SslCertsListResponse { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `items`. + pub fn set_items>>(mut self, v: T) -> Self { + self.items = v.into(); + self + } +} + +impl wkt::message::Message for SslCertsListResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SslCertsListResponse" + } +} + +/// Tiers list request. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlTiersListRequest { + + /// Project ID of the project for which to list tiers. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlTiersListRequest { + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlTiersListRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlTiersListRequest" + } +} + +/// Tiers list response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct TiersListResponse { + + /// This is always `sql#tiersList`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// List of tiers. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub items: std::vec::Vec, +} + +impl TiersListResponse { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `items`. + pub fn set_items>>(mut self, v: T) -> Self { + self.items = v.into(); + self + } +} + +impl wkt::message::Message for TiersListResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.TiersListResponse" + } +} + +/// A Google Cloud SQL service tier resource. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct Tier { + + /// An identifier for the machine type, for example, `db-custom-1-3840`. For + /// related information, see [Pricing](/sql/pricing). + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub tier: std::string::String, + + /// The maximum RAM usage of this tier in bytes. + #[serde(rename = "RAM")] + #[serde_as(as = "serde_with::DisplayFromStr")] + pub ram: i64, + + /// This is always `sql#tier`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The maximum disk size of this tier in bytes. + #[serde(rename = "DiskQuota")] + #[serde_as(as = "serde_with::DisplayFromStr")] + pub disk_quota: i64, + + /// The applicable regions for this tier. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub region: std::vec::Vec, +} + +impl Tier { + + /// Sets the value of `tier`. + pub fn set_tier>(mut self, v: T) -> Self { + self.tier = v.into(); + self + } + + /// Sets the value of `ram`. + pub fn set_ram>(mut self, v: T) -> Self { + self.ram = v.into(); + self + } + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `disk_quota`. + pub fn set_disk_quota>(mut self, v: T) -> Self { + self.disk_quota = v.into(); + self + } + + /// Sets the value of `region`. + pub fn set_region>>(mut self, v: T) -> Self { + self.region = v.into(); + self + } +} + +impl wkt::message::Message for Tier { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.Tier" + } +} + +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlUsersDeleteRequest { + + /// Host of the user in the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub host: std::string::String, + + /// Database instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Name of the user in the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlUsersDeleteRequest { + + /// Sets the value of `host`. + pub fn set_host>(mut self, v: T) -> Self { + self.host = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlUsersDeleteRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlUsersDeleteRequest" + } +} + +/// Request message for Users Get RPC +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlUsersGetRequest { + + /// Database instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// User of the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// Host of a user of the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub host: std::string::String, +} + +impl SqlUsersGetRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `host`. + pub fn set_host>(mut self, v: T) -> Self { + self.host = v.into(); + self + } +} + +impl wkt::message::Message for SqlUsersGetRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlUsersGetRequest" + } +} + +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlUsersInsertRequest { + + /// Database instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlUsersInsertRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlUsersInsertRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlUsersInsertRequest" + } +} + +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlUsersListRequest { + + /// Database instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, +} + +impl SqlUsersListRequest { + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } +} + +impl wkt::message::Message for SqlUsersListRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlUsersListRequest" + } +} + +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlUsersUpdateRequest { + + /// Optional. Host of the user in the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub host: std::string::String, + + /// Database instance ID. This does not include the project ID. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// Name of the user in the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// Project ID of the project that contains the instance. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub body: std::option::Option, +} + +impl SqlUsersUpdateRequest { + + /// Sets the value of `host`. + pub fn set_host>(mut self, v: T) -> Self { + self.host = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `body`. + pub fn set_body>>(mut self, v: T) -> Self { + self.body = v.into(); + self + } +} + +impl wkt::message::Message for SqlUsersUpdateRequest { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlUsersUpdateRequest" + } +} + +/// User level password validation policy. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct UserPasswordValidationPolicy { + + /// Number of failed login attempts allowed before user get locked. + pub allowed_failed_attempts: i32, + + /// Expiration duration after password is updated. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub password_expiration_duration: std::option::Option, + + /// If true, failed login attempts check will be enabled. + pub enable_failed_attempts_check: bool, + + /// Output only. Read-only password status. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub status: std::option::Option, + + /// If true, the user must specify the current password before changing the + /// password. This flag is supported only for MySQL. + pub enable_password_verification: bool, +} + +impl UserPasswordValidationPolicy { + + /// Sets the value of `allowed_failed_attempts`. + pub fn set_allowed_failed_attempts>(mut self, v: T) -> Self { + self.allowed_failed_attempts = v.into(); + self + } + + /// Sets the value of `password_expiration_duration`. + pub fn set_password_expiration_duration>>(mut self, v: T) -> Self { + self.password_expiration_duration = v.into(); + self + } + + /// Sets the value of `enable_failed_attempts_check`. + pub fn set_enable_failed_attempts_check>(mut self, v: T) -> Self { + self.enable_failed_attempts_check = v.into(); + self + } + + /// Sets the value of `status`. + pub fn set_status>>(mut self, v: T) -> Self { + self.status = v.into(); + self + } + + /// Sets the value of `enable_password_verification`. + pub fn set_enable_password_verification>(mut self, v: T) -> Self { + self.enable_password_verification = v.into(); + self + } +} + +impl wkt::message::Message for UserPasswordValidationPolicy { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.UserPasswordValidationPolicy" + } +} + +/// Read-only password status. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct PasswordStatus { + + /// If true, user does not have login privileges. + pub locked: bool, + + /// The expiration time of the current password. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub password_expiration_time: std::option::Option, +} + +impl PasswordStatus { + + /// Sets the value of `locked`. + pub fn set_locked>(mut self, v: T) -> Self { + self.locked = v.into(); + self + } + + /// Sets the value of `password_expiration_time`. + pub fn set_password_expiration_time>>(mut self, v: T) -> Self { + self.password_expiration_time = v.into(); + self + } +} + +impl wkt::message::Message for PasswordStatus { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.PasswordStatus" + } +} + +/// A Cloud SQL user resource. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct User { + + /// This is always `sql#user`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// The password for the user. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub password: std::string::String, + + /// This field is deprecated and will be removed from a future version of the + /// API. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub etag: std::string::String, + + /// The name of the user in the Cloud SQL instance. Can be omitted for + /// `update` because it is already specified in the URL. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub name: std::string::String, + + /// Optional. The host from which the user can connect. For `insert` + /// operations, host defaults to an empty string. For `update` + /// operations, host is specified as part of the request URL. The host name + /// cannot be updated after insertion. For a MySQL instance, it's required; + /// for a PostgreSQL or SQL Server instance, it's optional. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub host: std::string::String, + + /// The name of the Cloud SQL instance. This does not include the project ID. + /// Can be omitted for `update` because it is already specified on the + /// URL. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub instance: std::string::String, + + /// The project ID of the project containing the Cloud SQL database. The Google + /// apps domain is prefixed if applicable. Can be omitted for `update` because + /// it is already specified on the URL. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub project: std::string::String, + + /// The user type. It determines the method to authenticate the user during + /// login. The default is the database's built-in user type. + #[serde(rename = "type")] + pub r#type: crate::model::user::SqlUserType, + + /// User level password validation policy. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub password_policy: std::option::Option, + + /// Dual password status for the user. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub dual_password_type: std::option::Option, + + /// User details for specific database type + #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")] + pub user_details: std::option::Option, +} + +impl User { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `password`. + pub fn set_password>(mut self, v: T) -> Self { + self.password = v.into(); + self + } + + /// Sets the value of `etag`. + pub fn set_etag>(mut self, v: T) -> Self { + self.etag = v.into(); + self + } + + /// Sets the value of `name`. + pub fn set_name>(mut self, v: T) -> Self { + self.name = v.into(); + self + } + + /// Sets the value of `host`. + pub fn set_host>(mut self, v: T) -> Self { + self.host = v.into(); + self + } + + /// Sets the value of `instance`. + pub fn set_instance>(mut self, v: T) -> Self { + self.instance = v.into(); + self + } + + /// Sets the value of `project`. + pub fn set_project>(mut self, v: T) -> Self { + self.project = v.into(); + self + } + + /// Sets the value of `r#type`. + pub fn set_type>(mut self, v: T) -> Self { + self.r#type = v.into(); + self + } + + /// Sets the value of `password_policy`. + pub fn set_password_policy>>(mut self, v: T) -> Self { + self.password_policy = v.into(); + self + } + + /// Sets the value of `dual_password_type`. + pub fn set_dual_password_type>>(mut self, v: T) -> Self { + self.dual_password_type = v.into(); + self + } + + /// Sets the value of `user_details`. + pub fn set_user_details>>(mut self, v: T) ->Self { + self.user_details = v.into(); + self + } +} + +impl wkt::message::Message for User { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.User" + } +} + +/// Defines additional types related to User +pub mod user { + #[allow(unused_imports)] + use super::*; + + + /// The user type. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct SqlUserType(std::string::String); + + impl SqlUserType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [SqlUserType](SqlUserType) + pub mod sql_user_type { + + /// The database's built-in user type. + pub const BUILT_IN: &str = "BUILT_IN"; + + /// Cloud IAM user. + pub const CLOUD_IAM_USER: &str = "CLOUD_IAM_USER"; + + /// Cloud IAM service account. + pub const CLOUD_IAM_SERVICE_ACCOUNT: &str = "CLOUD_IAM_SERVICE_ACCOUNT"; + + /// Cloud IAM group non-login user. + pub const CLOUD_IAM_GROUP: &str = "CLOUD_IAM_GROUP"; + + /// Cloud IAM group login user. + pub const CLOUD_IAM_GROUP_USER: &str = "CLOUD_IAM_GROUP_USER"; + + /// Cloud IAM group login service account. + pub const CLOUD_IAM_GROUP_SERVICE_ACCOUNT: &str = "CLOUD_IAM_GROUP_SERVICE_ACCOUNT"; + } + + /// The type of retained password. + #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct DualPasswordType(std::string::String); + + impl DualPasswordType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } + } + + /// Useful constants to work with [DualPasswordType](DualPasswordType) + pub mod dual_password_type { + + /// The default value. + pub const DUAL_PASSWORD_TYPE_UNSPECIFIED: &str = "DUAL_PASSWORD_TYPE_UNSPECIFIED"; + + /// Do not update the user's dual password status. + pub const NO_MODIFY_DUAL_PASSWORD: &str = "NO_MODIFY_DUAL_PASSWORD"; + + /// No dual password usable for connecting using this user. + pub const NO_DUAL_PASSWORD: &str = "NO_DUAL_PASSWORD"; + + /// Dual password usable for connecting using this user. + pub const DUAL_PASSWORD: &str = "DUAL_PASSWORD"; + } + + /// User details for specific database type + #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(rename_all = "camelCase")] + #[non_exhaustive] + pub enum UserDetails { + SqlserverUserDetails(crate::model::SqlServerUserDetails), + } +} + +/// Represents a Sql Server user on the Cloud SQL instance. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct SqlServerUserDetails { + + /// If the user has been disabled + pub disabled: bool, + + /// The server roles for this user + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub server_roles: std::vec::Vec, +} + +impl SqlServerUserDetails { + + /// Sets the value of `disabled`. + pub fn set_disabled>(mut self, v: T) -> Self { + self.disabled = v.into(); + self + } + + /// Sets the value of `server_roles`. + pub fn set_server_roles>>(mut self, v: T) -> Self { + self.server_roles = v.into(); + self + } +} + +impl wkt::message::Message for SqlServerUserDetails { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.SqlServerUserDetails" + } +} + +/// User list response. +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(default, rename_all = "camelCase")] +#[non_exhaustive] +pub struct UsersListResponse { + + /// This is always `sql#usersList`. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub kind: std::string::String, + + /// List of user resources in the instance. + #[serde(skip_serializing_if = "std::vec::Vec::is_empty")] + pub items: std::vec::Vec, + + /// Unused. + #[serde(skip_serializing_if = "std::string::String::is_empty")] + pub next_page_token: std::string::String, +} + +impl UsersListResponse { + + /// Sets the value of `kind`. + pub fn set_kind>(mut self, v: T) -> Self { + self.kind = v.into(); + self + } + + /// Sets the value of `items`. + pub fn set_items>>(mut self, v: T) -> Self { + self.items = v.into(); + self + } + + /// Sets the value of `next_page_token`. + pub fn set_next_page_token>(mut self, v: T) -> Self { + self.next_page_token = v.into(); + self + } +} + +impl wkt::message::Message for UsersListResponse { + fn typename() -> &'static str { + "type.googleapis.com/google.cloud.sql.v1.UsersListResponse" + } +} + +/// The status of a backup run. +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlBackupRunStatus(std::string::String); + +impl SqlBackupRunStatus { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlBackupRunStatus](SqlBackupRunStatus) +pub mod sql_backup_run_status { + + /// The status of the run is unknown. + pub const SQL_BACKUP_RUN_STATUS_UNSPECIFIED: &str = "SQL_BACKUP_RUN_STATUS_UNSPECIFIED"; + + /// The backup operation was enqueued. + pub const ENQUEUED: &str = "ENQUEUED"; + + /// The backup is overdue across a given backup window. Indicates a + /// problem. Example: Long-running operation in progress during + /// the whole window. + pub const OVERDUE: &str = "OVERDUE"; + + /// The backup is in progress. + pub const RUNNING: &str = "RUNNING"; + + /// The backup failed. + pub const FAILED: &str = "FAILED"; + + /// The backup was successful. + pub const SUCCESSFUL: &str = "SUCCESSFUL"; + + /// The backup was skipped (without problems) for a given backup + /// window. Example: Instance was idle. + pub const SKIPPED: &str = "SKIPPED"; + + /// The backup is about to be deleted. + pub const DELETION_PENDING: &str = "DELETION_PENDING"; + + /// The backup deletion failed. + pub const DELETION_FAILED: &str = "DELETION_FAILED"; + + /// The backup has been deleted. + pub const DELETED: &str = "DELETED"; +} + +/// Defines the supported backup kinds. +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlBackupKind(std::string::String); + +impl SqlBackupKind { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlBackupKind](SqlBackupKind) +pub mod sql_backup_kind { + + /// This is an unknown BackupKind. + pub const SQL_BACKUP_KIND_UNSPECIFIED: &str = "SQL_BACKUP_KIND_UNSPECIFIED"; + + /// The snapshot based backups + pub const SNAPSHOT: &str = "SNAPSHOT"; + + /// Physical backups + pub const PHYSICAL: &str = "PHYSICAL"; +} + +/// Type of backup (i.e. automated, on demand, etc). +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlBackupRunType(std::string::String); + +impl SqlBackupRunType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlBackupRunType](SqlBackupRunType) +pub mod sql_backup_run_type { + + /// This is an unknown BackupRun type. + pub const SQL_BACKUP_RUN_TYPE_UNSPECIFIED: &str = "SQL_BACKUP_RUN_TYPE_UNSPECIFIED"; + + /// The backup schedule automatically triggers a backup. + pub const AUTOMATED: &str = "AUTOMATED"; + + /// The user manually triggers a backup. + pub const ON_DEMAND: &str = "ON_DEMAND"; +} + +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlFlagType(std::string::String); + +impl SqlFlagType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlFlagType](SqlFlagType) +pub mod sql_flag_type { + + /// This is an unknown flag type. + pub const SQL_FLAG_TYPE_UNSPECIFIED: &str = "SQL_FLAG_TYPE_UNSPECIFIED"; + + /// Boolean type flag. + pub const BOOLEAN: &str = "BOOLEAN"; + + /// String type flag. + pub const STRING: &str = "STRING"; + + /// Integer type flag. + pub const INTEGER: &str = "INTEGER"; + + /// Flag type used for a server startup option. + pub const NONE: &str = "NONE"; + + /// Type introduced specially for MySQL TimeZone offset. Accept a string value + /// with the format [-12:59, 13:00]. + pub const MYSQL_TIMEZONE_OFFSET: &str = "MYSQL_TIMEZONE_OFFSET"; + + /// Float type flag. + pub const FLOAT: &str = "FLOAT"; + + /// Comma-separated list of the strings in a SqlFlagType enum. + pub const REPEATED_STRING: &str = "REPEATED_STRING"; +} + +/// External Sync parallel level. +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct ExternalSyncParallelLevel(std::string::String); + +impl ExternalSyncParallelLevel { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [ExternalSyncParallelLevel](ExternalSyncParallelLevel) +pub mod external_sync_parallel_level { + + /// Unknown sync parallel level. Will be defaulted to OPTIMAL. + pub const EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED: &str = "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED"; + + /// Minimal parallel level. + pub const MIN: &str = "MIN"; + + /// Optimal parallel level. + pub const OPTIMAL: &str = "OPTIMAL"; + + /// Maximum parallel level. + pub const MAX: &str = "MAX"; +} + +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlInstanceType(std::string::String); + +impl SqlInstanceType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlInstanceType](SqlInstanceType) +pub mod sql_instance_type { + + /// This is an unknown Cloud SQL instance type. + pub const SQL_INSTANCE_TYPE_UNSPECIFIED: &str = "SQL_INSTANCE_TYPE_UNSPECIFIED"; + + /// A regular Cloud SQL instance that is not replicating from a primary + /// instance. + pub const CLOUD_SQL_INSTANCE: &str = "CLOUD_SQL_INSTANCE"; + + /// An instance running on the customer's premises that is not managed by + /// Cloud SQL. + pub const ON_PREMISES_INSTANCE: &str = "ON_PREMISES_INSTANCE"; + + /// A Cloud SQL instance acting as a read-replica. + pub const READ_REPLICA_INSTANCE: &str = "READ_REPLICA_INSTANCE"; +} + +/// The suspension reason of the database instance if the state is SUSPENDED. +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlSuspensionReason(std::string::String); + +impl SqlSuspensionReason { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlSuspensionReason](SqlSuspensionReason) +pub mod sql_suspension_reason { + + /// This is an unknown suspension reason. + pub const SQL_SUSPENSION_REASON_UNSPECIFIED: &str = "SQL_SUSPENSION_REASON_UNSPECIFIED"; + + /// The instance is suspended due to billing issues (for example:, GCP account + /// issue) + pub const BILLING_ISSUE: &str = "BILLING_ISSUE"; + + /// The instance is suspended due to illegal content (for example:, child + /// pornography, copyrighted material, etc.). + pub const LEGAL_ISSUE: &str = "LEGAL_ISSUE"; + + /// The instance is causing operational issues (for example:, causing the + /// database to crash). + pub const OPERATIONAL_ISSUE: &str = "OPERATIONAL_ISSUE"; + + /// The KMS key used by the instance is either revoked or denied access to + pub const KMS_KEY_ISSUE: &str = "KMS_KEY_ISSUE"; +} + +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlFileType(std::string::String); + +impl SqlFileType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlFileType](SqlFileType) +pub mod sql_file_type { + + /// Unknown file type. + pub const SQL_FILE_TYPE_UNSPECIFIED: &str = "SQL_FILE_TYPE_UNSPECIFIED"; + + /// File containing SQL statements. + pub const SQL: &str = "SQL"; + + /// File in CSV format. + pub const CSV: &str = "CSV"; + + pub const BAK: &str = "BAK"; +} + +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct BakType(std::string::String); + +impl BakType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [BakType](BakType) +pub mod bak_type { + + /// Default type. + pub const BAK_TYPE_UNSPECIFIED: &str = "BAK_TYPE_UNSPECIFIED"; + + /// Full backup. + pub const FULL: &str = "FULL"; + + /// Differential backup. + pub const DIFF: &str = "DIFF"; + + /// Transaction Log backup + pub const TLOG: &str = "TLOG"; +} + +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlBackendType(std::string::String); + +impl SqlBackendType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlBackendType](SqlBackendType) +pub mod sql_backend_type { + + /// This is an unknown backend type for instance. + pub const SQL_BACKEND_TYPE_UNSPECIFIED: &str = "SQL_BACKEND_TYPE_UNSPECIFIED"; + + /// V1 speckle instance. + pub const FIRST_GEN: &str = "FIRST_GEN"; + + /// V2 speckle instance. + pub const SECOND_GEN: &str = "SECOND_GEN"; + + /// On premises instance. + pub const EXTERNAL: &str = "EXTERNAL"; +} + +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlIpAddressType(std::string::String); + +impl SqlIpAddressType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlIpAddressType](SqlIpAddressType) +pub mod sql_ip_address_type { + + /// This is an unknown IP address type. + pub const SQL_IP_ADDRESS_TYPE_UNSPECIFIED: &str = "SQL_IP_ADDRESS_TYPE_UNSPECIFIED"; + + /// IP address the customer is supposed to connect to. Usually this is the + /// load balancer's IP address + pub const PRIMARY: &str = "PRIMARY"; + + /// Source IP address of the connection a read replica establishes to its + /// external primary instance. This IP address can be allowlisted by the + /// customer in case it has a firewall that filters incoming connection to its + /// on premises primary instance. + pub const OUTGOING: &str = "OUTGOING"; + + /// Private IP used when using private IPs and network peering. + pub const PRIVATE: &str = "PRIVATE"; + + /// V1 IP of a migrated instance. We want the user to + /// decommission this IP as soon as the migration is complete. + /// Note: V1 instances with V1 ip addresses will be counted as PRIMARY. + pub const MIGRATED_1ST_GEN: &str = "MIGRATED_1ST_GEN"; +} + +/// The database engine type and version. +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlDatabaseVersion(std::string::String); + +impl SqlDatabaseVersion { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlDatabaseVersion](SqlDatabaseVersion) +pub mod sql_database_version { + + /// This is an unknown database version. + pub const SQL_DATABASE_VERSION_UNSPECIFIED: &str = "SQL_DATABASE_VERSION_UNSPECIFIED"; + + /// The database version is MySQL 5.1. + pub const MYSQL_5_1: &str = "MYSQL_5_1"; + + /// The database version is MySQL 5.5. + pub const MYSQL_5_5: &str = "MYSQL_5_5"; + + /// The database version is MySQL 5.6. + pub const MYSQL_5_6: &str = "MYSQL_5_6"; + + /// The database version is MySQL 5.7. + pub const MYSQL_5_7: &str = "MYSQL_5_7"; + + /// The database version is SQL Server 2017 Standard. + pub const SQLSERVER_2017_STANDARD: &str = "SQLSERVER_2017_STANDARD"; + + /// The database version is SQL Server 2017 Enterprise. + pub const SQLSERVER_2017_ENTERPRISE: &str = "SQLSERVER_2017_ENTERPRISE"; + + /// The database version is SQL Server 2017 Express. + pub const SQLSERVER_2017_EXPRESS: &str = "SQLSERVER_2017_EXPRESS"; + + /// The database version is SQL Server 2017 Web. + pub const SQLSERVER_2017_WEB: &str = "SQLSERVER_2017_WEB"; + + /// The database version is PostgreSQL 9.6. + pub const POSTGRES_9_6: &str = "POSTGRES_9_6"; + + /// The database version is PostgreSQL 10. + pub const POSTGRES_10: &str = "POSTGRES_10"; + + /// The database version is PostgreSQL 11. + pub const POSTGRES_11: &str = "POSTGRES_11"; + + /// The database version is PostgreSQL 12. + pub const POSTGRES_12: &str = "POSTGRES_12"; + + /// The database version is PostgreSQL 13. + pub const POSTGRES_13: &str = "POSTGRES_13"; + + /// The database version is PostgreSQL 14. + pub const POSTGRES_14: &str = "POSTGRES_14"; + + /// The database version is PostgreSQL 15. + pub const POSTGRES_15: &str = "POSTGRES_15"; + + /// The database version is PostgreSQL 16. + pub const POSTGRES_16: &str = "POSTGRES_16"; + + /// The database version is MySQL 8. + pub const MYSQL_8_0: &str = "MYSQL_8_0"; + + /// The database major version is MySQL 8.0 and the minor version is 18. + pub const MYSQL_8_0_18: &str = "MYSQL_8_0_18"; + + /// The database major version is MySQL 8.0 and the minor version is 26. + pub const MYSQL_8_0_26: &str = "MYSQL_8_0_26"; + + /// The database major version is MySQL 8.0 and the minor version is 27. + pub const MYSQL_8_0_27: &str = "MYSQL_8_0_27"; + + /// The database major version is MySQL 8.0 and the minor version is 28. + pub const MYSQL_8_0_28: &str = "MYSQL_8_0_28"; + + /// The database major version is MySQL 8.0 and the minor version is 29. + pub const MYSQL_8_0_29: &str = "MYSQL_8_0_29"; + + /// The database major version is MySQL 8.0 and the minor version is 30. + pub const MYSQL_8_0_30: &str = "MYSQL_8_0_30"; + + /// The database major version is MySQL 8.0 and the minor version is 31. + pub const MYSQL_8_0_31: &str = "MYSQL_8_0_31"; + + /// The database major version is MySQL 8.0 and the minor version is 32. + pub const MYSQL_8_0_32: &str = "MYSQL_8_0_32"; + + /// The database major version is MySQL 8.0 and the minor version is 33. + pub const MYSQL_8_0_33: &str = "MYSQL_8_0_33"; + + /// The database major version is MySQL 8.0 and the minor version is 34. + pub const MYSQL_8_0_34: &str = "MYSQL_8_0_34"; + + /// The database major version is MySQL 8.0 and the minor version is 35. + pub const MYSQL_8_0_35: &str = "MYSQL_8_0_35"; + + /// The database major version is MySQL 8.0 and the minor version is 36. + pub const MYSQL_8_0_36: &str = "MYSQL_8_0_36"; + + /// The database major version is MySQL 8.0 and the minor version is 37. + pub const MYSQL_8_0_37: &str = "MYSQL_8_0_37"; + + /// The database major version is MySQL 8.0 and the minor version is 38. + pub const MYSQL_8_0_38: &str = "MYSQL_8_0_38"; + + /// The database major version is MySQL 8.0 and the minor version is 39. + pub const MYSQL_8_0_39: &str = "MYSQL_8_0_39"; + + /// The database major version is MySQL 8.0 and the minor version is 40. + pub const MYSQL_8_0_40: &str = "MYSQL_8_0_40"; + + /// The database version is MySQL 8.4. + pub const MYSQL_8_4: &str = "MYSQL_8_4"; + + /// The database version is MySQL 8.4 and the patch version is 0. + pub const MYSQL_8_4_0: &str = "MYSQL_8_4_0"; + + /// The database version is SQL Server 2019 Standard. + pub const SQLSERVER_2019_STANDARD: &str = "SQLSERVER_2019_STANDARD"; + + /// The database version is SQL Server 2019 Enterprise. + pub const SQLSERVER_2019_ENTERPRISE: &str = "SQLSERVER_2019_ENTERPRISE"; + + /// The database version is SQL Server 2019 Express. + pub const SQLSERVER_2019_EXPRESS: &str = "SQLSERVER_2019_EXPRESS"; + + /// The database version is SQL Server 2019 Web. + pub const SQLSERVER_2019_WEB: &str = "SQLSERVER_2019_WEB"; + + /// The database version is SQL Server 2022 Standard. + pub const SQLSERVER_2022_STANDARD: &str = "SQLSERVER_2022_STANDARD"; + + /// The database version is SQL Server 2022 Enterprise. + pub const SQLSERVER_2022_ENTERPRISE: &str = "SQLSERVER_2022_ENTERPRISE"; + + /// The database version is SQL Server 2022 Express. + pub const SQLSERVER_2022_EXPRESS: &str = "SQLSERVER_2022_EXPRESS"; + + /// The database version is SQL Server 2022 Web. + pub const SQLSERVER_2022_WEB: &str = "SQLSERVER_2022_WEB"; +} + +/// The pricing plan for this instance. +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlPricingPlan(std::string::String); + +impl SqlPricingPlan { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlPricingPlan](SqlPricingPlan) +pub mod sql_pricing_plan { + + /// This is an unknown pricing plan for this instance. + pub const SQL_PRICING_PLAN_UNSPECIFIED: &str = "SQL_PRICING_PLAN_UNSPECIFIED"; + + /// The instance is billed at a monthly flat rate. + pub const PACKAGE: &str = "PACKAGE"; + + /// The instance is billed per usage. + pub const PER_USE: &str = "PER_USE"; +} + +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlReplicationType(std::string::String); + +impl SqlReplicationType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlReplicationType](SqlReplicationType) +pub mod sql_replication_type { + + /// This is an unknown replication type for a Cloud SQL instance. + pub const SQL_REPLICATION_TYPE_UNSPECIFIED: &str = "SQL_REPLICATION_TYPE_UNSPECIFIED"; + + /// The synchronous replication mode for First Generation instances. It is the + /// default value. + pub const SYNCHRONOUS: &str = "SYNCHRONOUS"; + + /// The asynchronous replication mode for First Generation instances. It + /// provides a slight performance gain, but if an outage occurs while this + /// option is set to asynchronous, you can lose up to a few seconds of updates + /// to your data. + pub const ASYNCHRONOUS: &str = "ASYNCHRONOUS"; +} + +/// The type of disk that is used for a v2 instance to use. +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlDataDiskType(std::string::String); + +impl SqlDataDiskType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlDataDiskType](SqlDataDiskType) +pub mod sql_data_disk_type { + + /// This is an unknown data disk type. + pub const SQL_DATA_DISK_TYPE_UNSPECIFIED: &str = "SQL_DATA_DISK_TYPE_UNSPECIFIED"; + + /// An SSD data disk. + pub const PD_SSD: &str = "PD_SSD"; + + /// An HDD data disk. + pub const PD_HDD: &str = "PD_HDD"; + + /// This field is deprecated and will be removed from a future version of the + /// API. + pub const OBSOLETE_LOCAL_SSD: &str = "OBSOLETE_LOCAL_SSD"; +} + +/// The availability type of the given Cloud SQL instance. +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlAvailabilityType(std::string::String); + +impl SqlAvailabilityType { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlAvailabilityType](SqlAvailabilityType) +pub mod sql_availability_type { + + /// This is an unknown Availability type. + pub const SQL_AVAILABILITY_TYPE_UNSPECIFIED: &str = "SQL_AVAILABILITY_TYPE_UNSPECIFIED"; + + /// Zonal available instance. + pub const ZONAL: &str = "ZONAL"; + + /// Regional available instance. + pub const REGIONAL: &str = "REGIONAL"; +} + +#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct SqlUpdateTrack(std::string::String); + +impl SqlUpdateTrack { + /// Sets the enum value. + pub fn set_value>(mut self, v: T) -> Self { + self.0 = v.into(); + self + } + + /// Gets the enum value. + pub fn value(&self) -> &str { + &self.0 + } +} + +/// Useful constants to work with [SqlUpdateTrack](SqlUpdateTrack) +pub mod sql_update_track { + + /// This is an unknown maintenance timing preference. + pub const SQL_UPDATE_TRACK_UNSPECIFIED: &str = "SQL_UPDATE_TRACK_UNSPECIFIED"; + + /// For an instance with a scheduled maintenance window, this maintenance + /// timing indicates that the maintenance update is scheduled 7 to 14 days + /// after the notification is sent out. Also referred to as `Week 1` (Console) + /// and `preview` (gcloud CLI). + pub const CANARY: &str = "canary"; + + /// For an instance with a scheduled maintenance window, this maintenance + /// timing indicates that the maintenance update is scheduled 15 to 21 days + /// after the notification is sent out. Also referred to as `Week 2` (Console) + /// and `production` (gcloud CLI). + pub const STABLE: &str = "stable"; + + /// For instance with a scheduled maintenance window, this maintenance + /// timing indicates that the maintenance update is scheduled 35 to 42 days + /// after the notification is sent out. + pub const WEEK_5: &str = "week5"; +} diff --git a/src/generated/cloud/sql/v1/src/tracing.rs b/src/generated/cloud/sql/v1/src/tracing.rs new file mode 100755 index 000000000..f55dee9b1 --- /dev/null +++ b/src/generated/cloud/sql/v1/src/tracing.rs @@ -0,0 +1,719 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by sidekick. DO NOT EDIT. +use crate::Result; + +/// Implements a [SqlBackupRunsService](crate::traits::) decorator for logging and tracing. +#[derive(Clone, Debug)] +pub struct SqlBackupRunsService +where T: crate::traits::SqlBackupRunsService + std::fmt::Debug + Send + Sync { + inner: T, +} + +impl SqlBackupRunsService +where T: crate::traits::SqlBackupRunsService + std::fmt::Debug + Send + Sync { + pub fn new(inner: T) -> Self { + Self { inner } + } +} + +impl crate::traits::SqlBackupRunsService for SqlBackupRunsService +where T: crate::traits::SqlBackupRunsService + std::fmt::Debug + Send + Sync { + #[tracing::instrument(ret)] + async fn delete( + &self, + req: crate::model::SqlBackupRunsDeleteRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.delete(req, options).await + } + + #[tracing::instrument(ret)] + async fn get( + &self, + req: crate::model::SqlBackupRunsGetRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.get(req, options).await + } + + #[tracing::instrument(ret)] + async fn insert( + &self, + req: crate::model::SqlBackupRunsInsertRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.insert(req, options).await + } + + #[tracing::instrument(ret)] + async fn list( + &self, + req: crate::model::SqlBackupRunsListRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.list(req, options).await + } + +} + +/// Implements a [SqlConnectService](crate::traits::) decorator for logging and tracing. +#[derive(Clone, Debug)] +pub struct SqlConnectService +where T: crate::traits::SqlConnectService + std::fmt::Debug + Send + Sync { + inner: T, +} + +impl SqlConnectService +where T: crate::traits::SqlConnectService + std::fmt::Debug + Send + Sync { + pub fn new(inner: T) -> Self { + Self { inner } + } +} + +impl crate::traits::SqlConnectService for SqlConnectService +where T: crate::traits::SqlConnectService + std::fmt::Debug + Send + Sync { + #[tracing::instrument(ret)] + async fn get_connect_settings( + &self, + req: crate::model::GetConnectSettingsRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.get_connect_settings(req, options).await + } + + #[tracing::instrument(ret)] + async fn generate_ephemeral_cert( + &self, + req: crate::model::GenerateEphemeralCertRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.generate_ephemeral_cert(req, options).await + } + +} + +/// Implements a [SqlDatabasesService](crate::traits::) decorator for logging and tracing. +#[derive(Clone, Debug)] +pub struct SqlDatabasesService +where T: crate::traits::SqlDatabasesService + std::fmt::Debug + Send + Sync { + inner: T, +} + +impl SqlDatabasesService +where T: crate::traits::SqlDatabasesService + std::fmt::Debug + Send + Sync { + pub fn new(inner: T) -> Self { + Self { inner } + } +} + +impl crate::traits::SqlDatabasesService for SqlDatabasesService +where T: crate::traits::SqlDatabasesService + std::fmt::Debug + Send + Sync { + #[tracing::instrument(ret)] + async fn delete( + &self, + req: crate::model::SqlDatabasesDeleteRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.delete(req, options).await + } + + #[tracing::instrument(ret)] + async fn get( + &self, + req: crate::model::SqlDatabasesGetRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.get(req, options).await + } + + #[tracing::instrument(ret)] + async fn insert( + &self, + req: crate::model::SqlDatabasesInsertRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.insert(req, options).await + } + + #[tracing::instrument(ret)] + async fn list( + &self, + req: crate::model::SqlDatabasesListRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.list(req, options).await + } + + #[tracing::instrument(ret)] + async fn patch( + &self, + req: crate::model::SqlDatabasesUpdateRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.patch(req, options).await + } + + #[tracing::instrument(ret)] + async fn update( + &self, + req: crate::model::SqlDatabasesUpdateRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.update(req, options).await + } + +} + +/// Implements a [SqlFlagsService](crate::traits::) decorator for logging and tracing. +#[derive(Clone, Debug)] +pub struct SqlFlagsService +where T: crate::traits::SqlFlagsService + std::fmt::Debug + Send + Sync { + inner: T, +} + +impl SqlFlagsService +where T: crate::traits::SqlFlagsService + std::fmt::Debug + Send + Sync { + pub fn new(inner: T) -> Self { + Self { inner } + } +} + +impl crate::traits::SqlFlagsService for SqlFlagsService +where T: crate::traits::SqlFlagsService + std::fmt::Debug + Send + Sync { + #[tracing::instrument(ret)] + async fn list( + &self, + req: crate::model::SqlFlagsListRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.list(req, options).await + } + +} + +/// Implements a [SqlInstancesService](crate::traits::) decorator for logging and tracing. +#[derive(Clone, Debug)] +pub struct SqlInstancesService +where T: crate::traits::SqlInstancesService + std::fmt::Debug + Send + Sync { + inner: T, +} + +impl SqlInstancesService +where T: crate::traits::SqlInstancesService + std::fmt::Debug + Send + Sync { + pub fn new(inner: T) -> Self { + Self { inner } + } +} + +impl crate::traits::SqlInstancesService for SqlInstancesService +where T: crate::traits::SqlInstancesService + std::fmt::Debug + Send + Sync { + #[tracing::instrument(ret)] + async fn add_server_ca( + &self, + req: crate::model::SqlInstancesAddServerCaRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.add_server_ca(req, options).await + } + + #[tracing::instrument(ret)] + async fn clone( + &self, + req: crate::model::SqlInstancesCloneRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.clone(req, options).await + } + + #[tracing::instrument(ret)] + async fn delete( + &self, + req: crate::model::SqlInstancesDeleteRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.delete(req, options).await + } + + #[tracing::instrument(ret)] + async fn demote_master( + &self, + req: crate::model::SqlInstancesDemoteMasterRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.demote_master(req, options).await + } + + #[tracing::instrument(ret)] + async fn demote( + &self, + req: crate::model::SqlInstancesDemoteRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.demote(req, options).await + } + + #[tracing::instrument(ret)] + async fn export( + &self, + req: crate::model::SqlInstancesExportRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.export(req, options).await + } + + #[tracing::instrument(ret)] + async fn failover( + &self, + req: crate::model::SqlInstancesFailoverRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.failover(req, options).await + } + + #[tracing::instrument(ret)] + async fn reencrypt( + &self, + req: crate::model::SqlInstancesReencryptRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.reencrypt(req, options).await + } + + #[tracing::instrument(ret)] + async fn get( + &self, + req: crate::model::SqlInstancesGetRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.get(req, options).await + } + + #[tracing::instrument(ret)] + async fn import( + &self, + req: crate::model::SqlInstancesImportRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.import(req, options).await + } + + #[tracing::instrument(ret)] + async fn insert( + &self, + req: crate::model::SqlInstancesInsertRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.insert(req, options).await + } + + #[tracing::instrument(ret)] + async fn list( + &self, + req: crate::model::SqlInstancesListRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.list(req, options).await + } + + #[tracing::instrument(ret)] + async fn list_server_cas( + &self, + req: crate::model::SqlInstancesListServerCasRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.list_server_cas(req, options).await + } + + #[tracing::instrument(ret)] + async fn patch( + &self, + req: crate::model::SqlInstancesPatchRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.patch(req, options).await + } + + #[tracing::instrument(ret)] + async fn promote_replica( + &self, + req: crate::model::SqlInstancesPromoteReplicaRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.promote_replica(req, options).await + } + + #[tracing::instrument(ret)] + async fn switchover( + &self, + req: crate::model::SqlInstancesSwitchoverRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.switchover(req, options).await + } + + #[tracing::instrument(ret)] + async fn reset_ssl_config( + &self, + req: crate::model::SqlInstancesResetSslConfigRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.reset_ssl_config(req, options).await + } + + #[tracing::instrument(ret)] + async fn restart( + &self, + req: crate::model::SqlInstancesRestartRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.restart(req, options).await + } + + #[tracing::instrument(ret)] + async fn restore_backup( + &self, + req: crate::model::SqlInstancesRestoreBackupRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.restore_backup(req, options).await + } + + #[tracing::instrument(ret)] + async fn rotate_server_ca( + &self, + req: crate::model::SqlInstancesRotateServerCaRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.rotate_server_ca(req, options).await + } + + #[tracing::instrument(ret)] + async fn start_replica( + &self, + req: crate::model::SqlInstancesStartReplicaRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.start_replica(req, options).await + } + + #[tracing::instrument(ret)] + async fn stop_replica( + &self, + req: crate::model::SqlInstancesStopReplicaRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.stop_replica(req, options).await + } + + #[tracing::instrument(ret)] + async fn truncate_log( + &self, + req: crate::model::SqlInstancesTruncateLogRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.truncate_log(req, options).await + } + + #[tracing::instrument(ret)] + async fn update( + &self, + req: crate::model::SqlInstancesUpdateRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.update(req, options).await + } + + #[tracing::instrument(ret)] + async fn create_ephemeral( + &self, + req: crate::model::SqlInstancesCreateEphemeralCertRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.create_ephemeral(req, options).await + } + + #[tracing::instrument(ret)] + async fn reschedule_maintenance( + &self, + req: crate::model::SqlInstancesRescheduleMaintenanceRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.reschedule_maintenance(req, options).await + } + + #[tracing::instrument(ret)] + async fn verify_external_sync_settings( + &self, + req: crate::model::SqlInstancesVerifyExternalSyncSettingsRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.verify_external_sync_settings(req, options).await + } + + #[tracing::instrument(ret)] + async fn start_external_sync( + &self, + req: crate::model::SqlInstancesStartExternalSyncRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.start_external_sync(req, options).await + } + + #[tracing::instrument(ret)] + async fn perform_disk_shrink( + &self, + req: crate::model::SqlInstancesPerformDiskShrinkRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.perform_disk_shrink(req, options).await + } + + #[tracing::instrument(ret)] + async fn get_disk_shrink_config( + &self, + req: crate::model::SqlInstancesGetDiskShrinkConfigRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.get_disk_shrink_config(req, options).await + } + + #[tracing::instrument(ret)] + async fn reset_replica_size( + &self, + req: crate::model::SqlInstancesResetReplicaSizeRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.reset_replica_size(req, options).await + } + + #[tracing::instrument(ret)] + async fn get_latest_recovery_time( + &self, + req: crate::model::SqlInstancesGetLatestRecoveryTimeRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.get_latest_recovery_time(req, options).await + } + + #[tracing::instrument(ret)] + async fn acquire_ssrs_lease( + &self, + req: crate::model::SqlInstancesAcquireSsrsLeaseRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.acquire_ssrs_lease(req, options).await + } + + #[tracing::instrument(ret)] + async fn release_ssrs_lease( + &self, + req: crate::model::SqlInstancesReleaseSsrsLeaseRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.release_ssrs_lease(req, options).await + } + +} + +/// Implements a [SqlOperationsService](crate::traits::) decorator for logging and tracing. +#[derive(Clone, Debug)] +pub struct SqlOperationsService +where T: crate::traits::SqlOperationsService + std::fmt::Debug + Send + Sync { + inner: T, +} + +impl SqlOperationsService +where T: crate::traits::SqlOperationsService + std::fmt::Debug + Send + Sync { + pub fn new(inner: T) -> Self { + Self { inner } + } +} + +impl crate::traits::SqlOperationsService for SqlOperationsService +where T: crate::traits::SqlOperationsService + std::fmt::Debug + Send + Sync { + #[tracing::instrument(ret)] + async fn get( + &self, + req: crate::model::SqlOperationsGetRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.get(req, options).await + } + + #[tracing::instrument(ret)] + async fn list( + &self, + req: crate::model::SqlOperationsListRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.list(req, options).await + } + + #[tracing::instrument(ret)] + async fn cancel( + &self, + req: crate::model::SqlOperationsCancelRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.cancel(req, options).await + } + +} + +/// Implements a [SqlSslCertsService](crate::traits::) decorator for logging and tracing. +#[derive(Clone, Debug)] +pub struct SqlSslCertsService +where T: crate::traits::SqlSslCertsService + std::fmt::Debug + Send + Sync { + inner: T, +} + +impl SqlSslCertsService +where T: crate::traits::SqlSslCertsService + std::fmt::Debug + Send + Sync { + pub fn new(inner: T) -> Self { + Self { inner } + } +} + +impl crate::traits::SqlSslCertsService for SqlSslCertsService +where T: crate::traits::SqlSslCertsService + std::fmt::Debug + Send + Sync { + #[tracing::instrument(ret)] + async fn delete( + &self, + req: crate::model::SqlSslCertsDeleteRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.delete(req, options).await + } + + #[tracing::instrument(ret)] + async fn get( + &self, + req: crate::model::SqlSslCertsGetRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.get(req, options).await + } + + #[tracing::instrument(ret)] + async fn insert( + &self, + req: crate::model::SqlSslCertsInsertRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.insert(req, options).await + } + + #[tracing::instrument(ret)] + async fn list( + &self, + req: crate::model::SqlSslCertsListRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.list(req, options).await + } + +} + +/// Implements a [SqlTiersService](crate::traits::) decorator for logging and tracing. +#[derive(Clone, Debug)] +pub struct SqlTiersService +where T: crate::traits::SqlTiersService + std::fmt::Debug + Send + Sync { + inner: T, +} + +impl SqlTiersService +where T: crate::traits::SqlTiersService + std::fmt::Debug + Send + Sync { + pub fn new(inner: T) -> Self { + Self { inner } + } +} + +impl crate::traits::SqlTiersService for SqlTiersService +where T: crate::traits::SqlTiersService + std::fmt::Debug + Send + Sync { + #[tracing::instrument(ret)] + async fn list( + &self, + req: crate::model::SqlTiersListRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.list(req, options).await + } + +} + +/// Implements a [SqlUsersService](crate::traits::) decorator for logging and tracing. +#[derive(Clone, Debug)] +pub struct SqlUsersService +where T: crate::traits::SqlUsersService + std::fmt::Debug + Send + Sync { + inner: T, +} + +impl SqlUsersService +where T: crate::traits::SqlUsersService + std::fmt::Debug + Send + Sync { + pub fn new(inner: T) -> Self { + Self { inner } + } +} + +impl crate::traits::SqlUsersService for SqlUsersService +where T: crate::traits::SqlUsersService + std::fmt::Debug + Send + Sync { + #[tracing::instrument(ret)] + async fn delete( + &self, + req: crate::model::SqlUsersDeleteRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.delete(req, options).await + } + + #[tracing::instrument(ret)] + async fn get( + &self, + req: crate::model::SqlUsersGetRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.get(req, options).await + } + + #[tracing::instrument(ret)] + async fn insert( + &self, + req: crate::model::SqlUsersInsertRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.insert(req, options).await + } + + #[tracing::instrument(ret)] + async fn list( + &self, + req: crate::model::SqlUsersListRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.list(req, options).await + } + + #[tracing::instrument(ret)] + async fn update( + &self, + req: crate::model::SqlUsersUpdateRequest, + options: gax::options::RequestOptions + ) -> Result { + self.inner.update(req, options).await + } + +} + diff --git a/src/generated/cloud/sql/v1/src/traits/dyntraits.rs b/src/generated/cloud/sql/v1/src/traits/dyntraits.rs new file mode 100755 index 000000000..d548295b4 --- /dev/null +++ b/src/generated/cloud/sql/v1/src/traits/dyntraits.rs @@ -0,0 +1,1005 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by sidekick. DO NOT EDIT. + +/// A dyn-compatible, crate-private version of `SqlBackupRunsService`. +#[async_trait::async_trait] +pub trait SqlBackupRunsService: std::fmt::Debug + Send + Sync { + async fn delete( + &self, + req: crate::model::SqlBackupRunsDeleteRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn get( + &self, + req: crate::model::SqlBackupRunsGetRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn insert( + &self, + req: crate::model::SqlBackupRunsInsertRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn list( + &self, + req: crate::model::SqlBackupRunsListRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + +} + +/// All implementations of [crate::traits::SqlBackupRunsService] also implement [SqlBackupRunsService]. +#[async_trait::async_trait] +impl SqlBackupRunsService for T { + /// Forwards the call to the implementation provided by `T`. + async fn delete( + &self, + req: crate::model::SqlBackupRunsDeleteRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::delete(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn get( + &self, + req: crate::model::SqlBackupRunsGetRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::get(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn insert( + &self, + req: crate::model::SqlBackupRunsInsertRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::insert(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn list( + &self, + req: crate::model::SqlBackupRunsListRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::list(self, req, options).await + } + +} + +/// A dyn-compatible, crate-private version of `SqlConnectService`. +#[async_trait::async_trait] +pub trait SqlConnectService: std::fmt::Debug + Send + Sync { + async fn get_connect_settings( + &self, + req: crate::model::GetConnectSettingsRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn generate_ephemeral_cert( + &self, + req: crate::model::GenerateEphemeralCertRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + +} + +/// All implementations of [crate::traits::SqlConnectService] also implement [SqlConnectService]. +#[async_trait::async_trait] +impl SqlConnectService for T { + /// Forwards the call to the implementation provided by `T`. + async fn get_connect_settings( + &self, + req: crate::model::GetConnectSettingsRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::get_connect_settings(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn generate_ephemeral_cert( + &self, + req: crate::model::GenerateEphemeralCertRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::generate_ephemeral_cert(self, req, options).await + } + +} + +/// A dyn-compatible, crate-private version of `SqlDatabasesService`. +#[async_trait::async_trait] +pub trait SqlDatabasesService: std::fmt::Debug + Send + Sync { + async fn delete( + &self, + req: crate::model::SqlDatabasesDeleteRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn get( + &self, + req: crate::model::SqlDatabasesGetRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn insert( + &self, + req: crate::model::SqlDatabasesInsertRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn list( + &self, + req: crate::model::SqlDatabasesListRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn patch( + &self, + req: crate::model::SqlDatabasesUpdateRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn update( + &self, + req: crate::model::SqlDatabasesUpdateRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + +} + +/// All implementations of [crate::traits::SqlDatabasesService] also implement [SqlDatabasesService]. +#[async_trait::async_trait] +impl SqlDatabasesService for T { + /// Forwards the call to the implementation provided by `T`. + async fn delete( + &self, + req: crate::model::SqlDatabasesDeleteRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::delete(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn get( + &self, + req: crate::model::SqlDatabasesGetRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::get(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn insert( + &self, + req: crate::model::SqlDatabasesInsertRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::insert(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn list( + &self, + req: crate::model::SqlDatabasesListRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::list(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn patch( + &self, + req: crate::model::SqlDatabasesUpdateRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::patch(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn update( + &self, + req: crate::model::SqlDatabasesUpdateRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::update(self, req, options).await + } + +} + +/// A dyn-compatible, crate-private version of `SqlFlagsService`. +#[async_trait::async_trait] +pub trait SqlFlagsService: std::fmt::Debug + Send + Sync { + async fn list( + &self, + req: crate::model::SqlFlagsListRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + +} + +/// All implementations of [crate::traits::SqlFlagsService] also implement [SqlFlagsService]. +#[async_trait::async_trait] +impl SqlFlagsService for T { + /// Forwards the call to the implementation provided by `T`. + async fn list( + &self, + req: crate::model::SqlFlagsListRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::list(self, req, options).await + } + +} + +/// A dyn-compatible, crate-private version of `SqlInstancesService`. +#[async_trait::async_trait] +pub trait SqlInstancesService: std::fmt::Debug + Send + Sync { + async fn add_server_ca( + &self, + req: crate::model::SqlInstancesAddServerCaRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn clone( + &self, + req: crate::model::SqlInstancesCloneRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn delete( + &self, + req: crate::model::SqlInstancesDeleteRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn demote_master( + &self, + req: crate::model::SqlInstancesDemoteMasterRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn demote( + &self, + req: crate::model::SqlInstancesDemoteRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn export( + &self, + req: crate::model::SqlInstancesExportRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn failover( + &self, + req: crate::model::SqlInstancesFailoverRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn reencrypt( + &self, + req: crate::model::SqlInstancesReencryptRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn get( + &self, + req: crate::model::SqlInstancesGetRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn import( + &self, + req: crate::model::SqlInstancesImportRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn insert( + &self, + req: crate::model::SqlInstancesInsertRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn list( + &self, + req: crate::model::SqlInstancesListRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn list_server_cas( + &self, + req: crate::model::SqlInstancesListServerCasRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn patch( + &self, + req: crate::model::SqlInstancesPatchRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn promote_replica( + &self, + req: crate::model::SqlInstancesPromoteReplicaRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn switchover( + &self, + req: crate::model::SqlInstancesSwitchoverRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn reset_ssl_config( + &self, + req: crate::model::SqlInstancesResetSslConfigRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn restart( + &self, + req: crate::model::SqlInstancesRestartRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn restore_backup( + &self, + req: crate::model::SqlInstancesRestoreBackupRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn rotate_server_ca( + &self, + req: crate::model::SqlInstancesRotateServerCaRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn start_replica( + &self, + req: crate::model::SqlInstancesStartReplicaRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn stop_replica( + &self, + req: crate::model::SqlInstancesStopReplicaRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn truncate_log( + &self, + req: crate::model::SqlInstancesTruncateLogRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn update( + &self, + req: crate::model::SqlInstancesUpdateRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn create_ephemeral( + &self, + req: crate::model::SqlInstancesCreateEphemeralCertRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn reschedule_maintenance( + &self, + req: crate::model::SqlInstancesRescheduleMaintenanceRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn verify_external_sync_settings( + &self, + req: crate::model::SqlInstancesVerifyExternalSyncSettingsRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn start_external_sync( + &self, + req: crate::model::SqlInstancesStartExternalSyncRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn perform_disk_shrink( + &self, + req: crate::model::SqlInstancesPerformDiskShrinkRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn get_disk_shrink_config( + &self, + req: crate::model::SqlInstancesGetDiskShrinkConfigRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn reset_replica_size( + &self, + req: crate::model::SqlInstancesResetReplicaSizeRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn get_latest_recovery_time( + &self, + req: crate::model::SqlInstancesGetLatestRecoveryTimeRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn acquire_ssrs_lease( + &self, + req: crate::model::SqlInstancesAcquireSsrsLeaseRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn release_ssrs_lease( + &self, + req: crate::model::SqlInstancesReleaseSsrsLeaseRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + +} + +/// All implementations of [crate::traits::SqlInstancesService] also implement [SqlInstancesService]. +#[async_trait::async_trait] +impl SqlInstancesService for T { + /// Forwards the call to the implementation provided by `T`. + async fn add_server_ca( + &self, + req: crate::model::SqlInstancesAddServerCaRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::add_server_ca(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn clone( + &self, + req: crate::model::SqlInstancesCloneRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::clone(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn delete( + &self, + req: crate::model::SqlInstancesDeleteRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::delete(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn demote_master( + &self, + req: crate::model::SqlInstancesDemoteMasterRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::demote_master(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn demote( + &self, + req: crate::model::SqlInstancesDemoteRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::demote(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn export( + &self, + req: crate::model::SqlInstancesExportRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::export(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn failover( + &self, + req: crate::model::SqlInstancesFailoverRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::failover(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn reencrypt( + &self, + req: crate::model::SqlInstancesReencryptRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::reencrypt(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn get( + &self, + req: crate::model::SqlInstancesGetRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::get(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn import( + &self, + req: crate::model::SqlInstancesImportRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::import(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn insert( + &self, + req: crate::model::SqlInstancesInsertRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::insert(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn list( + &self, + req: crate::model::SqlInstancesListRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::list(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn list_server_cas( + &self, + req: crate::model::SqlInstancesListServerCasRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::list_server_cas(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn patch( + &self, + req: crate::model::SqlInstancesPatchRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::patch(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn promote_replica( + &self, + req: crate::model::SqlInstancesPromoteReplicaRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::promote_replica(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn switchover( + &self, + req: crate::model::SqlInstancesSwitchoverRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::switchover(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn reset_ssl_config( + &self, + req: crate::model::SqlInstancesResetSslConfigRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::reset_ssl_config(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn restart( + &self, + req: crate::model::SqlInstancesRestartRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::restart(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn restore_backup( + &self, + req: crate::model::SqlInstancesRestoreBackupRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::restore_backup(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn rotate_server_ca( + &self, + req: crate::model::SqlInstancesRotateServerCaRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::rotate_server_ca(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn start_replica( + &self, + req: crate::model::SqlInstancesStartReplicaRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::start_replica(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn stop_replica( + &self, + req: crate::model::SqlInstancesStopReplicaRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::stop_replica(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn truncate_log( + &self, + req: crate::model::SqlInstancesTruncateLogRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::truncate_log(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn update( + &self, + req: crate::model::SqlInstancesUpdateRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::update(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn create_ephemeral( + &self, + req: crate::model::SqlInstancesCreateEphemeralCertRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::create_ephemeral(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn reschedule_maintenance( + &self, + req: crate::model::SqlInstancesRescheduleMaintenanceRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::reschedule_maintenance(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn verify_external_sync_settings( + &self, + req: crate::model::SqlInstancesVerifyExternalSyncSettingsRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::verify_external_sync_settings(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn start_external_sync( + &self, + req: crate::model::SqlInstancesStartExternalSyncRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::start_external_sync(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn perform_disk_shrink( + &self, + req: crate::model::SqlInstancesPerformDiskShrinkRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::perform_disk_shrink(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn get_disk_shrink_config( + &self, + req: crate::model::SqlInstancesGetDiskShrinkConfigRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::get_disk_shrink_config(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn reset_replica_size( + &self, + req: crate::model::SqlInstancesResetReplicaSizeRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::reset_replica_size(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn get_latest_recovery_time( + &self, + req: crate::model::SqlInstancesGetLatestRecoveryTimeRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::get_latest_recovery_time(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn acquire_ssrs_lease( + &self, + req: crate::model::SqlInstancesAcquireSsrsLeaseRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::acquire_ssrs_lease(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn release_ssrs_lease( + &self, + req: crate::model::SqlInstancesReleaseSsrsLeaseRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::release_ssrs_lease(self, req, options).await + } + +} + +/// A dyn-compatible, crate-private version of `SqlOperationsService`. +#[async_trait::async_trait] +pub trait SqlOperationsService: std::fmt::Debug + Send + Sync { + async fn get( + &self, + req: crate::model::SqlOperationsGetRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn list( + &self, + req: crate::model::SqlOperationsListRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn cancel( + &self, + req: crate::model::SqlOperationsCancelRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + +} + +/// All implementations of [crate::traits::SqlOperationsService] also implement [SqlOperationsService]. +#[async_trait::async_trait] +impl SqlOperationsService for T { + /// Forwards the call to the implementation provided by `T`. + async fn get( + &self, + req: crate::model::SqlOperationsGetRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::get(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn list( + &self, + req: crate::model::SqlOperationsListRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::list(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn cancel( + &self, + req: crate::model::SqlOperationsCancelRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::cancel(self, req, options).await + } + +} + +/// A dyn-compatible, crate-private version of `SqlSslCertsService`. +#[async_trait::async_trait] +pub trait SqlSslCertsService: std::fmt::Debug + Send + Sync { + async fn delete( + &self, + req: crate::model::SqlSslCertsDeleteRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn get( + &self, + req: crate::model::SqlSslCertsGetRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn insert( + &self, + req: crate::model::SqlSslCertsInsertRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn list( + &self, + req: crate::model::SqlSslCertsListRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + +} + +/// All implementations of [crate::traits::SqlSslCertsService] also implement [SqlSslCertsService]. +#[async_trait::async_trait] +impl SqlSslCertsService for T { + /// Forwards the call to the implementation provided by `T`. + async fn delete( + &self, + req: crate::model::SqlSslCertsDeleteRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::delete(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn get( + &self, + req: crate::model::SqlSslCertsGetRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::get(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn insert( + &self, + req: crate::model::SqlSslCertsInsertRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::insert(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn list( + &self, + req: crate::model::SqlSslCertsListRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::list(self, req, options).await + } + +} + +/// A dyn-compatible, crate-private version of `SqlTiersService`. +#[async_trait::async_trait] +pub trait SqlTiersService: std::fmt::Debug + Send + Sync { + async fn list( + &self, + req: crate::model::SqlTiersListRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + +} + +/// All implementations of [crate::traits::SqlTiersService] also implement [SqlTiersService]. +#[async_trait::async_trait] +impl SqlTiersService for T { + /// Forwards the call to the implementation provided by `T`. + async fn list( + &self, + req: crate::model::SqlTiersListRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::list(self, req, options).await + } + +} + +/// A dyn-compatible, crate-private version of `SqlUsersService`. +#[async_trait::async_trait] +pub trait SqlUsersService: std::fmt::Debug + Send + Sync { + async fn delete( + &self, + req: crate::model::SqlUsersDeleteRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn get( + &self, + req: crate::model::SqlUsersGetRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn insert( + &self, + req: crate::model::SqlUsersInsertRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn list( + &self, + req: crate::model::SqlUsersListRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + + async fn update( + &self, + req: crate::model::SqlUsersUpdateRequest, + options: gax::options::RequestOptions + ) -> crate::Result; + +} + +/// All implementations of [crate::traits::SqlUsersService] also implement [SqlUsersService]. +#[async_trait::async_trait] +impl SqlUsersService for T { + /// Forwards the call to the implementation provided by `T`. + async fn delete( + &self, + req: crate::model::SqlUsersDeleteRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::delete(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn get( + &self, + req: crate::model::SqlUsersGetRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::get(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn insert( + &self, + req: crate::model::SqlUsersInsertRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::insert(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn list( + &self, + req: crate::model::SqlUsersListRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::list(self, req, options).await + } + + /// Forwards the call to the implementation provided by `T`. + async fn update( + &self, + req: crate::model::SqlUsersUpdateRequest, + options: gax::options::RequestOptions + ) -> crate::Result { + T::update(self, req, options).await + } + +} diff --git a/src/generated/cloud/sql/v1/src/traits/mod.rs b/src/generated/cloud/sql/v1/src/traits/mod.rs new file mode 100755 index 000000000..da425ffb4 --- /dev/null +++ b/src/generated/cloud/sql/v1/src/traits/mod.rs @@ -0,0 +1,723 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by sidekick. DO NOT EDIT. + +use gax::error::Error; + +pub(crate) mod dyntraits; + +/// Service for managing database backups. +/// +/// # Mocking +/// +/// Application developers may use this trait to mock the sqladmin clients. +/// +/// Services gain new RPCs routinely. Consequently, this trait gains new methods +/// too. To avoid breaking applications the trait provides a default +/// implementation for each method. These implementations return an error. +pub trait SqlBackupRunsService: std::fmt::Debug + Send + Sync { + + /// Deletes the backup taken by a backup run. + fn delete( + &self, + _req: crate::model::SqlBackupRunsDeleteRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Retrieves a resource containing information about a backup run. + fn get( + &self, + _req: crate::model::SqlBackupRunsGetRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Creates a new backup run on demand. + fn insert( + &self, + _req: crate::model::SqlBackupRunsInsertRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Lists all backup runs associated with the project or a given instance + /// and configuration in the reverse chronological order of the backup + /// initiation time. + fn list( + &self, + _req: crate::model::SqlBackupRunsListRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } +} + +/// Cloud SQL connect service. +/// +/// # Mocking +/// +/// Application developers may use this trait to mock the sqladmin clients. +/// +/// Services gain new RPCs routinely. Consequently, this trait gains new methods +/// too. To avoid breaking applications the trait provides a default +/// implementation for each method. These implementations return an error. +pub trait SqlConnectService: std::fmt::Debug + Send + Sync { + + /// Retrieves connect settings about a Cloud SQL instance. + fn get_connect_settings( + &self, + _req: crate::model::GetConnectSettingsRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Generates a short-lived X509 certificate containing the provided public key + /// and signed by a private key specific to the target instance. Users may use + /// the certificate to authenticate as themselves when connecting to the + /// database. + fn generate_ephemeral_cert( + &self, + _req: crate::model::GenerateEphemeralCertRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } +} + +/// Service to manage databases. +/// +/// # Mocking +/// +/// Application developers may use this trait to mock the sqladmin clients. +/// +/// Services gain new RPCs routinely. Consequently, this trait gains new methods +/// too. To avoid breaking applications the trait provides a default +/// implementation for each method. These implementations return an error. +pub trait SqlDatabasesService: std::fmt::Debug + Send + Sync { + + /// Deletes a database from a Cloud SQL instance. + fn delete( + &self, + _req: crate::model::SqlDatabasesDeleteRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Retrieves a resource containing information about a database inside a Cloud + /// SQL instance. + fn get( + &self, + _req: crate::model::SqlDatabasesGetRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Inserts a resource containing information about a database inside a Cloud + /// SQL instance. + /// + /// **Note:** You can't modify the default character set and collation. + fn insert( + &self, + _req: crate::model::SqlDatabasesInsertRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Lists databases in the specified Cloud SQL instance. + fn list( + &self, + _req: crate::model::SqlDatabasesListRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Partially updates a resource containing information about a database inside + /// a Cloud SQL instance. This method supports patch semantics. + fn patch( + &self, + _req: crate::model::SqlDatabasesUpdateRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Updates a resource containing information about a database inside a Cloud + /// SQL instance. + fn update( + &self, + _req: crate::model::SqlDatabasesUpdateRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } +} + +/// Service to manage database flags for Cloud SQL instances. +/// +/// # Mocking +/// +/// Application developers may use this trait to mock the sqladmin clients. +/// +/// Services gain new RPCs routinely. Consequently, this trait gains new methods +/// too. To avoid breaking applications the trait provides a default +/// implementation for each method. These implementations return an error. +pub trait SqlFlagsService: std::fmt::Debug + Send + Sync { + + /// Lists all available database flags for Cloud SQL instances. + fn list( + &self, + _req: crate::model::SqlFlagsListRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } +} + +/// Service to manage Cloud SQL instances. +/// +/// # Mocking +/// +/// Application developers may use this trait to mock the sqladmin clients. +/// +/// Services gain new RPCs routinely. Consequently, this trait gains new methods +/// too. To avoid breaking applications the trait provides a default +/// implementation for each method. These implementations return an error. +pub trait SqlInstancesService: std::fmt::Debug + Send + Sync { + + /// Adds a new trusted Certificate Authority (CA) version for the specified + /// instance. Required to prepare for a certificate rotation. If a CA version + /// was previously added but never used in a certificate rotation, this + /// operation replaces that version. There cannot be more than one CA version + /// waiting to be rotated in. For instances that have enabled Certificate + /// Authority Service (CAS) based server CA, please use AddServerCertificate to + /// add a new server certificate. + fn add_server_ca( + &self, + _req: crate::model::SqlInstancesAddServerCaRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Creates a Cloud SQL instance as a clone of the source instance. Using this + /// operation might cause your instance to restart. + fn clone( + &self, + _req: crate::model::SqlInstancesCloneRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Deletes a Cloud SQL instance. + fn delete( + &self, + _req: crate::model::SqlInstancesDeleteRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Demotes the stand-alone instance to be a Cloud SQL read replica for an + /// external database server. + fn demote_master( + &self, + _req: crate::model::SqlInstancesDemoteMasterRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Demotes an existing standalone instance to be a Cloud SQL read replica + /// for an external database server. + fn demote( + &self, + _req: crate::model::SqlInstancesDemoteRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL + /// dump or CSV file. + fn export( + &self, + _req: crate::model::SqlInstancesExportRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Initiates a manual failover of a high availability (HA) primary instance + /// to a standby instance, which becomes the primary instance. Users are + /// then rerouted to the new primary. For more information, see the + /// [Overview of high + /// availability](https://cloud.google.com/sql/docs/mysql/high-availability) + /// page in the Cloud SQL documentation. + /// If using Legacy HA (MySQL only), this causes the instance to failover to + /// its failover replica instance. + fn failover( + &self, + _req: crate::model::SqlInstancesFailoverRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Reencrypt CMEK instance with latest key version. + fn reencrypt( + &self, + _req: crate::model::SqlInstancesReencryptRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Retrieves a resource containing information about a Cloud SQL instance. + fn get( + &self, + _req: crate::model::SqlInstancesGetRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Imports data into a Cloud SQL instance from a SQL dump or CSV file in + /// Cloud Storage. + fn import( + &self, + _req: crate::model::SqlInstancesImportRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Creates a new Cloud SQL instance. + fn insert( + &self, + _req: crate::model::SqlInstancesInsertRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Lists instances under a given project. + fn list( + &self, + _req: crate::model::SqlInstancesListRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Lists all of the trusted Certificate Authorities (CAs) for the specified + /// instance. There can be up to three CAs listed: the CA that was used to sign + /// the certificate that is currently in use, a CA that has been added but not + /// yet used to sign a certificate, and a CA used to sign a certificate that + /// has previously rotated out. + fn list_server_cas( + &self, + _req: crate::model::SqlInstancesListServerCasRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Partially updates settings of a Cloud SQL instance by merging the request + /// with the current configuration. This method supports patch semantics. + fn patch( + &self, + _req: crate::model::SqlInstancesPatchRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Promotes the read replica instance to be an independent Cloud SQL + /// primary instance. + /// Using this operation might cause your instance to restart. + fn promote_replica( + &self, + _req: crate::model::SqlInstancesPromoteReplicaRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Switches over from the primary instance to the designated DR replica + /// instance. + fn switchover( + &self, + _req: crate::model::SqlInstancesSwitchoverRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Deletes all client certificates and generates a new server SSL certificate + /// for the instance. + fn reset_ssl_config( + &self, + _req: crate::model::SqlInstancesResetSslConfigRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Restarts a Cloud SQL instance. + fn restart( + &self, + _req: crate::model::SqlInstancesRestartRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Restores a backup of a Cloud SQL instance. Using this operation might cause + /// your instance to restart. + fn restore_backup( + &self, + _req: crate::model::SqlInstancesRestoreBackupRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Rotates the server certificate to one signed by the Certificate Authority + /// (CA) version previously added with the addServerCA method. For instances + /// that have enabled Certificate Authority Service (CAS) based server CA, + /// please use RotateServerCertificate to rotate the server certificate. + fn rotate_server_ca( + &self, + _req: crate::model::SqlInstancesRotateServerCaRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Starts the replication in the read replica instance. + fn start_replica( + &self, + _req: crate::model::SqlInstancesStartReplicaRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Stops the replication in the read replica instance. + fn stop_replica( + &self, + _req: crate::model::SqlInstancesStopReplicaRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Truncate MySQL general and slow query log tables + /// MySQL only. + fn truncate_log( + &self, + _req: crate::model::SqlInstancesTruncateLogRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Updates settings of a Cloud SQL instance. Using this operation might cause + /// your instance to restart. + fn update( + &self, + _req: crate::model::SqlInstancesUpdateRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Generates a short-lived X509 certificate containing the provided public key + /// and signed by a private key specific to the target instance. Users may use + /// the certificate to authenticate as themselves when connecting to the + /// database. + fn create_ephemeral( + &self, + _req: crate::model::SqlInstancesCreateEphemeralCertRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Reschedules the maintenance on the given instance. + fn reschedule_maintenance( + &self, + _req: crate::model::SqlInstancesRescheduleMaintenanceRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Verify External primary instance external sync settings. + fn verify_external_sync_settings( + &self, + _req: crate::model::SqlInstancesVerifyExternalSyncSettingsRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Start External primary instance migration. + fn start_external_sync( + &self, + _req: crate::model::SqlInstancesStartExternalSyncRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Perform Disk Shrink on primary instance. + fn perform_disk_shrink( + &self, + _req: crate::model::SqlInstancesPerformDiskShrinkRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Get Disk Shrink Config for a given instance. + fn get_disk_shrink_config( + &self, + _req: crate::model::SqlInstancesGetDiskShrinkConfigRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Reset Replica Size to primary instance disk size. + fn reset_replica_size( + &self, + _req: crate::model::SqlInstancesResetReplicaSizeRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Get Latest Recovery Time for a given instance. + fn get_latest_recovery_time( + &self, + _req: crate::model::SqlInstancesGetLatestRecoveryTimeRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + fn acquire_ssrs_lease( + &self, + _req: crate::model::SqlInstancesAcquireSsrsLeaseRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Release a lease for the setup of SQL Server Reporting Services (SSRS). + fn release_ssrs_lease( + &self, + _req: crate::model::SqlInstancesReleaseSsrsLeaseRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } +} + +/// Service to fetch operations for database instances. +/// +/// # Mocking +/// +/// Application developers may use this trait to mock the sqladmin clients. +/// +/// Services gain new RPCs routinely. Consequently, this trait gains new methods +/// too. To avoid breaking applications the trait provides a default +/// implementation for each method. These implementations return an error. +pub trait SqlOperationsService: std::fmt::Debug + Send + Sync { + + /// Retrieves an instance operation that has been performed on an instance. + fn get( + &self, + _req: crate::model::SqlOperationsGetRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Lists all instance operations that have been performed on the given Cloud + /// SQL instance in the reverse chronological order of the start time. + fn list( + &self, + _req: crate::model::SqlOperationsListRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Cancels an instance operation that has been performed on an instance. + fn cancel( + &self, + _req: crate::model::SqlOperationsCancelRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } +} + +/// Service to manage SSL certs for Cloud SQL instances. +/// +/// # Mocking +/// +/// Application developers may use this trait to mock the sqladmin clients. +/// +/// Services gain new RPCs routinely. Consequently, this trait gains new methods +/// too. To avoid breaking applications the trait provides a default +/// implementation for each method. These implementations return an error. +pub trait SqlSslCertsService: std::fmt::Debug + Send + Sync { + + /// Deletes the SSL certificate. For First Generation instances, the + /// certificate remains valid until the instance is restarted. + fn delete( + &self, + _req: crate::model::SqlSslCertsDeleteRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Retrieves a particular SSL certificate. Does not include the private key + /// (required for usage). The private key must be saved from the response to + /// initial creation. + fn get( + &self, + _req: crate::model::SqlSslCertsGetRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Creates an SSL certificate and returns it along with the private key and + /// server certificate authority. The new certificate will not be usable until + /// the instance is restarted. + fn insert( + &self, + _req: crate::model::SqlSslCertsInsertRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Lists all of the current SSL certificates for the instance. + fn list( + &self, + _req: crate::model::SqlSslCertsListRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } +} + +/// Service for providing machine types (tiers) for Cloud SQL instances. +/// +/// # Mocking +/// +/// Application developers may use this trait to mock the sqladmin clients. +/// +/// Services gain new RPCs routinely. Consequently, this trait gains new methods +/// too. To avoid breaking applications the trait provides a default +/// implementation for each method. These implementations return an error. +pub trait SqlTiersService: std::fmt::Debug + Send + Sync { + + /// Lists all available machine types (tiers) for Cloud SQL, for example, + /// `db-custom-1-3840`. For more information, see + /// . + fn list( + &self, + _req: crate::model::SqlTiersListRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } +} + +/// Cloud SQL users service. +/// +/// # Mocking +/// +/// Application developers may use this trait to mock the sqladmin clients. +/// +/// Services gain new RPCs routinely. Consequently, this trait gains new methods +/// too. To avoid breaking applications the trait provides a default +/// implementation for each method. These implementations return an error. +pub trait SqlUsersService: std::fmt::Debug + Send + Sync { + + /// Deletes a user from a Cloud SQL instance. + fn delete( + &self, + _req: crate::model::SqlUsersDeleteRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Retrieves a resource containing information about a user. + fn get( + &self, + _req: crate::model::SqlUsersGetRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Creates a new user in a Cloud SQL instance. + fn insert( + &self, + _req: crate::model::SqlUsersInsertRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Lists users in the specified Cloud SQL instance. + fn list( + &self, + _req: crate::model::SqlUsersListRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } + + /// Updates an existing user in a Cloud SQL instance. + fn update( + &self, + _req: crate::model::SqlUsersUpdateRequest, + _options: gax::options::RequestOptions + ) -> impl std::future::Future> + Send { + std::future::ready::>(Err(Error::other("unimplemented"))) + } +} + diff --git a/src/generated/cloud/sql/v1/src/transport.rs b/src/generated/cloud/sql/v1/src/transport.rs new file mode 100755 index 000000000..8beaeef92 --- /dev/null +++ b/src/generated/cloud/sql/v1/src/transport.rs @@ -0,0 +1,1755 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by sidekick. DO NOT EDIT. + +use crate::Result; +#[allow(unused_imports)] +use gax::error::Error; + +/// Implements [SqlBackupRunsService](crate::traits::SqlBackupRunsService) using a [gax::http_client::ReqwestClient]. +#[derive(Clone)] +pub struct SqlBackupRunsService { + inner: gax::http_client::ReqwestClient, +} + +impl std::fmt::Debug for SqlBackupRunsService { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { + f.debug_struct("SqlBackupRunsService") + .field("inner", &self.inner) + .finish() + } +} + +impl SqlBackupRunsService { + pub async fn new(config: gax::http_client::ClientConfig) -> Result { + let inner = gax::http_client::ReqwestClient::new(config, crate::DEFAULT_HOST).await?; + Ok(Self { inner }) + } +} + +impl crate::traits::SqlBackupRunsService for SqlBackupRunsService { + async fn delete( + &self, + req: crate::model::SqlBackupRunsDeleteRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::DELETE.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::DELETE, + format!("/v1/projects/{}/instances/{}/backupRuns/{}" + , req.project + , req.instance + , req.id + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn get( + &self, + req: crate::model::SqlBackupRunsGetRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}/backupRuns/{}" + , req.project + , req.instance + , req.id + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn insert( + &self, + req: crate::model::SqlBackupRunsInsertRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/backupRuns" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn list( + &self, + req: crate::model::SqlBackupRunsListRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}/backupRuns" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + let builder = builder.query(&[("maxResults", &req.max_results)]); + let builder = builder.query(&[("pageToken", &req.page_token)]); + self.inner.execute( + builder, + + None::, + options, + ).await + } + +} + +/// Implements [SqlConnectService](crate::traits::SqlConnectService) using a [gax::http_client::ReqwestClient]. +#[derive(Clone)] +pub struct SqlConnectService { + inner: gax::http_client::ReqwestClient, +} + +impl std::fmt::Debug for SqlConnectService { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { + f.debug_struct("SqlConnectService") + .field("inner", &self.inner) + .finish() + } +} + +impl SqlConnectService { + pub async fn new(config: gax::http_client::ClientConfig) -> Result { + let inner = gax::http_client::ReqwestClient::new(config, crate::DEFAULT_HOST).await?; + Ok(Self { inner }) + } +} + +impl crate::traits::SqlConnectService for SqlConnectService { + async fn get_connect_settings( + &self, + req: crate::model::GetConnectSettingsRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}/connectSettings" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + let builder = req.read_time.as_ref().map(|p| serde_json::to_value(p).map_err(Error::serde) ).transpose()?.into_iter().fold(builder, |builder, v| { use gax::query_parameter::QueryParameter; v.add(builder, "readTime") }); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn generate_ephemeral_cert( + &self, + req: crate::model::GenerateEphemeralCertRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}:generateEphemeralCert" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req) + , + options, + ).await + } + +} + +/// Implements [SqlDatabasesService](crate::traits::SqlDatabasesService) using a [gax::http_client::ReqwestClient]. +#[derive(Clone)] +pub struct SqlDatabasesService { + inner: gax::http_client::ReqwestClient, +} + +impl std::fmt::Debug for SqlDatabasesService { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { + f.debug_struct("SqlDatabasesService") + .field("inner", &self.inner) + .finish() + } +} + +impl SqlDatabasesService { + pub async fn new(config: gax::http_client::ClientConfig) -> Result { + let inner = gax::http_client::ReqwestClient::new(config, crate::DEFAULT_HOST).await?; + Ok(Self { inner }) + } +} + +impl crate::traits::SqlDatabasesService for SqlDatabasesService { + async fn delete( + &self, + req: crate::model::SqlDatabasesDeleteRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::DELETE.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::DELETE, + format!("/v1/projects/{}/instances/{}/databases/{}" + , req.project + , req.instance + , req.database + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn get( + &self, + req: crate::model::SqlDatabasesGetRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}/databases/{}" + , req.project + , req.instance + , req.database + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn insert( + &self, + req: crate::model::SqlDatabasesInsertRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/databases" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn list( + &self, + req: crate::model::SqlDatabasesListRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}/databases" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn patch( + &self, + req: crate::model::SqlDatabasesUpdateRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::PATCH.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::PATCH, + format!("/v1/projects/{}/instances/{}/databases/{}" + , req.project + , req.instance + , req.database + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn update( + &self, + req: crate::model::SqlDatabasesUpdateRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::PUT.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::PUT, + format!("/v1/projects/{}/instances/{}/databases/{}" + , req.project + , req.instance + , req.database + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + +} + +/// Implements [SqlFlagsService](crate::traits::SqlFlagsService) using a [gax::http_client::ReqwestClient]. +#[derive(Clone)] +pub struct SqlFlagsService { + inner: gax::http_client::ReqwestClient, +} + +impl std::fmt::Debug for SqlFlagsService { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { + f.debug_struct("SqlFlagsService") + .field("inner", &self.inner) + .finish() + } +} + +impl SqlFlagsService { + pub async fn new(config: gax::http_client::ClientConfig) -> Result { + let inner = gax::http_client::ReqwestClient::new(config, crate::DEFAULT_HOST).await?; + Ok(Self { inner }) + } +} + +impl crate::traits::SqlFlagsService for SqlFlagsService { + async fn list( + &self, + req: crate::model::SqlFlagsListRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + "/v1/flags".to_string() + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + let builder = builder.query(&[("databaseVersion", &req.database_version)]); + self.inner.execute( + builder, + + None::, + options, + ).await + } + +} + +/// Implements [SqlInstancesService](crate::traits::SqlInstancesService) using a [gax::http_client::ReqwestClient]. +#[derive(Clone)] +pub struct SqlInstancesService { + inner: gax::http_client::ReqwestClient, +} + +impl std::fmt::Debug for SqlInstancesService { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { + f.debug_struct("SqlInstancesService") + .field("inner", &self.inner) + .finish() + } +} + +impl SqlInstancesService { + pub async fn new(config: gax::http_client::ClientConfig) -> Result { + let inner = gax::http_client::ReqwestClient::new(config, crate::DEFAULT_HOST).await?; + Ok(Self { inner }) + } +} + +impl crate::traits::SqlInstancesService for SqlInstancesService { + async fn add_server_ca( + &self, + req: crate::model::SqlInstancesAddServerCaRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/addServerCa" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn clone( + &self, + req: crate::model::SqlInstancesCloneRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/clone" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn delete( + &self, + req: crate::model::SqlInstancesDeleteRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::DELETE.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::DELETE, + format!("/v1/projects/{}/instances/{}" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn demote_master( + &self, + req: crate::model::SqlInstancesDemoteMasterRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/demoteMaster" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn demote( + &self, + req: crate::model::SqlInstancesDemoteRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/demote" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn export( + &self, + req: crate::model::SqlInstancesExportRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/export" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn failover( + &self, + req: crate::model::SqlInstancesFailoverRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/failover" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn reencrypt( + &self, + req: crate::model::SqlInstancesReencryptRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/reencrypt" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn get( + &self, + req: crate::model::SqlInstancesGetRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn import( + &self, + req: crate::model::SqlInstancesImportRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/import" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn insert( + &self, + req: crate::model::SqlInstancesInsertRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances" + , req.project + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn list( + &self, + req: crate::model::SqlInstancesListRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances" + , req.project + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + let builder = builder.query(&[("filter", &req.filter)]); + let builder = builder.query(&[("maxResults", &req.max_results)]); + let builder = builder.query(&[("pageToken", &req.page_token)]); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn list_server_cas( + &self, + req: crate::model::SqlInstancesListServerCasRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}/listServerCas" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn patch( + &self, + req: crate::model::SqlInstancesPatchRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::PATCH.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::PATCH, + format!("/v1/projects/{}/instances/{}" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn promote_replica( + &self, + req: crate::model::SqlInstancesPromoteReplicaRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/promoteReplica" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + let builder = builder.query(&[("failover", &req.failover)]); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn switchover( + &self, + req: crate::model::SqlInstancesSwitchoverRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/switchover" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + let builder = req.db_timeout.as_ref().map(|p| serde_json::to_value(p).map_err(Error::serde) ).transpose()?.into_iter().fold(builder, |builder, v| { use gax::query_parameter::QueryParameter; v.add(builder, "dbTimeout") }); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn reset_ssl_config( + &self, + req: crate::model::SqlInstancesResetSslConfigRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/resetSslConfig" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn restart( + &self, + req: crate::model::SqlInstancesRestartRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/restart" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn restore_backup( + &self, + req: crate::model::SqlInstancesRestoreBackupRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/restoreBackup" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn rotate_server_ca( + &self, + req: crate::model::SqlInstancesRotateServerCaRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/rotateServerCa" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn start_replica( + &self, + req: crate::model::SqlInstancesStartReplicaRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/startReplica" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn stop_replica( + &self, + req: crate::model::SqlInstancesStopReplicaRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/stopReplica" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn truncate_log( + &self, + req: crate::model::SqlInstancesTruncateLogRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/truncateLog" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn update( + &self, + req: crate::model::SqlInstancesUpdateRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::PUT.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::PUT, + format!("/v1/projects/{}/instances/{}" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn create_ephemeral( + &self, + req: crate::model::SqlInstancesCreateEphemeralCertRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/createEphemeral" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn reschedule_maintenance( + &self, + req: crate::model::SqlInstancesRescheduleMaintenanceRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/rescheduleMaintenance" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn verify_external_sync_settings( + &self, + req: crate::model::SqlInstancesVerifyExternalSyncSettingsRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/verifyExternalSyncSettings" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req) + , + options, + ).await + } + + async fn start_external_sync( + &self, + req: crate::model::SqlInstancesStartExternalSyncRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/startExternalSync" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req) + , + options, + ).await + } + + async fn perform_disk_shrink( + &self, + req: crate::model::SqlInstancesPerformDiskShrinkRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/performDiskShrink" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn get_disk_shrink_config( + &self, + req: crate::model::SqlInstancesGetDiskShrinkConfigRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}/getDiskShrinkConfig" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn reset_replica_size( + &self, + req: crate::model::SqlInstancesResetReplicaSizeRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/resetReplicaSize" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req) + , + options, + ).await + } + + async fn get_latest_recovery_time( + &self, + req: crate::model::SqlInstancesGetLatestRecoveryTimeRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}/getLatestRecoveryTime" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn acquire_ssrs_lease( + &self, + req: crate::model::SqlInstancesAcquireSsrsLeaseRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/acquireSsrsLease" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn release_ssrs_lease( + &self, + req: crate::model::SqlInstancesReleaseSsrsLeaseRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/releaseSsrsLease" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + +} + +/// Implements [SqlOperationsService](crate::traits::SqlOperationsService) using a [gax::http_client::ReqwestClient]. +#[derive(Clone)] +pub struct SqlOperationsService { + inner: gax::http_client::ReqwestClient, +} + +impl std::fmt::Debug for SqlOperationsService { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { + f.debug_struct("SqlOperationsService") + .field("inner", &self.inner) + .finish() + } +} + +impl SqlOperationsService { + pub async fn new(config: gax::http_client::ClientConfig) -> Result { + let inner = gax::http_client::ReqwestClient::new(config, crate::DEFAULT_HOST).await?; + Ok(Self { inner }) + } +} + +impl crate::traits::SqlOperationsService for SqlOperationsService { + async fn get( + &self, + req: crate::model::SqlOperationsGetRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/operations/{}" + , req.project + , req.operation + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn list( + &self, + req: crate::model::SqlOperationsListRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/operations" + , req.project + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + let builder = builder.query(&[("instance", &req.instance)]); + let builder = builder.query(&[("maxResults", &req.max_results)]); + let builder = builder.query(&[("pageToken", &req.page_token)]); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn cancel( + &self, + req: crate::model::SqlOperationsCancelRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/operations/{}/cancel" + , req.project + , req.operation + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + +} + +/// Implements [SqlSslCertsService](crate::traits::SqlSslCertsService) using a [gax::http_client::ReqwestClient]. +#[derive(Clone)] +pub struct SqlSslCertsService { + inner: gax::http_client::ReqwestClient, +} + +impl std::fmt::Debug for SqlSslCertsService { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { + f.debug_struct("SqlSslCertsService") + .field("inner", &self.inner) + .finish() + } +} + +impl SqlSslCertsService { + pub async fn new(config: gax::http_client::ClientConfig) -> Result { + let inner = gax::http_client::ReqwestClient::new(config, crate::DEFAULT_HOST).await?; + Ok(Self { inner }) + } +} + +impl crate::traits::SqlSslCertsService for SqlSslCertsService { + async fn delete( + &self, + req: crate::model::SqlSslCertsDeleteRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::DELETE.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::DELETE, + format!("/v1/projects/{}/instances/{}/sslCerts/{}" + , req.project + , req.instance + , req.sha1_fingerprint + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn get( + &self, + req: crate::model::SqlSslCertsGetRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}/sslCerts/{}" + , req.project + , req.instance + , req.sha1_fingerprint + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn insert( + &self, + req: crate::model::SqlSslCertsInsertRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/sslCerts" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn list( + &self, + req: crate::model::SqlSslCertsListRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}/sslCerts" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + +} + +/// Implements [SqlTiersService](crate::traits::SqlTiersService) using a [gax::http_client::ReqwestClient]. +#[derive(Clone)] +pub struct SqlTiersService { + inner: gax::http_client::ReqwestClient, +} + +impl std::fmt::Debug for SqlTiersService { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { + f.debug_struct("SqlTiersService") + .field("inner", &self.inner) + .finish() + } +} + +impl SqlTiersService { + pub async fn new(config: gax::http_client::ClientConfig) -> Result { + let inner = gax::http_client::ReqwestClient::new(config, crate::DEFAULT_HOST).await?; + Ok(Self { inner }) + } +} + +impl crate::traits::SqlTiersService for SqlTiersService { + async fn list( + &self, + req: crate::model::SqlTiersListRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/tiers" + , req.project + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + +} + +/// Implements [SqlUsersService](crate::traits::SqlUsersService) using a [gax::http_client::ReqwestClient]. +#[derive(Clone)] +pub struct SqlUsersService { + inner: gax::http_client::ReqwestClient, +} + +impl std::fmt::Debug for SqlUsersService { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { + f.debug_struct("SqlUsersService") + .field("inner", &self.inner) + .finish() + } +} + +impl SqlUsersService { + pub async fn new(config: gax::http_client::ClientConfig) -> Result { + let inner = gax::http_client::ReqwestClient::new(config, crate::DEFAULT_HOST).await?; + Ok(Self { inner }) + } +} + +impl crate::traits::SqlUsersService for SqlUsersService { + async fn delete( + &self, + req: crate::model::SqlUsersDeleteRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::DELETE.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::DELETE, + format!("/v1/projects/{}/instances/{}/users" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + let builder = builder.query(&[("host", &req.host)]); + let builder = builder.query(&[("name", &req.name)]); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn get( + &self, + req: crate::model::SqlUsersGetRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}/users/{}" + , req.project + , req.instance + , req.name + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + let builder = builder.query(&[("host", &req.host)]); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn insert( + &self, + req: crate::model::SqlUsersInsertRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::POST.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::POST, + format!("/v1/projects/{}/instances/{}/users" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + + async fn list( + &self, + req: crate::model::SqlUsersListRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::GET.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::GET, + format!("/v1/projects/{}/instances/{}/users" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + self.inner.execute( + builder, + + None::, + options, + ).await + } + + async fn update( + &self, + req: crate::model::SqlUsersUpdateRequest, + options: gax::options::RequestOptions, + ) -> Result { + let options = options.set_default_idempotency(reqwest::Method::PUT.is_idempotent()); + let builder = self + .inner + .builder( + reqwest::Method::PUT, + format!("/v1/projects/{}/instances/{}/users" + , req.project + , req.instance + ) + ) + .query(&[("alt", "json")]) + .header("x-goog-api-client", reqwest::header::HeaderValue::from_static(&crate::info::X_GOOG_API_CLIENT_HEADER)); + let builder = builder.query(&[("host", &req.host)]); + let builder = builder.query(&[("name", &req.name)]); + self.inner.execute( + builder, + Some(req.body) + , + options, + ).await + } + +} +