remove generated libs

This commit is contained in:
OMGeeky
2024-05-12 22:15:06 +02:00
4862 changed files with 0 additions and 6416267 deletions

View File

@@ -1,42 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-abusiveexperiencereport1-cli"
version = "5.0.4+20240207"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Abusive Experience Report (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/abusiveexperiencereport1-cli"
homepage = "https://developers.google.com/abusive-experience-report/"
documentation = "http://byron.github.io/google-apis-rs/google_abusiveexperiencereport1_cli"
license = "MIT"
keywords = ["abusiveexperiencerep", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "abusiveexperiencereport1"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-abusiveexperiencereport1]
path = "../abusiveexperiencereport1"
version = "5.0.4+20240207"

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,103 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `abusiveexperiencereport1` command-line interface *(CLI)* allows to use most features of the *Google Abusive Experience Report* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Abusive Experience Report* API can be found at the
[official documentation site](https://developers.google.com/abusive-experience-report/).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-abusiveexperiencereport1-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/abusiveexperiencereport1-cli).
# Usage
This documentation was generated from the *Abusive Experience Report* API at revision *20240207*. The CLI is at version *5.0.4*.
```bash
abusiveexperiencereport1 [options]
sites
get <name> [-p <v>]... [-o <out>]
violating-sites
list [-p <v>]... [-o <out>]
abusiveexperiencereport1 --help
Configuration:
--config-dir <folder>
A directory into which we will store our persistent data. Defaults to
a user-writable directory that we will create during the first invocation.
[default: ~/.google-service-cli]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `abusiveexperiencereport1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/abusiveexperiencereport1-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/abusiveexperiencereport1-secret.json`, assuming that the required *abusiveexperiencereport* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `abusiveexperiencereport1 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -1,20 +0,0 @@
site_name: Abusive Experience Report v5.0.4+20240207
site_url: http://byron.github.io/google-apis-rs/google-abusiveexperiencereport1-cli
site_description: A complete library to interact with Abusive Experience Report (protocol v1)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/abusiveexperiencereport1-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Sites':
- 'Get': 'sites_get.md'
- 'Violating Sites':
- 'List': 'violating-sites_list.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

View File

@@ -1,387 +0,0 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/cli/main.rs.mako'
// DO NOT EDIT !
#![allow(unused_variables, unused_imports, dead_code, unused_mut)]
#[macro_use]
extern crate clap;
use std::env;
use std::io::{self, Write};
use clap::{App, SubCommand, Arg};
use google_abusiveexperiencereport1::{api, Error, oauth2, client::chrono, FieldMask};
use google_clis_common as client;
use client::{InvalidOptionsError, CLIError, arg_from_str, writer_from_opts, parse_kv_arg,
input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol,
calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo};
use std::default::Default;
use std::error::Error as StdError;
use std::str::FromStr;
use serde_json as json;
use clap::ArgMatches;
use http::Uri;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tower_service;
enum DoitError {
IoError(String, io::Error),
ApiError(Error),
}
struct Engine<'n, S> {
opt: ArgMatches<'n>,
hub: api::AbusiveExperienceReport<S>,
gp: Vec<&'static str>,
gpm: Vec<(&'static str, &'static str)>,
}
impl<'n, S> Engine<'n, S>
where
S: tower_service::Service<Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
async fn _sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
-> Result<(), DoitError> {
let mut call = self.hub.sites().get(opt.value_of("name").unwrap_or(""));
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
let (key, value) = parse_kv_arg(&*parg, err, false);
match key {
_ => {
let mut found = false;
for param in &self.gp {
if key == *param {
found = true;
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
break;
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v } ));
}
}
}
}
let protocol = CallType::Standard;
if dry_run {
Ok(())
} else {
assert!(err.issues.len() == 0);
let mut ostream = match writer_from_opts(opt.value_of("out")) {
Ok(mut f) => f,
Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)),
};
match match protocol {
CallType::Standard => call.doit().await,
_ => unreachable!()
} {
Err(api_err) => Err(DoitError::ApiError(api_err)),
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema).expect("serde to work");
remove_json_null_values(&mut value);
json::to_writer_pretty(&mut ostream, &value).unwrap();
ostream.flush().unwrap();
Ok(())
}
}
}
}
async fn _violating_sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
-> Result<(), DoitError> {
let mut call = self.hub.violating_sites().list();
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
let (key, value) = parse_kv_arg(&*parg, err, false);
match key {
_ => {
let mut found = false;
for param in &self.gp {
if key == *param {
found = true;
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
break;
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v } ));
}
}
}
}
let protocol = CallType::Standard;
if dry_run {
Ok(())
} else {
assert!(err.issues.len() == 0);
let mut ostream = match writer_from_opts(opt.value_of("out")) {
Ok(mut f) => f,
Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)),
};
match match protocol {
CallType::Standard => call.doit().await,
_ => unreachable!()
} {
Err(api_err) => Err(DoitError::ApiError(api_err)),
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema).expect("serde to work");
remove_json_null_values(&mut value);
json::to_writer_pretty(&mut ostream, &value).unwrap();
ostream.flush().unwrap();
Ok(())
}
}
}
}
async fn _doit(&self, dry_run: bool) -> Result<Result<(), DoitError>, Option<InvalidOptionsError>> {
let mut err = InvalidOptionsError::new();
let mut call_result: Result<(), DoitError> = Ok(());
let mut err_opt: Option<InvalidOptionsError> = None;
match self.opt.subcommand() {
("sites", Some(opt)) => {
match opt.subcommand() {
("get", Some(opt)) => {
call_result = self._sites_get(opt, dry_run, &mut err).await;
},
_ => {
err.issues.push(CLIError::MissingMethodError("sites".to_string()));
writeln!(io::stderr(), "{}\n", opt.usage()).ok();
}
}
},
("violating-sites", Some(opt)) => {
match opt.subcommand() {
("list", Some(opt)) => {
call_result = self._violating_sites_list(opt, dry_run, &mut err).await;
},
_ => {
err.issues.push(CLIError::MissingMethodError("violating-sites".to_string()));
writeln!(io::stderr(), "{}\n", opt.usage()).ok();
}
}
},
_ => {
err.issues.push(CLIError::MissingCommandError);
writeln!(io::stderr(), "{}\n", self.opt.usage()).ok();
}
}
if dry_run {
if err.issues.len() > 0 {
err_opt = Some(err);
}
Err(err_opt)
} else {
Ok(call_result)
}
}
// Please note that this call will fail if any part of the opt can't be handled
async fn new(opt: ArgMatches<'n>, connector: S) -> Result<Engine<'n, S>, InvalidOptionsError> {
let (config_dir, secret) = {
let config_dir = match client::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) {
Err(e) => return Err(InvalidOptionsError::single(e, 3)),
Ok(p) => p,
};
match client::application_secret_from_directory(&config_dir, "abusiveexperiencereport1-secret.json",
"{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") {
Ok(secret) => (config_dir, secret),
Err(e) => return Err(InvalidOptionsError::single(e, 4))
}
};
let client = hyper::Client::builder().build(connector);
let auth = oauth2::InstalledFlowAuthenticator::with_client(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
client.clone(),
).persist_tokens_to_disk(format!("{}/abusiveexperiencereport1", config_dir)).build().await.unwrap();
let engine = Engine {
opt: opt,
hub: api::AbusiveExperienceReport::new(client, auth),
gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"],
gpm: vec![
("$-xgafv", "$.xgafv"),
("access-token", "access_token"),
("oauth-token", "oauth_token"),
("pretty-print", "prettyPrint"),
("quota-user", "quotaUser"),
("upload-type", "uploadType"),
("upload-protocol", "upload_protocol"),
]
};
match engine._doit(true).await {
Err(Some(err)) => Err(err),
Err(None) => Ok(engine),
Ok(_) => unreachable!(),
}
}
async fn doit(&self) -> Result<(), DoitError> {
match self._doit(false).await {
Ok(res) => res,
Err(_) => unreachable!(),
}
}
}
#[tokio::main]
async fn main() {
let mut exit_status = 0i32;
let arg_data = [
("sites", "methods: 'get'", vec![
("get",
Some(r##"Gets a site's Abusive Experience Report summary."##),
"Details at http://byron.github.io/google-apis-rs/google_abusiveexperiencereport1_cli/sites_get",
vec![
(Some(r##"name"##),
None,
Some(r##"Required. The name of the site whose summary to get, e.g. `sites/http%3A%2F%2Fwww.google.com%2F`. Format: `sites/{site}`"##),
Some(true),
Some(false)),
(Some(r##"v"##),
Some(r##"p"##),
Some(r##"Set various optional parameters, matching the key=value form"##),
Some(false),
Some(true)),
(Some(r##"out"##),
Some(r##"o"##),
Some(r##"Specify the file into which to write the program's output"##),
Some(false),
Some(false)),
]),
]),
("violating-sites", "methods: 'list'", vec![
("list",
Some(r##"Lists sites that are failing in the Abusive Experience Report."##),
"Details at http://byron.github.io/google-apis-rs/google_abusiveexperiencereport1_cli/violating-sites_list",
vec![
(Some(r##"v"##),
Some(r##"p"##),
Some(r##"Set various optional parameters, matching the key=value form"##),
Some(false),
Some(true)),
(Some(r##"out"##),
Some(r##"o"##),
Some(r##"Specify the file into which to write the program's output"##),
Some(false),
Some(false)),
]),
]),
];
let mut app = App::new("abusiveexperiencereport1")
.author("Sebastian Thiel <byronimo@gmail.com>")
.version("5.0.4+20240207")
.about("Views Abusive Experience Report data, and gets a list of sites that have a significant number of abusive experiences.")
.after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_abusiveexperiencereport1_cli")
.arg(Arg::with_name("folder")
.long("config-dir")
.help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli")
.multiple(false)
.takes_value(true))
.arg(Arg::with_name("debug")
.long("debug")
.help("Debug print all errors")
.multiple(false)
.takes_value(false));
for &(main_command_name, about, ref subcommands) in arg_data.iter() {
let mut mcmd = SubCommand::with_name(main_command_name).about(about);
for &(sub_command_name, ref desc, url_info, ref args) in subcommands {
let mut scmd = SubCommand::with_name(sub_command_name);
if let &Some(desc) = desc {
scmd = scmd.about(desc);
}
scmd = scmd.after_help(url_info);
for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args {
let arg_name_str =
match (arg_name, flag) {
(&Some(an), _ ) => an,
(_ , &Some(f)) => f,
_ => unreachable!(),
};
let mut arg = Arg::with_name(arg_name_str)
.empty_values(false);
if let &Some(short_flag) = flag {
arg = arg.short(short_flag);
}
if let &Some(desc) = desc {
arg = arg.help(desc);
}
if arg_name.is_some() && flag.is_some() {
arg = arg.takes_value(true);
}
if let &Some(required) = required {
arg = arg.required(required);
}
if let &Some(multi) = multi {
arg = arg.multiple(multi);
}
scmd = scmd.arg(arg);
}
mcmd = mcmd.subcommand(scmd);
}
app = app.subcommand(mcmd);
}
let matches = app.get_matches();
let debug = matches.is_present("adebug");
let connector = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots()
.https_or_http()
.enable_http1()
.build();
match Engine::new(matches, connector).await {
Err(err) => {
exit_status = err.exit_code;
writeln!(io::stderr(), "{}", err).ok();
},
Ok(engine) => {
if let Err(doit_err) = engine.doit().await {
exit_status = 1;
match doit_err {
DoitError::IoError(path, err) => {
writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok();
},
DoitError::ApiError(err) => {
if debug {
writeln!(io::stderr(), "{:#?}", err).ok();
} else {
writeln!(io::stderr(), "{}", err).ok();
}
}
}
}
}
}
std::process::exit(exit_status);
}

View File

@@ -1,37 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-abusiveexperiencereport1"
version = "5.0.4+20240207"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Abusive Experience Report (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/abusiveexperiencereport1"
homepage = "https://developers.google.com/abusive-experience-report/"
documentation = "https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207"
license = "MIT"
keywords = ["abusiveexperiencerep", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,179 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-abusiveexperiencereport1` library allows access to all features of the *Google Abusive Experience Report* service.
This documentation was generated from *Abusive Experience Report* crate version *5.0.4+20240207*, where *20240207* is the exact revision of the *abusiveexperiencereport:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Abusive Experience Report* *v1* API can be found at the
[official documentation site](https://developers.google.com/abusive-experience-report/).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/AbusiveExperienceReport) ...
* sites
* [*get*](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/api::SiteGetCall)
* violating sites
* [*list*](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/api::ViolatingSiteListCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/AbusiveExperienceReport)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::CallBuilder)
* **[Resources](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.sites().get(...).doit().await
```
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
The `doit()` method performs the actual communication with the server and returns the respective result.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-abusiveexperiencereport1 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
use abusiveexperiencereport1::{Result, Error};
use std::default::Default;
use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.sites().get("name")
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
makes the system potentially resilient to all kinds of errors.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::ResponseResult), it will return that by default.
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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Delegate) to the
[Method Builder](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::RequestValue) and
[decodable](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Part) which are identifiable by name, which will be sent to
the server to indicate either the set parts of the request or the desired parts in the response.
## Builder Arguments
Using [method builders](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
These will always take a single argument, for which the following statements are true.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::RequestValue) are moved
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **abusiveexperiencereport1** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

View File

@@ -1,740 +0,0 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
// ##############
// UTILITIES ###
// ############
// ########
// HUB ###
// ######
/// Central instance to access all AbusiveExperienceReport related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
/// use abusiveexperiencereport1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.sites().get("name")
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AbusiveExperienceReport<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
_user_agent: String,
_base_url: String,
_root_url: String,
}
impl<'a, S> client::Hub for AbusiveExperienceReport<S> {}
impl<'a, S> AbusiveExperienceReport<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AbusiveExperienceReport<S> {
AbusiveExperienceReport {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.4".to_string(),
_base_url: "https://abusiveexperiencereport.googleapis.com/".to_string(),
_root_url: "https://abusiveexperiencereport.googleapis.com/".to_string(),
}
}
pub fn sites(&'a self) -> SiteMethods<'a, S> {
SiteMethods { hub: &self }
}
pub fn violating_sites(&'a self) -> ViolatingSiteMethods<'a, S> {
ViolatingSiteMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.4`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://abusiveexperiencereport.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://abusiveexperiencereport.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}
// ############
// SCHEMAS ###
// ##########
/// Response message for GetSiteSummary.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [get sites](SiteGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct SiteSummaryResponse {
/// The site's Abusive Experience Report status.
#[serde(rename="abusiveStatus")]
pub abusive_status: Option<String>,
/// The time at which [enforcement](https://support.google.com/webtools/answer/7538608) against the site began or will begin. Not set when the filter_status is OFF.
#[serde(rename="enforcementTime")]
pub enforcement_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The site's [enforcement status](https://support.google.com/webtools/answer/7538608).
#[serde(rename="filterStatus")]
pub filter_status: Option<String>,
/// The time at which the site's status last changed.
#[serde(rename="lastChangeTime")]
pub last_change_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// A link to the full Abusive Experience Report for the site. Not set in ViolatingSitesResponse. Note that you must complete the [Search Console verification process](https://support.google.com/webmasters/answer/9008080) for the site before you can access the full report.
#[serde(rename="reportUrl")]
pub report_url: Option<String>,
/// The name of the reviewed site, e.g. `google.com`.
#[serde(rename="reviewedSite")]
pub reviewed_site: Option<String>,
/// Whether the site is currently under review.
#[serde(rename="underReview")]
pub under_review: Option<bool>,
}
impl client::ResponseResult for SiteSummaryResponse {}
/// Response message for ListViolatingSites.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [list violating sites](ViolatingSiteListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ViolatingSitesResponse {
/// The list of violating sites.
#[serde(rename="violatingSites")]
pub violating_sites: Option<Vec<SiteSummaryResponse>>,
}
impl client::ResponseResult for ViolatingSitesResponse {}
// ###################
// MethodBuilders ###
// #################
/// A builder providing access to all methods supported on *site* resources.
/// It is not used directly, but through the [`AbusiveExperienceReport`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `get(...)`
/// // to build up your call.
/// let rb = hub.sites();
/// # }
/// ```
pub struct SiteMethods<'a, S>
where S: 'a {
hub: &'a AbusiveExperienceReport<S>,
}
impl<'a, S> client::MethodsBuilder for SiteMethods<'a, S> {}
impl<'a, S> SiteMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Gets a site's Abusive Experience Report summary.
///
/// # Arguments
///
/// * `name` - Required. The name of the site whose summary to get, e.g. `sites/http%3A%2F%2Fwww.google.com%2F`. Format: `sites/{site}`
pub fn get(&self, name: &str) -> SiteGetCall<'a, S> {
SiteGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *violatingSite* resources.
/// It is not used directly, but through the [`AbusiveExperienceReport`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `list(...)`
/// // to build up your call.
/// let rb = hub.violating_sites();
/// # }
/// ```
pub struct ViolatingSiteMethods<'a, S>
where S: 'a {
hub: &'a AbusiveExperienceReport<S>,
}
impl<'a, S> client::MethodsBuilder for ViolatingSiteMethods<'a, S> {}
impl<'a, S> ViolatingSiteMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Lists sites that are failing in the Abusive Experience Report.
pub fn list(&self) -> ViolatingSiteListCall<'a, S> {
ViolatingSiteListCall {
hub: self.hub,
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
}
// ###################
// CallBuilders ###
// #################
/// Gets a site's Abusive Experience Report summary.
///
/// A builder for the *get* method supported by a *site* resource.
/// It is not used directly, but through a [`SiteMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
/// # async fn dox() {
/// # use std::default::Default;
/// # use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// # let secret: oauth2::ApplicationSecret = Default::default();
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.sites().get("name")
/// .doit().await;
/// # }
/// ```
pub struct SiteGetCall<'a, S>
where S: 'a {
hub: &'a AbusiveExperienceReport<S>,
_name: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
}
impl<'a, S> client::CallBuilder for SiteGetCall<'a, S> {}
impl<'a, S> SiteGetCall<'a, S>
where
S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, SiteSummaryResponse)> {
use std::io::{Read, Seek};
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
use client::{ToParts, url::Params};
use std::borrow::Cow;
let mut dd = client::DefaultDelegate;
let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(client::MethodInfo { id: "abusiveexperiencereport.sites.get",
http_method: hyper::Method::GET });
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(client::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(3 + self._additional_params.len());
params.push("name", &self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}";
match dlg.api_key() {
Some(value) => params.push("key", value),
None => {
dlg.finished(false);
return Err(client::Error::MissingAPIKey)
}
}
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
let request = req_builder
.body(hyper::body::Body::empty());
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let client::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(client::Error::HttpError(err))
}
Ok(mut res) => {
if !res.status().is_success() {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
let (parts, _) = res.into_parts();
let body = hyper::Body::from(res_body_string.clone());
let restored_response = hyper::Response::from_parts(parts, body);
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
sleep(d).await;
continue;
}
dlg.finished(false);
return match server_response {
Some(error_value) => Err(client::Error::BadRequest(error_value)),
None => Err(client::Error::Failure(restored_response)),
}
}
let result_value = {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
match json::from_str(&res_body_string) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&res_body_string, &err);
return Err(client::Error::JsonDecodeError(res_body_string, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
/// Required. The name of the site whose summary to get, e.g. `sites/http%3A%2F%2Fwww.google.com%2F`. Format: `sites/{site}`
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> SiteGetCall<'a, S> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SiteGetCall<'a, S> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> SiteGetCall<'a, S>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
}
/// Lists sites that are failing in the Abusive Experience Report.
///
/// A builder for the *list* method supported by a *violatingSite* resource.
/// It is not used directly, but through a [`ViolatingSiteMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
/// # async fn dox() {
/// # use std::default::Default;
/// # use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// # let secret: oauth2::ApplicationSecret = Default::default();
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.violating_sites().list()
/// .doit().await;
/// # }
/// ```
pub struct ViolatingSiteListCall<'a, S>
where S: 'a {
hub: &'a AbusiveExperienceReport<S>,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
}
impl<'a, S> client::CallBuilder for ViolatingSiteListCall<'a, S> {}
impl<'a, S> ViolatingSiteListCall<'a, S>
where
S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ViolatingSitesResponse)> {
use std::io::{Read, Seek};
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
use client::{ToParts, url::Params};
use std::borrow::Cow;
let mut dd = client::DefaultDelegate;
let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(client::MethodInfo { id: "abusiveexperiencereport.violatingSites.list",
http_method: hyper::Method::GET });
for &field in ["alt"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(client::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(2 + self._additional_params.len());
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/violatingSites";
match dlg.api_key() {
Some(value) => params.push("key", value),
None => {
dlg.finished(false);
return Err(client::Error::MissingAPIKey)
}
}
let url = params.parse_with_url(&url);
loop {
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
let request = req_builder
.body(hyper::body::Body::empty());
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let client::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(client::Error::HttpError(err))
}
Ok(mut res) => {
if !res.status().is_success() {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
let (parts, _) = res.into_parts();
let body = hyper::Body::from(res_body_string.clone());
let restored_response = hyper::Response::from_parts(parts, body);
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
sleep(d).await;
continue;
}
dlg.finished(false);
return match server_response {
Some(error_value) => Err(client::Error::BadRequest(error_value)),
None => Err(client::Error::Failure(restored_response)),
}
}
let result_value = {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
match json::from_str(&res_body_string) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&res_body_string, &err);
return Err(client::Error::JsonDecodeError(res_body_string, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ViolatingSiteListCall<'a, S> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ViolatingSiteListCall<'a, S>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
}

View File

@@ -1,109 +0,0 @@
use super::*;
/// Central instance to access all AbusiveExperienceReport related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
/// use abusiveexperiencereport1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.sites().get("name")
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AbusiveExperienceReport<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AbusiveExperienceReport<S> {}
impl<'a, S> AbusiveExperienceReport<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AbusiveExperienceReport<S> {
AbusiveExperienceReport {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://abusiveexperiencereport.googleapis.com/".to_string(),
_root_url: "https://abusiveexperiencereport.googleapis.com/".to_string(),
}
}
pub fn sites(&'a self) -> SiteMethods<'a, S> {
SiteMethods { hub: &self }
}
pub fn violating_sites(&'a self) -> ViolatingSiteMethods<'a, S> {
ViolatingSiteMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.3`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://abusiveexperiencereport.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://abusiveexperiencereport.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}

View File

@@ -1,110 +0,0 @@
use super::*;
/// A builder providing access to all methods supported on *site* resources.
/// It is not used directly, but through the [`AbusiveExperienceReport`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `get(...)`
/// // to build up your call.
/// let rb = hub.sites();
/// # }
/// ```
pub struct SiteMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AbusiveExperienceReport<S>,
}
impl<'a, S> client::MethodsBuilder for SiteMethods<'a, S> {}
impl<'a, S> SiteMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Gets a site's Abusive Experience Report summary.
///
/// # Arguments
///
/// * `name` - Required. The name of the site whose summary to get, e.g. `sites/http%3A%2F%2Fwww.google.com%2F`. Format: `sites/{site}`
pub fn get(&self, name: &str) -> SiteGetCall<'a, S> {
SiteGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *violatingSite* resources.
/// It is not used directly, but through the [`AbusiveExperienceReport`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `list(...)`
/// // to build up your call.
/// let rb = hub.violating_sites();
/// # }
/// ```
pub struct ViolatingSiteMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AbusiveExperienceReport<S>,
}
impl<'a, S> client::MethodsBuilder for ViolatingSiteMethods<'a, S> {}
impl<'a, S> ViolatingSiteMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Lists sites that are failing in the Abusive Experience Report.
pub fn list(&self) -> ViolatingSiteListCall<'a, S> {
ViolatingSiteListCall {
hub: self.hub,
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
}

View File

@@ -1,35 +0,0 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;
mod enums;
pub use enums::*;

View File

@@ -1,65 +0,0 @@
use super::*;
/// Response message for GetSiteSummary.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [get sites](SiteGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct SiteSummaryResponse {
/// The site's Abusive Experience Report status.
#[serde(rename="abusiveStatus")]
pub abusive_status: Option<SiteSummaryResponseAbusiveStatusEnum>,
/// The time at which [enforcement](https://support.google.com/webtools/answer/7538608) against the site began or will begin. Not set when the filter_status is OFF.
#[serde(rename="enforcementTime")]
pub enforcement_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The site's [enforcement status](https://support.google.com/webtools/answer/7538608).
#[serde(rename="filterStatus")]
pub filter_status: Option<SiteSummaryResponseFilterStatusEnum>,
/// The time at which the site's status last changed.
#[serde(rename="lastChangeTime")]
pub last_change_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// A link to the full Abusive Experience Report for the site. Not set in ViolatingSitesResponse. Note that you must complete the [Search Console verification process](https://support.google.com/webmasters/answer/9008080) for the site before you can access the full report.
#[serde(rename="reportUrl")]
pub report_url: Option<String>,
/// The name of the reviewed site, e.g. `google.com`.
#[serde(rename="reviewedSite")]
pub reviewed_site: Option<String>,
/// Whether the site is currently under review.
#[serde(rename="underReview")]
pub under_review: Option<bool>,
}
impl client::ResponseResult for SiteSummaryResponse {}
/// Response message for ListViolatingSites.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [list violating sites](ViolatingSiteListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ViolatingSitesResponse {
/// The list of violating sites.
#[serde(rename="violatingSites")]
pub violating_sites: Option<Vec<SiteSummaryResponse>>,
}
impl client::ResponseResult for ViolatingSitesResponse {}

View File

@@ -1,2 +0,0 @@
use super::*;

View File

@@ -1,199 +0,0 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Abusive Experience Report* crate version *5.0.4+20240207*, where *20240207* is the exact revision of the *abusiveexperiencereport:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Abusive Experience Report* *v1* API can be found at the
//! [official documentation site](https://developers.google.com/abusive-experience-report/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/abusiveexperiencereport1).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AbusiveExperienceReport) ...
//!
//! * sites
//! * [*get*](api::SiteGetCall)
//! * violating sites
//! * [*list*](api::ViolatingSiteListCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AbusiveExperienceReport)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.sites().get(...).doit().await
//! ```
//!
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
//! The `doit()` method performs the actual communication with the server and returns the respective result.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-abusiveexperiencereport1 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
//! use abusiveexperiencereport1::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.sites().get("name")
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
//! makes the system potentially resilient to all kinds of errors.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), it will return that by default.
//! 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
//! the server to indicate either the set parts of the request or the desired parts in the response.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
//! These will always take a single argument, for which the following statements are true.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
//!
//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// Unused attributes happen thanks to defined, but unused structures
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
// unused imports in fully featured APIs. Same with unused_mut ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AbusiveExperienceReport;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -1,42 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-acceleratedmobilepageurl1-cli"
version = "5.0.4+20240303"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Acceleratedmobilepageurl (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/acceleratedmobilepageurl1-cli"
homepage = "https://developers.google.com/amp/cache/"
documentation = "http://byron.github.io/google-apis-rs/google_acceleratedmobilepageurl1_cli"
license = "MIT"
keywords = ["acceleratedmobilepag", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "acceleratedmobilepageurl1"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-acceleratedmobilepageurl1]
path = "../acceleratedmobilepageurl1"
version = "5.0.4+20240303"

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,101 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `acceleratedmobilepageurl1` command-line interface *(CLI)* allows to use most features of the *Google Acceleratedmobilepageurl* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Acceleratedmobilepageurl* API can be found at the
[official documentation site](https://developers.google.com/amp/cache/).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-acceleratedmobilepageurl1-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/acceleratedmobilepageurl1-cli).
# Usage
This documentation was generated from the *Acceleratedmobilepageurl* API at revision *20240303*. The CLI is at version *5.0.4*.
```bash
acceleratedmobilepageurl1 [options]
amp-urls
batch-get (-r <kv>)... [-p <v>]... [-o <out>]
acceleratedmobilepageurl1 --help
Configuration:
--config-dir <folder>
A directory into which we will store our persistent data. Defaults to
a user-writable directory that we will create during the first invocation.
[default: ~/.google-service-cli]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `acceleratedmobilepageurl1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/acceleratedmobilepageurl1-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/acceleratedmobilepageurl1-secret.json`, assuming that the required *acceleratedmobilepageurl* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `acceleratedmobilepageurl1 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -1,18 +0,0 @@
site_name: Acceleratedmobilepageurl v5.0.4+20240303
site_url: http://byron.github.io/google-apis-rs/google-acceleratedmobilepageurl1-cli
site_description: A complete library to interact with Acceleratedmobilepageurl (protocol v1)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/acceleratedmobilepageurl1-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Amp Urls':
- 'Batch Get': 'amp-urls_batch-get.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

View File

@@ -1,342 +0,0 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/cli/main.rs.mako'
// DO NOT EDIT !
#![allow(unused_variables, unused_imports, dead_code, unused_mut)]
#[macro_use]
extern crate clap;
use std::env;
use std::io::{self, Write};
use clap::{App, SubCommand, Arg};
use google_acceleratedmobilepageurl1::{api, Error, oauth2, client::chrono, FieldMask};
use google_clis_common as client;
use client::{InvalidOptionsError, CLIError, arg_from_str, writer_from_opts, parse_kv_arg,
input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol,
calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo};
use std::default::Default;
use std::error::Error as StdError;
use std::str::FromStr;
use serde_json as json;
use clap::ArgMatches;
use http::Uri;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tower_service;
enum DoitError {
IoError(String, io::Error),
ApiError(Error),
}
struct Engine<'n, S> {
opt: ArgMatches<'n>,
hub: api::Acceleratedmobilepageurl<S>,
gp: Vec<&'static str>,
gpm: Vec<(&'static str, &'static str)>,
}
impl<'n, S> Engine<'n, S>
where
S: tower_service::Service<Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
async fn _amp_urls_batch_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
-> Result<(), DoitError> {
let mut field_cursor = FieldCursor::default();
let mut object = json::value::Value::Object(Default::default());
for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
let last_errc = err.issues.len();
let (key, value) = parse_kv_arg(&*kvarg, err, false);
let mut temp_cursor = field_cursor.clone();
if let Err(field_err) = temp_cursor.set(&*key) {
err.issues.push(field_err);
}
if value.is_none() {
field_cursor = temp_cursor.clone();
if err.issues.len() > last_errc {
err.issues.remove(last_errc);
}
continue;
}
let type_info: Option<(&'static str, JsonTypeInfo)> =
match &temp_cursor.to_string()[..] {
"lookup-strategy" => Some(("lookupStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
"urls" => Some(("urls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })),
_ => {
let suggestion = FieldCursor::did_you_mean(key, &vec!["lookup-strategy", "urls"]);
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string()))));
None
}
};
if let Some((field_cursor_str, type_info)) = type_info {
FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor);
}
}
let mut request: api::BatchGetAmpUrlsRequest = json::value::from_value(object).unwrap();
let mut call = self.hub.amp_urls().batch_get(request);
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
let (key, value) = parse_kv_arg(&*parg, err, false);
match key {
_ => {
let mut found = false;
for param in &self.gp {
if key == *param {
found = true;
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
break;
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v } ));
}
}
}
}
let protocol = CallType::Standard;
if dry_run {
Ok(())
} else {
assert!(err.issues.len() == 0);
let mut ostream = match writer_from_opts(opt.value_of("out")) {
Ok(mut f) => f,
Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)),
};
match match protocol {
CallType::Standard => call.doit().await,
_ => unreachable!()
} {
Err(api_err) => Err(DoitError::ApiError(api_err)),
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema).expect("serde to work");
remove_json_null_values(&mut value);
json::to_writer_pretty(&mut ostream, &value).unwrap();
ostream.flush().unwrap();
Ok(())
}
}
}
}
async fn _doit(&self, dry_run: bool) -> Result<Result<(), DoitError>, Option<InvalidOptionsError>> {
let mut err = InvalidOptionsError::new();
let mut call_result: Result<(), DoitError> = Ok(());
let mut err_opt: Option<InvalidOptionsError> = None;
match self.opt.subcommand() {
("amp-urls", Some(opt)) => {
match opt.subcommand() {
("batch-get", Some(opt)) => {
call_result = self._amp_urls_batch_get(opt, dry_run, &mut err).await;
},
_ => {
err.issues.push(CLIError::MissingMethodError("amp-urls".to_string()));
writeln!(io::stderr(), "{}\n", opt.usage()).ok();
}
}
},
_ => {
err.issues.push(CLIError::MissingCommandError);
writeln!(io::stderr(), "{}\n", self.opt.usage()).ok();
}
}
if dry_run {
if err.issues.len() > 0 {
err_opt = Some(err);
}
Err(err_opt)
} else {
Ok(call_result)
}
}
// Please note that this call will fail if any part of the opt can't be handled
async fn new(opt: ArgMatches<'n>, connector: S) -> Result<Engine<'n, S>, InvalidOptionsError> {
let (config_dir, secret) = {
let config_dir = match client::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) {
Err(e) => return Err(InvalidOptionsError::single(e, 3)),
Ok(p) => p,
};
match client::application_secret_from_directory(&config_dir, "acceleratedmobilepageurl1-secret.json",
"{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") {
Ok(secret) => (config_dir, secret),
Err(e) => return Err(InvalidOptionsError::single(e, 4))
}
};
let client = hyper::Client::builder().build(connector);
let auth = oauth2::InstalledFlowAuthenticator::with_client(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
client.clone(),
).persist_tokens_to_disk(format!("{}/acceleratedmobilepageurl1", config_dir)).build().await.unwrap();
let engine = Engine {
opt: opt,
hub: api::Acceleratedmobilepageurl::new(client, auth),
gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"],
gpm: vec![
("$-xgafv", "$.xgafv"),
("access-token", "access_token"),
("oauth-token", "oauth_token"),
("pretty-print", "prettyPrint"),
("quota-user", "quotaUser"),
("upload-type", "uploadType"),
("upload-protocol", "upload_protocol"),
]
};
match engine._doit(true).await {
Err(Some(err)) => Err(err),
Err(None) => Ok(engine),
Ok(_) => unreachable!(),
}
}
async fn doit(&self) -> Result<(), DoitError> {
match self._doit(false).await {
Ok(res) => res,
Err(_) => unreachable!(),
}
}
}
#[tokio::main]
async fn main() {
let mut exit_status = 0i32;
let arg_data = [
("amp-urls", "methods: 'batch-get'", vec![
("batch-get",
Some(r##"Returns AMP URL(s) and equivalent [AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format)."##),
"Details at http://byron.github.io/google-apis-rs/google_acceleratedmobilepageurl1_cli/amp-urls_batch-get",
vec![
(Some(r##"kv"##),
Some(r##"r"##),
Some(r##"Set various fields of the request structure, matching the key=value form"##),
Some(true),
Some(true)),
(Some(r##"v"##),
Some(r##"p"##),
Some(r##"Set various optional parameters, matching the key=value form"##),
Some(false),
Some(true)),
(Some(r##"out"##),
Some(r##"o"##),
Some(r##"Specify the file into which to write the program's output"##),
Some(false),
Some(false)),
]),
]),
];
let mut app = App::new("acceleratedmobilepageurl1")
.author("Sebastian Thiel <byronimo@gmail.com>")
.version("5.0.4+20240303")
.about("Retrieves the list of AMP URLs (and equivalent AMP Cache URLs) for a given list of public URL(s). ")
.after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_acceleratedmobilepageurl1_cli")
.arg(Arg::with_name("folder")
.long("config-dir")
.help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli")
.multiple(false)
.takes_value(true))
.arg(Arg::with_name("debug")
.long("debug")
.help("Debug print all errors")
.multiple(false)
.takes_value(false));
for &(main_command_name, about, ref subcommands) in arg_data.iter() {
let mut mcmd = SubCommand::with_name(main_command_name).about(about);
for &(sub_command_name, ref desc, url_info, ref args) in subcommands {
let mut scmd = SubCommand::with_name(sub_command_name);
if let &Some(desc) = desc {
scmd = scmd.about(desc);
}
scmd = scmd.after_help(url_info);
for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args {
let arg_name_str =
match (arg_name, flag) {
(&Some(an), _ ) => an,
(_ , &Some(f)) => f,
_ => unreachable!(),
};
let mut arg = Arg::with_name(arg_name_str)
.empty_values(false);
if let &Some(short_flag) = flag {
arg = arg.short(short_flag);
}
if let &Some(desc) = desc {
arg = arg.help(desc);
}
if arg_name.is_some() && flag.is_some() {
arg = arg.takes_value(true);
}
if let &Some(required) = required {
arg = arg.required(required);
}
if let &Some(multi) = multi {
arg = arg.multiple(multi);
}
scmd = scmd.arg(arg);
}
mcmd = mcmd.subcommand(scmd);
}
app = app.subcommand(mcmd);
}
let matches = app.get_matches();
let debug = matches.is_present("adebug");
let connector = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots()
.https_or_http()
.enable_http1()
.build();
match Engine::new(matches, connector).await {
Err(err) => {
exit_status = err.exit_code;
writeln!(io::stderr(), "{}", err).ok();
},
Ok(engine) => {
if let Err(doit_err) = engine.doit().await {
exit_status = 1;
match doit_err {
DoitError::IoError(path, err) => {
writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok();
},
DoitError::ApiError(err) => {
if debug {
writeln!(io::stderr(), "{:#?}", err).ok();
} else {
writeln!(io::stderr(), "{}", err).ok();
}
}
}
}
}
}
std::process::exit(exit_status);
}

View File

@@ -1,37 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-acceleratedmobilepageurl1"
version = "5.0.4+20240303"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Acceleratedmobilepageurl (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/acceleratedmobilepageurl1"
homepage = "https://developers.google.com/amp/cache/"
documentation = "https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303"
license = "MIT"
keywords = ["acceleratedmobilepag", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,183 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-acceleratedmobilepageurl1` library allows access to all features of the *Google Acceleratedmobilepageurl* service.
This documentation was generated from *Acceleratedmobilepageurl* crate version *5.0.4+20240303*, where *20240303* is the exact revision of the *acceleratedmobilepageurl:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Acceleratedmobilepageurl* *v1* API can be found at the
[official documentation site](https://developers.google.com/amp/cache/).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/Acceleratedmobilepageurl) ...
* [amp urls](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/api::AmpUrl)
* [*batch get*](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/api::AmpUrlBatchGetCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/Acceleratedmobilepageurl)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::CallBuilder)
* **[Resources](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.amp_urls().batch_get(...).doit().await
```
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
The `doit()` method performs the actual communication with the server and returns the respective result.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-acceleratedmobilepageurl1 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
use acceleratedmobilepageurl1::api::BatchGetAmpUrlsRequest;
use acceleratedmobilepageurl1::{Result, Error};
use std::default::Default;
use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = BatchGetAmpUrlsRequest::default();
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.amp_urls().batch_get(req)
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
makes the system potentially resilient to all kinds of errors.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::ResponseResult), it will return that by default.
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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Delegate) to the
[Method Builder](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::RequestValue) and
[decodable](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Part) which are identifiable by name, which will be sent to
the server to indicate either the set parts of the request or the desired parts in the response.
## Builder Arguments
Using [method builders](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
These will always take a single argument, for which the following statements are true.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::RequestValue) are moved
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **acceleratedmobilepageurl1** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

View File

@@ -1,539 +0,0 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
// ##############
// UTILITIES ###
// ############
// ########
// HUB ###
// ######
/// Central instance to access all Acceleratedmobilepageurl related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
/// use acceleratedmobilepageurl1::api::BatchGetAmpUrlsRequest;
/// use acceleratedmobilepageurl1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = BatchGetAmpUrlsRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.amp_urls().batch_get(req)
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct Acceleratedmobilepageurl<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
_user_agent: String,
_base_url: String,
_root_url: String,
}
impl<'a, S> client::Hub for Acceleratedmobilepageurl<S> {}
impl<'a, S> Acceleratedmobilepageurl<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> Acceleratedmobilepageurl<S> {
Acceleratedmobilepageurl {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.4".to_string(),
_base_url: "https://acceleratedmobilepageurl.googleapis.com/".to_string(),
_root_url: "https://acceleratedmobilepageurl.googleapis.com/".to_string(),
}
}
pub fn amp_urls(&'a self) -> AmpUrlMethods<'a, S> {
AmpUrlMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.4`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://acceleratedmobilepageurl.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://acceleratedmobilepageurl.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}
// ############
// SCHEMAS ###
// ##########
/// AMP URL response for a requested URL.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [batch get amp urls](AmpUrlBatchGetCall) (none)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AmpUrl {
/// The AMP URL pointing to the publisher's web server.
#[serde(rename="ampUrl")]
pub amp_url: Option<String>,
/// The [AMP Cache URL](https://developers.google.com/amp/cache/overview#amp-cache-url-format) pointing to the cached document in the Google AMP Cache.
#[serde(rename="cdnAmpUrl")]
pub cdn_amp_url: Option<String>,
/// The original non-AMP URL.
#[serde(rename="originalUrl")]
pub original_url: Option<String>,
}
impl client::Resource for AmpUrl {}
/// AMP URL Error resource for a requested URL that couldn't be found.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AmpUrlError {
/// The error code of an API call.
#[serde(rename="errorCode")]
pub error_code: Option<String>,
/// An optional descriptive error message.
#[serde(rename="errorMessage")]
pub error_message: Option<String>,
/// The original non-AMP URL.
#[serde(rename="originalUrl")]
pub original_url: Option<String>,
}
impl client::Part for AmpUrlError {}
/// AMP URL request for a batch of URLs.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [batch get amp urls](AmpUrlBatchGetCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BatchGetAmpUrlsRequest {
/// The lookup_strategy being requested.
#[serde(rename="lookupStrategy")]
pub lookup_strategy: Option<String>,
/// List of URLs to look up for the paired AMP URLs. The URLs are case-sensitive. Up to 50 URLs per lookup (see [Usage Limits](https://developers.google.com/amp/cache/reference/limits)).
pub urls: Option<Vec<String>>,
}
impl client::RequestValue for BatchGetAmpUrlsRequest {}
/// Batch AMP URL response.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [batch get amp urls](AmpUrlBatchGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BatchGetAmpUrlsResponse {
/// For each URL in BatchAmpUrlsRequest, the URL response. The response might not be in the same order as URLs in the batch request. If BatchAmpUrlsRequest contains duplicate URLs, AmpUrl is generated only once.
#[serde(rename="ampUrls")]
pub amp_urls: Option<Vec<AmpUrl>>,
/// The errors for requested URLs that have no AMP URL.
#[serde(rename="urlErrors")]
pub url_errors: Option<Vec<AmpUrlError>>,
}
impl client::ResponseResult for BatchGetAmpUrlsResponse {}
// ###################
// MethodBuilders ###
// #################
/// A builder providing access to all methods supported on *ampUrl* resources.
/// It is not used directly, but through the [`Acceleratedmobilepageurl`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `batch_get(...)`
/// // to build up your call.
/// let rb = hub.amp_urls();
/// # }
/// ```
pub struct AmpUrlMethods<'a, S>
where S: 'a {
hub: &'a Acceleratedmobilepageurl<S>,
}
impl<'a, S> client::MethodsBuilder for AmpUrlMethods<'a, S> {}
impl<'a, S> AmpUrlMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Returns AMP URL(s) and equivalent [AMP Cache URL(s)](https://developers.google.com/amp/cache/overview#amp-cache-url-format).
///
/// # Arguments
///
/// * `request` - No description provided.
pub fn batch_get(&self, request: BatchGetAmpUrlsRequest) -> AmpUrlBatchGetCall<'a, S> {
AmpUrlBatchGetCall {
hub: self.hub,
_request: request,
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
}
// ###################
// CallBuilders ###
// #################
/// Returns AMP URL(s) and equivalent [AMP Cache URL(s)](https://developers.google.com/amp/cache/overview#amp-cache-url-format).
///
/// A builder for the *batchGet* method supported by a *ampUrl* resource.
/// It is not used directly, but through a [`AmpUrlMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
/// use acceleratedmobilepageurl1::api::BatchGetAmpUrlsRequest;
/// # async fn dox() {
/// # use std::default::Default;
/// # use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// # let secret: oauth2::ApplicationSecret = Default::default();
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = BatchGetAmpUrlsRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.amp_urls().batch_get(req)
/// .doit().await;
/// # }
/// ```
pub struct AmpUrlBatchGetCall<'a, S>
where S: 'a {
hub: &'a Acceleratedmobilepageurl<S>,
_request: BatchGetAmpUrlsRequest,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
}
impl<'a, S> client::CallBuilder for AmpUrlBatchGetCall<'a, S> {}
impl<'a, S> AmpUrlBatchGetCall<'a, S>
where
S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, BatchGetAmpUrlsResponse)> {
use std::io::{Read, Seek};
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
use client::{ToParts, url::Params};
use std::borrow::Cow;
let mut dd = client::DefaultDelegate;
let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(client::MethodInfo { id: "acceleratedmobilepageurl.ampUrls.batchGet",
http_method: hyper::Method::POST });
for &field in ["alt"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(client::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(3 + self._additional_params.len());
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/ampUrls:batchGet";
match dlg.api_key() {
Some(value) => params.push("key", value),
None => {
dlg.finished(false);
return Err(client::Error::MissingAPIKey)
}
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader =
{
let mut value = json::value::to_value(&self._request).expect("serde to work");
client::remove_json_null_values(&mut value);
let mut dst = io::Cursor::new(Vec::with_capacity(128));
json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
loop {
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let client::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(client::Error::HttpError(err))
}
Ok(mut res) => {
if !res.status().is_success() {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
let (parts, _) = res.into_parts();
let body = hyper::Body::from(res_body_string.clone());
let restored_response = hyper::Response::from_parts(parts, body);
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
sleep(d).await;
continue;
}
dlg.finished(false);
return match server_response {
Some(error_value) => Err(client::Error::BadRequest(error_value)),
None => Err(client::Error::Failure(restored_response)),
}
}
let result_value = {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
match json::from_str(&res_body_string) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&res_body_string, &err);
return Err(client::Error::JsonDecodeError(res_body_string, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(mut self, new_value: BatchGetAmpUrlsRequest) -> AmpUrlBatchGetCall<'a, S> {
self._request = new_value;
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AmpUrlBatchGetCall<'a, S> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> AmpUrlBatchGetCall<'a, S>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
}

View File

@@ -1,229 +0,0 @@
use super::*;
/// Returns AMP URL(s) and equivalent [AMP Cache URL(s)](https://developers.google.com/amp/cache/overview#amp-cache-url-format).
///
/// A builder for the *batchGet* method supported by a *ampUrl* resource.
/// It is not used directly, but through a [`AmpUrlMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
/// use acceleratedmobilepageurl1::api::BatchGetAmpUrlsRequest;
/// # async fn dox() {
/// # use std::default::Default;
/// # use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// # let secret: oauth2::ApplicationSecret = Default::default();
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = BatchGetAmpUrlsRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.amp_urls().batch_get(req)
/// .doit().await;
/// # }
/// ```
pub struct AmpUrlBatchGetCall<'a, S>
where S: 'a {
pub(super) hub: &'a Acceleratedmobilepageurl<S>,
pub(super) _request: BatchGetAmpUrlsRequest,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
}
impl<'a, S> client::CallBuilder for AmpUrlBatchGetCall<'a, S> {}
impl<'a, S> AmpUrlBatchGetCall<'a, S>
where
S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, BatchGetAmpUrlsResponse)> {
use std::io::{Read, Seek};
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
use client::{ToParts, url::Params};
use std::borrow::Cow;
let mut dd = client::DefaultDelegate;
let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(client::MethodInfo { id: "acceleratedmobilepageurl.ampUrls.batchGet",
http_method: hyper::Method::POST });
for &field in ["alt"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(client::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(3 + self._additional_params.len());
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/ampUrls:batchGet";
match dlg.api_key() {
Some(value) => params.push("key", value),
None => {
dlg.finished(false);
return Err(client::Error::MissingAPIKey)
}
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader =
{
let mut value = json::value::to_value(&self._request).expect("serde to work");
client::remove_json_null_values(&mut value);
let mut dst = io::Cursor::new(Vec::with_capacity(128));
json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
loop {
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let client::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(client::Error::HttpError(err))
}
Ok(mut res) => {
if !res.status().is_success() {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
let (parts, _) = res.into_parts();
let body = hyper::Body::from(res_body_string.clone());
let restored_response = hyper::Response::from_parts(parts, body);
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
sleep(d).await;
continue;
}
dlg.finished(false);
return match server_response {
Some(error_value) => Err(client::Error::BadRequest(error_value)),
None => Err(client::Error::Failure(restored_response)),
}
}
let result_value = {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
match json::from_str(&res_body_string) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&res_body_string, &err);
return Err(client::Error::JsonDecodeError(res_body_string, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(mut self, new_value: BatchGetAmpUrlsRequest) -> AmpUrlBatchGetCall<'a, S> {
self._request = new_value;
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AmpUrlBatchGetCall<'a, S> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> AmpUrlBatchGetCall<'a, S>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
}

View File

@@ -1,112 +0,0 @@
use super::*;
/// Central instance to access all Acceleratedmobilepageurl related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
/// use acceleratedmobilepageurl1::api::BatchGetAmpUrlsRequest;
/// use acceleratedmobilepageurl1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = BatchGetAmpUrlsRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.amp_urls().batch_get(req)
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct Acceleratedmobilepageurl<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for Acceleratedmobilepageurl<S> {}
impl<'a, S> Acceleratedmobilepageurl<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> Acceleratedmobilepageurl<S> {
Acceleratedmobilepageurl {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://acceleratedmobilepageurl.googleapis.com/".to_string(),
_root_url: "https://acceleratedmobilepageurl.googleapis.com/".to_string(),
}
}
pub fn amp_urls(&'a self) -> AmpUrlMethods<'a, S> {
AmpUrlMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.3`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://acceleratedmobilepageurl.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://acceleratedmobilepageurl.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}

View File

@@ -1,58 +0,0 @@
use super::*;
/// A builder providing access to all methods supported on *ampUrl* resources.
/// It is not used directly, but through the [`Acceleratedmobilepageurl`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `batch_get(...)`
/// // to build up your call.
/// let rb = hub.amp_urls();
/// # }
/// ```
pub struct AmpUrlMethods<'a, S>
where S: 'a {
pub(super) hub: &'a Acceleratedmobilepageurl<S>,
}
impl<'a, S> client::MethodsBuilder for AmpUrlMethods<'a, S> {}
impl<'a, S> AmpUrlMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Returns AMP URL(s) and equivalent [AMP Cache URL(s)](https://developers.google.com/amp/cache/overview#amp-cache-url-format).
///
/// # Arguments
///
/// * `request` - No description provided.
pub fn batch_get(&self, request: BatchGetAmpUrlsRequest) -> AmpUrlBatchGetCall<'a, S> {
AmpUrlBatchGetCall {
hub: self.hub,
_request: request,
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
}

View File

@@ -1,35 +0,0 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;
mod enums;
pub use enums::*;

View File

@@ -1,100 +0,0 @@
use super::*;
/// AMP URL response for a requested URL.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [batch get amp urls](AmpUrlBatchGetCall) (none)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AmpUrl {
/// The AMP URL pointing to the publisher's web server.
#[serde(rename="ampUrl")]
pub amp_url: Option<String>,
/// The [AMP Cache URL](https://developers.google.com/amp/cache/overview#amp-cache-url-format) pointing to the cached document in the Google AMP Cache.
#[serde(rename="cdnAmpUrl")]
pub cdn_amp_url: Option<String>,
/// The original non-AMP URL.
#[serde(rename="originalUrl")]
pub original_url: Option<String>,
}
impl client::Resource for AmpUrl {}
/// AMP URL Error resource for a requested URL that couldn't be found.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AmpUrlError {
/// The error code of an API call.
#[serde(rename="errorCode")]
pub error_code: Option<AmpUrlErrorErrorCodeEnum>,
/// An optional descriptive error message.
#[serde(rename="errorMessage")]
pub error_message: Option<String>,
/// The original non-AMP URL.
#[serde(rename="originalUrl")]
pub original_url: Option<String>,
}
impl client::Part for AmpUrlError {}
/// AMP URL request for a batch of URLs.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [batch get amp urls](AmpUrlBatchGetCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BatchGetAmpUrlsRequest {
/// The lookup_strategy being requested.
#[serde(rename="lookupStrategy")]
pub lookup_strategy: Option<BatchGetAmpUrlsRequestLookupStrategyEnum>,
/// List of URLs to look up for the paired AMP URLs. The URLs are case-sensitive. Up to 50 URLs per lookup (see [Usage Limits](https://developers.google.com/amp/cache/reference/limits)).
pub urls: Option<Vec<String>>,
}
impl client::RequestValue for BatchGetAmpUrlsRequest {}
/// Batch AMP URL response.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [batch get amp urls](AmpUrlBatchGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BatchGetAmpUrlsResponse {
/// For each URL in BatchAmpUrlsRequest, the URL response. The response might not be in the same order as URLs in the batch request. If BatchAmpUrlsRequest contains duplicate URLs, AmpUrl is generated only once.
#[serde(rename="ampUrls")]
pub amp_urls: Option<Vec<AmpUrl>>,
/// The errors for requested URLs that have no AMP URL.
#[serde(rename="urlErrors")]
pub url_errors: Option<Vec<AmpUrlError>>,
}
impl client::ResponseResult for BatchGetAmpUrlsResponse {}

View File

@@ -1,2 +0,0 @@
use super::*;

View File

@@ -1,203 +0,0 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Acceleratedmobilepageurl* crate version *5.0.4+20240303*, where *20240303* is the exact revision of the *acceleratedmobilepageurl:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Acceleratedmobilepageurl* *v1* API can be found at the
//! [official documentation site](https://developers.google.com/amp/cache/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/acceleratedmobilepageurl1).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](Acceleratedmobilepageurl) ...
//!
//! * [amp urls](api::AmpUrl)
//! * [*batch get*](api::AmpUrlBatchGetCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](Acceleratedmobilepageurl)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.amp_urls().batch_get(...).doit().await
//! ```
//!
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
//! The `doit()` method performs the actual communication with the server and returns the respective result.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-acceleratedmobilepageurl1 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
//! use acceleratedmobilepageurl1::api::BatchGetAmpUrlsRequest;
//! use acceleratedmobilepageurl1::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // As the method needs a request, you would usually fill it with the desired information
//! // into the respective structure. Some of the parts shown here might not be applicable !
//! // Values shown here are possibly random and not representative !
//! let mut req = BatchGetAmpUrlsRequest::default();
//!
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.amp_urls().batch_get(req)
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
//! makes the system potentially resilient to all kinds of errors.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), it will return that by default.
//! 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
//! the server to indicate either the set parts of the request or the desired parts in the response.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
//! These will always take a single argument, for which the following statements are true.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
//!
//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// Unused attributes happen thanks to defined, but unused structures
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
// unused imports in fully featured APIs. Same with unused_mut ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::Acceleratedmobilepageurl;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -1,42 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accessapproval1-cli"
version = "5.0.4+20240223"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Approval (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1-cli"
homepage = "https://cloud.google.com/assured-workloads/access-approval/docs"
documentation = "http://byron.github.io/google-apis-rs/google_accessapproval1_cli"
license = "MIT"
keywords = ["accessapproval", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "accessapproval1"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-accessapproval1]
path = "../accessapproval1"
version = "5.0.4+20240223"

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,133 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `accessapproval1` command-line interface *(CLI)* allows to use most features of the *Google Access Approval* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Access Approval* API can be found at the
[official documentation site](https://cloud.google.com/assured-workloads/access-approval/docs).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-accessapproval1-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1-cli).
# Usage
This documentation was generated from the *Access Approval* API at revision *20240223*. The CLI is at version *5.0.4*.
```bash
accessapproval1 [options]
folders
approval-requests-approve <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-dismiss <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-get <name> [-p <v>]... [-o <out>]
approval-requests-invalidate <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-list <parent> [-p <v>]... [-o <out>]
delete-access-approval-settings <name> [-p <v>]... [-o <out>]
get-access-approval-settings <name> [-p <v>]... [-o <out>]
get-service-account <name> [-p <v>]... [-o <out>]
update-access-approval-settings <name> (-r <kv>)... [-p <v>]... [-o <out>]
organizations
approval-requests-approve <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-dismiss <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-get <name> [-p <v>]... [-o <out>]
approval-requests-invalidate <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-list <parent> [-p <v>]... [-o <out>]
delete-access-approval-settings <name> [-p <v>]... [-o <out>]
get-access-approval-settings <name> [-p <v>]... [-o <out>]
get-service-account <name> [-p <v>]... [-o <out>]
update-access-approval-settings <name> (-r <kv>)... [-p <v>]... [-o <out>]
projects
approval-requests-approve <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-dismiss <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-get <name> [-p <v>]... [-o <out>]
approval-requests-invalidate <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-list <parent> [-p <v>]... [-o <out>]
delete-access-approval-settings <name> [-p <v>]... [-o <out>]
get-access-approval-settings <name> [-p <v>]... [-o <out>]
get-service-account <name> [-p <v>]... [-o <out>]
update-access-approval-settings <name> (-r <kv>)... [-p <v>]... [-o <out>]
accessapproval1 --help
Configuration:
[--scope <url>]...
Specify the authentication a method should be executed in. Each scope
requires the user to grant this application permission to use it.
If unset, it defaults to the shortest scope url for a particular method.
--config-dir <folder>
A directory into which we will store our persistent data. Defaults to
a user-writable directory that we will create during the first invocation.
[default: ~/.google-service-cli]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `accessapproval1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/accessapproval1-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/accessapproval1-secret.json`, assuming that the required *accessapproval* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `accessapproval1 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -1,46 +0,0 @@
site_name: Access Approval v5.0.4+20240223
site_url: http://byron.github.io/google-apis-rs/google-accessapproval1-cli
site_description: A complete library to interact with Access Approval (protocol v1)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Folders':
- 'Approval Requests Approve': 'folders_approval-requests-approve.md'
- 'Approval Requests Dismiss': 'folders_approval-requests-dismiss.md'
- 'Approval Requests Get': 'folders_approval-requests-get.md'
- 'Approval Requests Invalidate': 'folders_approval-requests-invalidate.md'
- 'Approval Requests List': 'folders_approval-requests-list.md'
- 'Delete Access Approval Settings': 'folders_delete-access-approval-settings.md'
- 'Get Access Approval Settings': 'folders_get-access-approval-settings.md'
- 'Get Service Account': 'folders_get-service-account.md'
- 'Update Access Approval Settings': 'folders_update-access-approval-settings.md'
- 'Organizations':
- 'Approval Requests Approve': 'organizations_approval-requests-approve.md'
- 'Approval Requests Dismiss': 'organizations_approval-requests-dismiss.md'
- 'Approval Requests Get': 'organizations_approval-requests-get.md'
- 'Approval Requests Invalidate': 'organizations_approval-requests-invalidate.md'
- 'Approval Requests List': 'organizations_approval-requests-list.md'
- 'Delete Access Approval Settings': 'organizations_delete-access-approval-settings.md'
- 'Get Access Approval Settings': 'organizations_get-access-approval-settings.md'
- 'Get Service Account': 'organizations_get-service-account.md'
- 'Update Access Approval Settings': 'organizations_update-access-approval-settings.md'
- 'Projects':
- 'Approval Requests Approve': 'projects_approval-requests-approve.md'
- 'Approval Requests Dismiss': 'projects_approval-requests-dismiss.md'
- 'Approval Requests Get': 'projects_approval-requests-get.md'
- 'Approval Requests Invalidate': 'projects_approval-requests-invalidate.md'
- 'Approval Requests List': 'projects_approval-requests-list.md'
- 'Delete Access Approval Settings': 'projects_delete-access-approval-settings.md'
- 'Get Access Approval Settings': 'projects_get-access-approval-settings.md'
- 'Get Service Account': 'projects_get-service-account.md'
- 'Update Access Approval Settings': 'projects_update-access-approval-settings.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -1,37 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accessapproval1"
version = "5.0.4+20240223"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Approval (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1"
homepage = "https://cloud.google.com/assured-workloads/access-approval/docs"
documentation = "https://docs.rs/google-accessapproval1/5.0.4+20240223"
license = "MIT"
keywords = ["accessapproval", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,198 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-accessapproval1` library allows access to all features of the *Google Access Approval* service.
This documentation was generated from *Access Approval* crate version *5.0.4+20240223*, where *20240223* is the exact revision of the *accessapproval:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Access Approval* *v1* API can be found at the
[official documentation site](https://cloud.google.com/assured-workloads/access-approval/docs).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/AccessApproval) ...
* folders
* [*approval requests approve*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderApprovalRequestApproveCall), [*approval requests dismiss*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderApprovalRequestDismisCall), [*approval requests get*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderApprovalRequestGetCall), [*approval requests invalidate*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderApprovalRequestInvalidateCall), [*approval requests list*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderApprovalRequestListCall), [*delete access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderDeleteAccessApprovalSettingCall), [*get access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderGetAccessApprovalSettingCall), [*get service account*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderGetServiceAccountCall) and [*update access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderUpdateAccessApprovalSettingCall)
* organizations
* [*approval requests approve*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationApprovalRequestApproveCall), [*approval requests dismiss*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationApprovalRequestDismisCall), [*approval requests get*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationApprovalRequestGetCall), [*approval requests invalidate*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationApprovalRequestInvalidateCall), [*approval requests list*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationApprovalRequestListCall), [*delete access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationDeleteAccessApprovalSettingCall), [*get access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationGetAccessApprovalSettingCall), [*get service account*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationGetServiceAccountCall) and [*update access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationUpdateAccessApprovalSettingCall)
* projects
* [*approval requests approve*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectApprovalRequestApproveCall), [*approval requests dismiss*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectApprovalRequestDismisCall), [*approval requests get*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectApprovalRequestGetCall), [*approval requests invalidate*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectApprovalRequestInvalidateCall), [*approval requests list*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectApprovalRequestListCall), [*delete access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectDeleteAccessApprovalSettingCall), [*get access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectGetAccessApprovalSettingCall), [*get service account*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectGetServiceAccountCall) and [*update access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectUpdateAccessApprovalSettingCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/AccessApproval)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::CallBuilder)
* **[Resources](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.folders().approval_requests_approve(...).doit().await
let r = hub.folders().approval_requests_dismiss(...).doit().await
let r = hub.folders().approval_requests_get(...).doit().await
let r = hub.folders().approval_requests_invalidate(...).doit().await
let r = hub.organizations().approval_requests_approve(...).doit().await
let r = hub.organizations().approval_requests_dismiss(...).doit().await
let r = hub.organizations().approval_requests_get(...).doit().await
let r = hub.organizations().approval_requests_invalidate(...).doit().await
let r = hub.projects().approval_requests_approve(...).doit().await
let r = hub.projects().approval_requests_dismiss(...).doit().await
let r = hub.projects().approval_requests_get(...).doit().await
let r = hub.projects().approval_requests_invalidate(...).doit().await
```
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
The `doit()` method performs the actual communication with the server and returns the respective result.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-accessapproval1 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_accessapproval1 as accessapproval1;
use accessapproval1::api::ApproveApprovalRequestMessage;
use accessapproval1::{Result, Error};
use std::default::Default;
use accessapproval1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = ApproveApprovalRequestMessage::default();
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.folders().approval_requests_approve(req, "name")
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
makes the system potentially resilient to all kinds of errors.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::ResponseResult), it will return that by default.
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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Delegate) to the
[Method Builder](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::RequestValue) and
[decodable](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Part) which are identifiable by name, which will be sent to
the server to indicate either the set parts of the request or the desired parts in the response.
## Builder Arguments
Using [method builders](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
These will always take a single argument, for which the following statements are true.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::RequestValue) are moved
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **accessapproval1** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

File diff suppressed because it is too large Load Diff

View File

@@ -1,118 +0,0 @@
use super::*;
/// Central instance to access all AccessApproval related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1 as accessapproval1;
/// use accessapproval1::api::ApproveApprovalRequestMessage;
/// use accessapproval1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = ApproveApprovalRequestMessage::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.folders().approval_requests_approve(req, "name")
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AccessApproval<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AccessApproval<S> {}
impl<'a, S> AccessApproval<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AccessApproval<S> {
AccessApproval {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://accessapproval.googleapis.com/".to_string(),
_root_url: "https://accessapproval.googleapis.com/".to_string(),
}
}
pub fn folders(&'a self) -> FolderMethods<'a, S> {
FolderMethods { hub: &self }
}
pub fn organizations(&'a self) -> OrganizationMethods<'a, S> {
OrganizationMethods { hub: &self }
}
pub fn projects(&'a self) -> ProjectMethods<'a, S> {
ProjectMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.3`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://accessapproval.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://accessapproval.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}

View File

@@ -1,619 +0,0 @@
use super::*;
/// A builder providing access to all methods supported on *folder* resources.
/// It is not used directly, but through the [`AccessApproval`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1 as accessapproval1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `approval_requests_approve(...)`, `approval_requests_dismiss(...)`, `approval_requests_get(...)`, `approval_requests_invalidate(...)`, `approval_requests_list(...)`, `delete_access_approval_settings(...)`, `get_access_approval_settings(...)`, `get_service_account(...)` and `update_access_approval_settings(...)`
/// // to build up your call.
/// let rb = hub.folders();
/// # }
/// ```
pub struct FolderMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessApproval<S>,
}
impl<'a, S> client::MethodsBuilder for FolderMethods<'a, S> {}
impl<'a, S> FolderMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Approves a request and returns the updated ApprovalRequest. Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the approval request to approve.
pub fn approval_requests_approve(&self, request: ApproveApprovalRequestMessage, name: &str) -> FolderApprovalRequestApproveCall<'a, S> {
FolderApprovalRequestApproveCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Dismisses a request. Returns the updated ApprovalRequest. NOTE: This does not deny access to the resource if another request has been made and approved. It is equivalent in effect to ignoring the request altogether. Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to dismiss.
pub fn approval_requests_dismiss(&self, request: DismissApprovalRequestMessage, name: &str) -> FolderApprovalRequestDismisCall<'a, S> {
FolderApprovalRequestDismisCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an approval request. Returns NOT_FOUND if the request does not exist.
///
/// # Arguments
///
/// * `name` - The name of the approval request to retrieve. Format: "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}"
pub fn approval_requests_get(&self, name: &str) -> FolderApprovalRequestGetCall<'a, S> {
FolderApprovalRequestGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Invalidates an existing ApprovalRequest. Returns the updated ApprovalRequest. NOTE: This does not deny access to the resource if another request has been made and approved. It only invalidates a single approval. Returns FAILED_PRECONDITION if the request exists but is not in an approved state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to invalidate.
pub fn approval_requests_invalidate(&self, request: InvalidateApprovalRequestMessage, name: &str) -> FolderApprovalRequestInvalidateCall<'a, S> {
FolderApprovalRequestInvalidateCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.
///
/// # Arguments
///
/// * `parent` - The parent resource. This may be "projects/{project}", "folders/{folder}", or "organizations/{organization}".
pub fn approval_requests_list(&self, parent: &str) -> FolderApprovalRequestListCall<'a, S> {
FolderApprovalRequestListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to delete.
pub fn delete_access_approval_settings(&self, name: &str) -> FolderDeleteAccessApprovalSettingCall<'a, S> {
FolderDeleteAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the settings associated with a project, folder, or organization.
///
/// # Arguments
///
/// * `name` - The name of the AccessApprovalSettings to retrieve. Format: "{projects|folders|organizations}/{id}/accessApprovalSettings"
pub fn get_access_approval_settings(&self, name: &str) -> FolderGetAccessApprovalSettingCall<'a, S> {
FolderGetAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves the service account that is used by Access Approval to access KMS keys for signing approved approval requests.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalServiceAccount to retrieve.
pub fn get_service_account(&self, name: &str) -> FolderGetServiceAccountCall<'a, S> {
FolderGetServiceAccountCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings associated with a project, folder, or organization. Settings to update are determined by the value of field_mask.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The resource name of the settings. Format is one of: * "projects/{project}/accessApprovalSettings" * "folders/{folder}/accessApprovalSettings" * "organizations/{organization}/accessApprovalSettings"
pub fn update_access_approval_settings(&self, request: AccessApprovalSettings, name: &str) -> FolderUpdateAccessApprovalSettingCall<'a, S> {
FolderUpdateAccessApprovalSettingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *organization* resources.
/// It is not used directly, but through the [`AccessApproval`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1 as accessapproval1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `approval_requests_approve(...)`, `approval_requests_dismiss(...)`, `approval_requests_get(...)`, `approval_requests_invalidate(...)`, `approval_requests_list(...)`, `delete_access_approval_settings(...)`, `get_access_approval_settings(...)`, `get_service_account(...)` and `update_access_approval_settings(...)`
/// // to build up your call.
/// let rb = hub.organizations();
/// # }
/// ```
pub struct OrganizationMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessApproval<S>,
}
impl<'a, S> client::MethodsBuilder for OrganizationMethods<'a, S> {}
impl<'a, S> OrganizationMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Approves a request and returns the updated ApprovalRequest. Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the approval request to approve.
pub fn approval_requests_approve(&self, request: ApproveApprovalRequestMessage, name: &str) -> OrganizationApprovalRequestApproveCall<'a, S> {
OrganizationApprovalRequestApproveCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Dismisses a request. Returns the updated ApprovalRequest. NOTE: This does not deny access to the resource if another request has been made and approved. It is equivalent in effect to ignoring the request altogether. Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to dismiss.
pub fn approval_requests_dismiss(&self, request: DismissApprovalRequestMessage, name: &str) -> OrganizationApprovalRequestDismisCall<'a, S> {
OrganizationApprovalRequestDismisCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an approval request. Returns NOT_FOUND if the request does not exist.
///
/// # Arguments
///
/// * `name` - The name of the approval request to retrieve. Format: "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}"
pub fn approval_requests_get(&self, name: &str) -> OrganizationApprovalRequestGetCall<'a, S> {
OrganizationApprovalRequestGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Invalidates an existing ApprovalRequest. Returns the updated ApprovalRequest. NOTE: This does not deny access to the resource if another request has been made and approved. It only invalidates a single approval. Returns FAILED_PRECONDITION if the request exists but is not in an approved state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to invalidate.
pub fn approval_requests_invalidate(&self, request: InvalidateApprovalRequestMessage, name: &str) -> OrganizationApprovalRequestInvalidateCall<'a, S> {
OrganizationApprovalRequestInvalidateCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.
///
/// # Arguments
///
/// * `parent` - The parent resource. This may be "projects/{project}", "folders/{folder}", or "organizations/{organization}".
pub fn approval_requests_list(&self, parent: &str) -> OrganizationApprovalRequestListCall<'a, S> {
OrganizationApprovalRequestListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to delete.
pub fn delete_access_approval_settings(&self, name: &str) -> OrganizationDeleteAccessApprovalSettingCall<'a, S> {
OrganizationDeleteAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the settings associated with a project, folder, or organization.
///
/// # Arguments
///
/// * `name` - The name of the AccessApprovalSettings to retrieve. Format: "{projects|folders|organizations}/{id}/accessApprovalSettings"
pub fn get_access_approval_settings(&self, name: &str) -> OrganizationGetAccessApprovalSettingCall<'a, S> {
OrganizationGetAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves the service account that is used by Access Approval to access KMS keys for signing approved approval requests.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalServiceAccount to retrieve.
pub fn get_service_account(&self, name: &str) -> OrganizationGetServiceAccountCall<'a, S> {
OrganizationGetServiceAccountCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings associated with a project, folder, or organization. Settings to update are determined by the value of field_mask.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The resource name of the settings. Format is one of: * "projects/{project}/accessApprovalSettings" * "folders/{folder}/accessApprovalSettings" * "organizations/{organization}/accessApprovalSettings"
pub fn update_access_approval_settings(&self, request: AccessApprovalSettings, name: &str) -> OrganizationUpdateAccessApprovalSettingCall<'a, S> {
OrganizationUpdateAccessApprovalSettingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *project* resources.
/// It is not used directly, but through the [`AccessApproval`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1 as accessapproval1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `approval_requests_approve(...)`, `approval_requests_dismiss(...)`, `approval_requests_get(...)`, `approval_requests_invalidate(...)`, `approval_requests_list(...)`, `delete_access_approval_settings(...)`, `get_access_approval_settings(...)`, `get_service_account(...)` and `update_access_approval_settings(...)`
/// // to build up your call.
/// let rb = hub.projects();
/// # }
/// ```
pub struct ProjectMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessApproval<S>,
}
impl<'a, S> client::MethodsBuilder for ProjectMethods<'a, S> {}
impl<'a, S> ProjectMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Approves a request and returns the updated ApprovalRequest. Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the approval request to approve.
pub fn approval_requests_approve(&self, request: ApproveApprovalRequestMessage, name: &str) -> ProjectApprovalRequestApproveCall<'a, S> {
ProjectApprovalRequestApproveCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Dismisses a request. Returns the updated ApprovalRequest. NOTE: This does not deny access to the resource if another request has been made and approved. It is equivalent in effect to ignoring the request altogether. Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to dismiss.
pub fn approval_requests_dismiss(&self, request: DismissApprovalRequestMessage, name: &str) -> ProjectApprovalRequestDismisCall<'a, S> {
ProjectApprovalRequestDismisCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an approval request. Returns NOT_FOUND if the request does not exist.
///
/// # Arguments
///
/// * `name` - The name of the approval request to retrieve. Format: "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}"
pub fn approval_requests_get(&self, name: &str) -> ProjectApprovalRequestGetCall<'a, S> {
ProjectApprovalRequestGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Invalidates an existing ApprovalRequest. Returns the updated ApprovalRequest. NOTE: This does not deny access to the resource if another request has been made and approved. It only invalidates a single approval. Returns FAILED_PRECONDITION if the request exists but is not in an approved state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to invalidate.
pub fn approval_requests_invalidate(&self, request: InvalidateApprovalRequestMessage, name: &str) -> ProjectApprovalRequestInvalidateCall<'a, S> {
ProjectApprovalRequestInvalidateCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.
///
/// # Arguments
///
/// * `parent` - The parent resource. This may be "projects/{project}", "folders/{folder}", or "organizations/{organization}".
pub fn approval_requests_list(&self, parent: &str) -> ProjectApprovalRequestListCall<'a, S> {
ProjectApprovalRequestListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to delete.
pub fn delete_access_approval_settings(&self, name: &str) -> ProjectDeleteAccessApprovalSettingCall<'a, S> {
ProjectDeleteAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the settings associated with a project, folder, or organization.
///
/// # Arguments
///
/// * `name` - The name of the AccessApprovalSettings to retrieve. Format: "{projects|folders|organizations}/{id}/accessApprovalSettings"
pub fn get_access_approval_settings(&self, name: &str) -> ProjectGetAccessApprovalSettingCall<'a, S> {
ProjectGetAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves the service account that is used by Access Approval to access KMS keys for signing approved approval requests.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalServiceAccount to retrieve.
pub fn get_service_account(&self, name: &str) -> ProjectGetServiceAccountCall<'a, S> {
ProjectGetServiceAccountCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings associated with a project, folder, or organization. Settings to update are determined by the value of field_mask.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The resource name of the settings. Format is one of: * "projects/{project}/accessApprovalSettings" * "folders/{folder}/accessApprovalSettings" * "organizations/{organization}/accessApprovalSettings"
pub fn update_access_approval_settings(&self, request: AccessApprovalSettings, name: &str) -> ProjectUpdateAccessApprovalSettingCall<'a, S> {
ProjectUpdateAccessApprovalSettingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -1,35 +0,0 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;
mod enums;
pub use enums::*;

View File

@@ -1,384 +0,0 @@
use super::*;
/// Access Approval service account related to a project/folder/organization.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [get service account folders](FolderGetServiceAccountCall) (response)
/// * [get service account organizations](OrganizationGetServiceAccountCall) (response)
/// * [get service account projects](ProjectGetServiceAccountCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessApprovalServiceAccount {
/// Email address of the service account.
#[serde(rename="accountEmail")]
pub account_email: Option<String>,
/// The resource name of the Access Approval service account. Format is one of: * "projects/{project}/serviceAccount" * "folders/{folder}/serviceAccount" * "organizations/{organization}/serviceAccount"
pub name: Option<String>,
}
impl client::ResponseResult for AccessApprovalServiceAccount {}
/// Settings on a Project/Folder/Organization related to Access Approval.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [get access approval settings folders](FolderGetAccessApprovalSettingCall) (response)
/// * [update access approval settings folders](FolderUpdateAccessApprovalSettingCall) (request|response)
/// * [get access approval settings organizations](OrganizationGetAccessApprovalSettingCall) (response)
/// * [update access approval settings organizations](OrganizationUpdateAccessApprovalSettingCall) (request|response)
/// * [get access approval settings projects](ProjectGetAccessApprovalSettingCall) (response)
/// * [update access approval settings projects](ProjectUpdateAccessApprovalSettingCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessApprovalSettings {
/// The asymmetric crypto key version to use for signing approval requests. Empty active_key_version indicates that a Google-managed key should be used for signing. This property will be ignored if set by an ancestor of this resource, and new non-empty values may not be set.
#[serde(rename="activeKeyVersion")]
pub active_key_version: Option<String>,
/// Output only. This field is read only (not settable via UpdateAccessApprovalSettings method). If the field is true, that indicates that an ancestor of this Project or Folder has set active_key_version (this field will always be unset for the organization since organizations do not have ancestors).
#[serde(rename="ancestorHasActiveKeyVersion")]
pub ancestor_has_active_key_version: Option<bool>,
/// Output only. This field is read only (not settable via UpdateAccessApprovalSettings method). If the field is true, that indicates that at least one service is enrolled for Access Approval in one or more ancestors of the Project or Folder (this field will always be unset for the organization since organizations do not have ancestors).
#[serde(rename="enrolledAncestor")]
pub enrolled_ancestor: Option<bool>,
/// A list of Google Cloud Services for which the given resource has Access Approval enrolled. Access requests for the resource given by name against any of these services contained here will be required to have explicit approval. If name refers to an organization, enrollment can be done for individual services. If name refers to a folder or project, enrollment can only be done on an all or nothing basis. If a cloud_product is repeated in this list, the first entry will be honored and all following entries will be discarded. A maximum of 10 enrolled services will be enforced, to be expanded as the set of supported services is expanded.
#[serde(rename="enrolledServices")]
pub enrolled_services: Option<Vec<EnrolledService>>,
/// Output only. This field is read only (not settable via UpdateAccessApprovalSettings method). If the field is true, that indicates that there is some configuration issue with the active_key_version configured at this level in the resource hierarchy (e.g. it doesn't exist or the Access Approval service account doesn't have the correct permissions on it, etc.) This key version is not necessarily the effective key version at this level, as key versions are inherited top-down.
#[serde(rename="invalidKeyVersion")]
pub invalid_key_version: Option<bool>,
/// The resource name of the settings. Format is one of: * "projects/{project}/accessApprovalSettings" * "folders/{folder}/accessApprovalSettings" * "organizations/{organization}/accessApprovalSettings"
pub name: Option<String>,
/// A list of email addresses to which notifications relating to approval requests should be sent. Notifications relating to a resource will be sent to all emails in the settings of ancestor resources of that resource. A maximum of 50 email addresses are allowed.
#[serde(rename="notificationEmails")]
pub notification_emails: Option<Vec<String>>,
}
impl client::RequestValue for AccessApprovalSettings {}
impl client::ResponseResult for AccessApprovalSettings {}
/// Home office and physical location of the principal.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessLocations {
/// The "home office" location of the principal. A two-letter country code (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or a region code. In some limited situations Google systems may refer refer to a region code instead of a country code. Possible Region Codes: * ASI: Asia * EUR: Europe * OCE: Oceania * AFR: Africa * NAM: North America * SAM: South America * ANT: Antarctica * ANY: Any location
#[serde(rename="principalOfficeCountry")]
pub principal_office_country: Option<String>,
/// Physical location of the principal at the time of the access. A two-letter country code (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or a region code. In some limited situations Google systems may refer refer to a region code instead of a country code. Possible Region Codes: * ASI: Asia * EUR: Europe * OCE: Oceania * AFR: Africa * NAM: North America * SAM: South America * ANT: Antarctica * ANY: Any location
#[serde(rename="principalPhysicalLocationCountry")]
pub principal_physical_location_country: Option<String>,
}
impl client::Part for AccessLocations {}
/// There is no detailed description.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessReason {
/// More detail about certain reason types. See comments for each type above.
pub detail: Option<String>,
/// Type of access justification.
#[serde(rename="type")]
pub type_: Option<AccessReasonTypeEnum>,
}
impl client::Part for AccessReason {}
/// A request for the customer to approve access to a resource.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [approval requests approve folders](FolderApprovalRequestApproveCall) (response)
/// * [approval requests dismiss folders](FolderApprovalRequestDismisCall) (response)
/// * [approval requests get folders](FolderApprovalRequestGetCall) (response)
/// * [approval requests invalidate folders](FolderApprovalRequestInvalidateCall) (response)
/// * [approval requests approve organizations](OrganizationApprovalRequestApproveCall) (response)
/// * [approval requests dismiss organizations](OrganizationApprovalRequestDismisCall) (response)
/// * [approval requests get organizations](OrganizationApprovalRequestGetCall) (response)
/// * [approval requests invalidate organizations](OrganizationApprovalRequestInvalidateCall) (response)
/// * [approval requests approve projects](ProjectApprovalRequestApproveCall) (response)
/// * [approval requests dismiss projects](ProjectApprovalRequestDismisCall) (response)
/// * [approval requests get projects](ProjectApprovalRequestGetCall) (response)
/// * [approval requests invalidate projects](ProjectApprovalRequestInvalidateCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ApprovalRequest {
/// Access was approved.
pub approve: Option<ApproveDecision>,
/// The request was dismissed.
pub dismiss: Option<DismissDecision>,
/// The resource name of the request. Format is "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}".
pub name: Option<String>,
/// The time at which approval was requested.
#[serde(rename="requestTime")]
pub request_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The requested expiration for the approval. If the request is approved, access will be granted from the time of approval until the expiration time.
#[serde(rename="requestedExpiration")]
pub requested_expiration: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The locations for which approval is being requested.
#[serde(rename="requestedLocations")]
pub requested_locations: Option<AccessLocations>,
/// The justification for which approval is being requested.
#[serde(rename="requestedReason")]
pub requested_reason: Option<AccessReason>,
/// The resource for which approval is being requested. The format of the resource name is defined at https://cloud.google.com/apis/design/resource_names. The resource name here may either be a "full" resource name (e.g. "//library.googleapis.com/shelves/shelf1/books/book2") or a "relative" resource name (e.g. "shelves/shelf1/books/book2") as described in the resource name specification.
#[serde(rename="requestedResourceName")]
pub requested_resource_name: Option<String>,
/// Properties related to the resource represented by requested_resource_name.
#[serde(rename="requestedResourceProperties")]
pub requested_resource_properties: Option<ResourceProperties>,
}
impl client::ResponseResult for ApprovalRequest {}
/// Request to approve an ApprovalRequest.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [approval requests approve folders](FolderApprovalRequestApproveCall) (request)
/// * [approval requests approve organizations](OrganizationApprovalRequestApproveCall) (request)
/// * [approval requests approve projects](ProjectApprovalRequestApproveCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ApproveApprovalRequestMessage {
/// The expiration time of this approval.
#[serde(rename="expireTime")]
pub expire_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
}
impl client::RequestValue for ApproveApprovalRequestMessage {}
/// A decision that has been made to approve access to a resource.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ApproveDecision {
/// The time at which approval was granted.
#[serde(rename="approveTime")]
pub approve_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// True when the request has been auto-approved.
#[serde(rename="autoApproved")]
pub auto_approved: Option<bool>,
/// The time at which the approval expires.
#[serde(rename="expireTime")]
pub expire_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// If set, denotes the timestamp at which the approval is invalidated.
#[serde(rename="invalidateTime")]
pub invalidate_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The signature for the ApprovalRequest and details on how it was signed.
#[serde(rename="signatureInfo")]
pub signature_info: Option<SignatureInfo>,
}
impl client::Part for ApproveDecision {}
/// Request to dismiss an approval request.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [approval requests dismiss folders](FolderApprovalRequestDismisCall) (request)
/// * [approval requests dismiss organizations](OrganizationApprovalRequestDismisCall) (request)
/// * [approval requests dismiss projects](ProjectApprovalRequestDismisCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DismissApprovalRequestMessage { _never_set: Option<bool> }
impl client::RequestValue for DismissApprovalRequestMessage {}
/// A decision that has been made to dismiss an approval request.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DismissDecision {
/// The time at which the approval request was dismissed.
#[serde(rename="dismissTime")]
pub dismiss_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// This field will be true if the ApprovalRequest was implicitly dismissed due to inaction by the access approval approvers (the request is not acted on by the approvers before the exiration time).
pub implicit: Option<bool>,
}
impl client::Part for DismissDecision {}
/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [delete access approval settings folders](FolderDeleteAccessApprovalSettingCall) (response)
/// * [delete access approval settings organizations](OrganizationDeleteAccessApprovalSettingCall) (response)
/// * [delete access approval settings projects](ProjectDeleteAccessApprovalSettingCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Empty { _never_set: Option<bool> }
impl client::ResponseResult for Empty {}
/// Represents the enrollment of a cloud resource into a specific service.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct EnrolledService {
/// The product for which Access Approval will be enrolled. Allowed values are listed below (case-sensitive): * all * GA * App Engine . * Artifact Registry * BigQuery * Cloud Bigtable * Cloud Key Management Service * Compute Engine * Cloud Dataflow * Cloud Dataproc * Cloud DLP * Cloud EKM * Cloud HSM * Cloud Identity and Access Management * Cloud Logging * Cloud Pub/Sub * Cloud Spanner * Cloud SQL * Cloud Storage * Google Kubernetes Engine * Organization Policy Serivice * Persistent Disk * Resource Manager * Secret Manager * Speaker ID Note: These values are supported as input for legacy purposes, but will not be returned from the API. * all * ga-only * appengine.googleapis.com * artifactregistry.googleapis.com * bigquery.googleapis.com * bigtable.googleapis.com * container.googleapis.com * cloudkms.googleapis.com * cloudresourcemanager.googleapis.com * cloudsql.googleapis.com * compute.googleapis.com * dataflow.googleapis.com * dataproc.googleapis.com * dlp.googleapis.com * iam.googleapis.com * logging.googleapis.com * orgpolicy.googleapis.com * pubsub.googleapis.com * spanner.googleapis.com * secretmanager.googleapis.com * speakerid.googleapis.com * storage.googleapis.com Calls to UpdateAccessApprovalSettings using 'all' or any of the XXX.googleapis.com will be translated to the associated product name ('all', 'App Engine', etc.). Note: 'all' will enroll the resource in all products supported at both 'GA' and 'Preview' levels. More information about levels of support is available at https://cloud.google.com/access-approval/docs/supported-services
#[serde(rename="cloudProduct")]
pub cloud_product: Option<String>,
/// The enrollment level of the service.
#[serde(rename="enrollmentLevel")]
pub enrollment_level: Option<EnrolledServiceEnrollmentLevelEnum>,
}
impl client::Part for EnrolledService {}
/// Request to invalidate an existing approval.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [approval requests invalidate folders](FolderApprovalRequestInvalidateCall) (request)
/// * [approval requests invalidate organizations](OrganizationApprovalRequestInvalidateCall) (request)
/// * [approval requests invalidate projects](ProjectApprovalRequestInvalidateCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct InvalidateApprovalRequestMessage { _never_set: Option<bool> }
impl client::RequestValue for InvalidateApprovalRequestMessage {}
/// Response to listing of ApprovalRequest objects.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [approval requests list folders](FolderApprovalRequestListCall) (response)
/// * [approval requests list organizations](OrganizationApprovalRequestListCall) (response)
/// * [approval requests list projects](ProjectApprovalRequestListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListApprovalRequestsResponse {
/// Approval request details.
#[serde(rename="approvalRequests")]
pub approval_requests: Option<Vec<ApprovalRequest>>,
/// Token to retrieve the next page of results, or empty if there are no more.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListApprovalRequestsResponse {}
/// The properties associated with the resource of the request.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ResourceProperties {
/// Whether an approval will exclude the descendants of the resource being requested.
#[serde(rename="excludesDescendants")]
pub excludes_descendants: Option<bool>,
}
impl client::Part for ResourceProperties {}
/// Information about the digital signature of the resource.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct SignatureInfo {
/// The resource name of the customer CryptoKeyVersion used for signing.
#[serde(rename="customerKmsKeyVersion")]
pub customer_kms_key_version: Option<String>,
/// The public key for the Google default signing, encoded in PEM format. The signature was created using a private key which may be verified using this public key.
#[serde(rename="googlePublicKeyPem")]
pub google_public_key_pem: Option<String>,
/// The digital signature.
#[serde_as(as = "Option<::client::serde::urlsafe_base64::Wrapper>")]
pub signature: Option<Vec<u8>>,
}
impl client::Part for SignatureInfo {}

View File

@@ -1,24 +0,0 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
CloudPlatform,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::CloudPlatform
}
}

View File

@@ -1,218 +0,0 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Access Approval* crate version *5.0.4+20240223*, where *20240223* is the exact revision of the *accessapproval:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Access Approval* *v1* API can be found at the
//! [official documentation site](https://cloud.google.com/assured-workloads/access-approval/docs).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AccessApproval) ...
//!
//! * folders
//! * [*approval requests approve*](api::FolderApprovalRequestApproveCall), [*approval requests dismiss*](api::FolderApprovalRequestDismisCall), [*approval requests get*](api::FolderApprovalRequestGetCall), [*approval requests invalidate*](api::FolderApprovalRequestInvalidateCall), [*approval requests list*](api::FolderApprovalRequestListCall), [*delete access approval settings*](api::FolderDeleteAccessApprovalSettingCall), [*get access approval settings*](api::FolderGetAccessApprovalSettingCall), [*get service account*](api::FolderGetServiceAccountCall) and [*update access approval settings*](api::FolderUpdateAccessApprovalSettingCall)
//! * organizations
//! * [*approval requests approve*](api::OrganizationApprovalRequestApproveCall), [*approval requests dismiss*](api::OrganizationApprovalRequestDismisCall), [*approval requests get*](api::OrganizationApprovalRequestGetCall), [*approval requests invalidate*](api::OrganizationApprovalRequestInvalidateCall), [*approval requests list*](api::OrganizationApprovalRequestListCall), [*delete access approval settings*](api::OrganizationDeleteAccessApprovalSettingCall), [*get access approval settings*](api::OrganizationGetAccessApprovalSettingCall), [*get service account*](api::OrganizationGetServiceAccountCall) and [*update access approval settings*](api::OrganizationUpdateAccessApprovalSettingCall)
//! * projects
//! * [*approval requests approve*](api::ProjectApprovalRequestApproveCall), [*approval requests dismiss*](api::ProjectApprovalRequestDismisCall), [*approval requests get*](api::ProjectApprovalRequestGetCall), [*approval requests invalidate*](api::ProjectApprovalRequestInvalidateCall), [*approval requests list*](api::ProjectApprovalRequestListCall), [*delete access approval settings*](api::ProjectDeleteAccessApprovalSettingCall), [*get access approval settings*](api::ProjectGetAccessApprovalSettingCall), [*get service account*](api::ProjectGetServiceAccountCall) and [*update access approval settings*](api::ProjectUpdateAccessApprovalSettingCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AccessApproval)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.folders().approval_requests_approve(...).doit().await
//! let r = hub.folders().approval_requests_dismiss(...).doit().await
//! let r = hub.folders().approval_requests_get(...).doit().await
//! let r = hub.folders().approval_requests_invalidate(...).doit().await
//! let r = hub.organizations().approval_requests_approve(...).doit().await
//! let r = hub.organizations().approval_requests_dismiss(...).doit().await
//! let r = hub.organizations().approval_requests_get(...).doit().await
//! let r = hub.organizations().approval_requests_invalidate(...).doit().await
//! let r = hub.projects().approval_requests_approve(...).doit().await
//! let r = hub.projects().approval_requests_dismiss(...).doit().await
//! let r = hub.projects().approval_requests_get(...).doit().await
//! let r = hub.projects().approval_requests_invalidate(...).doit().await
//! ```
//!
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
//! The `doit()` method performs the actual communication with the server and returns the respective result.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-accessapproval1 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_accessapproval1 as accessapproval1;
//! use accessapproval1::api::ApproveApprovalRequestMessage;
//! use accessapproval1::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use accessapproval1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // As the method needs a request, you would usually fill it with the desired information
//! // into the respective structure. Some of the parts shown here might not be applicable !
//! // Values shown here are possibly random and not representative !
//! let mut req = ApproveApprovalRequestMessage::default();
//!
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.folders().approval_requests_approve(req, "name")
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
//! makes the system potentially resilient to all kinds of errors.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), it will return that by default.
//! 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
//! the server to indicate either the set parts of the request or the desired parts in the response.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
//! These will always take a single argument, for which the following statements are true.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
//!
//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// Unused attributes happen thanks to defined, but unused structures
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
// unused imports in fully featured APIs. Same with unused_mut ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AccessApproval;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -1,42 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accessapproval1_beta1-cli"
version = "5.0.4+20200708"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Approval (protocol v1beta1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1_beta1-cli"
homepage = "https://cloud.google.com/access-approval/docs"
documentation = "http://byron.github.io/google-apis-rs/google_accessapproval1_beta1_cli"
license = "MIT"
keywords = ["accessapproval", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "accessapproval1-beta1"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-accessapproval1_beta1]
path = "../accessapproval1_beta1"
version = "5.0.4+20200708"

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,127 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `accessapproval1-beta1` command-line interface *(CLI)* allows to use most features of the *Google Access Approval* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Access Approval* API can be found at the
[official documentation site](https://cloud.google.com/access-approval/docs).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-accessapproval1_beta1-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1_beta1-cli).
# Usage
This documentation was generated from the *Access Approval* API at revision *20200708*. The CLI is at version *5.0.4*.
```bash
accessapproval1-beta1 [options]
folders
approval-requests-approve <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-dismiss <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-get <name> [-p <v>]... [-o <out>]
approval-requests-list <parent> [-p <v>]... [-o <out>]
delete-access-approval-settings <name> [-p <v>]... [-o <out>]
get-access-approval-settings <name> [-p <v>]... [-o <out>]
update-access-approval-settings <name> (-r <kv>)... [-p <v>]... [-o <out>]
organizations
approval-requests-approve <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-dismiss <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-get <name> [-p <v>]... [-o <out>]
approval-requests-list <parent> [-p <v>]... [-o <out>]
delete-access-approval-settings <name> [-p <v>]... [-o <out>]
get-access-approval-settings <name> [-p <v>]... [-o <out>]
update-access-approval-settings <name> (-r <kv>)... [-p <v>]... [-o <out>]
projects
approval-requests-approve <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-dismiss <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-get <name> [-p <v>]... [-o <out>]
approval-requests-list <parent> [-p <v>]... [-o <out>]
delete-access-approval-settings <name> [-p <v>]... [-o <out>]
get-access-approval-settings <name> [-p <v>]... [-o <out>]
update-access-approval-settings <name> (-r <kv>)... [-p <v>]... [-o <out>]
accessapproval1-beta1 --help
Configuration:
[--scope <url>]...
Specify the authentication a method should be executed in. Each scope
requires the user to grant this application permission to use it.
If unset, it defaults to the shortest scope url for a particular method.
--config-dir <folder>
A directory into which we will store our persistent data. Defaults to
a user-writable directory that we will create during the first invocation.
[default: ~/.google-service-cli]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `accessapproval1-beta1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/accessapproval1-beta1-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/accessapproval1-beta1-secret.json`, assuming that the required *accessapproval* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `accessapproval1-beta1 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -1,40 +0,0 @@
site_name: Access Approval v5.0.4+20200708
site_url: http://byron.github.io/google-apis-rs/google-accessapproval1_beta1-cli
site_description: A complete library to interact with Access Approval (protocol v1beta1)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1_beta1-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Folders':
- 'Approval Requests Approve': 'folders_approval-requests-approve.md'
- 'Approval Requests Dismiss': 'folders_approval-requests-dismiss.md'
- 'Approval Requests Get': 'folders_approval-requests-get.md'
- 'Approval Requests List': 'folders_approval-requests-list.md'
- 'Delete Access Approval Settings': 'folders_delete-access-approval-settings.md'
- 'Get Access Approval Settings': 'folders_get-access-approval-settings.md'
- 'Update Access Approval Settings': 'folders_update-access-approval-settings.md'
- 'Organizations':
- 'Approval Requests Approve': 'organizations_approval-requests-approve.md'
- 'Approval Requests Dismiss': 'organizations_approval-requests-dismiss.md'
- 'Approval Requests Get': 'organizations_approval-requests-get.md'
- 'Approval Requests List': 'organizations_approval-requests-list.md'
- 'Delete Access Approval Settings': 'organizations_delete-access-approval-settings.md'
- 'Get Access Approval Settings': 'organizations_get-access-approval-settings.md'
- 'Update Access Approval Settings': 'organizations_update-access-approval-settings.md'
- 'Projects':
- 'Approval Requests Approve': 'projects_approval-requests-approve.md'
- 'Approval Requests Dismiss': 'projects_approval-requests-dismiss.md'
- 'Approval Requests Get': 'projects_approval-requests-get.md'
- 'Approval Requests List': 'projects_approval-requests-list.md'
- 'Delete Access Approval Settings': 'projects_delete-access-approval-settings.md'
- 'Get Access Approval Settings': 'projects_get-access-approval-settings.md'
- 'Update Access Approval Settings': 'projects_update-access-approval-settings.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -1,37 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accessapproval1_beta1"
version = "5.0.4+20200708"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Approval (protocol v1beta1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1_beta1"
homepage = "https://cloud.google.com/access-approval/docs"
documentation = "https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708"
license = "MIT"
keywords = ["accessapproval", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,195 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-accessapproval1_beta1` library allows access to all features of the *Google Access Approval* service.
This documentation was generated from *Access Approval* crate version *5.0.4+20200708*, where *20200708* is the exact revision of the *accessapproval:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Access Approval* *v1_beta1* API can be found at the
[official documentation site](https://cloud.google.com/access-approval/docs).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/AccessApproval) ...
* folders
* [*approval requests approve*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderApprovalRequestApproveCall), [*approval requests dismiss*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderApprovalRequestDismisCall), [*approval requests get*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderApprovalRequestGetCall), [*approval requests list*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderApprovalRequestListCall), [*delete access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderDeleteAccessApprovalSettingCall), [*get access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderGetAccessApprovalSettingCall) and [*update access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderUpdateAccessApprovalSettingCall)
* organizations
* [*approval requests approve*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationApprovalRequestApproveCall), [*approval requests dismiss*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationApprovalRequestDismisCall), [*approval requests get*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationApprovalRequestGetCall), [*approval requests list*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationApprovalRequestListCall), [*delete access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationDeleteAccessApprovalSettingCall), [*get access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationGetAccessApprovalSettingCall) and [*update access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationUpdateAccessApprovalSettingCall)
* projects
* [*approval requests approve*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectApprovalRequestApproveCall), [*approval requests dismiss*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectApprovalRequestDismisCall), [*approval requests get*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectApprovalRequestGetCall), [*approval requests list*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectApprovalRequestListCall), [*delete access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectDeleteAccessApprovalSettingCall), [*get access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectGetAccessApprovalSettingCall) and [*update access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectUpdateAccessApprovalSettingCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/AccessApproval)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::CallBuilder)
* **[Resources](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.folders().approval_requests_approve(...).doit().await
let r = hub.folders().approval_requests_dismiss(...).doit().await
let r = hub.folders().approval_requests_get(...).doit().await
let r = hub.organizations().approval_requests_approve(...).doit().await
let r = hub.organizations().approval_requests_dismiss(...).doit().await
let r = hub.organizations().approval_requests_get(...).doit().await
let r = hub.projects().approval_requests_approve(...).doit().await
let r = hub.projects().approval_requests_dismiss(...).doit().await
let r = hub.projects().approval_requests_get(...).doit().await
```
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
The `doit()` method performs the actual communication with the server and returns the respective result.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-accessapproval1_beta1 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_accessapproval1_beta1 as accessapproval1_beta1;
use accessapproval1_beta1::api::ApproveApprovalRequestMessage;
use accessapproval1_beta1::{Result, Error};
use std::default::Default;
use accessapproval1_beta1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = ApproveApprovalRequestMessage::default();
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.folders().approval_requests_approve(req, "name")
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
makes the system potentially resilient to all kinds of errors.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::ResponseResult), it will return that by default.
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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Delegate) to the
[Method Builder](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::RequestValue) and
[decodable](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Part) which are identifiable by name, which will be sent to
the server to indicate either the set parts of the request or the desired parts in the response.
## Builder Arguments
Using [method builders](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
These will always take a single argument, for which the following statements are true.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::RequestValue) are moved
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **accessapproval1_beta1** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

File diff suppressed because it is too large Load Diff

View File

@@ -1,118 +0,0 @@
use super::*;
/// Central instance to access all AccessApproval related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1_beta1 as accessapproval1_beta1;
/// use accessapproval1_beta1::api::ApproveApprovalRequestMessage;
/// use accessapproval1_beta1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1_beta1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = ApproveApprovalRequestMessage::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.folders().approval_requests_approve(req, "name")
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AccessApproval<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AccessApproval<S> {}
impl<'a, S> AccessApproval<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AccessApproval<S> {
AccessApproval {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://accessapproval.googleapis.com/".to_string(),
_root_url: "https://accessapproval.googleapis.com/".to_string(),
}
}
pub fn folders(&'a self) -> FolderMethods<'a, S> {
FolderMethods { hub: &self }
}
pub fn organizations(&'a self) -> OrganizationMethods<'a, S> {
OrganizationMethods { hub: &self }
}
pub fn projects(&'a self) -> ProjectMethods<'a, S> {
ProjectMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.3`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://accessapproval.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://accessapproval.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}

View File

@@ -1,589 +0,0 @@
use super::*;
/// A builder providing access to all methods supported on *folder* resources.
/// It is not used directly, but through the [`AccessApproval`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1_beta1 as accessapproval1_beta1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1_beta1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `approval_requests_approve(...)`, `approval_requests_dismiss(...)`, `approval_requests_get(...)`, `approval_requests_list(...)`, `delete_access_approval_settings(...)`, `get_access_approval_settings(...)` and `update_access_approval_settings(...)`
/// // to build up your call.
/// let rb = hub.folders();
/// # }
/// ```
pub struct FolderMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessApproval<S>,
}
impl<'a, S> client::MethodsBuilder for FolderMethods<'a, S> {}
impl<'a, S> FolderMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Approves a request and returns the updated ApprovalRequest.
///
/// Returns NOT_FOUND if the request does not exist. Returns
/// FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the approval request to approve.
pub fn approval_requests_approve(&self, request: ApproveApprovalRequestMessage, name: &str) -> FolderApprovalRequestApproveCall<'a, S> {
FolderApprovalRequestApproveCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Dismisses a request. Returns the updated ApprovalRequest.
///
/// NOTE: This does not deny access to the resource if another request has been
/// made and approved. It is equivalent in effect to ignoring the request
/// altogether.
///
/// Returns NOT_FOUND if the request does not exist.
///
/// Returns FAILED_PRECONDITION if the request exists but is not in a pending
/// state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to dismiss.
pub fn approval_requests_dismiss(&self, request: DismissApprovalRequestMessage, name: &str) -> FolderApprovalRequestDismisCall<'a, S> {
FolderApprovalRequestDismisCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an approval request. Returns NOT_FOUND if the request does not exist.
///
/// # Arguments
///
/// * `name` - Name of the approval request to retrieve.
pub fn approval_requests_get(&self, name: &str) -> FolderApprovalRequestGetCall<'a, S> {
FolderApprovalRequestGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists approval requests associated with a project, folder, or organization.
/// Approval requests can be filtered by state (pending, active, dismissed).
/// The order is reverse chronological.
///
/// # Arguments
///
/// * `parent` - The parent resource. This may be "projects/{project_id}",
/// "folders/{folder_id}", or "organizations/{organization_id}".
pub fn approval_requests_list(&self, parent: &str) -> FolderApprovalRequestListCall<'a, S> {
FolderApprovalRequestListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes the settings associated with a project, folder, or organization.
/// This will have the effect of disabling Access Approval for the project,
/// folder, or organization, but only if all ancestors also have Access
/// Approval disabled. If Access Approval is enabled at a higher level of the
/// hierarchy, then Access Approval will still be enabled at this level as
/// the settings are inherited.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to delete.
pub fn delete_access_approval_settings(&self, name: &str) -> FolderDeleteAccessApprovalSettingCall<'a, S> {
FolderDeleteAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the settings associated with a project, folder, or organization.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to retrieve.
pub fn get_access_approval_settings(&self, name: &str) -> FolderGetAccessApprovalSettingCall<'a, S> {
FolderGetAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings associated with a project, folder, or organization.
/// Settings to update are determined by the value of field_mask.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The resource name of the settings. Format is one of:
/// <ol>
/// <li>"projects/{project_id}/accessApprovalSettings"</li>
/// <li>"folders/{folder_id}/accessApprovalSettings"</li>
/// <li>"organizations/{organization_id}/accessApprovalSettings"</li>
/// <ol>
pub fn update_access_approval_settings(&self, request: AccessApprovalSettings, name: &str) -> FolderUpdateAccessApprovalSettingCall<'a, S> {
FolderUpdateAccessApprovalSettingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *organization* resources.
/// It is not used directly, but through the [`AccessApproval`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1_beta1 as accessapproval1_beta1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1_beta1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `approval_requests_approve(...)`, `approval_requests_dismiss(...)`, `approval_requests_get(...)`, `approval_requests_list(...)`, `delete_access_approval_settings(...)`, `get_access_approval_settings(...)` and `update_access_approval_settings(...)`
/// // to build up your call.
/// let rb = hub.organizations();
/// # }
/// ```
pub struct OrganizationMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessApproval<S>,
}
impl<'a, S> client::MethodsBuilder for OrganizationMethods<'a, S> {}
impl<'a, S> OrganizationMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Approves a request and returns the updated ApprovalRequest.
///
/// Returns NOT_FOUND if the request does not exist. Returns
/// FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the approval request to approve.
pub fn approval_requests_approve(&self, request: ApproveApprovalRequestMessage, name: &str) -> OrganizationApprovalRequestApproveCall<'a, S> {
OrganizationApprovalRequestApproveCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Dismisses a request. Returns the updated ApprovalRequest.
///
/// NOTE: This does not deny access to the resource if another request has been
/// made and approved. It is equivalent in effect to ignoring the request
/// altogether.
///
/// Returns NOT_FOUND if the request does not exist.
///
/// Returns FAILED_PRECONDITION if the request exists but is not in a pending
/// state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to dismiss.
pub fn approval_requests_dismiss(&self, request: DismissApprovalRequestMessage, name: &str) -> OrganizationApprovalRequestDismisCall<'a, S> {
OrganizationApprovalRequestDismisCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an approval request. Returns NOT_FOUND if the request does not exist.
///
/// # Arguments
///
/// * `name` - Name of the approval request to retrieve.
pub fn approval_requests_get(&self, name: &str) -> OrganizationApprovalRequestGetCall<'a, S> {
OrganizationApprovalRequestGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists approval requests associated with a project, folder, or organization.
/// Approval requests can be filtered by state (pending, active, dismissed).
/// The order is reverse chronological.
///
/// # Arguments
///
/// * `parent` - The parent resource. This may be "projects/{project_id}",
/// "folders/{folder_id}", or "organizations/{organization_id}".
pub fn approval_requests_list(&self, parent: &str) -> OrganizationApprovalRequestListCall<'a, S> {
OrganizationApprovalRequestListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes the settings associated with a project, folder, or organization.
/// This will have the effect of disabling Access Approval for the project,
/// folder, or organization, but only if all ancestors also have Access
/// Approval disabled. If Access Approval is enabled at a higher level of the
/// hierarchy, then Access Approval will still be enabled at this level as
/// the settings are inherited.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to delete.
pub fn delete_access_approval_settings(&self, name: &str) -> OrganizationDeleteAccessApprovalSettingCall<'a, S> {
OrganizationDeleteAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the settings associated with a project, folder, or organization.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to retrieve.
pub fn get_access_approval_settings(&self, name: &str) -> OrganizationGetAccessApprovalSettingCall<'a, S> {
OrganizationGetAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings associated with a project, folder, or organization.
/// Settings to update are determined by the value of field_mask.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The resource name of the settings. Format is one of:
/// <ol>
/// <li>"projects/{project_id}/accessApprovalSettings"</li>
/// <li>"folders/{folder_id}/accessApprovalSettings"</li>
/// <li>"organizations/{organization_id}/accessApprovalSettings"</li>
/// <ol>
pub fn update_access_approval_settings(&self, request: AccessApprovalSettings, name: &str) -> OrganizationUpdateAccessApprovalSettingCall<'a, S> {
OrganizationUpdateAccessApprovalSettingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *project* resources.
/// It is not used directly, but through the [`AccessApproval`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1_beta1 as accessapproval1_beta1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1_beta1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `approval_requests_approve(...)`, `approval_requests_dismiss(...)`, `approval_requests_get(...)`, `approval_requests_list(...)`, `delete_access_approval_settings(...)`, `get_access_approval_settings(...)` and `update_access_approval_settings(...)`
/// // to build up your call.
/// let rb = hub.projects();
/// # }
/// ```
pub struct ProjectMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessApproval<S>,
}
impl<'a, S> client::MethodsBuilder for ProjectMethods<'a, S> {}
impl<'a, S> ProjectMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Approves a request and returns the updated ApprovalRequest.
///
/// Returns NOT_FOUND if the request does not exist. Returns
/// FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the approval request to approve.
pub fn approval_requests_approve(&self, request: ApproveApprovalRequestMessage, name: &str) -> ProjectApprovalRequestApproveCall<'a, S> {
ProjectApprovalRequestApproveCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Dismisses a request. Returns the updated ApprovalRequest.
///
/// NOTE: This does not deny access to the resource if another request has been
/// made and approved. It is equivalent in effect to ignoring the request
/// altogether.
///
/// Returns NOT_FOUND if the request does not exist.
///
/// Returns FAILED_PRECONDITION if the request exists but is not in a pending
/// state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to dismiss.
pub fn approval_requests_dismiss(&self, request: DismissApprovalRequestMessage, name: &str) -> ProjectApprovalRequestDismisCall<'a, S> {
ProjectApprovalRequestDismisCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an approval request. Returns NOT_FOUND if the request does not exist.
///
/// # Arguments
///
/// * `name` - Name of the approval request to retrieve.
pub fn approval_requests_get(&self, name: &str) -> ProjectApprovalRequestGetCall<'a, S> {
ProjectApprovalRequestGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists approval requests associated with a project, folder, or organization.
/// Approval requests can be filtered by state (pending, active, dismissed).
/// The order is reverse chronological.
///
/// # Arguments
///
/// * `parent` - The parent resource. This may be "projects/{project_id}",
/// "folders/{folder_id}", or "organizations/{organization_id}".
pub fn approval_requests_list(&self, parent: &str) -> ProjectApprovalRequestListCall<'a, S> {
ProjectApprovalRequestListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes the settings associated with a project, folder, or organization.
/// This will have the effect of disabling Access Approval for the project,
/// folder, or organization, but only if all ancestors also have Access
/// Approval disabled. If Access Approval is enabled at a higher level of the
/// hierarchy, then Access Approval will still be enabled at this level as
/// the settings are inherited.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to delete.
pub fn delete_access_approval_settings(&self, name: &str) -> ProjectDeleteAccessApprovalSettingCall<'a, S> {
ProjectDeleteAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the settings associated with a project, folder, or organization.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to retrieve.
pub fn get_access_approval_settings(&self, name: &str) -> ProjectGetAccessApprovalSettingCall<'a, S> {
ProjectGetAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings associated with a project, folder, or organization.
/// Settings to update are determined by the value of field_mask.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The resource name of the settings. Format is one of:
/// <ol>
/// <li>"projects/{project_id}/accessApprovalSettings"</li>
/// <li>"folders/{folder_id}/accessApprovalSettings"</li>
/// <li>"organizations/{organization_id}/accessApprovalSettings"</li>
/// <ol>
pub fn update_access_approval_settings(&self, request: AccessApprovalSettings, name: &str) -> ProjectUpdateAccessApprovalSettingCall<'a, S> {
ProjectUpdateAccessApprovalSettingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -1,35 +0,0 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;
mod enums;
pub use enums::*;

View File

@@ -1,370 +0,0 @@
use super::*;
/// Settings on a Project/Folder/Organization related to Access Approval.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [get access approval settings folders](FolderGetAccessApprovalSettingCall) (response)
/// * [update access approval settings folders](FolderUpdateAccessApprovalSettingCall) (request|response)
/// * [get access approval settings organizations](OrganizationGetAccessApprovalSettingCall) (response)
/// * [update access approval settings organizations](OrganizationUpdateAccessApprovalSettingCall) (request|response)
/// * [get access approval settings projects](ProjectGetAccessApprovalSettingCall) (response)
/// * [update access approval settings projects](ProjectUpdateAccessApprovalSettingCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessApprovalSettings {
/// Output only. This field is read only (not settable via
/// UpdateAccessAccessApprovalSettings method). If the field is true, that
/// indicates that at least one service is enrolled for Access Approval in one
/// or more ancestors of the Project or Folder (this field will always be
/// unset for the organization since organizations do not have ancestors).
#[serde(rename="enrolledAncestor")]
pub enrolled_ancestor: Option<bool>,
/// A list of Google Cloud Services for which the given resource has Access
/// Approval enrolled. Access requests for the resource given by name against
/// any of these services contained here will be required to have explicit
/// approval. If name refers to an organization, enrollment can be done for
/// individual services. If name refers to a folder or project, enrollment can
/// only be done on an all or nothing basis.
///
/// If a cloud_product is repeated in this list, the first entry will be
/// honored and all following entries will be discarded. A maximum of 10
/// enrolled services will be enforced, to be expanded as the set of supported
/// services is expanded.
#[serde(rename="enrolledServices")]
pub enrolled_services: Option<Vec<EnrolledService>>,
/// The resource name of the settings. Format is one of:
/// <ol>
/// <li>"projects/{project_id}/accessApprovalSettings"</li>
/// <li>"folders/{folder_id}/accessApprovalSettings"</li>
/// <li>"organizations/{organization_id}/accessApprovalSettings"</li>
/// <ol>
pub name: Option<String>,
/// A list of email addresses to which notifications relating to approval
/// requests should be sent. Notifications relating to a resource will be sent
/// to all emails in the settings of ancestor resources of that resource. A
/// maximum of 50 email addresses are allowed.
#[serde(rename="notificationEmails")]
pub notification_emails: Option<Vec<String>>,
}
impl client::RequestValue for AccessApprovalSettings {}
impl client::ResponseResult for AccessApprovalSettings {}
/// Home office and physical location of the principal.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessLocations {
/// The "home office" location of the principal. A two-letter country code
/// (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or a region code. In some
/// limited situations Google systems may refer refer to a region code instead
/// of a country code.
/// Possible Region Codes:
/// <ol>
/// <li>ASI: Asia</li>
/// <li>EUR: Europe</li>
/// <li>OCE: Oceania</li>
/// <li>AFR: Africa</li>
/// <li>NAM: North America</li>
/// <li>SAM: South America</li>
/// <li>ANT: Antarctica</li>
/// <li>ANY: Any location</li>
/// </ol>
#[serde(rename="principalOfficeCountry")]
pub principal_office_country: Option<String>,
/// Physical location of the principal at the time of the access. A
/// two-letter country code (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or
/// a region code. In some limited situations Google systems may refer refer to
/// a region code instead of a country code.
/// Possible Region Codes:
/// <ol>
/// <li>ASI: Asia</li>
/// <li>EUR: Europe</li>
/// <li>OCE: Oceania</li>
/// <li>AFR: Africa</li>
/// <li>NAM: North America</li>
/// <li>SAM: South America</li>
/// <li>ANT: Antarctica</li>
/// <li>ANY: Any location</li>
/// </ol>
#[serde(rename="principalPhysicalLocationCountry")]
pub principal_physical_location_country: Option<String>,
}
impl client::Part for AccessLocations {}
/// There is no detailed description.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessReason {
/// More detail about certain reason types. See comments for each type above.
pub detail: Option<String>,
/// Type of access justification.
#[serde(rename="type")]
pub type_: Option<AccessReasonTypeEnum>,
}
impl client::Part for AccessReason {}
/// A request for the customer to approve access to a resource.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [approval requests approve folders](FolderApprovalRequestApproveCall) (response)
/// * [approval requests dismiss folders](FolderApprovalRequestDismisCall) (response)
/// * [approval requests get folders](FolderApprovalRequestGetCall) (response)
/// * [approval requests approve organizations](OrganizationApprovalRequestApproveCall) (response)
/// * [approval requests dismiss organizations](OrganizationApprovalRequestDismisCall) (response)
/// * [approval requests get organizations](OrganizationApprovalRequestGetCall) (response)
/// * [approval requests approve projects](ProjectApprovalRequestApproveCall) (response)
/// * [approval requests dismiss projects](ProjectApprovalRequestDismisCall) (response)
/// * [approval requests get projects](ProjectApprovalRequestGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ApprovalRequest {
/// Access was approved.
pub approve: Option<ApproveDecision>,
/// The request was dismissed.
pub dismiss: Option<DismissDecision>,
/// The resource name of the request. Format is
/// "{projects|folders|organizations}/{id}/approvalRequests/{approval_request_id}".
pub name: Option<String>,
/// The time at which approval was requested.
#[serde(rename="requestTime")]
pub request_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The requested expiration for the approval. If the request is approved,
/// access will be granted from the time of approval until the expiration time.
#[serde(rename="requestedExpiration")]
pub requested_expiration: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The locations for which approval is being requested.
#[serde(rename="requestedLocations")]
pub requested_locations: Option<AccessLocations>,
/// The justification for which approval is being requested.
#[serde(rename="requestedReason")]
pub requested_reason: Option<AccessReason>,
/// The resource for which approval is being requested. The format of the
/// resource name is defined at
/// https://cloud.google.com/apis/design/resource_names. The resource name here
/// may either be a "full" resource name (e.g.
/// "//library.googleapis.com/shelves/shelf1/books/book2") or a "relative"
/// resource name (e.g. "shelves/shelf1/books/book2") as described in the
/// resource name specification.
#[serde(rename="requestedResourceName")]
pub requested_resource_name: Option<String>,
/// Properties related to the resource represented by requested_resource_name.
#[serde(rename="requestedResourceProperties")]
pub requested_resource_properties: Option<ResourceProperties>,
}
impl client::ResponseResult for ApprovalRequest {}
/// Request to approve an ApprovalRequest.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [approval requests approve folders](FolderApprovalRequestApproveCall) (request)
/// * [approval requests approve organizations](OrganizationApprovalRequestApproveCall) (request)
/// * [approval requests approve projects](ProjectApprovalRequestApproveCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ApproveApprovalRequestMessage {
/// The expiration time of this approval.
#[serde(rename="expireTime")]
pub expire_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
}
impl client::RequestValue for ApproveApprovalRequestMessage {}
/// A decision that has been made to approve access to a resource.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ApproveDecision {
/// The time at which approval was granted.
#[serde(rename="approveTime")]
pub approve_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The time at which the approval expires.
#[serde(rename="expireTime")]
pub expire_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
}
impl client::Part for ApproveDecision {}
/// Request to dismiss an approval request.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [approval requests dismiss folders](FolderApprovalRequestDismisCall) (request)
/// * [approval requests dismiss organizations](OrganizationApprovalRequestDismisCall) (request)
/// * [approval requests dismiss projects](ProjectApprovalRequestDismisCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DismissApprovalRequestMessage { _never_set: Option<bool> }
impl client::RequestValue for DismissApprovalRequestMessage {}
/// A decision that has been made to dismiss an approval request.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DismissDecision {
/// The time at which the approval request was dismissed.
#[serde(rename="dismissTime")]
pub dismiss_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
}
impl client::Part for DismissDecision {}
/// A generic empty message that you can re-use to avoid defining duplicated
/// empty messages in your APIs. A typical example is to use it as the request
/// or the response type of an API method. For instance:
///
/// ````text
/// service Foo {
/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
/// }
/// ````
///
/// The JSON representation for `Empty` is empty JSON object `{}`.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [delete access approval settings folders](FolderDeleteAccessApprovalSettingCall) (response)
/// * [delete access approval settings organizations](OrganizationDeleteAccessApprovalSettingCall) (response)
/// * [delete access approval settings projects](ProjectDeleteAccessApprovalSettingCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Empty { _never_set: Option<bool> }
impl client::ResponseResult for Empty {}
/// Represents the enrollment of a cloud resource into a specific service.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct EnrolledService {
/// The product for which Access Approval will be enrolled. Allowed values are
/// listed below (case-sensitive):
/// <ol>
/// <li>all</li>
/// <li>appengine.googleapis.com</li>
/// <li>bigquery.googleapis.com</li>
/// <li>bigtable.googleapis.com</li>
/// <li>cloudkms.googleapis.com</li>
/// <li>compute.googleapis.com</li>
/// <li>dataflow.googleapis.com</li>
/// <li>iam.googleapis.com</li>
/// <li>pubsub.googleapis.com</li>
/// <li>storage.googleapis.com</li>
/// <ol>
#[serde(rename="cloudProduct")]
pub cloud_product: Option<String>,
/// The enrollment level of the service.
#[serde(rename="enrollmentLevel")]
pub enrollment_level: Option<EnrolledServiceEnrollmentLevelEnum>,
}
impl client::Part for EnrolledService {}
/// Response to listing of ApprovalRequest objects.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [approval requests list folders](FolderApprovalRequestListCall) (response)
/// * [approval requests list organizations](OrganizationApprovalRequestListCall) (response)
/// * [approval requests list projects](ProjectApprovalRequestListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListApprovalRequestsResponse {
/// Approval request details.
#[serde(rename="approvalRequests")]
pub approval_requests: Option<Vec<ApprovalRequest>>,
/// Token to retrieve the next page of results, or empty if there are no more.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListApprovalRequestsResponse {}
/// The properties associated with the resource of the request.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ResourceProperties {
/// Whether an approval will exclude the descendants of the resource being
/// requested.
#[serde(rename="excludesDescendants")]
pub excludes_descendants: Option<bool>,
}
impl client::Part for ResourceProperties {}

View File

@@ -1,24 +0,0 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// View and manage your data across Google Cloud Platform services
CloudPlatform,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::CloudPlatform
}
}

View File

@@ -1,215 +0,0 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Access Approval* crate version *5.0.4+20200708*, where *20200708* is the exact revision of the *accessapproval:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Access Approval* *v1_beta1* API can be found at the
//! [official documentation site](https://cloud.google.com/access-approval/docs).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1_beta1).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AccessApproval) ...
//!
//! * folders
//! * [*approval requests approve*](api::FolderApprovalRequestApproveCall), [*approval requests dismiss*](api::FolderApprovalRequestDismisCall), [*approval requests get*](api::FolderApprovalRequestGetCall), [*approval requests list*](api::FolderApprovalRequestListCall), [*delete access approval settings*](api::FolderDeleteAccessApprovalSettingCall), [*get access approval settings*](api::FolderGetAccessApprovalSettingCall) and [*update access approval settings*](api::FolderUpdateAccessApprovalSettingCall)
//! * organizations
//! * [*approval requests approve*](api::OrganizationApprovalRequestApproveCall), [*approval requests dismiss*](api::OrganizationApprovalRequestDismisCall), [*approval requests get*](api::OrganizationApprovalRequestGetCall), [*approval requests list*](api::OrganizationApprovalRequestListCall), [*delete access approval settings*](api::OrganizationDeleteAccessApprovalSettingCall), [*get access approval settings*](api::OrganizationGetAccessApprovalSettingCall) and [*update access approval settings*](api::OrganizationUpdateAccessApprovalSettingCall)
//! * projects
//! * [*approval requests approve*](api::ProjectApprovalRequestApproveCall), [*approval requests dismiss*](api::ProjectApprovalRequestDismisCall), [*approval requests get*](api::ProjectApprovalRequestGetCall), [*approval requests list*](api::ProjectApprovalRequestListCall), [*delete access approval settings*](api::ProjectDeleteAccessApprovalSettingCall), [*get access approval settings*](api::ProjectGetAccessApprovalSettingCall) and [*update access approval settings*](api::ProjectUpdateAccessApprovalSettingCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AccessApproval)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.folders().approval_requests_approve(...).doit().await
//! let r = hub.folders().approval_requests_dismiss(...).doit().await
//! let r = hub.folders().approval_requests_get(...).doit().await
//! let r = hub.organizations().approval_requests_approve(...).doit().await
//! let r = hub.organizations().approval_requests_dismiss(...).doit().await
//! let r = hub.organizations().approval_requests_get(...).doit().await
//! let r = hub.projects().approval_requests_approve(...).doit().await
//! let r = hub.projects().approval_requests_dismiss(...).doit().await
//! let r = hub.projects().approval_requests_get(...).doit().await
//! ```
//!
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
//! The `doit()` method performs the actual communication with the server and returns the respective result.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-accessapproval1_beta1 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_accessapproval1_beta1 as accessapproval1_beta1;
//! use accessapproval1_beta1::api::ApproveApprovalRequestMessage;
//! use accessapproval1_beta1::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use accessapproval1_beta1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // As the method needs a request, you would usually fill it with the desired information
//! // into the respective structure. Some of the parts shown here might not be applicable !
//! // Values shown here are possibly random and not representative !
//! let mut req = ApproveApprovalRequestMessage::default();
//!
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.folders().approval_requests_approve(req, "name")
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
//! makes the system potentially resilient to all kinds of errors.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), it will return that by default.
//! 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
//! the server to indicate either the set parts of the request or the desired parts in the response.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
//! These will always take a single argument, for which the following statements are true.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
//!
//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// Unused attributes happen thanks to defined, but unused structures
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
// unused imports in fully featured APIs. Same with unused_mut ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AccessApproval;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -1,42 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accesscontextmanager1-cli"
version = "5.0.4+20240226"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Context Manager (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1-cli"
homepage = "https://cloud.google.com/access-context-manager/docs/reference/rest/"
documentation = "http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli"
license = "MIT"
keywords = ["accesscontextmanager", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "accesscontextmanager1"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-accesscontextmanager1]
path = "../accesscontextmanager1"
version = "5.0.4+20240226"

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,146 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `accesscontextmanager1` command-line interface *(CLI)* allows to use most features of the *Google Access Context Manager* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Access Context Manager* API can be found at the
[official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-accesscontextmanager1-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1-cli).
# Usage
This documentation was generated from the *Access Context Manager* API at revision *20240226*. The CLI is at version *5.0.4*.
```bash
accesscontextmanager1 [options]
access-policies
access-levels-create <parent> (-r <kv>)... [-p <v>]... [-o <out>]
access-levels-delete <name> [-p <v>]... [-o <out>]
access-levels-get <name> [-p <v>]... [-o <out>]
access-levels-list <parent> [-p <v>]... [-o <out>]
access-levels-patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
access-levels-replace-all <parent> (-r <kv>)... [-p <v>]... [-o <out>]
access-levels-test-iam-permissions <resource> (-r <kv>)... [-p <v>]... [-o <out>]
authorized-orgs-descs-create <parent> (-r <kv>)... [-p <v>]... [-o <out>]
authorized-orgs-descs-delete <name> [-p <v>]... [-o <out>]
authorized-orgs-descs-get <name> [-p <v>]... [-o <out>]
authorized-orgs-descs-list <parent> [-p <v>]... [-o <out>]
authorized-orgs-descs-patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
create (-r <kv>)... [-p <v>]... [-o <out>]
delete <name> [-p <v>]... [-o <out>]
get <name> [-p <v>]... [-o <out>]
get-iam-policy <resource> (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-commit <parent> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-create <parent> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-delete <name> [-p <v>]... [-o <out>]
service-perimeters-get <name> [-p <v>]... [-o <out>]
service-perimeters-list <parent> [-p <v>]... [-o <out>]
service-perimeters-patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-replace-all <parent> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-test-iam-permissions <resource> (-r <kv>)... [-p <v>]... [-o <out>]
set-iam-policy <resource> (-r <kv>)... [-p <v>]... [-o <out>]
test-iam-permissions <resource> (-r <kv>)... [-p <v>]... [-o <out>]
operations
cancel <name> (-r <kv>)... [-p <v>]... [-o <out>]
delete <name> [-p <v>]... [-o <out>]
get <name> [-p <v>]... [-o <out>]
list <name> [-p <v>]... [-o <out>]
organizations
gcp-user-access-bindings-create <parent> (-r <kv>)... [-p <v>]... [-o <out>]
gcp-user-access-bindings-delete <name> [-p <v>]... [-o <out>]
gcp-user-access-bindings-get <name> [-p <v>]... [-o <out>]
gcp-user-access-bindings-list <parent> [-p <v>]... [-o <out>]
gcp-user-access-bindings-patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
services
get <name> [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
accesscontextmanager1 --help
Configuration:
[--scope <url>]...
Specify the authentication a method should be executed in. Each scope
requires the user to grant this application permission to use it.
If unset, it defaults to the shortest scope url for a particular method.
--config-dir <folder>
A directory into which we will store our persistent data. Defaults to
a user-writable directory that we will create during the first invocation.
[default: ~/.google-service-cli]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `accesscontextmanager1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/accesscontextmanager1-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/accesscontextmanager1-secret.json`, assuming that the required *accesscontextmanager* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `accesscontextmanager1 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -1,59 +0,0 @@
site_name: Access Context Manager v5.0.4+20240226
site_url: http://byron.github.io/google-apis-rs/google-accesscontextmanager1-cli
site_description: A complete library to interact with Access Context Manager (protocol v1)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Access Policies':
- 'Access Levels Create': 'access-policies_access-levels-create.md'
- 'Access Levels Delete': 'access-policies_access-levels-delete.md'
- 'Access Levels Get': 'access-policies_access-levels-get.md'
- 'Access Levels List': 'access-policies_access-levels-list.md'
- 'Access Levels Patch': 'access-policies_access-levels-patch.md'
- 'Access Levels Replace All': 'access-policies_access-levels-replace-all.md'
- 'Access Levels Test Iam Permissions': 'access-policies_access-levels-test-iam-permissions.md'
- 'Authorized Orgs Descs Create': 'access-policies_authorized-orgs-descs-create.md'
- 'Authorized Orgs Descs Delete': 'access-policies_authorized-orgs-descs-delete.md'
- 'Authorized Orgs Descs Get': 'access-policies_authorized-orgs-descs-get.md'
- 'Authorized Orgs Descs List': 'access-policies_authorized-orgs-descs-list.md'
- 'Authorized Orgs Descs Patch': 'access-policies_authorized-orgs-descs-patch.md'
- 'Create': 'access-policies_create.md'
- 'Delete': 'access-policies_delete.md'
- 'Get': 'access-policies_get.md'
- 'Get Iam Policy': 'access-policies_get-iam-policy.md'
- 'List': 'access-policies_list.md'
- 'Patch': 'access-policies_patch.md'
- 'Service Perimeters Commit': 'access-policies_service-perimeters-commit.md'
- 'Service Perimeters Create': 'access-policies_service-perimeters-create.md'
- 'Service Perimeters Delete': 'access-policies_service-perimeters-delete.md'
- 'Service Perimeters Get': 'access-policies_service-perimeters-get.md'
- 'Service Perimeters List': 'access-policies_service-perimeters-list.md'
- 'Service Perimeters Patch': 'access-policies_service-perimeters-patch.md'
- 'Service Perimeters Replace All': 'access-policies_service-perimeters-replace-all.md'
- 'Service Perimeters Test Iam Permissions': 'access-policies_service-perimeters-test-iam-permissions.md'
- 'Set Iam Policy': 'access-policies_set-iam-policy.md'
- 'Test Iam Permissions': 'access-policies_test-iam-permissions.md'
- 'Operations':
- 'Cancel': 'operations_cancel.md'
- 'Delete': 'operations_delete.md'
- 'Get': 'operations_get.md'
- 'List': 'operations_list.md'
- 'Organizations':
- 'Gcp User Access Bindings Create': 'organizations_gcp-user-access-bindings-create.md'
- 'Gcp User Access Bindings Delete': 'organizations_gcp-user-access-bindings-delete.md'
- 'Gcp User Access Bindings Get': 'organizations_gcp-user-access-bindings-get.md'
- 'Gcp User Access Bindings List': 'organizations_gcp-user-access-bindings-list.md'
- 'Gcp User Access Bindings Patch': 'organizations_gcp-user-access-bindings-patch.md'
- 'Services':
- 'Get': 'services_get.md'
- 'List': 'services_list.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -1,37 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accesscontextmanager1"
version = "5.0.4+20240226"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Context Manager (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1"
homepage = "https://cloud.google.com/access-context-manager/docs/reference/rest/"
documentation = "https://docs.rs/google-accesscontextmanager1/5.0.4+20240226"
license = "MIT"
keywords = ["accesscontextmanager", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,207 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-accesscontextmanager1` library allows access to all features of the *Google Access Context Manager* service.
This documentation was generated from *Access Context Manager* crate version *5.0.4+20240226*, where *20240226* is the exact revision of the *accesscontextmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Access Context Manager* *v1* API can be found at the
[official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/AccessContextManager) ...
* [access policies](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicy)
* [*access levels create*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelCreateCall), [*access levels delete*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelDeleteCall), [*access levels get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelGetCall), [*access levels list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelListCall), [*access levels patch*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelPatchCall), [*access levels replace all*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelReplaceAllCall), [*access levels test iam permissions*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelTestIamPermissionCall), [*authorized orgs descs create*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAuthorizedOrgsDescCreateCall), [*authorized orgs descs delete*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAuthorizedOrgsDescDeleteCall), [*authorized orgs descs get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAuthorizedOrgsDescGetCall), [*authorized orgs descs list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAuthorizedOrgsDescListCall), [*authorized orgs descs patch*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAuthorizedOrgsDescPatchCall), [*create*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyCreateCall), [*delete*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyDeleteCall), [*get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyGetCall), [*get iam policy*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyGetIamPolicyCall), [*list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyListCall), [*patch*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyPatchCall), [*service perimeters commit*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterCommitCall), [*service perimeters create*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterCreateCall), [*service perimeters delete*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterDeleteCall), [*service perimeters get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterGetCall), [*service perimeters list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterListCall), [*service perimeters patch*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterPatchCall), [*service perimeters replace all*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterReplaceAllCall), [*service perimeters test iam permissions*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterTestIamPermissionCall), [*set iam policy*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicySetIamPolicyCall) and [*test iam permissions*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyTestIamPermissionCall)
* [operations](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::Operation)
* [*cancel*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OperationCancelCall), [*delete*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OperationDeleteCall), [*get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OperationGetCall) and [*list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OperationListCall)
* organizations
* [*gcp user access bindings create*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OrganizationGcpUserAccessBindingCreateCall), [*gcp user access bindings delete*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OrganizationGcpUserAccessBindingDeleteCall), [*gcp user access bindings get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OrganizationGcpUserAccessBindingGetCall), [*gcp user access bindings list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OrganizationGcpUserAccessBindingListCall) and [*gcp user access bindings patch*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OrganizationGcpUserAccessBindingPatchCall)
* services
* [*get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::ServiceGetCall) and [*list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::ServiceListCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/AccessContextManager)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::CallBuilder)
* **[Resources](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.access_policies().access_levels_create(...).doit().await
let r = hub.access_policies().access_levels_delete(...).doit().await
let r = hub.access_policies().access_levels_patch(...).doit().await
let r = hub.access_policies().access_levels_replace_all(...).doit().await
let r = hub.access_policies().authorized_orgs_descs_create(...).doit().await
let r = hub.access_policies().authorized_orgs_descs_delete(...).doit().await
let r = hub.access_policies().authorized_orgs_descs_patch(...).doit().await
let r = hub.access_policies().service_perimeters_commit(...).doit().await
let r = hub.access_policies().service_perimeters_create(...).doit().await
let r = hub.access_policies().service_perimeters_delete(...).doit().await
let r = hub.access_policies().service_perimeters_patch(...).doit().await
let r = hub.access_policies().service_perimeters_replace_all(...).doit().await
let r = hub.access_policies().create(...).doit().await
let r = hub.access_policies().delete(...).doit().await
let r = hub.access_policies().patch(...).doit().await
let r = hub.operations().cancel(...).doit().await
let r = hub.operations().delete(...).doit().await
let r = hub.operations().get(...).doit().await
let r = hub.operations().list(...).doit().await
let r = hub.organizations().gcp_user_access_bindings_create(...).doit().await
let r = hub.organizations().gcp_user_access_bindings_delete(...).doit().await
let r = hub.organizations().gcp_user_access_bindings_patch(...).doit().await
```
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
The `doit()` method performs the actual communication with the server and returns the respective result.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-accesscontextmanager1 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_accesscontextmanager1 as accesscontextmanager1;
use accesscontextmanager1::{Result, Error};
use std::default::Default;
use accesscontextmanager1::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.operations().list("name")
.page_token("magna")
.page_size(-11)
.filter("ipsum")
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
makes the system potentially resilient to all kinds of errors.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::ResponseResult), it will return that by default.
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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Delegate) to the
[Method Builder](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::RequestValue) and
[decodable](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Part) which are identifiable by name, which will be sent to
the server to indicate either the set parts of the request or the desired parts in the response.
## Builder Arguments
Using [method builders](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
These will always take a single argument, for which the following statements are true.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::RequestValue) are moved
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **accesscontextmanager1** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

File diff suppressed because it is too large Load Diff

View File

@@ -1,115 +0,0 @@
use super::*;
/// Central instance to access all AccessContextManager related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accesscontextmanager1 as accesscontextmanager1;
/// use accesscontextmanager1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use accesscontextmanager1::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.operations().list("name")
/// .page_token("takimata")
/// .page_size(-52)
/// .filter("duo")
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AccessContextManager<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AccessContextManager<S> {}
impl<'a, S> AccessContextManager<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AccessContextManager<S> {
AccessContextManager {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://accesscontextmanager.googleapis.com/".to_string(),
_root_url: "https://accesscontextmanager.googleapis.com/".to_string(),
}
}
pub fn access_policies(&'a self) -> AccessPolicyMethods<'a, S> {
AccessPolicyMethods { hub: &self }
}
pub fn operations(&'a self) -> OperationMethods<'a, S> {
OperationMethods { hub: &self }
}
pub fn organizations(&'a self) -> OrganizationMethods<'a, S> {
OrganizationMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.3`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://accesscontextmanager.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://accesscontextmanager.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}

View File

@@ -1,805 +0,0 @@
use super::*;
/// A builder providing access to all methods supported on *accessPolicy* resources.
/// It is not used directly, but through the [`AccessContextManager`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accesscontextmanager1 as accesscontextmanager1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accesscontextmanager1::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `access_levels_create(...)`, `access_levels_delete(...)`, `access_levels_get(...)`, `access_levels_list(...)`, `access_levels_patch(...)`, `access_levels_replace_all(...)`, `access_levels_test_iam_permissions(...)`, `authorized_orgs_descs_create(...)`, `authorized_orgs_descs_delete(...)`, `authorized_orgs_descs_get(...)`, `authorized_orgs_descs_list(...)`, `authorized_orgs_descs_patch(...)`, `create(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `list(...)`, `patch(...)`, `service_perimeters_commit(...)`, `service_perimeters_create(...)`, `service_perimeters_delete(...)`, `service_perimeters_get(...)`, `service_perimeters_list(...)`, `service_perimeters_patch(...)`, `service_perimeters_replace_all(...)`, `service_perimeters_test_iam_permissions(...)`, `set_iam_policy(...)` and `test_iam_permissions(...)`
/// // to build up your call.
/// let rb = hub.access_policies();
/// # }
/// ```
pub struct AccessPolicyMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessContextManager<S>,
}
impl<'a, S> client::MethodsBuilder for AccessPolicyMethods<'a, S> {}
impl<'a, S> AccessPolicyMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Creates an access level. The long-running operation from this RPC has a successful status after the access level propagates to long-lasting storage. If access levels contain errors, an error response is returned for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns this Access Level. Format: `accessPolicies/{policy_id}`
pub fn access_levels_create(&self, request: AccessLevel, parent: &str) -> AccessPolicyAccessLevelCreateCall<'a, S> {
AccessPolicyAccessLevelCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes an access level based on the resource name. The long-running operation from this RPC has a successful status after the access level has been removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Access Level. Format: `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
pub fn access_levels_delete(&self, name: &str) -> AccessPolicyAccessLevelDeleteCall<'a, S> {
AccessPolicyAccessLevelDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an access level based on the resource name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Access Level. Format: `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
pub fn access_levels_get(&self, name: &str) -> AccessPolicyAccessLevelGetCall<'a, S> {
AccessPolicyAccessLevelGetCall {
hub: self.hub,
_name: name.to_string(),
_access_level_format: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all access levels for an access policy.
///
/// # Arguments
///
/// * `parent` - Required. Resource name for the access policy to list Access Levels from. Format: `accessPolicies/{policy_id}`
pub fn access_levels_list(&self, parent: &str) -> AccessPolicyAccessLevelListCall<'a, S> {
AccessPolicyAccessLevelListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_access_level_format: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates an access level. The long-running operation from this RPC has a successful status after the changes to the access level propagate to long-lasting storage. If access levels contain errors, an error response is returned for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Resource name for the `AccessLevel`. Format: `accessPolicies/{access_policy}/accessLevels/{access_level}`. The `access_level` component must begin with a letter, followed by alphanumeric characters or `_`. Its maximum length is 50 characters. After you create an `AccessLevel`, you cannot change its `name`.
pub fn access_levels_patch(&self, request: AccessLevel, name: &str) -> AccessPolicyAccessLevelPatchCall<'a, S> {
AccessPolicyAccessLevelPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Replaces all existing access levels in an access policy with the access levels provided. This is done atomically. The long-running operation from this RPC has a successful status after all replacements propagate to long-lasting storage. If the replacement contains errors, an error response is returned for the first error encountered. Upon error, the replacement is cancelled, and existing access levels are not affected. The Operation.response field contains ReplaceAccessLevelsResponse. Removing access levels contained in existing service perimeters result in an error.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns these Access Levels. Format: `accessPolicies/{policy_id}`
pub fn access_levels_replace_all(&self, request: ReplaceAccessLevelsRequest, parent: &str) -> AccessPolicyAccessLevelReplaceAllCall<'a, S> {
AccessPolicyAccessLevelReplaceAllCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns the IAM permissions that the caller has on the specified Access Context Manager resource. The resource can be an AccessPolicy, AccessLevel, or ServicePerimeter. This method does not support other resources.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
pub fn access_levels_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> AccessPolicyAccessLevelTestIamPermissionCall<'a, S> {
AccessPolicyAccessLevelTestIamPermissionCall {
hub: self.hub,
_request: request,
_resource: resource.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Creates a authorized orgs desc. The long-running operation from this RPC has a successful status after the authorized orgs desc propagates to long-lasting storage. If a authorized orgs desc contains errors, an error response is returned for the first error encountered. The name of this `AuthorizedOrgsDesc` will be assigned during creation.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns this Authorized Orgs Desc. Format: `accessPolicies/{policy_id}`
pub fn authorized_orgs_descs_create(&self, request: AuthorizedOrgsDesc, parent: &str) -> AccessPolicyAuthorizedOrgsDescCreateCall<'a, S> {
AccessPolicyAuthorizedOrgsDescCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes a authorized orgs desc based on the resource name. The long-running operation from this RPC has a successful status after the authorized orgs desc is removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Authorized Orgs Desc. Format: `accessPolicies/{policy_id}/authorizedOrgsDesc/{authorized_orgs_desc_id}`
pub fn authorized_orgs_descs_delete(&self, name: &str) -> AccessPolicyAuthorizedOrgsDescDeleteCall<'a, S> {
AccessPolicyAuthorizedOrgsDescDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets a authorized orgs desc based on the resource name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Authorized Orgs Desc. Format: `accessPolicies/{policy_id}/authorizedOrgsDescs/{authorized_orgs_descs_id}`
pub fn authorized_orgs_descs_get(&self, name: &str) -> AccessPolicyAuthorizedOrgsDescGetCall<'a, S> {
AccessPolicyAuthorizedOrgsDescGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all authorized orgs descs for an access policy.
///
/// # Arguments
///
/// * `parent` - Required. Resource name for the access policy to list Authorized Orgs Desc from. Format: `accessPolicies/{policy_id}`
pub fn authorized_orgs_descs_list(&self, parent: &str) -> AccessPolicyAuthorizedOrgsDescListCall<'a, S> {
AccessPolicyAuthorizedOrgsDescListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates a authorized orgs desc. The long-running operation from this RPC has a successful status after the authorized orgs desc propagates to long-lasting storage. If a authorized orgs desc contains errors, an error response is returned for the first error encountered. Only the organization list in `AuthorizedOrgsDesc` can be updated. The name, authorization_type, asset_type and authorization_direction cannot be updated.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Assigned by the server during creation. The last segment has an arbitrary length and has only URI unreserved characters (as defined by [RFC 3986 Section 2.3](https://tools.ietf.org/html/rfc3986#section-2.3)). Should not be specified by the client during creation. Example: "accessPolicies/122256/authorizedOrgs/b3-BhcX_Ud5N"
pub fn authorized_orgs_descs_patch(&self, request: AuthorizedOrgsDesc, name: &str) -> AccessPolicyAuthorizedOrgsDescPatchCall<'a, S> {
AccessPolicyAuthorizedOrgsDescPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Commits the dry-run specification for all the service perimeters in an access policy. A commit operation on a service perimeter involves copying its `spec` field to the `status` field of the service perimeter. Only service perimeters with `use_explicit_dry_run_spec` field set to true are affected by a commit operation. The long-running operation from this RPC has a successful status after the dry-run specifications for all the service perimeters have been committed. If a commit fails, it causes the long-running operation to return an error response and the entire commit operation is cancelled. When successful, the Operation.response field contains CommitServicePerimetersResponse. The `dry_run` and the `spec` fields are cleared after a successful commit operation.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the parent Access Policy which owns all Service Perimeters in scope for the commit operation. Format: `accessPolicies/{policy_id}`
pub fn service_perimeters_commit(&self, request: CommitServicePerimetersRequest, parent: &str) -> AccessPolicyServicePerimeterCommitCall<'a, S> {
AccessPolicyServicePerimeterCommitCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Creates a service perimeter. The long-running operation from this RPC has a successful status after the service perimeter propagates to long-lasting storage. If a service perimeter contains errors, an error response is returned for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns this Service Perimeter. Format: `accessPolicies/{policy_id}`
pub fn service_perimeters_create(&self, request: ServicePerimeter, parent: &str) -> AccessPolicyServicePerimeterCreateCall<'a, S> {
AccessPolicyServicePerimeterCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes a service perimeter based on the resource name. The long-running operation from this RPC has a successful status after the service perimeter is removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Service Perimeter. Format: `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}`
pub fn service_perimeters_delete(&self, name: &str) -> AccessPolicyServicePerimeterDeleteCall<'a, S> {
AccessPolicyServicePerimeterDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets a service perimeter based on the resource name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Service Perimeter. Format: `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}`
pub fn service_perimeters_get(&self, name: &str) -> AccessPolicyServicePerimeterGetCall<'a, S> {
AccessPolicyServicePerimeterGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all service perimeters for an access policy.
///
/// # Arguments
///
/// * `parent` - Required. Resource name for the access policy to list Service Perimeters from. Format: `accessPolicies/{policy_id}`
pub fn service_perimeters_list(&self, parent: &str) -> AccessPolicyServicePerimeterListCall<'a, S> {
AccessPolicyServicePerimeterListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates a service perimeter. The long-running operation from this RPC has a successful status after the service perimeter propagates to long-lasting storage. If a service perimeter contains errors, an error response is returned for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Resource name for the `ServicePerimeter`. Format: `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}`. The `service_perimeter` component must begin with a letter, followed by alphanumeric characters or `_`. After you create a `ServicePerimeter`, you cannot change its `name`.
pub fn service_perimeters_patch(&self, request: ServicePerimeter, name: &str) -> AccessPolicyServicePerimeterPatchCall<'a, S> {
AccessPolicyServicePerimeterPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Replace all existing service perimeters in an access policy with the service perimeters provided. This is done atomically. The long-running operation from this RPC has a successful status after all replacements propagate to long-lasting storage. Replacements containing errors result in an error response for the first error encountered. Upon an error, replacement are cancelled and existing service perimeters are not affected. The Operation.response field contains ReplaceServicePerimetersResponse.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns these Service Perimeters. Format: `accessPolicies/{policy_id}`
pub fn service_perimeters_replace_all(&self, request: ReplaceServicePerimetersRequest, parent: &str) -> AccessPolicyServicePerimeterReplaceAllCall<'a, S> {
AccessPolicyServicePerimeterReplaceAllCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns the IAM permissions that the caller has on the specified Access Context Manager resource. The resource can be an AccessPolicy, AccessLevel, or ServicePerimeter. This method does not support other resources.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
pub fn service_perimeters_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> AccessPolicyServicePerimeterTestIamPermissionCall<'a, S> {
AccessPolicyServicePerimeterTestIamPermissionCall {
hub: self.hub,
_request: request,
_resource: resource.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Creates an access policy. This method fails if the organization already has an access policy. The long-running operation has a successful status after the access policy propagates to long-lasting storage. Syntactic and basic semantic errors are returned in `metadata` as a BadRequest proto.
///
/// # Arguments
///
/// * `request` - No description provided.
pub fn create(&self, request: AccessPolicy) -> AccessPolicyCreateCall<'a, S> {
AccessPolicyCreateCall {
hub: self.hub,
_request: request,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes an access policy based on the resource name. The long-running operation has a successful status after the access policy is removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the access policy to delete. Format `accessPolicies/{policy_id}`
pub fn delete(&self, name: &str) -> AccessPolicyDeleteCall<'a, S> {
AccessPolicyDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns an access policy based on the name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the access policy to get. Format `accessPolicies/{policy_id}`
pub fn get(&self, name: &str) -> AccessPolicyGetCall<'a, S> {
AccessPolicyGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the IAM policy for the specified Access Context Manager access policy.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
pub fn get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> AccessPolicyGetIamPolicyCall<'a, S> {
AccessPolicyGetIamPolicyCall {
hub: self.hub,
_request: request,
_resource: resource.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all access policies in an organization.
pub fn list(&self) -> AccessPolicyListCall<'a, S> {
AccessPolicyListCall {
hub: self.hub,
_parent: Default::default(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates an access policy. The long-running operation from this RPC has a successful status after the changes to the access policy propagate to long-lasting storage.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{access_policy}`
pub fn patch(&self, request: AccessPolicy, name: &str) -> AccessPolicyPatchCall<'a, S> {
AccessPolicyPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the IAM policy for the specified Access Context Manager access policy. This method replaces the existing IAM policy on the access policy. The IAM policy controls the set of users who can perform specific operations on the Access Context Manager access policy.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> AccessPolicySetIamPolicyCall<'a, S> {
AccessPolicySetIamPolicyCall {
hub: self.hub,
_request: request,
_resource: resource.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns the IAM permissions that the caller has on the specified Access Context Manager resource. The resource can be an AccessPolicy, AccessLevel, or ServicePerimeter. This method does not support other resources.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
pub fn test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> AccessPolicyTestIamPermissionCall<'a, S> {
AccessPolicyTestIamPermissionCall {
hub: self.hub,
_request: request,
_resource: resource.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *operation* resources.
/// It is not used directly, but through the [`AccessContextManager`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accesscontextmanager1 as accesscontextmanager1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accesscontextmanager1::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `cancel(...)`, `delete(...)`, `get(...)` and `list(...)`
/// // to build up your call.
/// let rb = hub.operations();
/// # }
/// ```
pub struct OperationMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessContextManager<S>,
}
impl<'a, S> client::MethodsBuilder for OperationMethods<'a, S> {}
impl<'a, S> OperationMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name of the operation resource to be cancelled.
pub fn cancel(&self, request: CancelOperationRequest, name: &str) -> OperationCancelCall<'a, S> {
OperationCancelCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
///
/// # Arguments
///
/// * `name` - The name of the operation resource to be deleted.
pub fn delete(&self, name: &str) -> OperationDeleteCall<'a, S> {
OperationDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
///
/// # Arguments
///
/// * `name` - The name of the operation resource.
pub fn get(&self, name: &str) -> OperationGetCall<'a, S> {
OperationGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
///
/// # Arguments
///
/// * `name` - The name of the operation's parent resource.
pub fn list(&self, name: &str) -> OperationListCall<'a, S> {
OperationListCall {
hub: self.hub,
_name: name.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *organization* resources.
/// It is not used directly, but through the [`AccessContextManager`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accesscontextmanager1 as accesscontextmanager1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accesscontextmanager1::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `gcp_user_access_bindings_create(...)`, `gcp_user_access_bindings_delete(...)`, `gcp_user_access_bindings_get(...)`, `gcp_user_access_bindings_list(...)` and `gcp_user_access_bindings_patch(...)`
/// // to build up your call.
/// let rb = hub.organizations();
/// # }
/// ```
pub struct OrganizationMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessContextManager<S>,
}
impl<'a, S> client::MethodsBuilder for OrganizationMethods<'a, S> {}
impl<'a, S> OrganizationMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Creates a GcpUserAccessBinding. If the client specifies a name, the server ignores it. Fails if a resource already exists with the same group_key. Completion of this long-running operation does not necessarily signify that the new binding is deployed onto all affected users, which may take more time.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Example: "organizations/256"
pub fn gcp_user_access_bindings_create(&self, request: GcpUserAccessBinding, parent: &str) -> OrganizationGcpUserAccessBindingCreateCall<'a, S> {
OrganizationGcpUserAccessBindingCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes a GcpUserAccessBinding. Completion of this long-running operation does not necessarily signify that the binding deletion is deployed onto all affected users, which may take more time.
///
/// # Arguments
///
/// * `name` - Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N"
pub fn gcp_user_access_bindings_delete(&self, name: &str) -> OrganizationGcpUserAccessBindingDeleteCall<'a, S> {
OrganizationGcpUserAccessBindingDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the GcpUserAccessBinding with the given name.
///
/// # Arguments
///
/// * `name` - Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N"
pub fn gcp_user_access_bindings_get(&self, name: &str) -> OrganizationGcpUserAccessBindingGetCall<'a, S> {
OrganizationGcpUserAccessBindingGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all GcpUserAccessBindings for a Google Cloud organization.
///
/// # Arguments
///
/// * `parent` - Required. Example: "organizations/256"
pub fn gcp_user_access_bindings_list(&self, parent: &str) -> OrganizationGcpUserAccessBindingListCall<'a, S> {
OrganizationGcpUserAccessBindingListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates a GcpUserAccessBinding. Completion of this long-running operation does not necessarily signify that the changed binding is deployed onto all affected users, which may take more time.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Immutable. Assigned by the server during creation. The last segment has an arbitrary length and has only URI unreserved characters (as defined by [RFC 3986 Section 2.3](https://tools.ietf.org/html/rfc3986#section-2.3)). Should not be specified by the client during creation. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N"
pub fn gcp_user_access_bindings_patch(&self, request: GcpUserAccessBinding, name: &str) -> OrganizationGcpUserAccessBindingPatchCall<'a, S> {
OrganizationGcpUserAccessBindingPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -1,35 +0,0 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;
mod enums;
pub use enums::*;

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +0,0 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
CloudPlatform,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::CloudPlatform
}
}

View File

@@ -1,227 +0,0 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Access Context Manager* crate version *5.0.4+20240226*, where *20240226* is the exact revision of the *accesscontextmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Access Context Manager* *v1* API can be found at the
//! [official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AccessContextManager) ...
//!
//! * [access policies](api::AccessPolicy)
//! * [*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), [*access levels replace all*](api::AccessPolicyAccessLevelReplaceAllCall), [*access levels test iam permissions*](api::AccessPolicyAccessLevelTestIamPermissionCall), [*authorized orgs descs create*](api::AccessPolicyAuthorizedOrgsDescCreateCall), [*authorized orgs descs delete*](api::AccessPolicyAuthorizedOrgsDescDeleteCall), [*authorized orgs descs get*](api::AccessPolicyAuthorizedOrgsDescGetCall), [*authorized orgs descs list*](api::AccessPolicyAuthorizedOrgsDescListCall), [*authorized orgs descs patch*](api::AccessPolicyAuthorizedOrgsDescPatchCall), [*create*](api::AccessPolicyCreateCall), [*delete*](api::AccessPolicyDeleteCall), [*get*](api::AccessPolicyGetCall), [*get iam policy*](api::AccessPolicyGetIamPolicyCall), [*list*](api::AccessPolicyListCall), [*patch*](api::AccessPolicyPatchCall), [*service perimeters commit*](api::AccessPolicyServicePerimeterCommitCall), [*service perimeters create*](api::AccessPolicyServicePerimeterCreateCall), [*service perimeters delete*](api::AccessPolicyServicePerimeterDeleteCall), [*service perimeters get*](api::AccessPolicyServicePerimeterGetCall), [*service perimeters list*](api::AccessPolicyServicePerimeterListCall), [*service perimeters patch*](api::AccessPolicyServicePerimeterPatchCall), [*service perimeters replace all*](api::AccessPolicyServicePerimeterReplaceAllCall), [*service perimeters test iam permissions*](api::AccessPolicyServicePerimeterTestIamPermissionCall), [*set iam policy*](api::AccessPolicySetIamPolicyCall) and [*test iam permissions*](api::AccessPolicyTestIamPermissionCall)
//! * [operations](api::Operation)
//! * [*cancel*](api::OperationCancelCall), [*delete*](api::OperationDeleteCall), [*get*](api::OperationGetCall) and [*list*](api::OperationListCall)
//! * organizations
//! * [*gcp user access bindings create*](api::OrganizationGcpUserAccessBindingCreateCall), [*gcp user access bindings delete*](api::OrganizationGcpUserAccessBindingDeleteCall), [*gcp user access bindings get*](api::OrganizationGcpUserAccessBindingGetCall), [*gcp user access bindings list*](api::OrganizationGcpUserAccessBindingListCall) and [*gcp user access bindings patch*](api::OrganizationGcpUserAccessBindingPatchCall)
//! * services
//! * [*get*](api::ServiceGetCall) and [*list*](api::ServiceListCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AccessContextManager)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.access_policies().access_levels_create(...).doit().await
//! let r = hub.access_policies().access_levels_delete(...).doit().await
//! let r = hub.access_policies().access_levels_patch(...).doit().await
//! let r = hub.access_policies().access_levels_replace_all(...).doit().await
//! let r = hub.access_policies().authorized_orgs_descs_create(...).doit().await
//! let r = hub.access_policies().authorized_orgs_descs_delete(...).doit().await
//! let r = hub.access_policies().authorized_orgs_descs_patch(...).doit().await
//! let r = hub.access_policies().service_perimeters_commit(...).doit().await
//! let r = hub.access_policies().service_perimeters_create(...).doit().await
//! let r = hub.access_policies().service_perimeters_delete(...).doit().await
//! let r = hub.access_policies().service_perimeters_patch(...).doit().await
//! let r = hub.access_policies().service_perimeters_replace_all(...).doit().await
//! let r = hub.access_policies().create(...).doit().await
//! let r = hub.access_policies().delete(...).doit().await
//! let r = hub.access_policies().patch(...).doit().await
//! let r = hub.operations().cancel(...).doit().await
//! let r = hub.operations().delete(...).doit().await
//! let r = hub.operations().get(...).doit().await
//! let r = hub.operations().list(...).doit().await
//! let r = hub.organizations().gcp_user_access_bindings_create(...).doit().await
//! let r = hub.organizations().gcp_user_access_bindings_delete(...).doit().await
//! let r = hub.organizations().gcp_user_access_bindings_patch(...).doit().await
//! ```
//!
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
//! The `doit()` method performs the actual communication with the server and returns the respective result.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-accesscontextmanager1 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_accesscontextmanager1 as accesscontextmanager1;
//! use accesscontextmanager1::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use accesscontextmanager1::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.operations().list("name")
//! .page_token("At")
//! .page_size(-8)
//! .filter("sed")
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
//! makes the system potentially resilient to all kinds of errors.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), it will return that by default.
//! 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
//! the server to indicate either the set parts of the request or the desired parts in the response.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
//! These will always take a single argument, for which the following statements are true.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
//!
//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// Unused attributes happen thanks to defined, but unused structures
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
// unused imports in fully featured APIs. Same with unused_mut ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AccessContextManager;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -1,42 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accesscontextmanager1_beta-cli"
version = "5.0.4+20230123"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Context Manager (protocol v1beta)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1_beta-cli"
homepage = "https://cloud.google.com/access-context-manager/docs/reference/rest/"
documentation = "http://byron.github.io/google-apis-rs/google_accesscontextmanager1_beta_cli"
license = "MIT"
keywords = ["accesscontextmanager", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "accesscontextmanager1-beta"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-accesscontextmanager1_beta]
path = "../accesscontextmanager1_beta"
version = "5.0.4+20230123"

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,121 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `accesscontextmanager1-beta` command-line interface *(CLI)* allows to use most features of the *Google Access Context Manager* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Access Context Manager* API can be found at the
[official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-accesscontextmanager1_beta-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1_beta-cli).
# Usage
This documentation was generated from the *Access Context Manager* API at revision *20230123*. The CLI is at version *5.0.4*.
```bash
accesscontextmanager1-beta [options]
access-policies
access-levels-create <parent> (-r <kv>)... [-p <v>]... [-o <out>]
access-levels-delete <name> [-p <v>]... [-o <out>]
access-levels-get <name> [-p <v>]... [-o <out>]
access-levels-list <parent> [-p <v>]... [-o <out>]
access-levels-patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
create (-r <kv>)... [-p <v>]... [-o <out>]
delete <name> [-p <v>]... [-o <out>]
get <name> [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-create <parent> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-delete <name> [-p <v>]... [-o <out>]
service-perimeters-get <name> [-p <v>]... [-o <out>]
service-perimeters-list <parent> [-p <v>]... [-o <out>]
service-perimeters-patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
operations
get <name> [-p <v>]... [-o <out>]
accesscontextmanager1-beta --help
Configuration:
[--scope <url>]...
Specify the authentication a method should be executed in. Each scope
requires the user to grant this application permission to use it.
If unset, it defaults to the shortest scope url for a particular method.
--config-dir <folder>
A directory into which we will store our persistent data. Defaults to
a user-writable directory that we will create during the first invocation.
[default: ~/.google-service-cli]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `accesscontextmanager1-beta-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/accesscontextmanager1-beta-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/accesscontextmanager1-beta-secret.json`, assuming that the required *accesscontextmanager* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `accesscontextmanager1-beta --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -1,34 +0,0 @@
site_name: Access Context Manager v5.0.4+20230123
site_url: http://byron.github.io/google-apis-rs/google-accesscontextmanager1_beta-cli
site_description: A complete library to interact with Access Context Manager (protocol v1beta)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1_beta-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Access Policies':
- 'Access Levels Create': 'access-policies_access-levels-create.md'
- 'Access Levels Delete': 'access-policies_access-levels-delete.md'
- 'Access Levels Get': 'access-policies_access-levels-get.md'
- 'Access Levels List': 'access-policies_access-levels-list.md'
- 'Access Levels Patch': 'access-policies_access-levels-patch.md'
- 'Create': 'access-policies_create.md'
- 'Delete': 'access-policies_delete.md'
- 'Get': 'access-policies_get.md'
- 'List': 'access-policies_list.md'
- 'Patch': 'access-policies_patch.md'
- 'Service Perimeters Create': 'access-policies_service-perimeters-create.md'
- 'Service Perimeters Delete': 'access-policies_service-perimeters-delete.md'
- 'Service Perimeters Get': 'access-policies_service-perimeters-get.md'
- 'Service Perimeters List': 'access-policies_service-perimeters-list.md'
- 'Service Perimeters Patch': 'access-policies_service-perimeters-patch.md'
- 'Operations':
- 'Get': 'operations_get.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -1,37 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accesscontextmanager1_beta"
version = "5.0.4+20230123"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Context Manager (protocol v1beta)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1_beta"
homepage = "https://cloud.google.com/access-context-manager/docs/reference/rest/"
documentation = "https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123"
license = "MIT"
keywords = ["accesscontextmanager", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,195 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-accesscontextmanager1_beta` library allows access to all features of the *Google Access Context Manager* service.
This documentation was generated from *Access Context Manager* crate version *5.0.4+20230123*, where *20230123* is the exact revision of the *accesscontextmanager:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Access Context Manager* *v1_beta* API can be found at the
[official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/AccessContextManager) ...
* [access policies](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicy)
* [*access levels create*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyAccessLevelCreateCall), [*access levels delete*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyAccessLevelDeleteCall), [*access levels get*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyAccessLevelGetCall), [*access levels list*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyAccessLevelListCall), [*access levels patch*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyAccessLevelPatchCall), [*create*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyCreateCall), [*delete*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyDeleteCall), [*get*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyGetCall), [*list*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyListCall), [*patch*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyPatchCall), [*service perimeters create*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyServicePerimeterCreateCall), [*service perimeters delete*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyServicePerimeterDeleteCall), [*service perimeters get*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyServicePerimeterGetCall), [*service perimeters list*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyServicePerimeterListCall) and [*service perimeters patch*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyServicePerimeterPatchCall)
* [operations](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::Operation)
* [*get*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::OperationGetCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/AccessContextManager)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::CallBuilder)
* **[Resources](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.access_policies().access_levels_create(...).doit().await
let r = hub.access_policies().access_levels_delete(...).doit().await
let r = hub.access_policies().access_levels_patch(...).doit().await
let r = hub.access_policies().service_perimeters_create(...).doit().await
let r = hub.access_policies().service_perimeters_delete(...).doit().await
let r = hub.access_policies().service_perimeters_patch(...).doit().await
let r = hub.access_policies().create(...).doit().await
let r = hub.access_policies().delete(...).doit().await
let r = hub.access_policies().patch(...).doit().await
let r = hub.operations().get(...).doit().await
```
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
The `doit()` method performs the actual communication with the server and returns the respective result.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-accesscontextmanager1_beta = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_accesscontextmanager1_beta as accesscontextmanager1_beta;
use accesscontextmanager1_beta::api::AccessLevel;
use accesscontextmanager1_beta::{Result, Error};
use std::default::Default;
use accesscontextmanager1_beta::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = AccessLevel::default();
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.access_policies().access_levels_patch(req, "name")
.update_mask(&Default::default())
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
makes the system potentially resilient to all kinds of errors.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::ResponseResult), it will return that by default.
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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Delegate) to the
[Method Builder](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::RequestValue) and
[decodable](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Part) which are identifiable by name, which will be sent to
the server to indicate either the set parts of the request or the desired parts in the response.
## Builder Arguments
Using [method builders](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
These will always take a single argument, for which the following statements are true.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::RequestValue) are moved
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **accesscontextmanager1_beta** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

File diff suppressed because it is too large Load Diff

View File

@@ -1,116 +0,0 @@
use super::*;
/// Central instance to access all AccessContextManager related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accesscontextmanager1_beta as accesscontextmanager1_beta;
/// use accesscontextmanager1_beta::api::AccessLevel;
/// use accesscontextmanager1_beta::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use accesscontextmanager1_beta::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = AccessLevel::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.access_policies().access_levels_patch(req, "name")
/// .update_mask(&Default::default())
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AccessContextManager<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AccessContextManager<S> {}
impl<'a, S> AccessContextManager<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AccessContextManager<S> {
AccessContextManager {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://accesscontextmanager.googleapis.com/".to_string(),
_root_url: "https://accesscontextmanager.googleapis.com/".to_string(),
}
}
pub fn access_policies(&'a self) -> AccessPolicyMethods<'a, S> {
AccessPolicyMethods { hub: &self }
}
pub fn operations(&'a self) -> OperationMethods<'a, S> {
OperationMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.3`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://accesscontextmanager.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://accesscontextmanager.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}

View File

@@ -1,372 +0,0 @@
use super::*;
/// A builder providing access to all methods supported on *accessPolicy* resources.
/// It is not used directly, but through the [`AccessContextManager`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accesscontextmanager1_beta as accesscontextmanager1_beta;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accesscontextmanager1_beta::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `access_levels_create(...)`, `access_levels_delete(...)`, `access_levels_get(...)`, `access_levels_list(...)`, `access_levels_patch(...)`, `create(...)`, `delete(...)`, `get(...)`, `list(...)`, `patch(...)`, `service_perimeters_create(...)`, `service_perimeters_delete(...)`, `service_perimeters_get(...)`, `service_perimeters_list(...)` and `service_perimeters_patch(...)`
/// // to build up your call.
/// let rb = hub.access_policies();
/// # }
/// ```
pub struct AccessPolicyMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessContextManager<S>,
}
impl<'a, S> client::MethodsBuilder for AccessPolicyMethods<'a, S> {}
impl<'a, S> AccessPolicyMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Create an Access Level. The longrunning operation from this RPC will have a successful status once the Access Level has propagated to long-lasting storage. Access Levels containing errors will result in an error response for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns this Access Level. Format: `accessPolicies/{policy_id}`
pub fn access_levels_create(&self, request: AccessLevel, parent: &str) -> AccessPolicyAccessLevelCreateCall<'a, S> {
AccessPolicyAccessLevelCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Delete an Access Level by resource name. The longrunning operation from this RPC will have a successful status once the Access Level has been removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Access Level. Format: `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
pub fn access_levels_delete(&self, name: &str) -> AccessPolicyAccessLevelDeleteCall<'a, S> {
AccessPolicyAccessLevelDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get an Access Level by resource name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Access Level. Format: `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
pub fn access_levels_get(&self, name: &str) -> AccessPolicyAccessLevelGetCall<'a, S> {
AccessPolicyAccessLevelGetCall {
hub: self.hub,
_name: name.to_string(),
_access_level_format: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all Access Levels for an access policy.
///
/// # Arguments
///
/// * `parent` - Required. Resource name for the access policy to list Access Levels from. Format: `accessPolicies/{policy_id}`
pub fn access_levels_list(&self, parent: &str) -> AccessPolicyAccessLevelListCall<'a, S> {
AccessPolicyAccessLevelListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_access_level_format: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Update an Access Level. The longrunning operation from this RPC will have a successful status once the changes to the Access Level have propagated to long-lasting storage. Access Levels containing errors will result in an error response for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Resource name for the `AccessLevel`. Format: `accessPolicies/{access_policy}/accessLevels/{access_level}`. The `access_level` component must begin with a letter, followed by alphanumeric characters or `_`. Its maximum length is 50 characters. After you create an `AccessLevel`, you cannot change its `name`.
pub fn access_levels_patch(&self, request: AccessLevel, name: &str) -> AccessPolicyAccessLevelPatchCall<'a, S> {
AccessPolicyAccessLevelPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Create a Service Perimeter. The longrunning operation from this RPC will have a successful status once the Service Perimeter has propagated to long-lasting storage. Service Perimeters containing errors will result in an error response for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns this Service Perimeter. Format: `accessPolicies/{policy_id}`
pub fn service_perimeters_create(&self, request: ServicePerimeter, parent: &str) -> AccessPolicyServicePerimeterCreateCall<'a, S> {
AccessPolicyServicePerimeterCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Delete a Service Perimeter by resource name. The longrunning operation from this RPC will have a successful status once the Service Perimeter has been removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Service Perimeter. Format: `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}`
pub fn service_perimeters_delete(&self, name: &str) -> AccessPolicyServicePerimeterDeleteCall<'a, S> {
AccessPolicyServicePerimeterDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get a Service Perimeter by resource name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Service Perimeter. Format: `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}`
pub fn service_perimeters_get(&self, name: &str) -> AccessPolicyServicePerimeterGetCall<'a, S> {
AccessPolicyServicePerimeterGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all Service Perimeters for an access policy.
///
/// # Arguments
///
/// * `parent` - Required. Resource name for the access policy to list Service Perimeters from. Format: `accessPolicies/{policy_id}`
pub fn service_perimeters_list(&self, parent: &str) -> AccessPolicyServicePerimeterListCall<'a, S> {
AccessPolicyServicePerimeterListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Update a Service Perimeter. The longrunning operation from this RPC will have a successful status once the changes to the Service Perimeter have propagated to long-lasting storage. Service Perimeter containing errors will result in an error response for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Resource name for the `ServicePerimeter`. Format: `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}`. The `service_perimeter` component must begin with a letter, followed by alphanumeric characters or `_`. After you create a `ServicePerimeter`, you cannot change its `name`.
pub fn service_perimeters_patch(&self, request: ServicePerimeter, name: &str) -> AccessPolicyServicePerimeterPatchCall<'a, S> {
AccessPolicyServicePerimeterPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Create an `AccessPolicy`. Fails if this organization already has a `AccessPolicy`. The longrunning Operation will have a successful status once the `AccessPolicy` has propagated to long-lasting storage. Syntactic and basic semantic errors will be returned in `metadata` as a BadRequest proto.
///
/// # Arguments
///
/// * `request` - No description provided.
pub fn create(&self, request: AccessPolicy) -> AccessPolicyCreateCall<'a, S> {
AccessPolicyCreateCall {
hub: self.hub,
_request: request,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Delete an AccessPolicy by resource name. The longrunning Operation will have a successful status once the AccessPolicy has been removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the access policy to delete. Format `accessPolicies/{policy_id}`
pub fn delete(&self, name: &str) -> AccessPolicyDeleteCall<'a, S> {
AccessPolicyDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get an AccessPolicy by name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the access policy to get. Format `accessPolicies/{policy_id}`
pub fn get(&self, name: &str) -> AccessPolicyGetCall<'a, S> {
AccessPolicyGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all AccessPolicies under a container.
pub fn list(&self) -> AccessPolicyListCall<'a, S> {
AccessPolicyListCall {
hub: self.hub,
_parent: Default::default(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Update an AccessPolicy. The longrunning Operation from this RPC will have a successful status once the changes to the AccessPolicy have propagated to long-lasting storage. Syntactic and basic semantic errors will be returned in `metadata` as a BadRequest proto.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{policy_id}`
pub fn patch(&self, request: AccessPolicy, name: &str) -> AccessPolicyPatchCall<'a, S> {
AccessPolicyPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *operation* resources.
/// It is not used directly, but through the [`AccessContextManager`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accesscontextmanager1_beta as accesscontextmanager1_beta;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accesscontextmanager1_beta::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `get(...)`
/// // to build up your call.
/// let rb = hub.operations();
/// # }
/// ```
pub struct OperationMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessContextManager<S>,
}
impl<'a, S> client::MethodsBuilder for OperationMethods<'a, S> {}
impl<'a, S> OperationMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
///
/// # Arguments
///
/// * `name` - The name of the operation resource.
pub fn get(&self, name: &str) -> OperationGetCall<'a, S> {
OperationGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -1,35 +0,0 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;
mod enums;
pub use enums::*;

View File

@@ -1,434 +0,0 @@
use super::*;
/// An `AccessLevel` is a label that can be applied to requests to Google Cloud services, along with a list of requirements necessary for the label to be applied.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [access levels create access policies](AccessPolicyAccessLevelCreateCall) (request)
/// * [access levels get access policies](AccessPolicyAccessLevelGetCall) (response)
/// * [access levels patch access policies](AccessPolicyAccessLevelPatchCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessLevel {
/// A `BasicLevel` composed of `Conditions`.
pub basic: Option<BasicLevel>,
/// A `CustomLevel` written in the Common Expression Language.
pub custom: Option<CustomLevel>,
/// Description of the `AccessLevel` and its use. Does not affect behavior.
pub description: Option<String>,
/// Resource name for the `AccessLevel`. Format: `accessPolicies/{access_policy}/accessLevels/{access_level}`. The `access_level` component must begin with a letter, followed by alphanumeric characters or `_`. Its maximum length is 50 characters. After you create an `AccessLevel`, you cannot change its `name`.
pub name: Option<String>,
/// Human readable title. Must be unique within the Policy.
pub title: Option<String>,
}
impl client::RequestValue for AccessLevel {}
impl client::ResponseResult for AccessLevel {}
/// `AccessPolicy` is a container for `AccessLevels` (which define the necessary attributes to use Google Cloud services) and `ServicePerimeters` (which define regions of services able to freely pass data within a perimeter). An access policy is globally visible within an organization, and the restrictions it specifies apply to all projects within an organization.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [create access policies](AccessPolicyCreateCall) (request)
/// * [get access policies](AccessPolicyGetCall) (response)
/// * [patch access policies](AccessPolicyPatchCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessPolicy {
/// Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{policy_id}`
pub name: Option<String>,
/// Required. The parent of this `AccessPolicy` in the Cloud Resource Hierarchy. Currently immutable once created. Format: `organizations/{organization_id}`
pub parent: Option<String>,
/// Required. Human readable title. Does not affect behavior.
pub title: Option<String>,
}
impl client::RequestValue for AccessPolicy {}
impl client::ResponseResult for AccessPolicy {}
/// `BasicLevel` is an `AccessLevel` using a set of recommended features.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BasicLevel {
/// How the `conditions` list should be combined to determine if a request is granted this `AccessLevel`. If AND is used, each `Condition` in `conditions` must be satisfied for the `AccessLevel` to be applied. If OR is used, at least one `Condition` in `conditions` must be satisfied for the `AccessLevel` to be applied. Default behavior is AND.
#[serde(rename="combiningFunction")]
pub combining_function: Option<BasicLevelCombiningFunctionEnum>,
/// Required. A list of requirements for the `AccessLevel` to be granted.
pub conditions: Option<Vec<Condition>>,
}
impl client::Part for BasicLevel {}
/// A condition necessary for an `AccessLevel` to be granted. The Condition is an AND over its fields. So a Condition is true if: 1) the request IP is from one of the listed subnetworks AND 2) the originating device complies with the listed device policy AND 3) all listed access levels are granted AND 4) the request was sent at a time allowed by the DateTimeRestriction.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Condition {
/// Device specific restrictions, all restrictions must hold for the Condition to be true. If not specified, all devices are allowed.
#[serde(rename="devicePolicy")]
pub device_policy: Option<DevicePolicy>,
/// CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for a CIDR IP address block, the specified IP address portion must be properly truncated (i.e. all the host bits must be zero) or the input is considered malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas "2001:db8::1/32" is not. The originating IP of a request must be in one of the listed subnets in order for this Condition to be true. If empty, all IP addresses are allowed.
#[serde(rename="ipSubnetworks")]
pub ip_subnetworks: Option<Vec<String>>,
/// The request must be made by one of the provided user or service accounts. Groups are not supported. Syntax: `user:{emailid}` `serviceAccount:{emailid}` If not specified, a request may come from any user.
pub members: Option<Vec<String>>,
/// Whether to negate the Condition. If true, the Condition becomes a NAND over its non-empty fields, each field must be false for the Condition overall to be satisfied. Defaults to false.
pub negate: Option<bool>,
/// The request must originate from one of the provided countries/regions. Must be valid ISO 3166-1 alpha-2 codes.
pub regions: Option<Vec<String>>,
/// A list of other access levels defined in the same `Policy`, referenced by resource name. Referencing an `AccessLevel` which does not exist is an error. All access levels listed must be granted for the Condition to be true. Example: "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
#[serde(rename="requiredAccessLevels")]
pub required_access_levels: Option<Vec<String>>,
}
impl client::Part for Condition {}
/// `CustomLevel` is an `AccessLevel` using the Cloud Common Expression Language to represent the necessary conditions for the level to apply to a request. See CEL spec at: https://github.com/google/cel-spec
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct CustomLevel {
/// Required. A Cloud CEL expression evaluating to a boolean.
pub expr: Option<Expr>,
}
impl client::Part for CustomLevel {}
/// `DevicePolicy` specifies device specific restrictions necessary to acquire a given access level. A `DevicePolicy` specifies requirements for requests from devices to be granted access levels, it does not do any enforcement on the device. `DevicePolicy` acts as an AND over all specified fields, and each repeated field is an OR over its elements. Any unset fields are ignored. For example, if the proto is { os_type : DESKTOP_WINDOWS, os_type : DESKTOP_LINUX, encryption_status: ENCRYPTED}, then the DevicePolicy will be true for requests originating from encrypted Linux desktops and encrypted Windows desktops.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DevicePolicy {
/// Allowed device management levels, an empty list allows all management levels.
#[serde(rename="allowedDeviceManagementLevels")]
pub allowed_device_management_levels: Option<Vec<DevicePolicyAllowedDeviceManagementLevelsEnum>>,
/// Allowed encryptions statuses, an empty list allows all statuses.
#[serde(rename="allowedEncryptionStatuses")]
pub allowed_encryption_statuses: Option<Vec<DevicePolicyAllowedEncryptionStatusesEnum>>,
/// Allowed OS versions, an empty list allows all types and all versions.
#[serde(rename="osConstraints")]
pub os_constraints: Option<Vec<OsConstraint>>,
/// Whether the device needs to be approved by the customer admin.
#[serde(rename="requireAdminApproval")]
pub require_admin_approval: Option<bool>,
/// Whether the device needs to be corp owned.
#[serde(rename="requireCorpOwned")]
pub require_corp_owned: Option<bool>,
/// Whether or not screenlock is required for the DevicePolicy to be true. Defaults to `false`.
#[serde(rename="requireScreenlock")]
pub require_screenlock: Option<bool>,
}
impl client::Part for DevicePolicy {}
/// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Expr {
/// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
pub description: Option<String>,
/// Textual representation of an expression in Common Expression Language syntax.
pub expression: Option<String>,
/// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
pub location: Option<String>,
/// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
pub title: Option<String>,
}
impl client::Part for Expr {}
/// A response to `ListAccessLevelsRequest`.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [access levels list access policies](AccessPolicyAccessLevelListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListAccessLevelsResponse {
/// List of the Access Level instances.
#[serde(rename="accessLevels")]
pub access_levels: Option<Vec<AccessLevel>>,
/// The pagination token to retrieve the next page of results. If the value is empty, no further results remain.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListAccessLevelsResponse {}
/// A response to `ListAccessPoliciesRequest`.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [list access policies](AccessPolicyListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListAccessPoliciesResponse {
/// List of the AccessPolicy instances.
#[serde(rename="accessPolicies")]
pub access_policies: Option<Vec<AccessPolicy>>,
/// The pagination token to retrieve the next page of results. If the value is empty, no further results remain.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListAccessPoliciesResponse {}
/// A response to `ListServicePerimetersRequest`.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [service perimeters list access policies](AccessPolicyServicePerimeterListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListServicePerimetersResponse {
/// The pagination token to retrieve the next page of results. If the value is empty, no further results remain.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
/// List of the Service Perimeter instances.
#[serde(rename="servicePerimeters")]
pub service_perimeters: Option<Vec<ServicePerimeter>>,
}
impl client::ResponseResult for ListServicePerimetersResponse {}
/// This resource represents a long-running operation that is the result of a network API call.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [access levels create access policies](AccessPolicyAccessLevelCreateCall) (response)
/// * [access levels delete access policies](AccessPolicyAccessLevelDeleteCall) (response)
/// * [access levels patch access policies](AccessPolicyAccessLevelPatchCall) (response)
/// * [service perimeters create access policies](AccessPolicyServicePerimeterCreateCall) (response)
/// * [service perimeters delete access policies](AccessPolicyServicePerimeterDeleteCall) (response)
/// * [service perimeters patch access policies](AccessPolicyServicePerimeterPatchCall) (response)
/// * [create access policies](AccessPolicyCreateCall) (response)
/// * [delete access policies](AccessPolicyDeleteCall) (response)
/// * [patch access policies](AccessPolicyPatchCall) (response)
/// * [get operations](OperationGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Operation {
/// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
pub done: Option<bool>,
/// The error result of the operation in case of failure or cancellation.
pub error: Option<Status>,
/// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
pub metadata: Option<HashMap<String, json::Value>>,
/// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
pub name: Option<String>,
/// The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
pub response: Option<HashMap<String, json::Value>>,
}
impl client::Resource for Operation {}
impl client::ResponseResult for Operation {}
/// A restriction on the OS type and version of devices making requests.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct OsConstraint {
/// The minimum allowed OS version. If not set, any version of this OS satisfies the constraint. Format: `"major.minor.patch"`. Examples: `"10.5.301"`, `"9.2.1"`.
#[serde(rename="minimumVersion")]
pub minimum_version: Option<String>,
/// Required. The allowed OS type.
#[serde(rename="osType")]
pub os_type: Option<OsConstraintOsTypeEnum>,
/// Only allows requests from devices with a verified Chrome OS. Verifications includes requirements that the device is enterprise-managed, conformant to domain policies, and the caller has permission to call the API targeted by the request.
#[serde(rename="requireVerifiedChromeOs")]
pub require_verified_chrome_os: Option<bool>,
}
impl client::Part for OsConstraint {}
/// `ServicePerimeter` describes a set of Google Cloud resources which can freely import and export data amongst themselves, but not export outside of the `ServicePerimeter`. If a request with a source within this `ServicePerimeter` has a target outside of the `ServicePerimeter`, the request will be blocked. Otherwise the request is allowed. There are two types of Service Perimeter - Regular and Bridge. Regular Service Perimeters cannot overlap, a single Google Cloud project can only belong to a single regular Service Perimeter. Service Perimeter Bridges can contain only Google Cloud projects as members, a single Google Cloud project may belong to multiple Service Perimeter Bridges.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [service perimeters create access policies](AccessPolicyServicePerimeterCreateCall) (request)
/// * [service perimeters get access policies](AccessPolicyServicePerimeterGetCall) (response)
/// * [service perimeters patch access policies](AccessPolicyServicePerimeterPatchCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ServicePerimeter {
/// Description of the `ServicePerimeter` and its use. Does not affect behavior.
pub description: Option<String>,
/// Resource name for the `ServicePerimeter`. Format: `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}`. The `service_perimeter` component must begin with a letter, followed by alphanumeric characters or `_`. After you create a `ServicePerimeter`, you cannot change its `name`.
pub name: Option<String>,
/// Perimeter type indicator. A single project is allowed to be a member of single regular perimeter, but multiple service perimeter bridges. A project cannot be a included in a perimeter bridge without being included in regular perimeter. For perimeter bridges, restricted/unrestricted service lists as well as access lists must be empty.
#[serde(rename="perimeterType")]
pub perimeter_type: Option<ServicePerimeterPerimeterTypeEnum>,
/// Current ServicePerimeter configuration. Specifies sets of resources, restricted/unrestricted services and access levels that determine perimeter content and boundaries.
pub status: Option<ServicePerimeterConfig>,
/// Human readable title. Must be unique within the Policy.
pub title: Option<String>,
}
impl client::RequestValue for ServicePerimeter {}
impl client::ResponseResult for ServicePerimeter {}
/// `ServicePerimeterConfig` specifies a set of Google Cloud resources that describe specific Service Perimeter configuration.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ServicePerimeterConfig {
/// A list of `AccessLevel` resource names that allow resources within the `ServicePerimeter` to be accessed from the internet. `AccessLevels` listed must be in the same policy as this `ServicePerimeter`. Referencing a nonexistent `AccessLevel` is a syntax error. If no `AccessLevel` names are listed, resources within the perimeter can only be accessed via Google Cloud calls with request origins within the perimeter. Example: `"accessPolicies/MY_POLICY/accessLevels/MY_LEVEL"`. For Service Perimeter Bridge, must be empty.
#[serde(rename="accessLevels")]
pub access_levels: Option<Vec<String>>,
/// A list of Google Cloud resources that are inside of the service perimeter. Currently only projects are allowed. Format: `projects/{project_number}`
pub resources: Option<Vec<String>>,
/// Google Cloud services that are subject to the Service Perimeter restrictions. Must contain a list of services. For example, if `storage.googleapis.com` is specified, access to the storage buckets inside the perimeter must meet the perimeter's access restrictions.
#[serde(rename="restrictedServices")]
pub restricted_services: Option<Vec<String>>,
/// Google Cloud services that are not subject to the Service Perimeter restrictions. Deprecated. Must be set to a single wildcard "*". The wildcard means that unless explicitly specified by "restricted_services" list, any service is treated as unrestricted.
#[serde(rename="unrestrictedServices")]
pub unrestricted_services: Option<Vec<String>>,
/// Beta. Configuration for APIs allowed within Perimeter.
#[serde(rename="vpcAccessibleServices")]
pub vpc_accessible_services: Option<VpcAccessibleServices>,
}
impl client::Part for ServicePerimeterConfig {}
/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Status {
/// The status code, which should be an enum value of google.rpc.Code.
pub code: Option<i32>,
/// A list of messages that carry the error details. There is a common set of message types for APIs to use.
pub details: Option<Vec<HashMap<String, json::Value>>>,
/// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
pub message: Option<String>,
}
impl client::Part for Status {}
/// Specifies how APIs are allowed to communicate within the Service Perimeter.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct VpcAccessibleServices {
/// The list of APIs usable within the Service Perimeter. Must be empty unless 'enable_restriction' is True. You can specify a list of individual services, as well as include the 'RESTRICTED-SERVICES' value, which automatically includes all of the services protected by the perimeter.
#[serde(rename="allowedServices")]
pub allowed_services: Option<Vec<String>>,
/// Whether to restrict API calls within the Service Perimeter to the list of APIs specified in 'allowed_services'.
#[serde(rename="enableRestriction")]
pub enable_restriction: Option<bool>,
}
impl client::Part for VpcAccessibleServices {}

View File

@@ -1,24 +0,0 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
CloudPlatform,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::CloudPlatform
}
}

View File

@@ -1,215 +0,0 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Access Context Manager* crate version *5.0.4+20230123*, where *20230123* is the exact revision of the *accesscontextmanager:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Access Context Manager* *v1_beta* API can be found at the
//! [official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1_beta).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AccessContextManager) ...
//!
//! * [access policies](api::AccessPolicy)
//! * [*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)
//! * [operations](api::Operation)
//! * [*get*](api::OperationGetCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AccessContextManager)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.access_policies().access_levels_create(...).doit().await
//! let r = hub.access_policies().access_levels_delete(...).doit().await
//! let r = hub.access_policies().access_levels_patch(...).doit().await
//! let r = hub.access_policies().service_perimeters_create(...).doit().await
//! let r = hub.access_policies().service_perimeters_delete(...).doit().await
//! let r = hub.access_policies().service_perimeters_patch(...).doit().await
//! let r = hub.access_policies().create(...).doit().await
//! let r = hub.access_policies().delete(...).doit().await
//! let r = hub.access_policies().patch(...).doit().await
//! let r = hub.operations().get(...).doit().await
//! ```
//!
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
//! The `doit()` method performs the actual communication with the server and returns the respective result.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-accesscontextmanager1_beta = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_accesscontextmanager1_beta as accesscontextmanager1_beta;
//! use accesscontextmanager1_beta::api::AccessLevel;
//! use accesscontextmanager1_beta::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use accesscontextmanager1_beta::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // As the method needs a request, you would usually fill it with the desired information
//! // into the respective structure. Some of the parts shown here might not be applicable !
//! // Values shown here are possibly random and not representative !
//! let mut req = AccessLevel::default();
//!
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.access_policies().access_levels_patch(req, "name")
//! .update_mask(&Default::default())
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
//! makes the system potentially resilient to all kinds of errors.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), it will return that by default.
//! 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
//! the server to indicate either the set parts of the request or the desired parts in the response.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
//! These will always take a single argument, for which the following statements are true.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
//!
//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// Unused attributes happen thanks to defined, but unused structures
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
// unused imports in fully featured APIs. Same with unused_mut ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AccessContextManager;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -1,42 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-adexchangebuyer1d3-cli"
version = "5.0.4+20210330"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer1d3-cli"
homepage = "https://developers.google.com/ad-exchange/buyer-rest"
documentation = "http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli"
license = "MIT"
keywords = ["adexchangebuyer", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "adexchangebuyer1d3"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-adexchangebuyer1d3]
path = "../adexchangebuyer1d3"
version = "5.0.4+20210330"

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,131 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `adexchangebuyer1d3` command-line interface *(CLI)* allows to use most features of the *Google Ad Exchange Buyer* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Ad Exchange Buyer* API can be found at the
[official documentation site](https://developers.google.com/ad-exchange/buyer-rest).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-adexchangebuyer1d3-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer1d3-cli).
# Usage
This documentation was generated from the *Ad Exchange Buyer* API at revision *20210330*. The CLI is at version *5.0.4*.
```bash
adexchangebuyer1d3 [options]
accounts
get <id> [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <id> (-r <kv>)... [-p <v>]... [-o <out>]
update <id> (-r <kv>)... [-p <v>]... [-o <out>]
billing-info
get <account-id> [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
budget
get <account-id> <billing-id> [-p <v>]... [-o <out>]
patch <account-id> <billing-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <account-id> <billing-id> (-r <kv>)... [-p <v>]... [-o <out>]
creatives
get <account-id> <buyer-creative-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
direct-deals
get <id> [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
performance-report
list <account-id> <end-date-time> <start-date-time> [-p <v>]... [-o <out>]
pretargeting-config
delete <account-id> <config-id> [-p <v>]...
get <account-id> <config-id> [-p <v>]... [-o <out>]
insert <account-id> (-r <kv>)... [-p <v>]... [-o <out>]
list <account-id> [-p <v>]... [-o <out>]
patch <account-id> <config-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <account-id> <config-id> (-r <kv>)... [-p <v>]... [-o <out>]
adexchangebuyer1d3 --help
Configuration:
[--scope <url>]...
Specify the authentication a method should be executed in. Each scope
requires the user to grant this application permission to use it.
If unset, it defaults to the shortest scope url for a particular method.
--config-dir <folder>
A directory into which we will store our persistent data. Defaults to
a user-writable directory that we will create during the first invocation.
[default: ~/.google-service-cli]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `adexchangebuyer1d3-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/adexchangebuyer1d3-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/adexchangebuyer1d3-secret.json`, assuming that the required *adexchangebuyer* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `adexchangebuyer1d3 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -1,44 +0,0 @@
site_name: Ad Exchange Buyer v5.0.4+20210330
site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3-cli
site_description: A complete library to interact with Ad Exchange Buyer (protocol v1.3)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer1d3-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Accounts':
- 'Get': 'accounts_get.md'
- 'List': 'accounts_list.md'
- 'Patch': 'accounts_patch.md'
- 'Update': 'accounts_update.md'
- 'Billing Info':
- 'Get': 'billing-info_get.md'
- 'List': 'billing-info_list.md'
- 'Budget':
- 'Get': 'budget_get.md'
- 'Patch': 'budget_patch.md'
- 'Update': 'budget_update.md'
- 'Creatives':
- 'Get': 'creatives_get.md'
- 'Insert': 'creatives_insert.md'
- 'List': 'creatives_list.md'
- 'Direct Deals':
- 'Get': 'direct-deals_get.md'
- 'List': 'direct-deals_list.md'
- 'Performance Report':
- 'List': 'performance-report_list.md'
- 'Pretargeting Config':
- 'Delete': 'pretargeting-config_delete.md'
- 'Get': 'pretargeting-config_get.md'
- 'Insert': 'pretargeting-config_insert.md'
- 'List': 'pretargeting-config_list.md'
- 'Patch': 'pretargeting-config_patch.md'
- 'Update': 'pretargeting-config_update.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -1,37 +0,0 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-adexchangebuyer1d3"
version = "5.0.4+20210330"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer1d3"
homepage = "https://developers.google.com/ad-exchange/buyer-rest"
documentation = "https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330"
license = "MIT"
keywords = ["adexchangebuyer", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -1,30 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,198 +0,0 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-adexchangebuyer1d3` library allows access to all features of the *Google Ad Exchange Buyer* service.
This documentation was generated from *Ad Exchange Buyer* crate version *5.0.4+20210330*, where *20210330* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the
[official documentation site](https://developers.google.com/ad-exchange/buyer-rest).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/AdExchangeBuyer) ...
* [accounts](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::Account)
* [*get*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::AccountGetCall), [*list*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::AccountListCall), [*patch*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::AccountPatchCall) and [*update*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::AccountUpdateCall)
* [billing info](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::BillingInfo)
* [*get*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::BillingInfoGetCall) and [*list*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::BillingInfoListCall)
* [budget](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::Budget)
* [*get*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::BudgetGetCall), [*patch*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::BudgetPatchCall) and [*update*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::BudgetUpdateCall)
* [creatives](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::Creative)
* [*get*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::CreativeGetCall), [*insert*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::CreativeInsertCall) and [*list*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::CreativeListCall)
* [direct deals](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::DirectDeal)
* [*get*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::DirectDealGetCall) and [*list*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::DirectDealListCall)
* [performance report](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PerformanceReport)
* [*list*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PerformanceReportListCall)
* [pretargeting config](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfig)
* [*delete*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfigDeleteCall), [*get*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfigGetCall), [*insert*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfigInsertCall), [*list*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfigListCall), [*patch*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfigPatchCall) and [*update*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfigUpdateCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/AdExchangeBuyer)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::CallBuilder)
* **[Resources](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.pretargeting_config().get(...).doit().await
let r = hub.pretargeting_config().insert(...).doit().await
let r = hub.pretargeting_config().patch(...).doit().await
let r = hub.pretargeting_config().update(...).doit().await
```
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
The `doit()` method performs the actual communication with the server and returns the respective result.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-adexchangebuyer1d3 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_adexchangebuyer1d3 as adexchangebuyer1d3;
use adexchangebuyer1d3::api::PretargetingConfig;
use adexchangebuyer1d3::{Result, Error};
use std::default::Default;
use adexchangebuyer1d3::{AdExchangeBuyer, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AdExchangeBuyer::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = PretargetingConfig::default();
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.pretargeting_config().patch(req, -22, -33)
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
makes the system potentially resilient to all kinds of errors.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::ResponseResult), it will return that by default.
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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Delegate) to the
[Method Builder](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::RequestValue) and
[decodable](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Part) which are identifiable by name, which will be sent to
the server to indicate either the set parts of the request or the desired parts in the response.
## Builder Arguments
Using [method builders](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
These will always take a single argument, for which the following statements are true.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::RequestValue) are moved
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **adexchangebuyer1d3** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More