[][src]Crate opsgenie_rs

This is an unofficial Rust client for OpsGenie API v2.

The client is autogenerated from the OpenAPI definition found in the OpsGenie Python SDK repository.

Please consult the official OpsGenie API documentation.

For using this crate, you may want to start by exploring the apis submodules.

Quick example

The example below shows how to make a basic call to list open alerts.

Note the base_path in the Configuration. This allows connecting to a non-US datacenter. You may omit it when connecting to the default US datacenter.

use opsgenie_rs::apis::alert_api::list_alerts;
use opsgenie_rs::apis::configuration::{ApiKey, Configuration};

#[tokio::main]
async fn main() {
    let api_key = Some(ApiKey {
        prefix: Some("GenieKey".to_string()),
        key: "12345678-abcd-1234-abcd-1234567890ab".to_string(),
    });

    let configuration = Configuration {
        api_key,
        base_path: "https://api.eu.opsgenie.com".to_owned(),
        ..Default::default()
    };

    let result = list_alerts(
        &configuration,
        Some("state=open"),
        None,
        None,
        None,
        Some(10),
        Some("created_at"),
        Some("asc"),
    )
        .await;

    match result {
        Err(e) => println!("Something went wrong: {}", e),
        Ok(response) => println!("{:#?}", response),
    }
}

Modules

apis
models