Skip to main content

GoogleApiClient

Struct GoogleApiClient 

Source
pub struct GoogleApiClient<B, C>
where B: GoogleApiClientBuilder<C>, C: Clone + Send,
{ /* private fields */ }

Implementations§

Source§

impl<B, C> GoogleApiClient<B, C>
where B: GoogleApiClientBuilder<C>, C: Clone + Send,

Source

pub async fn with_credentials<S: AsRef<str>>( builder: B, google_api_url: S, cloud_resource_prefix: Option<String>, credentials: Credentials, ) -> Result<Self>

Source

pub async fn with_credentials_and_headers<S: AsRef<str>>( builder: B, google_api_url: S, cloud_resource_prefix: Option<String>, credentials: Credentials, additional_headers: HeaderMap, ) -> Result<Self>

Source

pub async fn with_middleware<S: AsRef<str>>( builder: B, google_api_url: S, middleware: GoogleAuthMiddlewareLayer, ) -> Result<Self>

Source

pub fn get(&self) -> C

Source

pub fn get_with<C2>( &self, f: impl FnOnce(GoogleAuthMiddlewareService<Channel>) -> C2, ) -> C2

Builds a client of another API on this client’s authenticated channel: same connection, authentication and headers, for an API served from the same endpoint (Firestore’s admin and long-running operations services, for example).

Source

pub async fn connect_with_endpoint<C2, S: AsRef<str>>( &self, builder_fn: fn(GoogleAuthMiddlewareService<Channel>) -> C2, google_api_url: S, cloud_resource_prefix: Option<String>, ) -> Result<GoogleApi<C2>>
where C2: Clone + Send,

Builds a client of an API served from another endpoint that reuses this client’s authentication: one GoogleAuthHeaders, so the token is fetched and refreshed once for both clients (BigQuery and Cloud Storage, for example).

Unlike get_with, which shares the channel and so reaches only the same host, this opens a new channel to google_api_url. The user agent, x-goog-api-client and additional headers are carried over; google-cloud-resource-prefix is not, since another API usually needs another prefix or none, and is set from cloud_resource_prefix instead.

Source

pub fn amend_user_agent(self, user_agent: String) -> Result<Self>

Source

pub fn amend_x_goog_api_client(self, x_goog_api_client: String) -> Result<Self>

Source§

impl<C> GoogleApiClient<GoogleApiClientBuilderFunction<C>, C>
where C: Clone + Send,

Source

pub async fn from_function<S: AsRef<str>>( builder_fn: fn(GoogleAuthMiddlewareService<Channel>) -> C, google_api_url: S, cloud_resource_prefix_meta: Option<String>, ) -> Result<Self>

A client that authenticates with the Application Default Credentials, for the cloud-platform scope.

Source

pub async fn from_function_with_headers<S: AsRef<str>>( builder_fn: fn(GoogleAuthMiddlewareService<Channel>) -> C, google_api_url: S, cloud_resource_prefix_meta: Option<String>, headers: HeaderMap, ) -> Result<Self>

Source

pub async fn from_function_with_scopes<S: AsRef<str>>( builder_fn: fn(GoogleAuthMiddlewareService<Channel>) -> C, google_api_url: S, cloud_resource_prefix_meta: Option<String>, token_scopes: Vec<String>, ) -> Result<Self>

A client that authenticates with the Application Default Credentials, for token_scopes.

Fails with ErrorKind::CryptoProviderMissing for a service account key, used directly or as the source of an impersonation, when the auth-default-crypto feature is off and no rustls crypto provider is installed.

Source

pub async fn from_function_with_scopes_and_headers<S: AsRef<str>>( builder_fn: fn(GoogleAuthMiddlewareService<Channel>) -> C, google_api_url: S, cloud_resource_prefix_meta: Option<String>, token_scopes: Vec<String>, headers: HeaderMap, ) -> Result<Self>

Source

pub async fn from_function_with_credentials<S: AsRef<str>>( builder_fn: fn(GoogleAuthMiddlewareService<Channel>) -> C, google_api_url: S, cloud_resource_prefix_meta: Option<String>, credentials: Credentials, ) -> Result<Self>

A client that authenticates with credentials, built with google_cloud_auth: a service account key, impersonation, workload identity federation, or a CredentialsProvider of your own.

credentials built from a service account key need a rustls crypto provider when the auth-default-crypto feature is off. They are opaque here, so this constructor cannot check for one.

Source

pub async fn from_function_with_credentials_and_headers<S: AsRef<str>>( builder_fn: fn(GoogleAuthMiddlewareService<Channel>) -> C, google_api_url: S, cloud_resource_prefix_meta: Option<String>, credentials: Credentials, headers: HeaderMap, ) -> Result<Self>

Source

pub async fn from_function_with_middleware<S: AsRef<str>>( builder_fn: fn(GoogleAuthMiddlewareService<Channel>) -> C, google_api_url: S, middleware: GoogleAuthMiddlewareLayer, ) -> Result<Self>

Trait Implementations§

Source§

impl<B, C> Clone for GoogleApiClient<B, C>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<B, C> !RefUnwindSafe for GoogleApiClient<B, C>

§

impl<B, C> !UnwindSafe for GoogleApiClient<B, C>

§

impl<B, C> Freeze for GoogleApiClient<B, C>
where B: Freeze, PhantomData<C>: Freeze,

§

impl<B, C> Send for GoogleApiClient<B, C>
where B: Send, PhantomData<C>: Send,

§

impl<B, C> Sync for GoogleApiClient<B, C>
where B: Sync, PhantomData<C>: Sync,

§

impl<B, C> Unpin for GoogleApiClient<B, C>
where B: Unpin, PhantomData<C>: Unpin,

§

impl<B, C> UnsafeUnpin for GoogleApiClient<B, 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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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