google_iam1::api

Struct Iam

source
pub struct Iam<C> {
    pub client: Client<C>,
    pub auth: Box<dyn GetToken>,
    /* private fields */
}
Expand description

Central instance to access all Iam related resource activities

§Examples

Instantiate a new hub

extern crate hyper;
extern crate hyper_rustls;
extern crate google_iam1 as iam1;
use iam1::api::WorkforcePoolProviderKey;
use iam1::{Result, Error};
use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};

// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: yup_oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace  `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
    secret,
    yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();

let client = hyper_util::client::legacy::Client::builder(
    hyper_util::rt::TokioExecutor::new()
)
.build(
    hyper_rustls::HttpsConnectorBuilder::new()
        .with_native_roots()
        .unwrap()
        .https_or_http()
        .enable_http1()
        .build()
);
let mut hub = Iam::new(client, 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 = WorkforcePoolProviderKey::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.locations().workforce_pools_providers_keys_create(req, "parent")
             .workforce_pool_provider_key_id("At")
             .doit().await;

match result {
    Err(e) => match e {
        // The Error enum provides details about what exactly happened.
        // You can also just use its `Debug`, `Display` or `Error` traits
         Error::HttpError(_)
        |Error::Io(_)
        |Error::MissingAPIKey
        |Error::MissingToken(_)
        |Error::Cancelled
        |Error::UploadSizeLimitExceeded(_, _)
        |Error::Failure(_)
        |Error::BadRequest(_)
        |Error::FieldClash(_)
        |Error::JsonDecodeError(_, _) => println!("{}", e),
    },
    Ok(res) => println!("Success: {:?}", res),
}

Fields§

§client: Client<C>§auth: Box<dyn GetToken>

Implementations§

source§

impl<'a, C> Iam<C>

source

pub fn new<A: 'static + GetToken>(client: Client<C>, auth: A) -> Iam<C>

source

pub fn iam_policies(&'a self) -> IamPolicyMethods<'a, C>

source

pub fn locations(&'a self) -> LocationMethods<'a, C>

source

pub fn organizations(&'a self) -> OrganizationMethods<'a, C>

source

pub fn permissions(&'a self) -> PermissionMethods<'a, C>

source

pub fn projects(&'a self) -> ProjectMethods<'a, C>

source

pub fn roles(&'a self) -> RoleMethods<'a, C>

source

pub fn user_agent(&mut self, agent_name: String) -> String

Set the user-agent header field to use in all requests to the server. It defaults to google-api-rust-client/6.0.0.

Returns the previously set user-agent.

source

pub fn base_url(&mut self, new_base_url: String) -> String

Set the base url to use in all requests to the server. It defaults to https://iam.googleapis.com/.

Returns the previously set base url.

source

pub fn root_url(&mut self, new_root_url: String) -> String

Set the root url to use in all requests to the server. It defaults to https://iam.googleapis.com/.

Returns the previously set root url.

Trait Implementations§

source§

impl<C: Clone> Clone for Iam<C>

source§

fn clone(&self) -> Iam<C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C> Hub for Iam<C>

Auto Trait Implementations§

§

impl<C> Freeze for Iam<C>
where C: Freeze,

§

impl<C> !RefUnwindSafe for Iam<C>

§

impl<C> Send for Iam<C>
where C: Send,

§

impl<C> Sync for Iam<C>
where C: Sync,

§

impl<C> Unpin for Iam<C>
where C: Unpin,

§

impl<C> !UnwindSafe for Iam<C>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more