pub struct MetadataService { /* private fields */ }Expand description
Instance metadata source (link-local address 169.254.169.254).
Implementations§
Source§impl MetadataService
impl MetadataService
Sourcepub const DEFAULT_BASE_URL: &'static str = "169.254.169.254"
pub const DEFAULT_BASE_URL: &'static str = "169.254.169.254"
Standard metadata service IP.
Sourcepub fn get_instance_id(&self) -> Option<&str>
pub fn get_instance_id(&self) -> Option<&str>
Get the instance ID.
Sourcepub fn get_hostname(&self) -> Option<&str>
pub fn get_hostname(&self) -> Option<&str>
Get the hostname.
Sourcepub fn get_public_keys(&self) -> Vec<&str>
pub fn get_public_keys(&self) -> Vec<&str>
Get public SSH keys.
Sourcepub fn set(&mut self, key: String, value: String)
pub fn set(&mut self, key: String, value: String)
Set a metadata value (for testing or manual override).
Sourcepub fn fetch_metadata(&mut self) -> Result<(), CloudInitError>
pub fn fetch_metadata(&mut self) -> Result<(), CloudInitError>
Simulate fetching metadata from the link-local service.
In a real implementation this would make HTTP GET requests to
http://169.254.169.254/latest/meta-data/{path}.