pub struct Client<C, B = Body> { /* private fields */ }
Expand description
A Client to access metadata service.
Implementations
sourceimpl Client<(), Body>
impl Client<(), Body>
sourcepub fn new() -> Client<HttpConnector, Body>
pub fn new() -> Client<HttpConnector, Body>
Create a new Client with the default config.
sourceimpl<C, B> Client<C, B> where
C: Connect + Clone + Send + Sync + 'static,
B: HttpBody + Default + Send + 'static,
B::Data: Send,
B::Error: Into<Box<dyn Error + Send + Sync>>,
impl<C, B> Client<C, B> where
C: Connect + Clone + Send + Sync + 'static,
B: HttpBody + Default + Send + 'static,
B::Data: Send,
B::Error: Into<Box<dyn Error + Send + Sync>>,
sourcepub fn get(
&self,
path_and_query: PathAndQuery,
trim: bool
) -> impl Future<Output = Result<String>> + Send + 'static
pub fn get(
&self,
path_and_query: PathAndQuery,
trim: bool
) -> impl Future<Output = Result<String>> + Send + 'static
Get value from the metadata service.
sourcepub fn get_as<T>(
&self,
path_and_query: PathAndQuery
) -> impl Future<Output = Result<T>> + Send + 'static where
T: DeserializeOwned,
pub fn get_as<T>(
&self,
path_and_query: PathAndQuery
) -> impl Future<Output = Result<T>> + Send + 'static where
T: DeserializeOwned,
Get value from the metadata service.
sourcepub async fn on_gce(&self) -> Result<bool>
pub async fn on_gce(&self) -> Result<bool>
Report whether this process is running on Google Compute Engine.
sourcepub async fn project_id(&self) -> Result<String>
pub async fn project_id(&self) -> Result<String>
Get the current instance’s project ID string.
sourcepub async fn numeric_project_id(&self) -> Result<String>
pub async fn numeric_project_id(&self) -> Result<String>
Get the current instance’s numeric project ID.
sourcepub async fn internal_ip(&self) -> Result<String>
pub async fn internal_ip(&self) -> Result<String>
Get the instance’s primary internal IP address.
sourcepub async fn external_ip(&self) -> Result<String>
pub async fn external_ip(&self) -> Result<String>
Get the instance’s primary external (public) IP address.
sourcepub async fn hostname(&self) -> Result<String>
pub async fn hostname(&self) -> Result<String>
Get the instance’s hostname.
This will be of the form <instance_id>.c.<project_id>.internal
.
Get the list of user-defined instance tags, assigned when initially creating a GCE instance.
sourcepub async fn instance_id(&self) -> Result<String>
pub async fn instance_id(&self) -> Result<String>
Get the current VM’s numeric instance ID.
sourcepub async fn instance_name(&self) -> Result<String>
pub async fn instance_name(&self) -> Result<String>
Get the current VM’s instance ID string.
sourcepub async fn instance_attrs(&self) -> Result<Vec<String>>
pub async fn instance_attrs(&self) -> Result<Vec<String>>
Get the list of user-defined attributes, assigned when initially creating a GCE VM instance.
sourcepub async fn project_attrs(&self) -> Result<Vec<String>>
pub async fn project_attrs(&self) -> Result<Vec<String>>
Get the list of user-defined attributes applying to the project as a whole, not just this VM.
sourcepub async fn instance_attr(&self, attr: impl AsRef<str>) -> Result<String>
pub async fn instance_attr(&self, attr: impl AsRef<str>) -> Result<String>
Get the value of the provided VM instance attribute.
Trait Implementations
Auto Trait Implementations
impl<C, B = Body> !RefUnwindSafe for Client<C, B>
impl<C, B> Send for Client<C, B> where
B: Send,
C: Send,
impl<C, B> Sync for Client<C, B> where
B: Send,
C: Sync,
impl<C, B> Unpin for Client<C, B> where
C: Unpin,
impl<C, B = Body> !UnwindSafe for Client<C, B>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more