coreos-stream-metadata

Fetch and parse stream metadata for Fedora CoreOS and derivatives


License
Apache-2.0

Documentation

Rust library for interacting with CoreOS Stream metadata

See the Fedora CoreOS documentation for basic information about streams.

This is a Rust library which defines standard structs that #[derive(Deserialize)] for use with serde.

Example usage

use anyhow::Result;
use coreos_stream_metadata::Stream;

#[tokio::main]
fn main() -> Result<()> {
  let streamid = coreos_stream_metadata::fcos::StreamId::Stable;
  let arch = "x86_64";
  let region = "us-east-1";
  let buf = reqwest::get(streamid.url())
    .await?
    .bytes()
    .await?;
  let stream: Stream = serde_json::from_slice(&buf)?;
  let ami = stream.architectures.get(arch).unwrap().images.get("aws").unwrap().regions(region).unwrap();
  println!("The AMI for FCOS {} {} is {} (version {})", streamid, region, ami.image, ami.release);
  Ok(())
}