/// Make a check using the hashicorp checkpoint api.
Make a check using the hashicorp checkpoint api.
Make a check using the hashicorp checkpoint api .
pub fn check(version: Option<&str>) -> anyhow::Result<CheckResponse> {
    let client = Client::builder()
        // https://github.com/hashicorp/go-checkpoint/blob/bbe6c410aa4be4194cb490a2bde8c3c33f295541/check.go#L101-L102
        .timeout(Duration::from_secs(3))
        .user_agent("github.com/cezarmathe/nomadutil")
        .build()?;
    let queries: Vec<(&str, &str)> = {
        let mut queries = Vec::new();
        queries.push(("arch", crate::ARCH));
        queries.push(("os", "linux"));
        if let Some(value) = version {
            queries.push(("version", value));
        }
        queries
    };
    Ok(client
        .get("https://checkpoint-api.hashicorp.com/v1/check/nomad")
        .header(ACCEPT, "application/json")
        .query(queries.as_slice())
        .send()?
        .json()?)
}
pub fn check ( version : Option < & str > ) -> anyhow :: Result < CheckResponse > { let client = Client :: builder ( ) // https://github.com/hashicorp/go-checkpoint/blob/bbe6c410aa4be4194cb490a2bde8c3c33f295541/check.go#L101-L102 . timeout ( Duration :: from_secs ( 3 ) ) . user_agent ( " " ) . build ( ) ? ; let queries : Vec < ( & str , & str ) > = { let mut queries = Vec :: new ( ) ; queries . push ( ( " " , crate :: ARCH ) ) ; queries . push ( ( " " , " " ) ) ; if let Some ( value ) = version { queries . push ( ( " " , value ) ) ; } queries } ; Ok ( client . get ( " " ) . header ( ACCEPT , " " ) . query ( queries . as_slice ( ) ) . send ( ) ? . json ( ) ? ) }
Make a check using the hashicorp checkpoint api.
Make a check using the hashicorp checkpoint api .
version
Option<&str>