google_sql1_beta4/
lib.rs

1// DO NOT EDIT !
2// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
3// DO NOT EDIT !
4
5//! This documentation was generated from *SQL Admin* crate version *6.0.0+20200331*, where *20200331* is the exact revision of the *sql:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v6.0.0*.
6//!
7//! Everything else about the *SQL Admin* *v1_beta4* API can be found at the
8//! [official documentation site](https://developers.google.com/cloud-sql/).
9//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/sql1_beta4).
10//! # Features
11//!
12//! Handle the following *Resources* with ease from the central [hub](SQLAdmin) ...
13//!
14//! * [backup runs](api::BackupRun)
15//!  * [*delete*](api::BackupRunDeleteCall), [*get*](api::BackupRunGetCall), [*insert*](api::BackupRunInsertCall) and [*list*](api::BackupRunListCall)
16//! * [databases](api::Database)
17//!  * [*delete*](api::DatabaseDeleteCall), [*get*](api::DatabaseGetCall), [*insert*](api::DatabaseInsertCall), [*list*](api::DatabaseListCall), [*patch*](api::DatabasePatchCall) and [*update*](api::DatabaseUpdateCall)
18//! * [flags](api::Flag)
19//!  * [*list*](api::FlagListCall)
20//! * instances
21//!  * [*add server ca*](api::InstanceAddServerCaCall), [*clone*](api::InstanceCloneCall), [*delete*](api::InstanceDeleteCall), [*demote master*](api::InstanceDemoteMasterCall), [*export*](api::InstanceExportCall), [*failover*](api::InstanceFailoverCall), [*get*](api::InstanceGetCall), [*import*](api::InstanceImportCall), [*insert*](api::InstanceInsertCall), [*list*](api::InstanceListCall), [*list server cas*](api::InstanceListServerCaCall), [*patch*](api::InstancePatchCall), [*promote replica*](api::InstancePromoteReplicaCall), [*reset ssl config*](api::InstanceResetSslConfigCall), [*restart*](api::InstanceRestartCall), [*restore backup*](api::InstanceRestoreBackupCall), [*rotate server ca*](api::InstanceRotateServerCaCall), [*start replica*](api::InstanceStartReplicaCall), [*stop replica*](api::InstanceStopReplicaCall), [*truncate log*](api::InstanceTruncateLogCall) and [*update*](api::InstanceUpdateCall)
22//! * [operations](api::Operation)
23//!  * [*get*](api::OperationGetCall) and [*list*](api::OperationListCall)
24//! * projects
25//!  * [*instances reschedule maintenance*](api::ProjectInstanceRescheduleMaintenanceCall), [*instances start external sync*](api::ProjectInstanceStartExternalSyncCall) and [*instances verify external sync settings*](api::ProjectInstanceVerifyExternalSyncSettingCall)
26//! * [ssl certs](api::SslCert)
27//!  * [*create ephemeral*](api::SslCertCreateEphemeralCall), [*delete*](api::SslCertDeleteCall), [*get*](api::SslCertGetCall), [*insert*](api::SslCertInsertCall) and [*list*](api::SslCertListCall)
28//! * [tiers](api::Tier)
29//!  * [*list*](api::TierListCall)
30//! * [users](api::User)
31//!  * [*delete*](api::UserDeleteCall), [*insert*](api::UserInsertCall), [*list*](api::UserListCall) and [*update*](api::UserUpdateCall)
32//!
33//!
34//!
35//!
36//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
37//!
38//! # Structure of this Library
39//!
40//! The API is structured into the following primary items:
41//!
42//! * **[Hub](SQLAdmin)**
43//!     * a central object to maintain state and allow accessing all *Activities*
44//!     * creates [*Method Builders*](common::MethodsBuilder) which in turn
45//!       allow access to individual [*Call Builders*](common::CallBuilder)
46//! * **[Resources](common::Resource)**
47//!     * primary types that you can apply *Activities* to
48//!     * a collection of properties and *Parts*
49//!     * **[Parts](common::Part)**
50//!         * a collection of properties
51//!         * never directly used in *Activities*
52//! * **[Activities](common::CallBuilder)**
53//!     * operations to apply to *Resources*
54//!
55//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
56//!
57//! Generally speaking, you can invoke *Activities* like this:
58//!
59//! ```Rust,ignore
60//! let r = hub.resource().activity(...).doit().await
61//! ```
62//!
63//! Or specifically ...
64//!
65//! ```ignore
66//! let r = hub.backup_runs().delete(...).doit().await
67//! let r = hub.backup_runs().insert(...).doit().await
68//! let r = hub.databases().delete(...).doit().await
69//! let r = hub.databases().insert(...).doit().await
70//! let r = hub.databases().patch(...).doit().await
71//! let r = hub.databases().update(...).doit().await
72//! let r = hub.instances().add_server_ca(...).doit().await
73//! let r = hub.instances().clone(...).doit().await
74//! let r = hub.instances().delete(...).doit().await
75//! let r = hub.instances().demote_master(...).doit().await
76//! let r = hub.instances().export(...).doit().await
77//! let r = hub.instances().failover(...).doit().await
78//! let r = hub.instances().import(...).doit().await
79//! let r = hub.instances().insert(...).doit().await
80//! let r = hub.instances().patch(...).doit().await
81//! let r = hub.instances().promote_replica(...).doit().await
82//! let r = hub.instances().reset_ssl_config(...).doit().await
83//! let r = hub.instances().restart(...).doit().await
84//! let r = hub.instances().restore_backup(...).doit().await
85//! let r = hub.instances().rotate_server_ca(...).doit().await
86//! let r = hub.instances().start_replica(...).doit().await
87//! let r = hub.instances().stop_replica(...).doit().await
88//! let r = hub.instances().truncate_log(...).doit().await
89//! let r = hub.instances().update(...).doit().await
90//! let r = hub.operations().get(...).doit().await
91//! let r = hub.operations().list(...).doit().await
92//! let r = hub.projects().instances_reschedule_maintenance(...).doit().await
93//! let r = hub.projects().instances_start_external_sync(...).doit().await
94//! let r = hub.ssl_certs().delete(...).doit().await
95//! let r = hub.users().delete(...).doit().await
96//! let r = hub.users().insert(...).doit().await
97//! let r = hub.users().update(...).doit().await
98//! ```
99//!
100//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
101//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
102//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
103//! The `doit()` method performs the actual communication with the server and returns the respective result.
104//!
105//! # Usage
106//!
107//! ## Setting up your Project
108//!
109//! To use this library, you would put the following lines into your `Cargo.toml` file:
110//!
111//! ```toml
112//! [dependencies]
113//! google-sql1_beta4 = "*"
114//! serde = "1"
115//! serde_json = "1"
116//! ```
117//!
118//! ## A complete example
119//!
120//! ```test_harness,no_run
121//! extern crate hyper;
122//! extern crate hyper_rustls;
123//! extern crate google_sql1_beta4 as sql1_beta4;
124//! use sql1_beta4::api::User;
125//! use sql1_beta4::{Result, Error};
126//! # async fn dox() {
127//! use sql1_beta4::{SQLAdmin, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
128//!
129//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
130//! // `client_secret`, among other things.
131//! let secret: yup_oauth2::ApplicationSecret = Default::default();
132//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
133//! // unless you replace  `None` with the desired Flow.
134//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
135//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
136//! // retrieve them from storage.
137//! let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
138//!     secret,
139//!     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
140//! ).build().await.unwrap();
141//!
142//! let client = hyper_util::client::legacy::Client::builder(
143//!     hyper_util::rt::TokioExecutor::new()
144//! )
145//! .build(
146//!     hyper_rustls::HttpsConnectorBuilder::new()
147//!         .with_native_roots()
148//!         .unwrap()
149//!         .https_or_http()
150//!         .enable_http1()
151//!         .build()
152//! );
153//! let mut hub = SQLAdmin::new(client, auth);
154//! // As the method needs a request, you would usually fill it with the desired information
155//! // into the respective structure. Some of the parts shown here might not be applicable !
156//! // Values shown here are possibly random and not representative !
157//! let mut req = User::default();
158//!
159//! // You can configure optional parameters by calling the respective setters at will, and
160//! // execute the final call using `doit()`.
161//! // Values shown here are possibly random and not representative !
162//! let result = hub.users().update(req, "project", "instance")
163//!              .name("sanctus")
164//!              .host("sed")
165//!              .doit().await;
166//!
167//! match result {
168//!     Err(e) => match e {
169//!         // The Error enum provides details about what exactly happened.
170//!         // You can also just use its `Debug`, `Display` or `Error` traits
171//!          Error::HttpError(_)
172//!         |Error::Io(_)
173//!         |Error::MissingAPIKey
174//!         |Error::MissingToken(_)
175//!         |Error::Cancelled
176//!         |Error::UploadSizeLimitExceeded(_, _)
177//!         |Error::Failure(_)
178//!         |Error::BadRequest(_)
179//!         |Error::FieldClash(_)
180//!         |Error::JsonDecodeError(_, _) => println!("{}", e),
181//!     },
182//!     Ok(res) => println!("Success: {:?}", res),
183//! }
184//! # }
185//! ```
186//! ## Handling Errors
187//!
188//! All errors produced by the system are provided either as [Result](common::Result) enumeration as return value of
189//! the doit() methods, or handed as possibly intermediate results to either the
190//! [Hub Delegate](common::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
191//!
192//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
193//! makes the system potentially resilient to all kinds of errors.
194//!
195//! ## Uploads and Downloads
196//! If a method supports downloads, the response body, which is part of the [Result](common::Result), should be
197//! read by you to obtain the media.
198//! If such a method also supports a [Response Result](common::ResponseResult), it will return that by default.
199//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making
200//! this call: `.param("alt", "media")`.
201//!
202//! Methods supporting uploads can do so using up to 2 different protocols:
203//! *simple* and *resumable*. The distinctiveness of each is represented by customized
204//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
205//!
206//! ## Customization and Callbacks
207//!
208//! You may alter the way an `doit()` method is called by providing a [delegate](common::Delegate) to the
209//! [Method Builder](common::CallBuilder) before making the final `doit()` call.
210//! Respective methods will be called to provide progress information, as well as determine whether the system should
211//! retry on failure.
212//!
213//! The [delegate trait](common::Delegate) is default-implemented, allowing you to customize it with minimal effort.
214//!
215//! ## Optional Parts in Server-Requests
216//!
217//! All structures provided by this library are made to be [encodable](common::RequestValue) and
218//! [decodable](common::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
219//! are valid.
220//! Most optionals are are considered [Parts](common::Part) which are identifiable by name, which will be sent to
221//! the server to indicate either the set parts of the request or the desired parts in the response.
222//!
223//! ## Builder Arguments
224//!
225//! Using [method builders](common::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
226//! These will always take a single argument, for which the following statements are true.
227//!
228//! * [PODs][wiki-pod] are handed by copy
229//! * strings are passed as `&str`
230//! * [request values](common::RequestValue) are moved
231//!
232//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
233//!
234//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
235//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
236//! [google-go-api]: https://github.com/google/google-api-go-client
237//!
238//! ## Cargo Features
239//!
240//! * `utoipa` - Add support for [utoipa](https://crates.io/crates/utoipa) and derive `utoipa::ToSchema` on all
241//! the types. You'll have to import and register the required types in `#[openapi(schemas(...))]`, otherwise the
242//! generated `openapi` spec would be invalid.
243//!
244//!
245//!
246
247// Unused attributes happen thanks to defined, but unused structures We don't
248// warn about this, as depending on the API, some data structures or facilities
249// are never used. Instead of pre-determining this, we just disable the lint.
250// It's manually tuned to not have any unused imports in fully featured APIs.
251// Same with unused_mut.
252#![allow(unused_imports, unused_mut, dead_code)]
253
254// DO NOT EDIT !
255// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
256// DO NOT EDIT !
257
258pub extern crate hyper;
259pub extern crate hyper_rustls;
260pub extern crate hyper_util;
261#[cfg(feature = "yup-oauth2")]
262pub extern crate yup_oauth2;
263
264pub extern crate google_apis_common as common;
265pub use common::{Delegate, Error, FieldMask, Result};
266
267pub mod api;
268pub use api::SQLAdmin;