pub struct GoogleApiClient<B, C>{ /* private fields */ }Implementations§
Source§impl<B, C> GoogleApiClient<B, C>
impl<B, C> GoogleApiClient<B, C>
pub async fn with_credentials<S: AsRef<str>>( builder: B, google_api_url: S, cloud_resource_prefix: Option<String>, credentials: Credentials, ) -> Result<Self>
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>
pub async fn with_middleware<S: AsRef<str>>( builder: B, google_api_url: S, middleware: GoogleAuthMiddlewareLayer, ) -> Result<Self>
pub fn get(&self) -> C
Sourcepub fn get_with<C2>(
&self,
f: impl FnOnce(GoogleAuthMiddlewareService<Channel>) -> C2,
) -> C2
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).
Sourcepub 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>>
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>>
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.
pub fn amend_user_agent(self, user_agent: String) -> Result<Self>
pub fn amend_x_goog_api_client(self, x_goog_api_client: String) -> Result<Self>
Source§impl<C> GoogleApiClient<GoogleApiClientBuilderFunction<C>, C>
impl<C> GoogleApiClient<GoogleApiClientBuilderFunction<C>, C>
Sourcepub 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>
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.
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>
Sourcepub 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>
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.
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>
Sourcepub 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>
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.
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>
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>
impl<B, C> Clone for GoogleApiClient<B, C>
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>
impl<B, C> Send for GoogleApiClient<B, C>
impl<B, C> Sync for GoogleApiClient<B, C>
impl<B, C> Unpin for GoogleApiClient<B, C>
impl<B, C> UnsafeUnpin for GoogleApiClient<B, C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request