pub struct InstanceMetadata { /* private fields */ }Expand description
The credential of the service account the instance runs as, from the
instance’s metadata service: a session is opened for six hours, and each
access token, which lives five minutes, requested with it a minute
before the last one expires. The requests never go through a proxy,
which the metadata service refuses, and one it can’t answer right now
(503) is sent again twice.
Implementations§
Source§impl InstanceMetadata
impl InstanceMetadata
Sourcepub fn new() -> Self
pub fn new() -> Self
The metadata service at METADATA_ENDPOINT.
Sourcepub fn with_endpoint(self, url: impl Into<String>) -> Self
pub fn with_endpoint(self, url: impl Into<String>) -> Self
Asks the metadata service at url instead of METADATA_ENDPOINT.
Sourcepub fn with_http_client(self, http: Client) -> Self
pub fn with_http_client(self, http: Client) -> Self
Sends the requests with http, as it is configured, instead of a
client without a proxy that gives up connecting after a second.
Opening a session is bounded by two seconds either way, and
requesting a credential by five.
Trait Implementations§
Source§impl Credentials for InstanceMetadata
impl Credentials for InstanceMetadata
Source§fn token(&self) -> TokenFuture<'_>
fn token(&self) -> TokenFuture<'_>
A valid access token.
Source§impl Debug for InstanceMetadata
impl Debug for InstanceMetadata
Auto Trait Implementations§
impl !Freeze for InstanceMetadata
impl !RefUnwindSafe for InstanceMetadata
impl !UnwindSafe for InstanceMetadata
impl Forget for InstanceMetadata
impl Send for InstanceMetadata
impl Sync for InstanceMetadata
impl Unpin for InstanceMetadata
impl UnsafeUnpin for InstanceMetadata
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