coreos-stream-metadata

Crates.iocoreos-stream-metadata
lib.rscoreos-stream-metadata
version0.1.0
sourcesrc
created_at2022-11-02 19:36:49.456765
updated_at2022-11-02 19:36:49.456765
descriptionFetch and parse stream metadata for Fedora CoreOS and derivatives
homepage
repositoryhttps://github.com/coreos/stream-metadata-rust
max_upload_size
id703698
size45,475
Jonathan Lebon (jlebon)

documentation

README

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(())
}
Commit count: 101

cargo fmt