google_accesscontextmanager1_beta/
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 *Access Context Manager* crate version *7.0.0+20230123*, where *20230123* is the exact revision of the *accesscontextmanager:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v7.0.0*.
6//!
7//! Everything else about the *Access Context Manager* *v1_beta* API can be found at the
8//! [official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
9//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1_beta).
10//! # Features
11//!
12//! Handle the following *Resources* with ease from the central [hub](AccessContextManager) ...
13//!
14//! * [access policies](api::AccessPolicy)
15//!  * [*access levels create*](api::AccessPolicyAccessLevelCreateCall), [*access levels delete*](api::AccessPolicyAccessLevelDeleteCall), [*access levels get*](api::AccessPolicyAccessLevelGetCall), [*access levels list*](api::AccessPolicyAccessLevelListCall), [*access levels patch*](api::AccessPolicyAccessLevelPatchCall), [*create*](api::AccessPolicyCreateCall), [*delete*](api::AccessPolicyDeleteCall), [*get*](api::AccessPolicyGetCall), [*list*](api::AccessPolicyListCall), [*patch*](api::AccessPolicyPatchCall), [*service perimeters create*](api::AccessPolicyServicePerimeterCreateCall), [*service perimeters delete*](api::AccessPolicyServicePerimeterDeleteCall), [*service perimeters get*](api::AccessPolicyServicePerimeterGetCall), [*service perimeters list*](api::AccessPolicyServicePerimeterListCall) and [*service perimeters patch*](api::AccessPolicyServicePerimeterPatchCall)
16//! * [operations](api::Operation)
17//!  * [*get*](api::OperationGetCall)
18//!
19//!
20//!
21//!
22//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
23//!
24//! # Structure of this Library
25//!
26//! The API is structured into the following primary items:
27//!
28//! * **[Hub](AccessContextManager)**
29//!     * a central object to maintain state and allow accessing all *Activities*
30//!     * creates [*Method Builders*](common::MethodsBuilder) which in turn
31//!       allow access to individual [*Call Builders*](common::CallBuilder)
32//! * **[Resources](common::Resource)**
33//!     * primary types that you can apply *Activities* to
34//!     * a collection of properties and *Parts*
35//!     * **[Parts](common::Part)**
36//!         * a collection of properties
37//!         * never directly used in *Activities*
38//! * **[Activities](common::CallBuilder)**
39//!     * operations to apply to *Resources*
40//!
41//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
42//!
43//! Generally speaking, you can invoke *Activities* like this:
44//!
45//! ```Rust,ignore
46//! let r = hub.resource().activity(...).doit().await
47//! ```
48//!
49//! Or specifically ...
50//!
51//! ```ignore
52//! let r = hub.access_policies().access_levels_create(...).doit().await
53//! let r = hub.access_policies().access_levels_delete(...).doit().await
54//! let r = hub.access_policies().access_levels_patch(...).doit().await
55//! let r = hub.access_policies().service_perimeters_create(...).doit().await
56//! let r = hub.access_policies().service_perimeters_delete(...).doit().await
57//! let r = hub.access_policies().service_perimeters_patch(...).doit().await
58//! let r = hub.access_policies().create(...).doit().await
59//! let r = hub.access_policies().delete(...).doit().await
60//! let r = hub.access_policies().patch(...).doit().await
61//! let r = hub.operations().get(...).doit().await
62//! ```
63//!
64//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
65//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
66//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
67//! The `doit()` method performs the actual communication with the server and returns the respective result.
68//!
69//! # Usage
70//!
71//! ## Setting up your Project
72//!
73//! To use this library, you would put the following lines into your `Cargo.toml` file:
74//!
75//! ```toml
76//! [dependencies]
77//! google-accesscontextmanager1_beta = "*"
78//! serde = "1"
79//! serde_json = "1"
80//! ```
81//!
82//! ## A complete example
83//!
84//! ```test_harness,no_run
85//! extern crate hyper;
86//! extern crate hyper_rustls;
87//! extern crate google_accesscontextmanager1_beta as accesscontextmanager1_beta;
88//! use accesscontextmanager1_beta::api::AccessLevel;
89//! use accesscontextmanager1_beta::{Result, Error};
90//! # async fn dox() {
91//! use accesscontextmanager1_beta::{AccessContextManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
92//!
93//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
94//! // `client_secret`, among other things.
95//! let secret: yup_oauth2::ApplicationSecret = Default::default();
96//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
97//! // unless you replace  `None` with the desired Flow.
98//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
99//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
100//! // retrieve them from storage.
101//! let connector = hyper_rustls::HttpsConnectorBuilder::new()
102//!     .with_native_roots()
103//!     .unwrap()
104//!     .https_only()
105//!     .enable_http2()
106//!     .build();
107//!
108//! let executor = hyper_util::rt::TokioExecutor::new();
109//! let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
110//!     secret,
111//!     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
112//!     yup_oauth2::client::CustomHyperClientBuilder::from(
113//!         hyper_util::client::legacy::Client::builder(executor).build(connector),
114//!     ),
115//! ).build().await.unwrap();
116//!
117//! let client = hyper_util::client::legacy::Client::builder(
118//!     hyper_util::rt::TokioExecutor::new()
119//! )
120//! .build(
121//!     hyper_rustls::HttpsConnectorBuilder::new()
122//!         .with_native_roots()
123//!         .unwrap()
124//!         .https_or_http()
125//!         .enable_http2()
126//!         .build()
127//! );
128//! let mut hub = AccessContextManager::new(client, auth);
129//! // As the method needs a request, you would usually fill it with the desired information
130//! // into the respective structure. Some of the parts shown here might not be applicable !
131//! // Values shown here are possibly random and not representative !
132//! let mut req = AccessLevel::default();
133//!
134//! // You can configure optional parameters by calling the respective setters at will, and
135//! // execute the final call using `doit()`.
136//! // Values shown here are possibly random and not representative !
137//! let result = hub.access_policies().access_levels_patch(req, "name")
138//!              .update_mask(FieldMask::new::<&str>(&[]))
139//!              .doit().await;
140//!
141//! match result {
142//!     Err(e) => match e {
143//!         // The Error enum provides details about what exactly happened.
144//!         // You can also just use its `Debug`, `Display` or `Error` traits
145//!          Error::HttpError(_)
146//!         |Error::Io(_)
147//!         |Error::MissingAPIKey
148//!         |Error::MissingToken(_)
149//!         |Error::Cancelled
150//!         |Error::UploadSizeLimitExceeded(_, _)
151//!         |Error::Failure(_)
152//!         |Error::BadRequest(_)
153//!         |Error::FieldClash(_)
154//!         |Error::JsonDecodeError(_, _) => println!("{}", e),
155//!     },
156//!     Ok(res) => println!("Success: {:?}", res),
157//! }
158//! # }
159//! ```
160//! ## Handling Errors
161//!
162//! All errors produced by the system are provided either as [Result](common::Result) enumeration as return value of
163//! the doit() methods, or handed as possibly intermediate results to either the
164//! [Hub Delegate](common::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
165//!
166//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
167//! makes the system potentially resilient to all kinds of errors.
168//!
169//! ## Uploads and Downloads
170//! If a method supports downloads, the response body, which is part of the [Result](common::Result), should be
171//! read by you to obtain the media.
172//! If such a method also supports a [Response Result](common::ResponseResult), it will return that by default.
173//! 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
174//! this call: `.param("alt", "media")`.
175//!
176//! Methods supporting uploads can do so using up to 2 different protocols:
177//! *simple* and *resumable*. The distinctiveness of each is represented by customized
178//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
179//!
180//! ## Customization and Callbacks
181//!
182//! You may alter the way an `doit()` method is called by providing a [delegate](common::Delegate) to the
183//! [Method Builder](common::CallBuilder) before making the final `doit()` call.
184//! Respective methods will be called to provide progress information, as well as determine whether the system should
185//! retry on failure.
186//!
187//! The [delegate trait](common::Delegate) is default-implemented, allowing you to customize it with minimal effort.
188//!
189//! ## Optional Parts in Server-Requests
190//!
191//! All structures provided by this library are made to be [encodable](common::RequestValue) and
192//! [decodable](common::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
193//! are valid.
194//! Most optionals are are considered [Parts](common::Part) which are identifiable by name, which will be sent to
195//! the server to indicate either the set parts of the request or the desired parts in the response.
196//!
197//! ## Builder Arguments
198//!
199//! Using [method builders](common::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
200//! These will always take a single argument, for which the following statements are true.
201//!
202//! * [PODs][wiki-pod] are handed by copy
203//! * strings are passed as `&str`
204//! * [request values](common::RequestValue) are moved
205//!
206//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
207//!
208//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
209//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
210//! [google-go-api]: https://github.com/google/google-api-go-client
211//!
212//! ## Cargo Features
213//!
214//! * `utoipa` - Add support for [utoipa](https://crates.io/crates/utoipa) and derive `utoipa::ToSchema` on all
215//! the types. You'll have to import and register the required types in `#[openapi(schemas(...))]`, otherwise the
216//! generated `openapi` spec would be invalid.
217//!
218//!
219//!
220
221// Unused attributes happen thanks to defined, but unused structures We don't
222// warn about this, as depending on the API, some data structures or facilities
223// are never used. Instead of pre-determining this, we just disable the lint.
224// It's manually tuned to not have any unused imports in fully featured APIs.
225// Same with unused_mut.
226#![allow(unused_imports, unused_mut, dead_code)]
227
228// DO NOT EDIT !
229// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
230// DO NOT EDIT !
231
232pub extern crate hyper;
233pub extern crate hyper_rustls;
234pub extern crate hyper_util;
235#[cfg(feature = "yup-oauth2")]
236pub extern crate yup_oauth2;
237
238pub extern crate google_apis_common as common;
239pub use common::{Delegate, Error, FieldMask, Result};
240
241pub mod api;
242pub use api::AccessContextManager;