google_binaryauthorization1/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 *Binary Authorization* crate version *5.0.3+20230113*, where *20230113* is the exact revision of the *binaryauthorization:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.3*.
6//!
7//! Everything else about the *Binary Authorization* *v1* API can be found at the
8//! [official documentation site](https://cloud.google.com/binary-authorization/).
9//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/binaryauthorization1).
10//! # Features
11//!
12//! Handle the following *Resources* with ease from the central [hub](BinaryAuthorization) ...
13//!
14//! * projects
15//! * [*attestors create*](api::ProjectAttestorCreateCall), [*attestors delete*](api::ProjectAttestorDeleteCall), [*attestors get*](api::ProjectAttestorGetCall), [*attestors get iam policy*](api::ProjectAttestorGetIamPolicyCall), [*attestors list*](api::ProjectAttestorListCall), [*attestors set iam policy*](api::ProjectAttestorSetIamPolicyCall), [*attestors test iam permissions*](api::ProjectAttestorTestIamPermissionCall), [*attestors update*](api::ProjectAttestorUpdateCall), [*attestors validate attestation occurrence*](api::ProjectAttestorValidateAttestationOccurrenceCall), [*get policy*](api::ProjectGetPolicyCall), [*policy get iam policy*](api::ProjectPolicyGetIamPolicyCall), [*policy set iam policy*](api::ProjectPolicySetIamPolicyCall), [*policy test iam permissions*](api::ProjectPolicyTestIamPermissionCall) and [*update policy*](api::ProjectUpdatePolicyCall)
16//! * systempolicy
17//! * [*get policy*](api::SystempolicyGetPolicyCall)
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](BinaryAuthorization)**
29//! * a central object to maintain state and allow accessing all *Activities*
30//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
31//! allow access to individual [*Call Builders*](client::CallBuilder)
32//! * **[Resources](client::Resource)**
33//! * primary types that you can apply *Activities* to
34//! * a collection of properties and *Parts*
35//! * **[Parts](client::Part)**
36//! * a collection of properties
37//! * never directly used in *Activities*
38//! * **[Activities](client::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.projects().attestors_get_iam_policy(...).doit().await
53//! let r = hub.projects().attestors_set_iam_policy(...).doit().await
54//! let r = hub.projects().policy_get_iam_policy(...).doit().await
55//! let r = hub.projects().policy_set_iam_policy(...).doit().await
56//! ```
57//!
58//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
59//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
60//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
61//! The `doit()` method performs the actual communication with the server and returns the respective result.
62//!
63//! # Usage
64//!
65//! ## Setting up your Project
66//!
67//! To use this library, you would put the following lines into your `Cargo.toml` file:
68//!
69//! ```toml
70//! [dependencies]
71//! google-binaryauthorization1 = "*"
72//! serde = "^1.0"
73//! serde_json = "^1.0"
74//! ```
75//!
76//! ## A complete example
77//!
78//! ```test_harness,no_run
79//! extern crate hyper;
80//! extern crate hyper_rustls;
81//! extern crate google_binaryauthorization1 as binaryauthorization1;
82//! use binaryauthorization1::{Result, Error};
83//! # async fn dox() {
84//! use std::default::Default;
85//! use binaryauthorization1::{BinaryAuthorization, oauth2, hyper, hyper_rustls, chrono, FieldMask};
86//!
87//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
88//! // `client_secret`, among other things.
89//! let secret: oauth2::ApplicationSecret = Default::default();
90//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
91//! // unless you replace `None` with the desired Flow.
92//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
93//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
94//! // retrieve them from storage.
95//! let auth = oauth2::InstalledFlowAuthenticator::builder(
96//! secret,
97//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
98//! ).build().await.unwrap();
99//! let mut hub = BinaryAuthorization::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
100//! // You can configure optional parameters by calling the respective setters at will, and
101//! // execute the final call using `doit()`.
102//! // Values shown here are possibly random and not representative !
103//! let result = hub.projects().attestors_get_iam_policy("resource")
104//! .options_requested_policy_version(-55)
105//! .doit().await;
106//!
107//! match result {
108//! Err(e) => match e {
109//! // The Error enum provides details about what exactly happened.
110//! // You can also just use its `Debug`, `Display` or `Error` traits
111//! Error::HttpError(_)
112//! |Error::Io(_)
113//! |Error::MissingAPIKey
114//! |Error::MissingToken(_)
115//! |Error::Cancelled
116//! |Error::UploadSizeLimitExceeded(_, _)
117//! |Error::Failure(_)
118//! |Error::BadRequest(_)
119//! |Error::FieldClash(_)
120//! |Error::JsonDecodeError(_, _) => println!("{}", e),
121//! },
122//! Ok(res) => println!("Success: {:?}", res),
123//! }
124//! # }
125//! ```
126//! ## Handling Errors
127//!
128//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
129//! the doit() methods, or handed as possibly intermediate results to either the
130//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
131//!
132//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
133//! makes the system potentially resilient to all kinds of errors.
134//!
135//! ## Uploads and Downloads
136//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
137//! read by you to obtain the media.
138//! If such a method also supports a [Response Result](client::ResponseResult), it will return that by default.
139//! 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
140//! this call: `.param("alt", "media")`.
141//!
142//! Methods supporting uploads can do so using up to 2 different protocols:
143//! *simple* and *resumable*. The distinctiveness of each is represented by customized
144//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
145//!
146//! ## Customization and Callbacks
147//!
148//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
149//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
150//! Respective methods will be called to provide progress information, as well as determine whether the system should
151//! retry on failure.
152//!
153//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
154//!
155//! ## Optional Parts in Server-Requests
156//!
157//! All structures provided by this library are made to be [encodable](client::RequestValue) and
158//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
159//! are valid.
160//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
161//! the server to indicate either the set parts of the request or the desired parts in the response.
162//!
163//! ## Builder Arguments
164//!
165//! Using [method builders](client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
166//! These will always take a single argument, for which the following statements are true.
167//!
168//! * [PODs][wiki-pod] are handed by copy
169//! * strings are passed as `&str`
170//! * [request values](client::RequestValue) are moved
171//!
172//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
173//!
174//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
175//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
176//! [google-go-api]: https://github.com/google/google-api-go-client
177//!
178//!
179
180// Unused attributes happen thanks to defined, but unused structures
181// We don't warn about this, as depending on the API, some data structures or facilities are never used.
182// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
183// unused imports in fully featured APIs. Same with unused_mut ... .
184#![allow(unused_imports, unused_mut, dead_code)]
185
186// DO NOT EDIT !
187// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
188// DO NOT EDIT !
189
190// Re-export the hyper and hyper_rustls crate, they are required to build the hub
191pub use hyper;
192pub use hyper_rustls;
193pub extern crate google_apis_common as client;
194pub use client::chrono;
195pub mod api;
196
197// Re-export the hub type and some basic client structs
198pub use api::BinaryAuthorization;
199pub use client::{Result, Error, Delegate, FieldMask};
200
201// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
202#[cfg(feature = "yup-oauth2")]
203pub use client::oauth2;