opsgenie-rs 0.1.0-alpha.2

Rust client for OpsGenie API
Documentation
/*
 * Python SDK for Opsgenie REST API
 *
 * Python SDK for Opsgenie REST API
 *
 * The version of the OpenAPI document: 2.0.0
 * Contact: support@opsgenie.com
 * Generated by: https://openapi-generator.tech
 */




#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Condition {
    /// Specifies which alert field will be used in condition. Possible values are message, alias, description, source, entity, tags, actions, extra-properties, recipients or teams
    #[serde(rename = "field")]
    pub field: Field,
    /// If field is set as extra-properties, key could be used for key-value pair
    #[serde(rename = "key", skip_serializing_if = "Option::is_none")]
    pub key: Option<String>,
    /// Indicates behaviour of the given operation. Default value is false
    #[serde(rename = "not", skip_serializing_if = "Option::is_none")]
    pub not: Option<bool>,
    /// It is the operation that will be executed for the given field and key.
    #[serde(rename = "operation")]
    pub operation: Operation,
    /// User defined value that will be compared with alert field according to the operation. Default value is empty string
    #[serde(rename = "expectedValue", skip_serializing_if = "Option::is_none")]
    pub expected_value: Option<String>,
    /// Order of the condition in conditions list
    #[serde(rename = "order", skip_serializing_if = "Option::is_none")]
    pub order: Option<i64>,
}

impl Condition {
    pub fn new(field: Field, operation: Operation) -> Condition {
        Condition {
            field,
            key: None,
            not: None,
            operation,
            expected_value: None,
            order: None,
        }
    }
}

/// Specifies which alert field will be used in condition. Possible values are message, alias, description, source, entity, tags, actions, extra-properties, recipients or teams
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Field {
    #[serde(rename = "message")]
    Message,
    #[serde(rename = "alias")]
    Alias,
    #[serde(rename = "description")]
    Description,
    #[serde(rename = "source")]
    Source,
    #[serde(rename = "entity")]
    Entity,
    #[serde(rename = "tags")]
    Tags,
    #[serde(rename = "actions")]
    Actions,
    #[serde(rename = "extra-properties")]
    ExtraProperties,
    #[serde(rename = "recipients")]
    Recipients,
    #[serde(rename = "teams")]
    Teams,
    #[serde(rename = "priority")]
    Priority,
    #[serde(rename = "details")]
    Details,
}
/// It is the operation that will be executed for the given field and key.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Operation {
    #[serde(rename = "matches")]
    Matches,
    #[serde(rename = "contains")]
    Contains,
    #[serde(rename = "starts-with")]
    StartsWith,
    #[serde(rename = "ends-with")]
    EndsWith,
    #[serde(rename = "equals")]
    Equals,
    #[serde(rename = "contains-key")]
    ContainsKey,
    #[serde(rename = "contains-value")]
    ContainsValue,
    #[serde(rename = "greater-than")]
    GreaterThan,
    #[serde(rename = "less-than")]
    LessThan,
    #[serde(rename = "is-empty")]
    IsEmpty,
    #[serde(rename = "equals-ignore-whitespace")]
    EqualsIgnoreWhitespace,
}