mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2025-12-30 08:08:50 +01:00
12321 lines
548 KiB
Rust
12321 lines
548 KiB
Rust
// DO NOT EDIT !
|
|
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
|
|
// DO NOT EDIT !
|
|
|
|
//! This documentation was generated from *Bigtable Admin* crate version *1.0.11+20190506*, where *20190506* is the exact revision of the *bigtableadmin:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.11*.
|
|
//!
|
|
//! Everything else about the *Bigtable Admin* *v2* API can be found at the
|
|
//! [official documentation site](https://cloud.google.com/bigtable/).
|
|
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/bigtableadmin2).
|
|
//! # Features
|
|
//!
|
|
//! Handle the following *Resources* with ease from the central [hub](struct.BigtableAdmin.html) ...
|
|
//!
|
|
//! * [operations](struct.Operation.html)
|
|
//! * [*cancel*](struct.OperationCancelCall.html), [*delete*](struct.OperationDeleteCall.html), [*get*](struct.OperationGetCall.html) and [*projects operations list*](struct.OperationProjectOperationListCall.html)
|
|
//! * projects
|
|
//! * [*instances app profiles create*](struct.ProjectInstanceAppProfileCreateCall.html), [*instances app profiles delete*](struct.ProjectInstanceAppProfileDeleteCall.html), [*instances app profiles get*](struct.ProjectInstanceAppProfileGetCall.html), [*instances app profiles list*](struct.ProjectInstanceAppProfileListCall.html), [*instances app profiles patch*](struct.ProjectInstanceAppProfilePatchCall.html), [*instances clusters create*](struct.ProjectInstanceClusterCreateCall.html), [*instances clusters delete*](struct.ProjectInstanceClusterDeleteCall.html), [*instances clusters get*](struct.ProjectInstanceClusterGetCall.html), [*instances clusters list*](struct.ProjectInstanceClusterListCall.html), [*instances clusters update*](struct.ProjectInstanceClusterUpdateCall.html), [*instances create*](struct.ProjectInstanceCreateCall.html), [*instances delete*](struct.ProjectInstanceDeleteCall.html), [*instances get*](struct.ProjectInstanceGetCall.html), [*instances get iam policy*](struct.ProjectInstanceGetIamPolicyCall.html), [*instances list*](struct.ProjectInstanceListCall.html), [*instances partial update instance*](struct.ProjectInstancePartialUpdateInstanceCall.html), [*instances set iam policy*](struct.ProjectInstanceSetIamPolicyCall.html), [*instances tables check consistency*](struct.ProjectInstanceTableCheckConsistencyCall.html), [*instances tables create*](struct.ProjectInstanceTableCreateCall.html), [*instances tables delete*](struct.ProjectInstanceTableDeleteCall.html), [*instances tables drop row range*](struct.ProjectInstanceTableDropRowRangeCall.html), [*instances tables generate consistency token*](struct.ProjectInstanceTableGenerateConsistencyTokenCall.html), [*instances tables get*](struct.ProjectInstanceTableGetCall.html), [*instances tables get iam policy*](struct.ProjectInstanceTableGetIamPolicyCall.html), [*instances tables list*](struct.ProjectInstanceTableListCall.html), [*instances tables modify column families*](struct.ProjectInstanceTableModifyColumnFamilyCall.html), [*instances tables set iam policy*](struct.ProjectInstanceTableSetIamPolicyCall.html), [*instances tables test iam permissions*](struct.ProjectInstanceTableTestIamPermissionCall.html), [*instances test iam permissions*](struct.ProjectInstanceTestIamPermissionCall.html), [*instances update*](struct.ProjectInstanceUpdateCall.html), [*locations get*](struct.ProjectLocationGetCall.html) and [*locations list*](struct.ProjectLocationListCall.html)
|
|
//!
|
|
//!
|
|
//!
|
|
//!
|
|
//! 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](struct.BigtableAdmin.html)**
|
|
//! * a central object to maintain state and allow accessing all *Activities*
|
|
//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn
|
|
//! allow access to individual [*Call Builders*](trait.CallBuilder.html)
|
|
//! * **[Resources](trait.Resource.html)**
|
|
//! * primary types that you can apply *Activities* to
|
|
//! * a collection of properties and *Parts*
|
|
//! * **[Parts](trait.Part.html)**
|
|
//! * a collection of properties
|
|
//! * never directly used in *Activities*
|
|
//! * **[Activities](trait.CallBuilder.html)**
|
|
//! * 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()
|
|
//! ```
|
|
//!
|
|
//! Or specifically ...
|
|
//!
|
|
//! ```ignore
|
|
//! let r = hub.operations().projects_operations_list(...).doit()
|
|
//! let r = hub.operations().delete(...).doit()
|
|
//! let r = hub.operations().get(...).doit()
|
|
//! let r = hub.projects().instances_create(...).doit()
|
|
//! let r = hub.operations().cancel(...).doit()
|
|
//! let r = hub.projects().instances_app_profiles_patch(...).doit()
|
|
//! let r = hub.projects().instances_partial_update_instance(...).doit()
|
|
//! let r = hub.projects().instances_clusters_create(...).doit()
|
|
//! let r = hub.projects().instances_clusters_update(...).doit()
|
|
//! ```
|
|
//!
|
|
//! 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-bigtableadmin2 = "*"
|
|
//! # This project intentionally uses an old version of Hyper. See
|
|
//! # https://github.com/Byron/google-apis-rs/issues/173 for more
|
|
//! # information.
|
|
//! hyper = "^0.10"
|
|
//! hyper-rustls = "^0.6"
|
|
//! serde = "^1.0"
|
|
//! serde_json = "^1.0"
|
|
//! yup-oauth2 = "^1.0"
|
|
//! ```
|
|
//!
|
|
//! ## A complete example
|
|
//!
|
|
//! ```test_harness,no_run
|
|
//! extern crate hyper;
|
|
//! extern crate hyper_rustls;
|
|
//! extern crate yup_oauth2 as oauth2;
|
|
//! extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
//! use bigtableadmin2::{Result, Error};
|
|
//! # #[test] fn egal() {
|
|
//! use std::default::Default;
|
|
//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
//! use bigtableadmin2::BigtableAdmin;
|
|
//!
|
|
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
|
|
//! // `client_secret`, among other things.
|
|
//! let secret: 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 = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
//! <MemoryStorage as Default>::default(), None);
|
|
//! let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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().projects_operations_list("name")
|
|
//! .page_token("dolores")
|
|
//! .page_size(-63)
|
|
//! .filter("accusam")
|
|
//! .doit();
|
|
//!
|
|
//! 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::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](enum.Result.html) enumeration as return value of
|
|
//! the doit() methods, or handed as possibly intermediate results to either the
|
|
//! [Hub Delegate](trait.Delegate.html), 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](enum.Result.html), should be
|
|
//! read by you to obtain the media.
|
|
//! If such a method also supports a [Response Result](trait.ResponseResult.html), 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](trait.Delegate.html) to the
|
|
//! [Method Builder](trait.CallBuilder.html) 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](trait.Delegate.html) 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 [enocodable](trait.RequestValue.html) and
|
|
//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
|
|
//! are valid.
|
|
//! Most optionals are are considered [Parts](trait.Part.html) 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](trait.CallBuilder.html), 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](trait.RequestValue.html) 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/mako/api/lib.rs.mako'
|
|
// DO NOT EDIT !
|
|
|
|
#[macro_use]
|
|
extern crate serde_derive;
|
|
|
|
extern crate hyper;
|
|
extern crate serde;
|
|
extern crate serde_json;
|
|
extern crate yup_oauth2 as oauth2;
|
|
extern crate mime;
|
|
extern crate url;
|
|
|
|
mod cmn;
|
|
|
|
use std::collections::HashMap;
|
|
use std::cell::RefCell;
|
|
use std::borrow::BorrowMut;
|
|
use std::default::Default;
|
|
use std::collections::BTreeMap;
|
|
use serde_json as json;
|
|
use std::io;
|
|
use std::fs;
|
|
use std::mem;
|
|
use std::thread::sleep;
|
|
use std::time::Duration;
|
|
|
|
pub use cmn::*;
|
|
|
|
|
|
// ##############
|
|
// UTILITIES ###
|
|
// ############
|
|
|
|
/// 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)]
|
|
pub enum Scope {
|
|
/// Administer your Cloud Bigtable tables and clusters
|
|
CloudBigtableAdmin,
|
|
|
|
/// Administer your Cloud Bigtable tables and clusters
|
|
BigtableAdmin,
|
|
|
|
/// View your data across Google Cloud Platform services
|
|
CloudPlatformReadOnly,
|
|
|
|
/// View and manage your data across Google Cloud Platform services
|
|
CloudPlatform,
|
|
|
|
/// Administer your Cloud Bigtable tables
|
|
CloudBigtableAdminTable,
|
|
|
|
/// Administer your Cloud Bigtable clusters
|
|
BigtableAdminCluster,
|
|
|
|
/// Administer your Cloud Bigtable clusters
|
|
CloudBigtableAdminCluster,
|
|
|
|
/// Administer your Cloud Bigtable tables
|
|
BigtableAdminTable,
|
|
|
|
/// Administer your Cloud Bigtable clusters
|
|
BigtableAdminInstance,
|
|
}
|
|
|
|
impl AsRef<str> for Scope {
|
|
fn as_ref(&self) -> &str {
|
|
match *self {
|
|
Scope::CloudBigtableAdmin => "https://www.googleapis.com/auth/cloud-bigtable.admin",
|
|
Scope::BigtableAdmin => "https://www.googleapis.com/auth/bigtable.admin",
|
|
Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only",
|
|
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
|
|
Scope::CloudBigtableAdminTable => "https://www.googleapis.com/auth/cloud-bigtable.admin.table",
|
|
Scope::BigtableAdminCluster => "https://www.googleapis.com/auth/bigtable.admin.cluster",
|
|
Scope::CloudBigtableAdminCluster => "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
|
|
Scope::BigtableAdminTable => "https://www.googleapis.com/auth/bigtable.admin.table",
|
|
Scope::BigtableAdminInstance => "https://www.googleapis.com/auth/bigtable.admin.instance",
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Default for Scope {
|
|
fn default() -> Scope {
|
|
Scope::BigtableAdmin
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ########
|
|
// HUB ###
|
|
// ######
|
|
|
|
/// Central instance to access all BigtableAdmin related resource activities
|
|
///
|
|
/// # Examples
|
|
///
|
|
/// Instantiate a new hub
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// extern crate hyper;
|
|
/// extern crate hyper_rustls;
|
|
/// extern crate yup_oauth2 as oauth2;
|
|
/// extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::{Result, Error};
|
|
/// # #[test] fn egal() {
|
|
/// use std::default::Default;
|
|
/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
|
|
/// // `client_secret`, among other things.
|
|
/// let secret: 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 = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// <MemoryStorage as Default>::default(), None);
|
|
/// let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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().projects_operations_list("name")
|
|
/// .page_token("justo")
|
|
/// .page_size(-1)
|
|
/// .filter("erat")
|
|
/// .doit();
|
|
///
|
|
/// 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::MissingAPIKey
|
|
/// |Error::MissingToken(_)
|
|
/// |Error::Cancelled
|
|
/// |Error::UploadSizeLimitExceeded(_, _)
|
|
/// |Error::Failure(_)
|
|
/// |Error::BadRequest(_)
|
|
/// |Error::FieldClash(_)
|
|
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
|
|
/// },
|
|
/// Ok(res) => println!("Success: {:?}", res),
|
|
/// }
|
|
/// # }
|
|
/// ```
|
|
pub struct BigtableAdmin<C, A> {
|
|
client: RefCell<C>,
|
|
auth: RefCell<A>,
|
|
_user_agent: String,
|
|
_base_url: String,
|
|
_root_url: String,
|
|
}
|
|
|
|
impl<'a, C, A> Hub for BigtableAdmin<C, A> {}
|
|
|
|
impl<'a, C, A> BigtableAdmin<C, A>
|
|
where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
pub fn new(client: C, authenticator: A) -> BigtableAdmin<C, A> {
|
|
BigtableAdmin {
|
|
client: RefCell::new(client),
|
|
auth: RefCell::new(authenticator),
|
|
_user_agent: "google-api-rust-client/1.0.11".to_string(),
|
|
_base_url: "https://bigtableadmin.googleapis.com/".to_string(),
|
|
_root_url: "https://bigtableadmin.googleapis.com/".to_string(),
|
|
}
|
|
}
|
|
|
|
pub fn operations(&'a self) -> OperationMethods<'a, C, A> {
|
|
OperationMethods { hub: &self }
|
|
}
|
|
pub fn projects(&'a self) -> ProjectMethods<'a, C, A> {
|
|
ProjectMethods { hub: &self }
|
|
}
|
|
|
|
/// Set the user-agent header field to use in all requests to the server.
|
|
/// It defaults to `google-api-rust-client/1.0.11`.
|
|
///
|
|
/// 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://bigtableadmin.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://bigtableadmin.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 ###
|
|
// ##########
|
|
/// Request message for
|
|
/// google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances tables check consistency projects](struct.ProjectInstanceTableCheckConsistencyCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct CheckConsistencyRequest {
|
|
/// The token created using GenerateConsistencyToken for the Table.
|
|
#[serde(rename="consistencyToken")]
|
|
pub consistency_token: Option<String>,
|
|
}
|
|
|
|
impl RequestValue for CheckConsistencyRequest {}
|
|
|
|
|
|
/// Response message for BigtableInstanceAdmin.ListInstances.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances list projects](struct.ProjectInstanceListCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListInstancesResponse {
|
|
/// DEPRECATED: This field is unused and ignored.
|
|
#[serde(rename="nextPageToken")]
|
|
pub next_page_token: Option<String>,
|
|
/// The list of requested instances.
|
|
pub instances: Option<Vec<Instance>>,
|
|
/// Locations from which Instance information could not be retrieved,
|
|
/// due to an outage or some other transient condition.
|
|
/// Instances whose Clusters are all in one of the failed locations
|
|
/// may be missing from `instances`, and Instances with at least one
|
|
/// Cluster in a failed location may only have partial information returned.
|
|
/// Values are of the form `projects/<project>/locations/<zone_id>`
|
|
#[serde(rename="failedLocations")]
|
|
pub failed_locations: Option<Vec<String>>,
|
|
}
|
|
|
|
impl ResponseResult for ListInstancesResponse {}
|
|
|
|
|
|
/// Request message for `SetIamPolicy` method.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances tables set iam policy projects](struct.ProjectInstanceTableSetIamPolicyCall.html) (request)
|
|
/// * [instances set iam policy projects](struct.ProjectInstanceSetIamPolicyCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct SetIamPolicyRequest {
|
|
/// REQUIRED: The complete policy to be applied to the `resource`. The size of
|
|
/// the policy is limited to a few 10s of KB. An empty policy is a
|
|
/// valid policy but certain Cloud Platform services (such as Projects)
|
|
/// might reject them.
|
|
pub policy: Option<Policy>,
|
|
/// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
|
|
/// the fields in the mask will be modified. If no mask is provided, the
|
|
/// following default mask is used:
|
|
/// paths: "bindings, etag"
|
|
/// This field is only used by Cloud IAM.
|
|
#[serde(rename="updateMask")]
|
|
pub update_mask: Option<String>,
|
|
}
|
|
|
|
impl RequestValue for SetIamPolicyRequest {}
|
|
|
|
|
|
/// A GcRule which deletes cells matching any of the given rules.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Union {
|
|
/// Delete cells which would be deleted by any element of `rules`.
|
|
pub rules: Option<Vec<GcRule>>,
|
|
}
|
|
|
|
impl Part for Union {}
|
|
|
|
|
|
/// Associates `members` with a `role`.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Binding {
|
|
/// Role that is assigned to `members`.
|
|
/// For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
|
|
pub role: Option<String>,
|
|
/// The condition that is associated with this binding.
|
|
/// NOTE: An unsatisfied condition will not allow user access via current
|
|
/// binding. Different bindings, including their conditions, are examined
|
|
/// independently.
|
|
pub condition: Option<Expr>,
|
|
/// Specifies the identities requesting access for a Cloud Platform resource.
|
|
/// `members` can have the following values:
|
|
///
|
|
/// * `allUsers`: A special identifier that represents anyone who is
|
|
/// on the internet; with or without a Google account.
|
|
///
|
|
/// * `allAuthenticatedUsers`: A special identifier that represents anyone
|
|
/// who is authenticated with a Google account or a service account.
|
|
///
|
|
/// * `user:{emailid}`: An email address that represents a specific Google
|
|
/// account. For example, `alice@gmail.com` .
|
|
///
|
|
///
|
|
/// * `serviceAccount:{emailid}`: An email address that represents a service
|
|
/// account. For example, `my-other-app@appspot.gserviceaccount.com`.
|
|
///
|
|
/// * `group:{emailid}`: An email address that represents a Google group.
|
|
/// For example, `admins@example.com`.
|
|
///
|
|
///
|
|
/// * `domain:{domain}`: The G Suite domain (primary) that represents all the
|
|
/// users of that domain. For example, `google.com` or `example.com`.
|
|
///
|
|
///
|
|
pub members: Option<Vec<String>>,
|
|
}
|
|
|
|
impl Part for Binding {}
|
|
|
|
|
|
/// Request message for
|
|
/// google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances tables drop row range projects](struct.ProjectInstanceTableDropRowRangeCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct DropRowRangeRequest {
|
|
/// Delete all rows that start with this row key prefix. Prefix cannot be
|
|
/// zero length.
|
|
#[serde(rename="rowKeyPrefix")]
|
|
pub row_key_prefix: Option<String>,
|
|
/// Delete all rows in the table. Setting this to false is a no-op.
|
|
#[serde(rename="deleteAllDataFromTable")]
|
|
pub delete_all_data_from_table: Option<bool>,
|
|
}
|
|
|
|
impl RequestValue for DropRowRangeRequest {}
|
|
|
|
|
|
/// A collection of Bigtable Tables and
|
|
/// the resources that serve them.
|
|
/// All tables in an instance are served from all
|
|
/// Clusters in the instance.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances get projects](struct.ProjectInstanceGetCall.html) (response)
|
|
/// * [instances update projects](struct.ProjectInstanceUpdateCall.html) (request|response)
|
|
/// * [instances partial update instance projects](struct.ProjectInstancePartialUpdateInstanceCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Instance {
|
|
/// The descriptive name for this instance as it appears in UIs.
|
|
/// Can be changed at any time, but should be kept globally unique
|
|
/// to avoid confusion.
|
|
#[serde(rename="displayName")]
|
|
pub display_name: Option<String>,
|
|
/// (`OutputOnly`)
|
|
/// The current state of the instance.
|
|
pub state: Option<String>,
|
|
/// Labels are a flexible and lightweight mechanism for organizing cloud
|
|
/// resources into groups that reflect a customer's organizational needs and
|
|
/// deployment strategies. They can be used to filter resources and aggregate
|
|
/// metrics.
|
|
///
|
|
/// * Label keys must be between 1 and 63 characters long and must conform to
|
|
/// the regular expression: `\p{Ll}\p{Lo}{0,62}`.
|
|
/// * Label values must be between 0 and 63 characters long and must conform to
|
|
/// the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`.
|
|
/// * No more than 64 labels can be associated with a given resource.
|
|
/// * Keys and values must both be under 128 bytes.
|
|
pub labels: Option<HashMap<String, String>>,
|
|
/// The type of the instance. Defaults to `PRODUCTION`.
|
|
#[serde(rename="type")]
|
|
pub type_: Option<String>,
|
|
/// (`OutputOnly`)
|
|
/// The unique name of the instance. Values are of the form
|
|
/// `projects/<project>/instances/a-z+[a-z0-9]`.
|
|
pub name: Option<String>,
|
|
}
|
|
|
|
impl RequestValue for Instance {}
|
|
impl ResponseResult for Instance {}
|
|
|
|
|
|
/// The response message for Locations.ListLocations.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [locations list projects](struct.ProjectLocationListCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListLocationsResponse {
|
|
/// The standard List next-page token.
|
|
#[serde(rename="nextPageToken")]
|
|
pub next_page_token: Option<String>,
|
|
/// A list of locations that matches the specified filter in the request.
|
|
pub locations: Option<Vec<Location>>,
|
|
}
|
|
|
|
impl ResponseResult for ListLocationsResponse {}
|
|
|
|
|
|
/// A resource that represents Google Cloud Platform location.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [locations get projects](struct.ProjectLocationGetCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Location {
|
|
/// The friendly name for this location, typically a nearby city name.
|
|
/// For example, "Tokyo".
|
|
#[serde(rename="displayName")]
|
|
pub display_name: Option<String>,
|
|
/// Cross-service attributes for the location. For example
|
|
///
|
|
/// ````text
|
|
/// {"cloud.googleapis.com/region": "us-east1"}````
|
|
pub labels: Option<HashMap<String, String>>,
|
|
/// The canonical id for this location. For example: `"us-east1"`.
|
|
#[serde(rename="locationId")]
|
|
pub location_id: Option<String>,
|
|
/// Resource name for the location, which may vary between implementations.
|
|
/// For example: `"projects/example-project/locations/us-east1"`
|
|
pub name: Option<String>,
|
|
/// Service-specific metadata. For example the available capacity at the given
|
|
/// location.
|
|
pub metadata: Option<HashMap<String, String>>,
|
|
}
|
|
|
|
impl ResponseResult for Location {}
|
|
|
|
|
|
/// A set of columns within a table which share a common configuration.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ColumnFamily {
|
|
/// Garbage collection rule specified as a protobuf.
|
|
/// Must serialize to at most 500 bytes.
|
|
///
|
|
/// NOTE: Garbage collection executes opportunistically in the background, and
|
|
/// so it's possible for reads to return a cell even if it matches the active
|
|
/// GC expression for its family.
|
|
#[serde(rename="gcRule")]
|
|
pub gc_rule: Option<GcRule>,
|
|
}
|
|
|
|
impl Part for ColumnFamily {}
|
|
|
|
|
|
/// A create, update, or delete of a particular column family.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Modification {
|
|
/// Create a new column family with the specified schema, or fail if
|
|
/// one already exists with the given ID.
|
|
pub create: Option<ColumnFamily>,
|
|
/// Drop (delete) the column family with the given ID, or fail if no such
|
|
/// family exists.
|
|
pub drop: Option<bool>,
|
|
/// The ID of the column family to be modified.
|
|
pub id: Option<String>,
|
|
/// Update an existing column family to the specified schema, or fail
|
|
/// if no column family exists with the given ID.
|
|
pub update: Option<ColumnFamily>,
|
|
}
|
|
|
|
impl Part for Modification {}
|
|
|
|
|
|
/// Response message for
|
|
/// google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances tables generate consistency token projects](struct.ProjectInstanceTableGenerateConsistencyTokenCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct GenerateConsistencyTokenResponse {
|
|
/// The generated consistency token.
|
|
#[serde(rename="consistencyToken")]
|
|
pub consistency_token: Option<String>,
|
|
}
|
|
|
|
impl ResponseResult for GenerateConsistencyTokenResponse {}
|
|
|
|
|
|
/// 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*).
|
|
///
|
|
/// * [instances tables drop row range projects](struct.ProjectInstanceTableDropRowRangeCall.html) (response)
|
|
/// * [delete operations](struct.OperationDeleteCall.html) (response)
|
|
/// * [instances app profiles delete projects](struct.ProjectInstanceAppProfileDeleteCall.html) (response)
|
|
/// * [instances clusters delete projects](struct.ProjectInstanceClusterDeleteCall.html) (response)
|
|
/// * [cancel operations](struct.OperationCancelCall.html) (response)
|
|
/// * [instances delete projects](struct.ProjectInstanceDeleteCall.html) (response)
|
|
/// * [instances tables delete projects](struct.ProjectInstanceTableDeleteCall.html) (response)
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Empty { _never_set: Option<bool> }
|
|
|
|
impl ResponseResult for Empty {}
|
|
|
|
|
|
/// Read/write requests may be routed to any cluster in the instance, and will
|
|
/// fail over to another cluster in the event of transient errors or delays.
|
|
/// Choosing this option sacrifices read-your-writes consistency to improve
|
|
/// availability.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct MultiClusterRoutingUseAny { _never_set: Option<bool> }
|
|
|
|
impl Part for MultiClusterRoutingUseAny {}
|
|
|
|
|
|
/// 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). The error model is designed to be:
|
|
///
|
|
/// * Simple to use and understand for most users
|
|
/// * Flexible enough to meet unexpected needs
|
|
///
|
|
/// # Overview
|
|
///
|
|
/// The `Status` message contains three pieces of data: error code, error
|
|
/// message, and error details. The error code should be an enum value of
|
|
/// google.rpc.Code, but it may accept additional error codes if needed. The
|
|
/// error message should be a developer-facing English message that helps
|
|
/// developers *understand* and *resolve* the error. If a localized user-facing
|
|
/// error message is needed, put the localized message in the error details or
|
|
/// localize it in the client. The optional error details may contain arbitrary
|
|
/// information about the error. There is a predefined set of error detail types
|
|
/// in the package `google.rpc` that can be used for common error conditions.
|
|
///
|
|
/// # Language mapping
|
|
///
|
|
/// The `Status` message is the logical representation of the error model, but it
|
|
/// is not necessarily the actual wire format. When the `Status` message is
|
|
/// exposed in different client libraries and different wire protocols, it can be
|
|
/// mapped differently. For example, it will likely be mapped to some exceptions
|
|
/// in Java, but more likely mapped to some error codes in C.
|
|
///
|
|
/// # Other uses
|
|
///
|
|
/// The error model and the `Status` message can be used in a variety of
|
|
/// environments, either with or without APIs, to provide a
|
|
/// consistent developer experience across different environments.
|
|
///
|
|
/// Example uses of this error model include:
|
|
///
|
|
/// * Partial errors. If a service needs to return partial errors to the client,
|
|
/// it may embed the `Status` in the normal response to indicate the partial
|
|
/// errors.
|
|
///
|
|
/// * Workflow errors. A typical workflow has multiple steps. Each step may
|
|
/// have a `Status` message for error reporting.
|
|
///
|
|
/// * Batch operations. If a client uses batch request and batch response, the
|
|
/// `Status` message should be used directly inside batch response, one for
|
|
/// each error sub-response.
|
|
///
|
|
/// * Asynchronous operations. If an API call embeds asynchronous operation
|
|
/// results in its response, the status of those operations should be
|
|
/// represented directly using the `Status` message.
|
|
///
|
|
/// * Logging. If some API errors are stored in logs, the message `Status` could
|
|
/// be used directly after any stripping needed for security/privacy reasons.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Status {
|
|
/// 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>,
|
|
/// 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, String>>>,
|
|
}
|
|
|
|
impl Part for Status {}
|
|
|
|
|
|
/// Defines an Identity and Access Management (IAM) policy. It is used to
|
|
/// specify access control policies for Cloud Platform resources.
|
|
///
|
|
/// A `Policy` consists of a list of `bindings`. A `binding` binds a list of
|
|
/// `members` to a `role`, where the members can be user accounts, Google groups,
|
|
/// Google domains, and service accounts. A `role` is a named list of permissions
|
|
/// defined by IAM.
|
|
///
|
|
/// **JSON Example**
|
|
///
|
|
/// ````text
|
|
/// {
|
|
/// "bindings": [
|
|
/// {
|
|
/// "role": "roles/owner",
|
|
/// "members": [
|
|
/// "user:mike@example.com",
|
|
/// "group:admins@example.com",
|
|
/// "domain:google.com",
|
|
/// "serviceAccount:my-other-app@appspot.gserviceaccount.com"
|
|
/// ]
|
|
/// },
|
|
/// {
|
|
/// "role": "roles/viewer",
|
|
/// "members": ["user:sean@example.com"]
|
|
/// }
|
|
/// ]
|
|
/// }
|
|
/// ````
|
|
///
|
|
/// **YAML Example**
|
|
///
|
|
/// ````text
|
|
/// bindings:
|
|
/// - members:
|
|
/// - user:mike@example.com
|
|
/// - group:admins@example.com
|
|
/// - domain:google.com
|
|
/// - serviceAccount:my-other-app@appspot.gserviceaccount.com
|
|
/// role: roles/owner
|
|
/// - members:
|
|
/// - user:sean@example.com
|
|
/// role: roles/viewer
|
|
/// ````
|
|
///
|
|
/// For a description of IAM and its features, see the
|
|
/// [IAM developer's guide](https://cloud.google.com/iam/docs).
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances tables set iam policy projects](struct.ProjectInstanceTableSetIamPolicyCall.html) (response)
|
|
/// * [instances get iam policy projects](struct.ProjectInstanceGetIamPolicyCall.html) (response)
|
|
/// * [instances set iam policy projects](struct.ProjectInstanceSetIamPolicyCall.html) (response)
|
|
/// * [instances tables get iam policy projects](struct.ProjectInstanceTableGetIamPolicyCall.html) (response)
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Policy {
|
|
/// Specifies cloud audit logging configuration for this policy.
|
|
#[serde(rename="auditConfigs")]
|
|
pub audit_configs: Option<Vec<AuditConfig>>,
|
|
/// `etag` is used for optimistic concurrency control as a way to help
|
|
/// prevent simultaneous updates of a policy from overwriting each other.
|
|
/// It is strongly suggested that systems make use of the `etag` in the
|
|
/// read-modify-write cycle to perform policy updates in order to avoid race
|
|
/// conditions: An `etag` is returned in the response to `getIamPolicy`, and
|
|
/// systems are expected to put that etag in the request to `setIamPolicy` to
|
|
/// ensure that their change will be applied to the same version of the policy.
|
|
///
|
|
/// If no `etag` is provided in the call to `setIamPolicy`, then the existing
|
|
/// policy is overwritten blindly.
|
|
pub etag: Option<String>,
|
|
/// Associates a list of `members` to a `role`.
|
|
/// `bindings` with no members will result in an error.
|
|
pub bindings: Option<Vec<Binding>>,
|
|
/// Deprecated.
|
|
pub version: Option<i32>,
|
|
}
|
|
|
|
impl ResponseResult for Policy {}
|
|
|
|
|
|
/// A resizable group of nodes in a particular cloud location, capable
|
|
/// of serving all Tables in the parent
|
|
/// Instance.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances clusters create projects](struct.ProjectInstanceClusterCreateCall.html) (request)
|
|
/// * [instances clusters get projects](struct.ProjectInstanceClusterGetCall.html) (response)
|
|
/// * [instances clusters update projects](struct.ProjectInstanceClusterUpdateCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Cluster {
|
|
/// (`CreationOnly`)
|
|
/// The type of storage used by this cluster to serve its
|
|
/// parent instance's tables, unless explicitly overridden.
|
|
#[serde(rename="defaultStorageType")]
|
|
pub default_storage_type: Option<String>,
|
|
/// The number of nodes allocated to this cluster. More nodes enable higher
|
|
/// throughput and more consistent performance.
|
|
#[serde(rename="serveNodes")]
|
|
pub serve_nodes: Option<i32>,
|
|
/// (`CreationOnly`)
|
|
/// The location where this cluster's nodes and storage reside. For best
|
|
/// performance, clients should be located as close as possible to this
|
|
/// cluster. Currently only zones are supported, so values should be of the
|
|
/// form `projects/<project>/locations/<zone>`.
|
|
pub location: Option<String>,
|
|
/// (`OutputOnly`)
|
|
/// The unique name of the cluster. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/clusters/a-z*`.
|
|
pub name: Option<String>,
|
|
/// (`OutputOnly`)
|
|
/// The current state of the cluster.
|
|
pub state: Option<String>,
|
|
}
|
|
|
|
impl RequestValue for Cluster {}
|
|
impl ResponseResult for Cluster {}
|
|
|
|
|
|
/// Request message for
|
|
/// google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances tables modify column families projects](struct.ProjectInstanceTableModifyColumnFamilyCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ModifyColumnFamiliesRequest {
|
|
/// Modifications to be atomically applied to the specified table's families.
|
|
/// Entries are applied in order, meaning that earlier modifications can be
|
|
/// masked by later ones (in the case of repeated updates to the same family,
|
|
/// for example).
|
|
pub modifications: Option<Vec<Modification>>,
|
|
}
|
|
|
|
impl RequestValue for ModifyColumnFamiliesRequest {}
|
|
|
|
|
|
/// Rule for determining which cells to delete during garbage collection.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct GcRule {
|
|
/// Delete cells that would be deleted by any nested rule.
|
|
pub union: Option<Union>,
|
|
/// Delete cells that would be deleted by every nested rule.
|
|
pub intersection: Option<Intersection>,
|
|
/// Delete cells in a column older than the given age.
|
|
/// Values must be at least one millisecond, and will be truncated to
|
|
/// microsecond granularity.
|
|
#[serde(rename="maxAge")]
|
|
pub max_age: Option<String>,
|
|
/// Delete all cells in a column except the most recent N.
|
|
#[serde(rename="maxNumVersions")]
|
|
pub max_num_versions: Option<i32>,
|
|
}
|
|
|
|
impl Part for GcRule {}
|
|
|
|
|
|
/// Request message for BigtableInstanceAdmin.CreateInstance.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances create projects](struct.ProjectInstanceCreateCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct CreateInstanceRequest {
|
|
/// The ID to be used when referring to the new instance within its project,
|
|
/// e.g., just `myinstance` rather than
|
|
/// `projects/myproject/instances/myinstance`.
|
|
#[serde(rename="instanceId")]
|
|
pub instance_id: Option<String>,
|
|
/// The clusters to be created within the instance, mapped by desired
|
|
/// cluster ID, e.g., just `mycluster` rather than
|
|
/// `projects/myproject/instances/myinstance/clusters/mycluster`.
|
|
/// Fields marked `OutputOnly` must be left blank.
|
|
/// Currently, at most two clusters can be specified.
|
|
pub clusters: Option<HashMap<String, Cluster>>,
|
|
/// The unique name of the project in which to create the new instance.
|
|
/// Values are of the form `projects/<project>`.
|
|
pub parent: Option<String>,
|
|
/// The instance to create.
|
|
/// Fields marked `OutputOnly` must be left blank.
|
|
pub instance: Option<Instance>,
|
|
}
|
|
|
|
impl RequestValue for CreateInstanceRequest {}
|
|
|
|
|
|
/// A GcRule which deletes cells matching all of the given rules.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Intersection {
|
|
/// Only delete cells which would be deleted by every element of `rules`.
|
|
pub rules: Option<Vec<GcRule>>,
|
|
}
|
|
|
|
impl Part for Intersection {}
|
|
|
|
|
|
/// Provides the configuration for logging a type of permissions.
|
|
/// Example:
|
|
///
|
|
/// ````text
|
|
/// {
|
|
/// "audit_log_configs": [
|
|
/// {
|
|
/// "log_type": "DATA_READ",
|
|
/// "exempted_members": [
|
|
/// "user:foo@gmail.com"
|
|
/// ]
|
|
/// },
|
|
/// {
|
|
/// "log_type": "DATA_WRITE",
|
|
/// }
|
|
/// ]
|
|
/// }
|
|
/// ````
|
|
///
|
|
/// This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting
|
|
/// foo@gmail.com from DATA_READ logging.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct AuditLogConfig {
|
|
/// Specifies the identities that do not cause logging for this type of
|
|
/// permission.
|
|
/// Follows the same format of Binding.members.
|
|
#[serde(rename="exemptedMembers")]
|
|
pub exempted_members: Option<Vec<String>>,
|
|
/// The log type that this config enables.
|
|
#[serde(rename="logType")]
|
|
pub log_type: Option<String>,
|
|
}
|
|
|
|
impl Part for AuditLogConfig {}
|
|
|
|
|
|
/// Request message for `GetIamPolicy` method.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances get iam policy projects](struct.ProjectInstanceGetIamPolicyCall.html) (request)
|
|
/// * [instances tables get iam policy projects](struct.ProjectInstanceTableGetIamPolicyCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct GetIamPolicyRequest { _never_set: Option<bool> }
|
|
|
|
impl RequestValue for GetIamPolicyRequest {}
|
|
|
|
|
|
/// Request message for `TestIamPermissions` method.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances test iam permissions projects](struct.ProjectInstanceTestIamPermissionCall.html) (request)
|
|
/// * [instances tables test iam permissions projects](struct.ProjectInstanceTableTestIamPermissionCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct TestIamPermissionsRequest {
|
|
/// The set of permissions to check for the `resource`. Permissions with
|
|
/// wildcards (such as '*' or 'storage.*') are not allowed. For more
|
|
/// information see
|
|
/// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
|
pub permissions: Option<Vec<String>>,
|
|
}
|
|
|
|
impl RequestValue for TestIamPermissionsRequest {}
|
|
|
|
|
|
/// Represents an expression text. Example:
|
|
///
|
|
/// ````text
|
|
/// title: "User account presence"
|
|
/// description: "Determines whether the request has a user account"
|
|
/// expression: "size(request.user) > 0"
|
|
/// ````
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Expr {
|
|
/// An 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.
|
|
///
|
|
/// The application context of the containing message determines which
|
|
/// well-known feature set of CEL is supported.
|
|
pub expression: Option<String>,
|
|
/// An 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>,
|
|
/// An 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 Part for Expr {}
|
|
|
|
|
|
/// Response message for BigtableInstanceAdmin.ListClusters.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances clusters list projects](struct.ProjectInstanceClusterListCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListClustersResponse {
|
|
/// DEPRECATED: This field is unused and ignored.
|
|
#[serde(rename="nextPageToken")]
|
|
pub next_page_token: Option<String>,
|
|
/// The list of requested clusters.
|
|
pub clusters: Option<Vec<Cluster>>,
|
|
/// Locations from which Cluster information could not be retrieved,
|
|
/// due to an outage or some other transient condition.
|
|
/// Clusters from these locations may be missing from `clusters`,
|
|
/// or may only have partial information returned.
|
|
/// Values are of the form `projects/<project>/locations/<zone_id>`
|
|
#[serde(rename="failedLocations")]
|
|
pub failed_locations: Option<Vec<String>>,
|
|
}
|
|
|
|
impl ResponseResult for ListClustersResponse {}
|
|
|
|
|
|
/// Response message for `TestIamPermissions` method.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances test iam permissions projects](struct.ProjectInstanceTestIamPermissionCall.html) (response)
|
|
/// * [instances tables test iam permissions projects](struct.ProjectInstanceTableTestIamPermissionCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct TestIamPermissionsResponse {
|
|
/// A subset of `TestPermissionsRequest.permissions` that the caller is
|
|
/// allowed.
|
|
pub permissions: Option<Vec<String>>,
|
|
}
|
|
|
|
impl ResponseResult for TestIamPermissionsResponse {}
|
|
|
|
|
|
/// An initial split point for a newly created table.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Split {
|
|
/// Row key to use as an initial tablet boundary.
|
|
pub key: Option<String>,
|
|
}
|
|
|
|
impl Part for Split {}
|
|
|
|
|
|
/// Response message for BigtableInstanceAdmin.ListAppProfiles.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances app profiles list projects](struct.ProjectInstanceAppProfileListCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListAppProfilesResponse {
|
|
/// Set if not all app profiles could be returned in a single response.
|
|
/// Pass this value to `page_token` in another request to get the next
|
|
/// page of results.
|
|
#[serde(rename="nextPageToken")]
|
|
pub next_page_token: Option<String>,
|
|
/// Locations from which AppProfile information could not be retrieved,
|
|
/// due to an outage or some other transient condition.
|
|
/// AppProfiles from these locations may be missing from `app_profiles`.
|
|
/// Values are of the form `projects/<project>/locations/<zone_id>`
|
|
#[serde(rename="failedLocations")]
|
|
pub failed_locations: Option<Vec<String>>,
|
|
/// The list of requested app profiles.
|
|
#[serde(rename="appProfiles")]
|
|
pub app_profiles: Option<Vec<AppProfile>>,
|
|
}
|
|
|
|
impl ResponseResult for ListAppProfilesResponse {}
|
|
|
|
|
|
/// Request message for
|
|
/// google.bigtable.admin.v2.BigtableTableAdmin.CreateTable
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances tables create projects](struct.ProjectInstanceTableCreateCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct CreateTableRequest {
|
|
/// The Table to create.
|
|
pub table: Option<Table>,
|
|
/// The optional list of row keys that will be used to initially split the
|
|
/// table into several tablets (tablets are similar to HBase regions).
|
|
/// Given two split keys, `s1` and `s2`, three tablets will be created,
|
|
/// spanning the key ranges: `[, s1), [s1, s2), [s2, )`.
|
|
///
|
|
/// Example:
|
|
///
|
|
/// * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",`
|
|
/// `"other", "zz"]`
|
|
/// * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]`
|
|
/// * Key assignment:
|
|
/// * Tablet 1 `[, apple) => {"a"}.`
|
|
/// * Tablet 2 `[apple, customer_1) => {"apple", "custom"}.`
|
|
/// * Tablet 3 `[customer_1, customer_2) => {"customer_1"}.`
|
|
/// * Tablet 4 `[customer_2, other) => {"customer_2"}.`
|
|
/// * Tablet 5 `[other, ) => {"other", "zz"}.`
|
|
#[serde(rename="initialSplits")]
|
|
pub initial_splits: Option<Vec<Split>>,
|
|
/// The name by which the new table should be referred to within the parent
|
|
/// instance, e.g., `foobar` rather than `<parent>/tables/foobar`.
|
|
#[serde(rename="tableId")]
|
|
pub table_id: Option<String>,
|
|
}
|
|
|
|
impl RequestValue for CreateTableRequest {}
|
|
|
|
|
|
/// The response message for Operations.ListOperations.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [projects operations list operations](struct.OperationProjectOperationListCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListOperationsResponse {
|
|
/// The standard List next-page token.
|
|
#[serde(rename="nextPageToken")]
|
|
pub next_page_token: Option<String>,
|
|
/// A list of operations that matches the specified filter in the request.
|
|
pub operations: Option<Vec<Operation>>,
|
|
}
|
|
|
|
impl ResponseResult for ListOperationsResponse {}
|
|
|
|
|
|
/// A configuration object describing how Cloud Bigtable should treat traffic
|
|
/// from a particular end user application.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances app profiles patch projects](struct.ProjectInstanceAppProfilePatchCall.html) (request)
|
|
/// * [instances app profiles get projects](struct.ProjectInstanceAppProfileGetCall.html) (response)
|
|
/// * [instances app profiles create projects](struct.ProjectInstanceAppProfileCreateCall.html) (request|response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct AppProfile {
|
|
/// Use a multi-cluster routing policy that may pick any cluster.
|
|
#[serde(rename="multiClusterRoutingUseAny")]
|
|
pub multi_cluster_routing_use_any: Option<MultiClusterRoutingUseAny>,
|
|
/// Strongly validated etag for optimistic concurrency control. Preserve the
|
|
/// value returned from `GetAppProfile` when calling `UpdateAppProfile` to
|
|
/// fail the request if there has been a modification in the mean time. The
|
|
/// `update_mask` of the request need not include `etag` for this protection
|
|
/// to apply.
|
|
/// See [Wikipedia](https://en.wikipedia.org/wiki/HTTP_ETag) and
|
|
/// [RFC 7232](https://tools.ietf.org/html/rfc7232#section-2.3) for more
|
|
/// details.
|
|
pub etag: Option<String>,
|
|
/// Use a single-cluster routing policy.
|
|
#[serde(rename="singleClusterRouting")]
|
|
pub single_cluster_routing: Option<SingleClusterRouting>,
|
|
/// Optional long form description of the use case for this AppProfile.
|
|
pub description: Option<String>,
|
|
/// (`OutputOnly`)
|
|
/// The unique name of the app profile. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/appProfiles/_a-zA-Z0-9*`.
|
|
pub name: Option<String>,
|
|
}
|
|
|
|
impl RequestValue for AppProfile {}
|
|
impl ResponseResult for AppProfile {}
|
|
|
|
|
|
/// Response message for
|
|
/// google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances tables check consistency projects](struct.ProjectInstanceTableCheckConsistencyCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct CheckConsistencyResponse {
|
|
/// True only if the token is consistent. A token is consistent if replication
|
|
/// has caught up with the restrictions specified in the request.
|
|
pub consistent: Option<bool>,
|
|
}
|
|
|
|
impl ResponseResult for CheckConsistencyResponse {}
|
|
|
|
|
|
/// Unconditionally routes all read/write requests to a specific cluster.
|
|
/// This option preserves read-your-writes consistency, but does not improve
|
|
/// availability.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct SingleClusterRouting {
|
|
/// The cluster to which read/write requests should be routed.
|
|
#[serde(rename="clusterId")]
|
|
pub cluster_id: Option<String>,
|
|
/// Whether or not `CheckAndMutateRow` and `ReadModifyWriteRow` requests are
|
|
/// allowed by this app profile. It is unsafe to send these requests to
|
|
/// the same table/row/column in multiple clusters.
|
|
#[serde(rename="allowTransactionalWrites")]
|
|
pub allow_transactional_writes: Option<bool>,
|
|
}
|
|
|
|
impl Part for SingleClusterRouting {}
|
|
|
|
|
|
/// The state of a table's data in a particular cluster.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ClusterState {
|
|
/// Output only.
|
|
/// The state of replication for the table in this cluster.
|
|
#[serde(rename="replicationState")]
|
|
pub replication_state: Option<String>,
|
|
}
|
|
|
|
impl Part for ClusterState {}
|
|
|
|
|
|
/// Specifies the audit configuration for a service.
|
|
/// The configuration determines which permission types are logged, and what
|
|
/// identities, if any, are exempted from logging.
|
|
/// An AuditConfig must have one or more AuditLogConfigs.
|
|
///
|
|
/// If there are AuditConfigs for both `allServices` and a specific service,
|
|
/// the union of the two AuditConfigs is used for that service: the log_types
|
|
/// specified in each AuditConfig are enabled, and the exempted_members in each
|
|
/// AuditLogConfig are exempted.
|
|
///
|
|
/// Example Policy with multiple AuditConfigs:
|
|
///
|
|
/// ````text
|
|
/// {
|
|
/// "audit_configs": [
|
|
/// {
|
|
/// "service": "allServices"
|
|
/// "audit_log_configs": [
|
|
/// {
|
|
/// "log_type": "DATA_READ",
|
|
/// "exempted_members": [
|
|
/// "user:foo@gmail.com"
|
|
/// ]
|
|
/// },
|
|
/// {
|
|
/// "log_type": "DATA_WRITE",
|
|
/// },
|
|
/// {
|
|
/// "log_type": "ADMIN_READ",
|
|
/// }
|
|
/// ]
|
|
/// },
|
|
/// {
|
|
/// "service": "fooservice.googleapis.com"
|
|
/// "audit_log_configs": [
|
|
/// {
|
|
/// "log_type": "DATA_READ",
|
|
/// },
|
|
/// {
|
|
/// "log_type": "DATA_WRITE",
|
|
/// "exempted_members": [
|
|
/// "user:bar@gmail.com"
|
|
/// ]
|
|
/// }
|
|
/// ]
|
|
/// }
|
|
/// ]
|
|
/// }
|
|
/// ````
|
|
///
|
|
/// For fooservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ
|
|
/// logging. It also exempts foo@gmail.com from DATA_READ logging, and
|
|
/// bar@gmail.com from DATA_WRITE logging.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct AuditConfig {
|
|
/// The configuration for logging of each type of permission.
|
|
#[serde(rename="auditLogConfigs")]
|
|
pub audit_log_configs: Option<Vec<AuditLogConfig>>,
|
|
/// Specifies a service that will be enabled for audit logging.
|
|
/// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.
|
|
/// `allServices` is a special value that covers all services.
|
|
pub service: Option<String>,
|
|
}
|
|
|
|
impl Part for AuditConfig {}
|
|
|
|
|
|
/// Request message for
|
|
/// google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances tables generate consistency token projects](struct.ProjectInstanceTableGenerateConsistencyTokenCall.html) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct GenerateConsistencyTokenRequest { _never_set: Option<bool> }
|
|
|
|
impl RequestValue for GenerateConsistencyTokenRequest {}
|
|
|
|
|
|
/// A collection of user data indexed by row, column, and timestamp.
|
|
/// Each table is served using the resources of its parent cluster.
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances tables create projects](struct.ProjectInstanceTableCreateCall.html) (response)
|
|
/// * [instances tables modify column families projects](struct.ProjectInstanceTableModifyColumnFamilyCall.html) (response)
|
|
/// * [instances tables get projects](struct.ProjectInstanceTableGetCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Table {
|
|
/// Output only.
|
|
/// Map from cluster ID to per-cluster table state.
|
|
/// If it could not be determined whether or not the table has data in a
|
|
/// particular cluster (for example, if its zone is unavailable), then
|
|
/// there will be an entry for the cluster with UNKNOWN `replication_status`.
|
|
/// Views: `REPLICATION_VIEW`, `FULL`
|
|
#[serde(rename="clusterStates")]
|
|
pub cluster_states: Option<HashMap<String, ClusterState>>,
|
|
/// (`CreationOnly`)
|
|
/// The column families configured for this table, mapped by column family ID.
|
|
/// Views: `SCHEMA_VIEW`, `FULL`
|
|
#[serde(rename="columnFamilies")]
|
|
pub column_families: Option<HashMap<String, ColumnFamily>>,
|
|
/// Output only.
|
|
/// The unique name of the table. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/_a-zA-Z0-9*`.
|
|
/// Views: `NAME_ONLY`, `SCHEMA_VIEW`, `REPLICATION_VIEW`, `FULL`
|
|
pub name: Option<String>,
|
|
/// (`CreationOnly`)
|
|
/// The granularity (i.e. `MILLIS`) at which timestamps are stored in
|
|
/// this table. Timestamps not matching the granularity will be rejected.
|
|
/// If unspecified at creation time, the value will be set to `MILLIS`.
|
|
/// Views: `SCHEMA_VIEW`, `FULL`.
|
|
pub granularity: Option<String>,
|
|
}
|
|
|
|
impl ResponseResult for Table {}
|
|
|
|
|
|
/// 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*).
|
|
///
|
|
/// * [projects operations list operations](struct.OperationProjectOperationListCall.html) (none)
|
|
/// * [delete operations](struct.OperationDeleteCall.html) (none)
|
|
/// * [get operations](struct.OperationGetCall.html) (response)
|
|
/// * [instances create projects](struct.ProjectInstanceCreateCall.html) (response)
|
|
/// * [cancel operations](struct.OperationCancelCall.html) (none)
|
|
/// * [instances app profiles patch projects](struct.ProjectInstanceAppProfilePatchCall.html) (response)
|
|
/// * [instances partial update instance projects](struct.ProjectInstancePartialUpdateInstanceCall.html) (response)
|
|
/// * [instances clusters create projects](struct.ProjectInstanceClusterCreateCall.html) (response)
|
|
/// * [instances clusters update projects](struct.ProjectInstanceClusterUpdateCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Operation {
|
|
/// The error result of the operation in case of failure or cancellation.
|
|
pub error: Option<Status>,
|
|
/// 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 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, String>>,
|
|
/// 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 have the format of `operations/some/unique/name`.
|
|
pub name: Option<String>,
|
|
/// 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, String>>,
|
|
}
|
|
|
|
impl Resource for Operation {}
|
|
impl ResponseResult for Operation {}
|
|
|
|
|
|
/// Response message for
|
|
/// google.bigtable.admin.v2.BigtableTableAdmin.ListTables
|
|
///
|
|
/// # 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*).
|
|
///
|
|
/// * [instances tables list projects](struct.ProjectInstanceTableListCall.html) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListTablesResponse {
|
|
/// Set if not all tables could be returned in a single response.
|
|
/// Pass this value to `page_token` in another request to get the next
|
|
/// page of results.
|
|
#[serde(rename="nextPageToken")]
|
|
pub next_page_token: Option<String>,
|
|
/// The tables present in the requested instance.
|
|
pub tables: Option<Vec<Table>>,
|
|
}
|
|
|
|
impl ResponseResult for ListTablesResponse {}
|
|
|
|
|
|
|
|
// ###################
|
|
// MethodBuilders ###
|
|
// #################
|
|
|
|
/// A builder providing access to all methods supported on *operation* resources.
|
|
/// It is not used directly, but through the `BigtableAdmin` hub.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// extern crate hyper;
|
|
/// extern crate hyper_rustls;
|
|
/// extern crate yup_oauth2 as oauth2;
|
|
/// extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
///
|
|
/// # #[test] fn egal() {
|
|
/// use std::default::Default;
|
|
/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// let secret: ApplicationSecret = Default::default();
|
|
/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// <MemoryStorage as Default>::default(), None);
|
|
/// let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
|
|
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
|
|
/// // like `cancel(...)`, `delete(...)`, `get(...)` and `projects_operations_list(...)`
|
|
/// // to build up your call.
|
|
/// let rb = hub.operations();
|
|
/// # }
|
|
/// ```
|
|
pub struct OperationMethods<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
}
|
|
|
|
impl<'a, C, A> MethodsBuilder for OperationMethods<'a, C, A> {}
|
|
|
|
impl<'a, C, A> OperationMethods<'a, C, A> {
|
|
|
|
/// 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 projects_operations_list(&self, name: &str) -> OperationProjectOperationListCall<'a, C, A> {
|
|
OperationProjectOperationListCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_page_token: Default::default(),
|
|
_page_size: Default::default(),
|
|
_filter: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
OperationDeleteCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: 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, C, A> {
|
|
OperationGetCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// 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
|
|
///
|
|
/// * `name` - The name of the operation resource to be cancelled.
|
|
pub fn cancel(&self, name: &str) -> OperationCancelCall<'a, C, A> {
|
|
OperationCancelCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// A builder providing access to all methods supported on *project* resources.
|
|
/// It is not used directly, but through the `BigtableAdmin` hub.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// extern crate hyper;
|
|
/// extern crate hyper_rustls;
|
|
/// extern crate yup_oauth2 as oauth2;
|
|
/// extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
///
|
|
/// # #[test] fn egal() {
|
|
/// use std::default::Default;
|
|
/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// let secret: ApplicationSecret = Default::default();
|
|
/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// <MemoryStorage as Default>::default(), None);
|
|
/// let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
|
|
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
|
|
/// // like `instances_app_profiles_create(...)`, `instances_app_profiles_delete(...)`, `instances_app_profiles_get(...)`, `instances_app_profiles_list(...)`, `instances_app_profiles_patch(...)`, `instances_clusters_create(...)`, `instances_clusters_delete(...)`, `instances_clusters_get(...)`, `instances_clusters_list(...)`, `instances_clusters_update(...)`, `instances_create(...)`, `instances_delete(...)`, `instances_get(...)`, `instances_get_iam_policy(...)`, `instances_list(...)`, `instances_partial_update_instance(...)`, `instances_set_iam_policy(...)`, `instances_tables_check_consistency(...)`, `instances_tables_create(...)`, `instances_tables_delete(...)`, `instances_tables_drop_row_range(...)`, `instances_tables_generate_consistency_token(...)`, `instances_tables_get(...)`, `instances_tables_get_iam_policy(...)`, `instances_tables_list(...)`, `instances_tables_modify_column_families(...)`, `instances_tables_set_iam_policy(...)`, `instances_tables_test_iam_permissions(...)`, `instances_test_iam_permissions(...)`, `instances_update(...)`, `locations_get(...)` and `locations_list(...)`
|
|
/// // to build up your call.
|
|
/// let rb = hub.projects();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectMethods<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
}
|
|
|
|
impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectMethods<'a, C, A> {
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Generates a consistency token for a Table, which can be used in
|
|
/// CheckConsistency to check whether mutations to the table that finished
|
|
/// before this call started have been replicated. The tokens will be available
|
|
/// for 90 days.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `name` - The unique name of the Table for which to create a consistency token.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/<table>`.
|
|
pub fn instances_tables_generate_consistency_token(&self, request: GenerateConsistencyTokenRequest, name: &str) -> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> {
|
|
ProjectInstanceTableGenerateConsistencyTokenCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Gets information about a location.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `name` - Resource name for the location.
|
|
pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C, A> {
|
|
ProjectLocationGetCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Permanently drop/delete a row range from a specified table. The request can
|
|
/// specify whether to delete all rows in a table, or only those that match a
|
|
/// particular prefix.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `name` - The unique name of the table on which to drop a range of rows.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/<table>`.
|
|
pub fn instances_tables_drop_row_range(&self, request: DropRowRangeRequest, name: &str) -> ProjectInstanceTableDropRowRangeCall<'a, C, A> {
|
|
ProjectInstanceTableDropRowRangeCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Deletes an app profile from an instance.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `name` - The unique name of the app profile to be deleted. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/appProfiles/<app_profile>`.
|
|
pub fn instances_app_profiles_delete(&self, name: &str) -> ProjectInstanceAppProfileDeleteCall<'a, C, A> {
|
|
ProjectInstanceAppProfileDeleteCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_ignore_warnings: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Create an instance within a project.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `parent` - The unique name of the project in which to create the new instance.
|
|
/// Values are of the form `projects/<project>`.
|
|
pub fn instances_create(&self, request: CreateInstanceRequest, parent: &str) -> ProjectInstanceCreateCall<'a, C, A> {
|
|
ProjectInstanceCreateCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_parent: parent.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Creates a cluster within an instance.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `parent` - The unique name of the instance in which to create the new cluster.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>`.
|
|
pub fn instances_clusters_create(&self, request: Cluster, parent: &str) -> ProjectInstanceClusterCreateCall<'a, C, A> {
|
|
ProjectInstanceClusterCreateCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_parent: parent.to_string(),
|
|
_cluster_id: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Gets metadata information about the specified table.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `name` - The unique name of the requested table.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/<table>`.
|
|
pub fn instances_tables_get(&self, name: &str) -> ProjectInstanceTableGetCall<'a, C, A> {
|
|
ProjectInstanceTableGetCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_view: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Updates an app profile within an instance.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `name` - (`OutputOnly`)
|
|
/// The unique name of the app profile. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/appProfiles/_a-zA-Z0-9*`.
|
|
pub fn instances_app_profiles_patch(&self, request: AppProfile, name: &str) -> ProjectInstanceAppProfilePatchCall<'a, C, A> {
|
|
ProjectInstanceAppProfilePatchCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_name: name.to_string(),
|
|
_update_mask: Default::default(),
|
|
_ignore_warnings: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Lists information about app profiles in an instance.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `parent` - The unique name of the instance for which a list of app profiles is
|
|
/// requested. Values are of the form
|
|
/// `projects/<project>/instances/<instance>`.
|
|
/// Use `<instance> = '-'` to list AppProfiles for all Instances in a project,
|
|
/// e.g., `projects/myproject/instances/-`.
|
|
pub fn instances_app_profiles_list(&self, parent: &str) -> ProjectInstanceAppProfileListCall<'a, C, A> {
|
|
ProjectInstanceAppProfileListCall {
|
|
hub: self.hub,
|
|
_parent: parent.to_string(),
|
|
_page_token: Default::default(),
|
|
_page_size: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Updates a cluster within an instance.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `name` - (`OutputOnly`)
|
|
/// The unique name of the cluster. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/clusters/a-z*`.
|
|
pub fn instances_clusters_update(&self, request: Cluster, name: &str) -> ProjectInstanceClusterUpdateCall<'a, C, A> {
|
|
ProjectInstanceClusterUpdateCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Sets the access control policy on an instance resource. Replaces any
|
|
/// existing policy.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `resource` - REQUIRED: The resource for which the policy is being specified.
|
|
/// See the operation documentation for the appropriate value for this field.
|
|
pub fn instances_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectInstanceSetIamPolicyCall<'a, C, A> {
|
|
ProjectInstanceSetIamPolicyCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_resource: resource.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Checks replication consistency based on a consistency token, that is, if
|
|
/// replication has caught up based on the conditions specified in the token
|
|
/// and the check request.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `name` - The unique name of the Table for which to check replication consistency.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/<table>`.
|
|
pub fn instances_tables_check_consistency(&self, request: CheckConsistencyRequest, name: &str) -> ProjectInstanceTableCheckConsistencyCall<'a, C, A> {
|
|
ProjectInstanceTableCheckConsistencyCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Lists information about the supported locations for this service.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `name` - The resource that owns the locations collection, if applicable.
|
|
pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C, A> {
|
|
ProjectLocationListCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_page_token: Default::default(),
|
|
_page_size: Default::default(),
|
|
_filter: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Gets the access control policy for an instance resource. Returns an empty
|
|
/// policy if an instance exists but does not have a policy set.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `resource` - REQUIRED: The resource for which the policy is being requested.
|
|
/// See the operation documentation for the appropriate value for this field.
|
|
pub fn instances_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectInstanceGetIamPolicyCall<'a, C, A> {
|
|
ProjectInstanceGetIamPolicyCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_resource: resource.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Gets the access control policy for an instance resource. Returns an empty
|
|
/// policy if an table exists but does not have a policy set.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `resource` - REQUIRED: The resource for which the policy is being requested.
|
|
/// See the operation documentation for the appropriate value for this field.
|
|
pub fn instances_tables_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectInstanceTableGetIamPolicyCall<'a, C, A> {
|
|
ProjectInstanceTableGetIamPolicyCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_resource: resource.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Gets information about an app profile.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `name` - The unique name of the requested app profile. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/appProfiles/<app_profile>`.
|
|
pub fn instances_app_profiles_get(&self, name: &str) -> ProjectInstanceAppProfileGetCall<'a, C, A> {
|
|
ProjectInstanceAppProfileGetCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Delete an instance from a project.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `name` - The unique name of the instance to be deleted.
|
|
/// Values are of the form `projects/<project>/instances/<instance>`.
|
|
pub fn instances_delete(&self, name: &str) -> ProjectInstanceDeleteCall<'a, C, A> {
|
|
ProjectInstanceDeleteCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Lists information about clusters in an instance.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `parent` - The unique name of the instance for which a list of clusters is requested.
|
|
/// Values are of the form `projects/<project>/instances/<instance>`.
|
|
/// Use `<instance> = '-'` to list Clusters for all Instances in a project,
|
|
/// e.g., `projects/myproject/instances/-`.
|
|
pub fn instances_clusters_list(&self, parent: &str) -> ProjectInstanceClusterListCall<'a, C, A> {
|
|
ProjectInstanceClusterListCall {
|
|
hub: self.hub,
|
|
_parent: parent.to_string(),
|
|
_page_token: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Creates a new table in the specified instance.
|
|
/// The table can be created with a full set of initial column families,
|
|
/// specified in the request.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `parent` - The unique name of the instance in which to create the table.
|
|
/// Values are of the form `projects/<project>/instances/<instance>`.
|
|
pub fn instances_tables_create(&self, request: CreateTableRequest, parent: &str) -> ProjectInstanceTableCreateCall<'a, C, A> {
|
|
ProjectInstanceTableCreateCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_parent: parent.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Lists all tables served from a specified instance.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `parent` - The unique name of the instance for which tables should be listed.
|
|
/// Values are of the form `projects/<project>/instances/<instance>`.
|
|
pub fn instances_tables_list(&self, parent: &str) -> ProjectInstanceTableListCall<'a, C, A> {
|
|
ProjectInstanceTableListCall {
|
|
hub: self.hub,
|
|
_parent: parent.to_string(),
|
|
_view: Default::default(),
|
|
_page_token: Default::default(),
|
|
_page_size: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Gets information about a cluster.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `name` - The unique name of the requested cluster. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/clusters/<cluster>`.
|
|
pub fn instances_clusters_get(&self, name: &str) -> ProjectInstanceClusterGetCall<'a, C, A> {
|
|
ProjectInstanceClusterGetCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Partially updates an instance within a project. This method can modify all
|
|
/// fields of an Instance and is the preferred way to update an Instance.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `name` - (`OutputOnly`)
|
|
/// The unique name of the instance. Values are of the form
|
|
/// `projects/<project>/instances/a-z+[a-z0-9]`.
|
|
pub fn instances_partial_update_instance(&self, request: Instance, name: &str) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A> {
|
|
ProjectInstancePartialUpdateInstanceCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_name: name.to_string(),
|
|
_update_mask: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Gets information about an instance.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `name` - The unique name of the requested instance. Values are of the form
|
|
/// `projects/<project>/instances/<instance>`.
|
|
pub fn instances_get(&self, name: &str) -> ProjectInstanceGetCall<'a, C, A> {
|
|
ProjectInstanceGetCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Updates an instance within a project. This method updates only the display
|
|
/// name and type for an Instance. To update other Instance properties, such as
|
|
/// labels, use PartialUpdateInstance.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `name` - (`OutputOnly`)
|
|
/// The unique name of the instance. Values are of the form
|
|
/// `projects/<project>/instances/a-z+[a-z0-9]`.
|
|
pub fn instances_update(&self, request: Instance, name: &str) -> ProjectInstanceUpdateCall<'a, C, A> {
|
|
ProjectInstanceUpdateCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Lists information about instances in a project.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `parent` - The unique name of the project for which a list of instances is requested.
|
|
/// Values are of the form `projects/<project>`.
|
|
pub fn instances_list(&self, parent: &str) -> ProjectInstanceListCall<'a, C, A> {
|
|
ProjectInstanceListCall {
|
|
hub: self.hub,
|
|
_parent: parent.to_string(),
|
|
_page_token: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Creates an app profile within an instance.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `parent` - The unique name of the instance in which to create the new app profile.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>`.
|
|
pub fn instances_app_profiles_create(&self, request: AppProfile, parent: &str) -> ProjectInstanceAppProfileCreateCall<'a, C, A> {
|
|
ProjectInstanceAppProfileCreateCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_parent: parent.to_string(),
|
|
_ignore_warnings: Default::default(),
|
|
_app_profile_id: Default::default(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Performs a series of column family modifications on the specified table.
|
|
/// Either all or none of the modifications will occur before this method
|
|
/// returns, but data requests received prior to that point may see a table
|
|
/// where only some modifications have taken effect.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `name` - The unique name of the table whose families should be modified.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/<table>`.
|
|
pub fn instances_tables_modify_column_families(&self, request: ModifyColumnFamiliesRequest, name: &str) -> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> {
|
|
ProjectInstanceTableModifyColumnFamilyCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Sets the access control policy on a table resource. Replaces any existing
|
|
/// policy.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `resource` - REQUIRED: The resource for which the policy is being specified.
|
|
/// See the operation documentation for the appropriate value for this field.
|
|
pub fn instances_tables_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectInstanceTableSetIamPolicyCall<'a, C, A> {
|
|
ProjectInstanceTableSetIamPolicyCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_resource: resource.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Deletes a cluster from an instance.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `name` - The unique name of the cluster to be deleted. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/clusters/<cluster>`.
|
|
pub fn instances_clusters_delete(&self, name: &str) -> ProjectInstanceClusterDeleteCall<'a, C, A> {
|
|
ProjectInstanceClusterDeleteCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Returns permissions that the caller has on the specified instance resource.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `resource` - REQUIRED: The resource for which the policy detail is being requested.
|
|
/// See the operation documentation for the appropriate value for this field.
|
|
pub fn instances_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectInstanceTestIamPermissionCall<'a, C, A> {
|
|
ProjectInstanceTestIamPermissionCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_resource: resource.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Permanently deletes a specified table and all of its data.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `name` - The unique name of the table to be deleted.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/<table>`.
|
|
pub fn instances_tables_delete(&self, name: &str) -> ProjectInstanceTableDeleteCall<'a, C, A> {
|
|
ProjectInstanceTableDeleteCall {
|
|
hub: self.hub,
|
|
_name: name.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Returns permissions that the caller has on the specified table resource.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `resource` - REQUIRED: The resource for which the policy detail is being requested.
|
|
/// See the operation documentation for the appropriate value for this field.
|
|
pub fn instances_tables_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectInstanceTableTestIamPermissionCall<'a, C, A> {
|
|
ProjectInstanceTableTestIamPermissionCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_resource: resource.to_string(),
|
|
_delegate: Default::default(),
|
|
_scopes: Default::default(),
|
|
_additional_params: Default::default(),
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ###################
|
|
// CallBuilders ###
|
|
// #################
|
|
|
|
/// 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.
|
|
///
|
|
/// A builder for the *projects.operations.list* method supported by a *operation* resource.
|
|
/// It is not used directly, but through a `OperationMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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().projects_operations_list("name")
|
|
/// .page_token("sea")
|
|
/// .page_size(-90)
|
|
/// .filter("dolores")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct OperationProjectOperationListCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_page_token: Option<String>,
|
|
_page_size: Option<i32>,
|
|
_filter: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for OperationProjectOperationListCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> OperationProjectOperationListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.operations.projects.operations.list",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
if let Some(value) = self._page_token {
|
|
params.push(("pageToken", value.to_string()));
|
|
}
|
|
if let Some(value) = self._page_size {
|
|
params.push(("pageSize", value.to_string()));
|
|
}
|
|
if let Some(value) = self._filter {
|
|
params.push(("filter", value.to_string()));
|
|
}
|
|
for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}/operations";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The name of the operation's parent resource.
|
|
///
|
|
/// 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) -> OperationProjectOperationListCall<'a, C, A> {
|
|
self._name = new_value.to_string();
|
|
self
|
|
}
|
|
/// The standard list page token.
|
|
///
|
|
/// Sets the *page token* query property to the given value.
|
|
pub fn page_token(mut self, new_value: &str) -> OperationProjectOperationListCall<'a, C, A> {
|
|
self._page_token = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// The standard list page size.
|
|
///
|
|
/// Sets the *page size* query property to the given value.
|
|
pub fn page_size(mut self, new_value: i32) -> OperationProjectOperationListCall<'a, C, A> {
|
|
self._page_size = Some(new_value);
|
|
self
|
|
}
|
|
/// The standard list filter.
|
|
///
|
|
/// Sets the *filter* query property to the given value.
|
|
pub fn filter(mut self, new_value: &str) -> OperationProjectOperationListCall<'a, C, A> {
|
|
self._filter = Some(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.
|
|
///
|
|
/// 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 Delegate) -> OperationProjectOperationListCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> OperationProjectOperationListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> OperationProjectOperationListCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// 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`.
|
|
///
|
|
/// A builder for the *delete* method supported by a *operation* resource.
|
|
/// It is not used directly, but through a `OperationMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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().delete("name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct OperationDeleteCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for OperationDeleteCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.operations.delete",
|
|
http_method: hyper::method::Method::Delete });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The name of the operation resource to be deleted.
|
|
///
|
|
/// 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) -> OperationDeleteCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> OperationDeleteCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> OperationDeleteCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> OperationDeleteCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
/// A builder for the *get* method supported by a *operation* resource.
|
|
/// It is not used directly, but through a `OperationMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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().get("name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct OperationGetCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for OperationGetCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.operations.get",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The name of the operation resource.
|
|
///
|
|
/// 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) -> OperationGetCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> OperationGetCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> OperationGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> OperationGetCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// 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`.
|
|
///
|
|
/// A builder for the *cancel* method supported by a *operation* resource.
|
|
/// It is not used directly, but through a `OperationMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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().cancel("name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct OperationCancelCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for OperationCancelCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.operations.cancel",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}:cancel";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The name of the operation resource to be cancelled.
|
|
///
|
|
/// 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) -> OperationCancelCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> OperationCancelCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> OperationCancelCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> OperationCancelCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Generates a consistency token for a Table, which can be used in
|
|
/// CheckConsistency to check whether mutations to the table that finished
|
|
/// before this call started have been replicated. The tokens will be available
|
|
/// for 90 days.
|
|
///
|
|
/// A builder for the *instances.tables.generateConsistencyToken* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::GenerateConsistencyTokenRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = GenerateConsistencyTokenRequest::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.projects().instances_tables_generate_consistency_token(req, "name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: GenerateConsistencyTokenRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, GenerateConsistencyTokenResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.generateConsistencyToken",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}:generateConsistencyToken";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: GenerateConsistencyTokenRequest) -> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The unique name of the Table for which to create a consistency token.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/<table>`.
|
|
///
|
|
/// 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) -> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Gets information about a location.
|
|
///
|
|
/// A builder for the *locations.get* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().locations_get("name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectLocationGetCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectLocationGetCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Location)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.locations.get",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Resource name for the location.
|
|
///
|
|
/// 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) -> ProjectLocationGetCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectLocationGetCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectLocationGetCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Permanently drop/delete a row range from a specified table. The request can
|
|
/// specify whether to delete all rows in a table, or only those that match a
|
|
/// particular prefix.
|
|
///
|
|
/// A builder for the *instances.tables.dropRowRange* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::DropRowRangeRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = DropRowRangeRequest::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.projects().instances_tables_drop_row_range(req, "name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceTableDropRowRangeCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: DropRowRangeRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceTableDropRowRangeCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceTableDropRowRangeCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.dropRowRange",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}:dropRowRange";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: DropRowRangeRequest) -> ProjectInstanceTableDropRowRangeCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The unique name of the table on which to drop a range of rows.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/<table>`.
|
|
///
|
|
/// 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) -> ProjectInstanceTableDropRowRangeCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceTableDropRowRangeCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceTableDropRowRangeCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceTableDropRowRangeCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Deletes an app profile from an instance.
|
|
///
|
|
/// A builder for the *instances.appProfiles.delete* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().instances_app_profiles_delete("name")
|
|
/// .ignore_warnings(true)
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceAppProfileDeleteCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_ignore_warnings: Option<bool>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceAppProfileDeleteCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceAppProfileDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.appProfiles.delete",
|
|
http_method: hyper::method::Method::Delete });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
if let Some(value) = self._ignore_warnings {
|
|
params.push(("ignoreWarnings", value.to_string()));
|
|
}
|
|
for &field in ["alt", "name", "ignoreWarnings"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The unique name of the app profile to be deleted. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/appProfiles/<app_profile>`.
|
|
///
|
|
/// 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) -> ProjectInstanceAppProfileDeleteCall<'a, C, A> {
|
|
self._name = new_value.to_string();
|
|
self
|
|
}
|
|
/// If true, ignore safety checks when deleting the app profile.
|
|
///
|
|
/// Sets the *ignore warnings* query property to the given value.
|
|
pub fn ignore_warnings(mut self, new_value: bool) -> ProjectInstanceAppProfileDeleteCall<'a, C, A> {
|
|
self._ignore_warnings = Some(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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceAppProfileDeleteCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceAppProfileDeleteCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceAppProfileDeleteCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Create an instance within a project.
|
|
///
|
|
/// A builder for the *instances.create* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::CreateInstanceRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = CreateInstanceRequest::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.projects().instances_create(req, "parent")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceCreateCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: CreateInstanceRequest,
|
|
_parent: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceCreateCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceCreateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.create",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
for &field in ["alt", "parent"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+parent}/instances";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: CreateInstanceRequest) -> ProjectInstanceCreateCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The unique name of the project in which to create the new instance.
|
|
/// Values are of the form `projects/<project>`.
|
|
///
|
|
/// Sets the *parent* 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 parent(mut self, new_value: &str) -> ProjectInstanceCreateCall<'a, C, A> {
|
|
self._parent = 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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceCreateCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceCreateCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceCreateCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Creates a cluster within an instance.
|
|
///
|
|
/// A builder for the *instances.clusters.create* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::Cluster;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = Cluster::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.projects().instances_clusters_create(req, "parent")
|
|
/// .cluster_id("ipsum")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceClusterCreateCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: Cluster,
|
|
_parent: String,
|
|
_cluster_id: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceClusterCreateCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceClusterCreateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.clusters.create",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
if let Some(value) = self._cluster_id {
|
|
params.push(("clusterId", value.to_string()));
|
|
}
|
|
for &field in ["alt", "parent", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+parent}/clusters";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: Cluster) -> ProjectInstanceClusterCreateCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The unique name of the instance in which to create the new cluster.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>`.
|
|
///
|
|
/// Sets the *parent* 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 parent(mut self, new_value: &str) -> ProjectInstanceClusterCreateCall<'a, C, A> {
|
|
self._parent = new_value.to_string();
|
|
self
|
|
}
|
|
/// The ID to be used when referring to the new cluster within its instance,
|
|
/// e.g., just `mycluster` rather than
|
|
/// `projects/myproject/instances/myinstance/clusters/mycluster`.
|
|
///
|
|
/// Sets the *cluster id* query property to the given value.
|
|
pub fn cluster_id(mut self, new_value: &str) -> ProjectInstanceClusterCreateCall<'a, C, A> {
|
|
self._cluster_id = Some(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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceClusterCreateCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceClusterCreateCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceClusterCreateCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Gets metadata information about the specified table.
|
|
///
|
|
/// A builder for the *instances.tables.get* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().instances_tables_get("name")
|
|
/// .view("et")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceTableGetCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_view: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceTableGetCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceTableGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Table)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.get",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
if let Some(value) = self._view {
|
|
params.push(("view", value.to_string()));
|
|
}
|
|
for &field in ["alt", "name", "view"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The unique name of the requested table.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/<table>`.
|
|
///
|
|
/// 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) -> ProjectInstanceTableGetCall<'a, C, A> {
|
|
self._name = new_value.to_string();
|
|
self
|
|
}
|
|
/// The view to be applied to the returned table's fields.
|
|
/// Defaults to `SCHEMA_VIEW` if unspecified.
|
|
///
|
|
/// Sets the *view* query property to the given value.
|
|
pub fn view(mut self, new_value: &str) -> ProjectInstanceTableGetCall<'a, C, A> {
|
|
self._view = Some(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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceTableGetCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceTableGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceTableGetCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Updates an app profile within an instance.
|
|
///
|
|
/// A builder for the *instances.appProfiles.patch* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::AppProfile;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = AppProfile::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.projects().instances_app_profiles_patch(req, "name")
|
|
/// .update_mask("aliquyam")
|
|
/// .ignore_warnings(true)
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceAppProfilePatchCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: AppProfile,
|
|
_name: String,
|
|
_update_mask: Option<String>,
|
|
_ignore_warnings: Option<bool>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceAppProfilePatchCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceAppProfilePatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.appProfiles.patch",
|
|
http_method: hyper::method::Method::Patch });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
if let Some(value) = self._update_mask {
|
|
params.push(("updateMask", value.to_string()));
|
|
}
|
|
if let Some(value) = self._ignore_warnings {
|
|
params.push(("ignoreWarnings", value.to_string()));
|
|
}
|
|
for &field in ["alt", "name", "updateMask", "ignoreWarnings"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: AppProfile) -> ProjectInstanceAppProfilePatchCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// (`OutputOnly`)
|
|
/// The unique name of the app profile. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/appProfiles/_a-zA-Z0-9*`.
|
|
///
|
|
/// 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) -> ProjectInstanceAppProfilePatchCall<'a, C, A> {
|
|
self._name = new_value.to_string();
|
|
self
|
|
}
|
|
/// The subset of app profile fields which should be replaced.
|
|
/// If unset, all fields will be replaced.
|
|
///
|
|
/// Sets the *update mask* query property to the given value.
|
|
pub fn update_mask(mut self, new_value: &str) -> ProjectInstanceAppProfilePatchCall<'a, C, A> {
|
|
self._update_mask = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// If true, ignore safety checks when updating the app profile.
|
|
///
|
|
/// Sets the *ignore warnings* query property to the given value.
|
|
pub fn ignore_warnings(mut self, new_value: bool) -> ProjectInstanceAppProfilePatchCall<'a, C, A> {
|
|
self._ignore_warnings = Some(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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceAppProfilePatchCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceAppProfilePatchCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceAppProfilePatchCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Lists information about app profiles in an instance.
|
|
///
|
|
/// A builder for the *instances.appProfiles.list* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().instances_app_profiles_list("parent")
|
|
/// .page_token("eos")
|
|
/// .page_size(-81)
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceAppProfileListCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_parent: String,
|
|
_page_token: Option<String>,
|
|
_page_size: Option<i32>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceAppProfileListCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceAppProfileListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, ListAppProfilesResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.appProfiles.list",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
if let Some(value) = self._page_token {
|
|
params.push(("pageToken", value.to_string()));
|
|
}
|
|
if let Some(value) = self._page_size {
|
|
params.push(("pageSize", value.to_string()));
|
|
}
|
|
for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+parent}/appProfiles";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The unique name of the instance for which a list of app profiles is
|
|
/// requested. Values are of the form
|
|
/// `projects/<project>/instances/<instance>`.
|
|
/// Use `<instance> = '-'` to list AppProfiles for all Instances in a project,
|
|
/// e.g., `projects/myproject/instances/-`.
|
|
///
|
|
/// Sets the *parent* 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 parent(mut self, new_value: &str) -> ProjectInstanceAppProfileListCall<'a, C, A> {
|
|
self._parent = new_value.to_string();
|
|
self
|
|
}
|
|
/// The value of `next_page_token` returned by a previous call.
|
|
///
|
|
/// Sets the *page token* query property to the given value.
|
|
pub fn page_token(mut self, new_value: &str) -> ProjectInstanceAppProfileListCall<'a, C, A> {
|
|
self._page_token = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Maximum number of results per page.
|
|
/// CURRENTLY UNIMPLEMENTED AND IGNORED.
|
|
///
|
|
/// Sets the *page size* query property to the given value.
|
|
pub fn page_size(mut self, new_value: i32) -> ProjectInstanceAppProfileListCall<'a, C, A> {
|
|
self._page_size = Some(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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceAppProfileListCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceAppProfileListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceAppProfileListCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Updates a cluster within an instance.
|
|
///
|
|
/// A builder for the *instances.clusters.update* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::Cluster;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = Cluster::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.projects().instances_clusters_update(req, "name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceClusterUpdateCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: Cluster,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceClusterUpdateCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceClusterUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.clusters.update",
|
|
http_method: hyper::method::Method::Put });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: Cluster) -> ProjectInstanceClusterUpdateCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// (`OutputOnly`)
|
|
/// The unique name of the cluster. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/clusters/a-z*`.
|
|
///
|
|
/// 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) -> ProjectInstanceClusterUpdateCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceClusterUpdateCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceClusterUpdateCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceClusterUpdateCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Sets the access control policy on an instance resource. Replaces any
|
|
/// existing policy.
|
|
///
|
|
/// A builder for the *instances.setIamPolicy* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::SetIamPolicyRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = SetIamPolicyRequest::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.projects().instances_set_iam_policy(req, "resource")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceSetIamPolicyCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: SetIamPolicyRequest,
|
|
_resource: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceSetIamPolicyCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceSetIamPolicyCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.setIamPolicy",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("resource", self._resource.to_string()));
|
|
for &field in ["alt", "resource"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+resource}:setIamPolicy";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["resource"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: SetIamPolicyRequest) -> ProjectInstanceSetIamPolicyCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// REQUIRED: The resource for which the policy is being specified.
|
|
/// See the operation documentation for the appropriate value for this field.
|
|
///
|
|
/// Sets the *resource* 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 resource(mut self, new_value: &str) -> ProjectInstanceSetIamPolicyCall<'a, C, A> {
|
|
self._resource = 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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceSetIamPolicyCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceSetIamPolicyCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceSetIamPolicyCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Checks replication consistency based on a consistency token, that is, if
|
|
/// replication has caught up based on the conditions specified in the token
|
|
/// and the check request.
|
|
///
|
|
/// A builder for the *instances.tables.checkConsistency* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::CheckConsistencyRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = CheckConsistencyRequest::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.projects().instances_tables_check_consistency(req, "name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceTableCheckConsistencyCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: CheckConsistencyRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceTableCheckConsistencyCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceTableCheckConsistencyCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, CheckConsistencyResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.checkConsistency",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}:checkConsistency";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: CheckConsistencyRequest) -> ProjectInstanceTableCheckConsistencyCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The unique name of the Table for which to check replication consistency.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/<table>`.
|
|
///
|
|
/// 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) -> ProjectInstanceTableCheckConsistencyCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceTableCheckConsistencyCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceTableCheckConsistencyCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceTableCheckConsistencyCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Lists information about the supported locations for this service.
|
|
///
|
|
/// A builder for the *locations.list* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().locations_list("name")
|
|
/// .page_token("amet")
|
|
/// .page_size(-60)
|
|
/// .filter("labore")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectLocationListCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_page_token: Option<String>,
|
|
_page_size: Option<i32>,
|
|
_filter: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectLocationListCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, ListLocationsResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.locations.list",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
if let Some(value) = self._page_token {
|
|
params.push(("pageToken", value.to_string()));
|
|
}
|
|
if let Some(value) = self._page_size {
|
|
params.push(("pageSize", value.to_string()));
|
|
}
|
|
if let Some(value) = self._filter {
|
|
params.push(("filter", value.to_string()));
|
|
}
|
|
for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}/locations";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The resource that owns the locations collection, if applicable.
|
|
///
|
|
/// 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) -> ProjectLocationListCall<'a, C, A> {
|
|
self._name = new_value.to_string();
|
|
self
|
|
}
|
|
/// The standard list page token.
|
|
///
|
|
/// Sets the *page token* query property to the given value.
|
|
pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> {
|
|
self._page_token = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// The standard list page size.
|
|
///
|
|
/// Sets the *page size* query property to the given value.
|
|
pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C, A> {
|
|
self._page_size = Some(new_value);
|
|
self
|
|
}
|
|
/// The standard list filter.
|
|
///
|
|
/// Sets the *filter* query property to the given value.
|
|
pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> {
|
|
self._filter = Some(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.
|
|
///
|
|
/// 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 Delegate) -> ProjectLocationListCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectLocationListCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Gets the access control policy for an instance resource. Returns an empty
|
|
/// policy if an instance exists but does not have a policy set.
|
|
///
|
|
/// A builder for the *instances.getIamPolicy* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::GetIamPolicyRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = GetIamPolicyRequest::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.projects().instances_get_iam_policy(req, "resource")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceGetIamPolicyCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: GetIamPolicyRequest,
|
|
_resource: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceGetIamPolicyCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceGetIamPolicyCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.getIamPolicy",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("resource", self._resource.to_string()));
|
|
for &field in ["alt", "resource"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+resource}:getIamPolicy";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["resource"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: GetIamPolicyRequest) -> ProjectInstanceGetIamPolicyCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// REQUIRED: The resource for which the policy is being requested.
|
|
/// See the operation documentation for the appropriate value for this field.
|
|
///
|
|
/// Sets the *resource* 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 resource(mut self, new_value: &str) -> ProjectInstanceGetIamPolicyCall<'a, C, A> {
|
|
self._resource = 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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceGetIamPolicyCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceGetIamPolicyCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceGetIamPolicyCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Gets the access control policy for an instance resource. Returns an empty
|
|
/// policy if an table exists but does not have a policy set.
|
|
///
|
|
/// A builder for the *instances.tables.getIamPolicy* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::GetIamPolicyRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = GetIamPolicyRequest::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.projects().instances_tables_get_iam_policy(req, "resource")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceTableGetIamPolicyCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: GetIamPolicyRequest,
|
|
_resource: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceTableGetIamPolicyCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceTableGetIamPolicyCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.getIamPolicy",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("resource", self._resource.to_string()));
|
|
for &field in ["alt", "resource"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+resource}:getIamPolicy";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["resource"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: GetIamPolicyRequest) -> ProjectInstanceTableGetIamPolicyCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// REQUIRED: The resource for which the policy is being requested.
|
|
/// See the operation documentation for the appropriate value for this field.
|
|
///
|
|
/// Sets the *resource* 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 resource(mut self, new_value: &str) -> ProjectInstanceTableGetIamPolicyCall<'a, C, A> {
|
|
self._resource = 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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceTableGetIamPolicyCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceTableGetIamPolicyCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceTableGetIamPolicyCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Gets information about an app profile.
|
|
///
|
|
/// A builder for the *instances.appProfiles.get* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().instances_app_profiles_get("name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceAppProfileGetCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceAppProfileGetCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceAppProfileGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, AppProfile)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.appProfiles.get",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The unique name of the requested app profile. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/appProfiles/<app_profile>`.
|
|
///
|
|
/// 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) -> ProjectInstanceAppProfileGetCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceAppProfileGetCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceAppProfileGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceAppProfileGetCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Delete an instance from a project.
|
|
///
|
|
/// A builder for the *instances.delete* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().instances_delete("name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceDeleteCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceDeleteCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.delete",
|
|
http_method: hyper::method::Method::Delete });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The unique name of the instance to be deleted.
|
|
/// Values are of the form `projects/<project>/instances/<instance>`.
|
|
///
|
|
/// 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) -> ProjectInstanceDeleteCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceDeleteCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceDeleteCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceDeleteCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Lists information about clusters in an instance.
|
|
///
|
|
/// A builder for the *instances.clusters.list* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().instances_clusters_list("parent")
|
|
/// .page_token("Lorem")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceClusterListCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_parent: String,
|
|
_page_token: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceClusterListCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceClusterListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, ListClustersResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.clusters.list",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
if let Some(value) = self._page_token {
|
|
params.push(("pageToken", value.to_string()));
|
|
}
|
|
for &field in ["alt", "parent", "pageToken"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+parent}/clusters";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The unique name of the instance for which a list of clusters is requested.
|
|
/// Values are of the form `projects/<project>/instances/<instance>`.
|
|
/// Use `<instance> = '-'` to list Clusters for all Instances in a project,
|
|
/// e.g., `projects/myproject/instances/-`.
|
|
///
|
|
/// Sets the *parent* 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 parent(mut self, new_value: &str) -> ProjectInstanceClusterListCall<'a, C, A> {
|
|
self._parent = new_value.to_string();
|
|
self
|
|
}
|
|
/// DEPRECATED: This field is unused and ignored.
|
|
///
|
|
/// Sets the *page token* query property to the given value.
|
|
pub fn page_token(mut self, new_value: &str) -> ProjectInstanceClusterListCall<'a, C, A> {
|
|
self._page_token = Some(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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceClusterListCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceClusterListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceClusterListCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Creates a new table in the specified instance.
|
|
/// The table can be created with a full set of initial column families,
|
|
/// specified in the request.
|
|
///
|
|
/// A builder for the *instances.tables.create* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::CreateTableRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = CreateTableRequest::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.projects().instances_tables_create(req, "parent")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceTableCreateCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: CreateTableRequest,
|
|
_parent: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceTableCreateCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceTableCreateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Table)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.create",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
for &field in ["alt", "parent"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+parent}/tables";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: CreateTableRequest) -> ProjectInstanceTableCreateCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The unique name of the instance in which to create the table.
|
|
/// Values are of the form `projects/<project>/instances/<instance>`.
|
|
///
|
|
/// Sets the *parent* 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 parent(mut self, new_value: &str) -> ProjectInstanceTableCreateCall<'a, C, A> {
|
|
self._parent = 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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceTableCreateCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceTableCreateCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceTableCreateCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Lists all tables served from a specified instance.
|
|
///
|
|
/// A builder for the *instances.tables.list* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().instances_tables_list("parent")
|
|
/// .view("duo")
|
|
/// .page_token("et")
|
|
/// .page_size(-40)
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceTableListCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_parent: String,
|
|
_view: Option<String>,
|
|
_page_token: Option<String>,
|
|
_page_size: Option<i32>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceTableListCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceTableListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, ListTablesResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.list",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
if let Some(value) = self._view {
|
|
params.push(("view", value.to_string()));
|
|
}
|
|
if let Some(value) = self._page_token {
|
|
params.push(("pageToken", value.to_string()));
|
|
}
|
|
if let Some(value) = self._page_size {
|
|
params.push(("pageSize", value.to_string()));
|
|
}
|
|
for &field in ["alt", "parent", "view", "pageToken", "pageSize"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+parent}/tables";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The unique name of the instance for which tables should be listed.
|
|
/// Values are of the form `projects/<project>/instances/<instance>`.
|
|
///
|
|
/// Sets the *parent* 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 parent(mut self, new_value: &str) -> ProjectInstanceTableListCall<'a, C, A> {
|
|
self._parent = new_value.to_string();
|
|
self
|
|
}
|
|
/// The view to be applied to the returned tables' fields.
|
|
/// Defaults to `NAME_ONLY` if unspecified; no others are currently supported.
|
|
///
|
|
/// Sets the *view* query property to the given value.
|
|
pub fn view(mut self, new_value: &str) -> ProjectInstanceTableListCall<'a, C, A> {
|
|
self._view = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// The value of `next_page_token` returned by a previous call.
|
|
///
|
|
/// Sets the *page token* query property to the given value.
|
|
pub fn page_token(mut self, new_value: &str) -> ProjectInstanceTableListCall<'a, C, A> {
|
|
self._page_token = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Maximum number of results per page.
|
|
///
|
|
/// A page_size of zero lets the server choose the number of items to return.
|
|
/// A page_size which is strictly positive will return at most that many items.
|
|
/// A negative page_size will cause an error.
|
|
///
|
|
/// Following the first request, subsequent paginated calls are not required
|
|
/// to pass a page_size. If a page_size is set in subsequent calls, it must
|
|
/// match the page_size given in the first request.
|
|
///
|
|
/// Sets the *page size* query property to the given value.
|
|
pub fn page_size(mut self, new_value: i32) -> ProjectInstanceTableListCall<'a, C, A> {
|
|
self._page_size = Some(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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceTableListCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceTableListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceTableListCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Gets information about a cluster.
|
|
///
|
|
/// A builder for the *instances.clusters.get* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().instances_clusters_get("name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceClusterGetCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceClusterGetCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceClusterGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Cluster)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.clusters.get",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The unique name of the requested cluster. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/clusters/<cluster>`.
|
|
///
|
|
/// 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) -> ProjectInstanceClusterGetCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceClusterGetCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceClusterGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceClusterGetCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Partially updates an instance within a project. This method can modify all
|
|
/// fields of an Instance and is the preferred way to update an Instance.
|
|
///
|
|
/// A builder for the *instances.partialUpdateInstance* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::Instance;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = Instance::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.projects().instances_partial_update_instance(req, "name")
|
|
/// .update_mask("amet")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstancePartialUpdateInstanceCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: Instance,
|
|
_name: String,
|
|
_update_mask: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstancePartialUpdateInstanceCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstancePartialUpdateInstanceCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.partialUpdateInstance",
|
|
http_method: hyper::method::Method::Patch });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
if let Some(value) = self._update_mask {
|
|
params.push(("updateMask", value.to_string()));
|
|
}
|
|
for &field in ["alt", "name", "updateMask"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: Instance) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// (`OutputOnly`)
|
|
/// The unique name of the instance. Values are of the form
|
|
/// `projects/<project>/instances/a-z+[a-z0-9]`.
|
|
///
|
|
/// 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) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A> {
|
|
self._name = new_value.to_string();
|
|
self
|
|
}
|
|
/// The subset of Instance fields which should be replaced.
|
|
/// Must be explicitly set.
|
|
///
|
|
/// Sets the *update mask* query property to the given value.
|
|
pub fn update_mask(mut self, new_value: &str) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A> {
|
|
self._update_mask = Some(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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Gets information about an instance.
|
|
///
|
|
/// A builder for the *instances.get* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().instances_get("name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceGetCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceGetCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Instance)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.get",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The unique name of the requested instance. Values are of the form
|
|
/// `projects/<project>/instances/<instance>`.
|
|
///
|
|
/// 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) -> ProjectInstanceGetCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceGetCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceGetCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceGetCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Updates an instance within a project. This method updates only the display
|
|
/// name and type for an Instance. To update other Instance properties, such as
|
|
/// labels, use PartialUpdateInstance.
|
|
///
|
|
/// A builder for the *instances.update* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::Instance;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = Instance::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.projects().instances_update(req, "name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceUpdateCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: Instance,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceUpdateCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Instance)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.update",
|
|
http_method: hyper::method::Method::Put });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: Instance) -> ProjectInstanceUpdateCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// (`OutputOnly`)
|
|
/// The unique name of the instance. Values are of the form
|
|
/// `projects/<project>/instances/a-z+[a-z0-9]`.
|
|
///
|
|
/// 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) -> ProjectInstanceUpdateCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceUpdateCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceUpdateCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceUpdateCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Lists information about instances in a project.
|
|
///
|
|
/// A builder for the *instances.list* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().instances_list("parent")
|
|
/// .page_token("ea")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceListCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_parent: String,
|
|
_page_token: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceListCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, ListInstancesResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.list",
|
|
http_method: hyper::method::Method::Get });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
if let Some(value) = self._page_token {
|
|
params.push(("pageToken", value.to_string()));
|
|
}
|
|
for &field in ["alt", "parent", "pageToken"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+parent}/instances";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The unique name of the project for which a list of instances is requested.
|
|
/// Values are of the form `projects/<project>`.
|
|
///
|
|
/// Sets the *parent* 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 parent(mut self, new_value: &str) -> ProjectInstanceListCall<'a, C, A> {
|
|
self._parent = new_value.to_string();
|
|
self
|
|
}
|
|
/// DEPRECATED: This field is unused and ignored.
|
|
///
|
|
/// Sets the *page token* query property to the given value.
|
|
pub fn page_token(mut self, new_value: &str) -> ProjectInstanceListCall<'a, C, A> {
|
|
self._page_token = Some(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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceListCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceListCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceListCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Creates an app profile within an instance.
|
|
///
|
|
/// A builder for the *instances.appProfiles.create* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::AppProfile;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = AppProfile::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.projects().instances_app_profiles_create(req, "parent")
|
|
/// .ignore_warnings(true)
|
|
/// .app_profile_id("dolor")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceAppProfileCreateCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: AppProfile,
|
|
_parent: String,
|
|
_ignore_warnings: Option<bool>,
|
|
_app_profile_id: Option<String>,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceAppProfileCreateCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceAppProfileCreateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, AppProfile)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.appProfiles.create",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
if let Some(value) = self._ignore_warnings {
|
|
params.push(("ignoreWarnings", value.to_string()));
|
|
}
|
|
if let Some(value) = self._app_profile_id {
|
|
params.push(("appProfileId", value.to_string()));
|
|
}
|
|
for &field in ["alt", "parent", "ignoreWarnings", "appProfileId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+parent}/appProfiles";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: AppProfile) -> ProjectInstanceAppProfileCreateCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The unique name of the instance in which to create the new app profile.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>`.
|
|
///
|
|
/// Sets the *parent* 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 parent(mut self, new_value: &str) -> ProjectInstanceAppProfileCreateCall<'a, C, A> {
|
|
self._parent = new_value.to_string();
|
|
self
|
|
}
|
|
/// If true, ignore safety checks when creating the app profile.
|
|
///
|
|
/// Sets the *ignore warnings* query property to the given value.
|
|
pub fn ignore_warnings(mut self, new_value: bool) -> ProjectInstanceAppProfileCreateCall<'a, C, A> {
|
|
self._ignore_warnings = Some(new_value);
|
|
self
|
|
}
|
|
/// The ID to be used when referring to the new app profile within its
|
|
/// instance, e.g., just `myprofile` rather than
|
|
/// `projects/myproject/instances/myinstance/appProfiles/myprofile`.
|
|
///
|
|
/// Sets the *app profile id* query property to the given value.
|
|
pub fn app_profile_id(mut self, new_value: &str) -> ProjectInstanceAppProfileCreateCall<'a, C, A> {
|
|
self._app_profile_id = Some(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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceAppProfileCreateCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceAppProfileCreateCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceAppProfileCreateCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Performs a series of column family modifications on the specified table.
|
|
/// Either all or none of the modifications will occur before this method
|
|
/// returns, but data requests received prior to that point may see a table
|
|
/// where only some modifications have taken effect.
|
|
///
|
|
/// A builder for the *instances.tables.modifyColumnFamilies* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::ModifyColumnFamiliesRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = ModifyColumnFamiliesRequest::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.projects().instances_tables_modify_column_families(req, "name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceTableModifyColumnFamilyCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: ModifyColumnFamiliesRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Table)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.modifyColumnFamilies",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}:modifyColumnFamilies";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: ModifyColumnFamiliesRequest) -> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The unique name of the table whose families should be modified.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/<table>`.
|
|
///
|
|
/// 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) -> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Sets the access control policy on a table resource. Replaces any existing
|
|
/// policy.
|
|
///
|
|
/// A builder for the *instances.tables.setIamPolicy* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::SetIamPolicyRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = SetIamPolicyRequest::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.projects().instances_tables_set_iam_policy(req, "resource")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceTableSetIamPolicyCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: SetIamPolicyRequest,
|
|
_resource: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceTableSetIamPolicyCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceTableSetIamPolicyCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.setIamPolicy",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("resource", self._resource.to_string()));
|
|
for &field in ["alt", "resource"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+resource}:setIamPolicy";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["resource"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: SetIamPolicyRequest) -> ProjectInstanceTableSetIamPolicyCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// REQUIRED: The resource for which the policy is being specified.
|
|
/// See the operation documentation for the appropriate value for this field.
|
|
///
|
|
/// Sets the *resource* 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 resource(mut self, new_value: &str) -> ProjectInstanceTableSetIamPolicyCall<'a, C, A> {
|
|
self._resource = 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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceTableSetIamPolicyCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceTableSetIamPolicyCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceTableSetIamPolicyCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Deletes a cluster from an instance.
|
|
///
|
|
/// A builder for the *instances.clusters.delete* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().instances_clusters_delete("name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceClusterDeleteCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceClusterDeleteCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceClusterDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.clusters.delete",
|
|
http_method: hyper::method::Method::Delete });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The unique name of the cluster to be deleted. Values are of the form
|
|
/// `projects/<project>/instances/<instance>/clusters/<cluster>`.
|
|
///
|
|
/// 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) -> ProjectInstanceClusterDeleteCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceClusterDeleteCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceClusterDeleteCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceClusterDeleteCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Returns permissions that the caller has on the specified instance resource.
|
|
///
|
|
/// A builder for the *instances.testIamPermissions* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::TestIamPermissionsRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = TestIamPermissionsRequest::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.projects().instances_test_iam_permissions(req, "resource")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceTestIamPermissionCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: TestIamPermissionsRequest,
|
|
_resource: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceTestIamPermissionCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceTestIamPermissionCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.testIamPermissions",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("resource", self._resource.to_string()));
|
|
for &field in ["alt", "resource"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+resource}:testIamPermissions";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["resource"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: TestIamPermissionsRequest) -> ProjectInstanceTestIamPermissionCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// REQUIRED: The resource for which the policy detail is being requested.
|
|
/// See the operation documentation for the appropriate value for this field.
|
|
///
|
|
/// Sets the *resource* 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 resource(mut self, new_value: &str) -> ProjectInstanceTestIamPermissionCall<'a, C, A> {
|
|
self._resource = 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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceTestIamPermissionCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceTestIamPermissionCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceTestIamPermissionCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Permanently deletes a specified table and all of its data.
|
|
///
|
|
/// A builder for the *instances.tables.delete* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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.projects().instances_tables_delete("name")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceTableDeleteCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_name: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceTableDeleteCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceTableDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.delete",
|
|
http_method: hyper::method::Method::Delete });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone());
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The unique name of the table to be deleted.
|
|
/// Values are of the form
|
|
/// `projects/<project>/instances/<instance>/tables/<table>`.
|
|
///
|
|
/// 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) -> ProjectInstanceTableDeleteCall<'a, C, A> {
|
|
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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceTableDeleteCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceTableDeleteCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceTableDeleteCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Returns permissions that the caller has on the specified table resource.
|
|
///
|
|
/// A builder for the *instances.tables.testIamPermissions* method supported by a *project* resource.
|
|
/// It is not used directly, but through a `ProjectMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate yup_oauth2 as oauth2;
|
|
/// # extern crate google_bigtableadmin2 as bigtableadmin2;
|
|
/// use bigtableadmin2::TestIamPermissionsRequest;
|
|
/// # #[test] fn egal() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
/// # use bigtableadmin2::BigtableAdmin;
|
|
///
|
|
/// # let secret: ApplicationSecret = Default::default();
|
|
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
|
/// # <MemoryStorage as Default>::default(), None);
|
|
/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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 = TestIamPermissionsRequest::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.projects().instances_tables_test_iam_permissions(req, "resource")
|
|
/// .doit();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectInstanceTableTestIamPermissionCall<'a, C, A>
|
|
where C: 'a, A: 'a {
|
|
|
|
hub: &'a BigtableAdmin<C, A>,
|
|
_request: TestIamPermissionsRequest,
|
|
_resource: String,
|
|
_delegate: Option<&'a mut Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a, C, A> CallBuilder for ProjectInstanceTableTestIamPermissionCall<'a, C, A> {}
|
|
|
|
impl<'a, C, A> ProjectInstanceTableTestIamPermissionCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
|
|
let mut dd = DefaultDelegate;
|
|
let mut dlg: &mut Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.testIamPermissions",
|
|
http_method: hyper::method::Method::Post });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("resource", self._resource.to_string()));
|
|
for &field in ["alt", "resource"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/{+resource}:testIamPermissions";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["resource"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = hyper::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
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 {
|
|
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
|
|
Ok(token) => token,
|
|
Err(err) => {
|
|
match dlg.token(&*err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let auth_header = Authorization(Bearer { token: token.access_token });
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let mut client = &mut *self.hub.client.borrow_mut();
|
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
|
|
.header(UserAgent(self.hub._user_agent.clone()))
|
|
.header(auth_header.clone())
|
|
.header(ContentType(json_mime_type.clone()))
|
|
.header(ContentLength(request_size as u64))
|
|
.body(&mut request_value_reader);
|
|
|
|
dlg.pre_request();
|
|
req.send()
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status.is_success() {
|
|
let mut json_err = String::new();
|
|
res.read_to_string(&mut json_err).unwrap();
|
|
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
|
|
json::from_str(&json_err).ok(),
|
|
json::from_str(&json_err).ok()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<ErrorResponse>(&json_err){
|
|
Err(_) => Err(Error::Failure(res)),
|
|
Ok(serr) => Err(Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let mut json_response = String::new();
|
|
res.read_to_string(&mut json_response).unwrap();
|
|
match json::from_str(&json_response) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&json_response, &err);
|
|
return Err(Error::JsonDecodeError(json_response, 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: TestIamPermissionsRequest) -> ProjectInstanceTableTestIamPermissionCall<'a, C, A> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// REQUIRED: The resource for which the policy detail is being requested.
|
|
/// See the operation documentation for the appropriate value for this field.
|
|
///
|
|
/// Sets the *resource* 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 resource(mut self, new_value: &str) -> ProjectInstanceTableTestIamPermissionCall<'a, C, A> {
|
|
self._resource = 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.
|
|
///
|
|
/// 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 Delegate) -> ProjectInstanceTableTestIamPermissionCall<'a, C, A> {
|
|
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
|
|
///
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
pub fn param<T>(mut self, name: T, value: T) -> ProjectInstanceTableTestIamPermissionCall<'a, C, A>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::BigtableAdmin`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectInstanceTableTestIamPermissionCall<'a, C, A>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|