pub struct MetadataService { /* private fields */ }Expand description
A client that talks to the Google metadata service and gets tokens for the default service account.
This only will work on hosts that are within the GCP network.
See google_cloud_auth::credentials::mds for more details.
Implementations§
Source§impl MetadataService
impl MetadataService
Sourcepub async fn metadata_endpoint_exists() -> Result<bool>
pub async fn metadata_endpoint_exists() -> Result<bool>
Verify whether the metadata.google.internal endpoint exists, and it returns a 2XX.
Sourcepub async fn new(
oauth_config: &OAuthConfig,
scopes: &[impl AsRef<str>],
) -> Result<MetadataService>
pub async fn new( oauth_config: &OAuthConfig, scopes: &[impl AsRef<str>], ) -> Result<MetadataService>
Attempt to create an auth client that will contact the metadata service if possible.
To verify that the metadata service is available, see Self::metadata_endpoint_exists
Trait Implementations§
Source§impl Debug for MetadataService
impl Debug for MetadataService
Source§impl TokenSource for MetadataService
impl TokenSource for MetadataService
Source§fn kind(&self) -> &'static str
fn kind(&self) -> &'static str
A human readable description of this class e.g. “authorized user”
Source§fn credentials<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Credentials> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn credentials<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Credentials> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return a
Credentials object that other Google Cloud SDK APIs can useSource§fn refresh<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn refresh<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Attempt to re-authenticate if possible. This may be an interactive action.
Source§fn get_id_token_impl<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token, IdTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_id_token_impl<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token, IdTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The actual implementation to fetch an ID token. This varies based on client type.
Source§fn get_id_token_with_refresh<'life0, 'async_trait>(
&'life0 self,
refresh: bool,
) -> Pin<Box<dyn Future<Output = Result<Token, IdTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_id_token_with_refresh<'life0, 'async_trait>(
&'life0 self,
refresh: bool,
) -> Pin<Box<dyn Future<Output = Result<Token, IdTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Common implementation for getting an id token, or refreshing and retrying
if the token is expired.
Source§fn get_id_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token, IdTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_id_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token, IdTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_access_token_impl<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token, AccessTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_access_token_impl<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token, AccessTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The actual implementation to fetch an access token. Read more
Source§fn get_access_token_with_refresh<'life0, 'async_trait>(
&'life0 self,
refresh: bool,
) -> Pin<Box<dyn Future<Output = Result<Token, AccessTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_access_token_with_refresh<'life0, 'async_trait>(
&'life0 self,
refresh: bool,
) -> Pin<Box<dyn Future<Output = Result<Token, AccessTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Common implementation for getting an access token, or refreshing and retrying
if the token is expired.
Source§fn get_access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token, AccessTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Token, AccessTokenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get an access token, refreshing if necessary
Auto Trait Implementations§
impl Freeze for MetadataService
impl !RefUnwindSafe for MetadataService
impl Send for MetadataService
impl Sync for MetadataService
impl Unpin for MetadataService
impl UnsafeUnpin for MetadataService
impl !UnwindSafe for MetadataService
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
Mutably borrows from an owned value. Read more
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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