opensearch-client 0.3.2

Strongly typed OpenSearch Client
Documentation
/*
 * opensearch-client
 *
 * Rust Client for OpenSearch
 *
 * The version of the OpenAPI document: 3.1.0
 * Contact: alberto.paro@gmail.com
 * Generated by Paro OpenAPI Generator
 */

use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PendingTask {
    /// The priority of the pending task.
    /// The valid priorities in descending priority order are: `IMMEDIATE` > `URGENT` > `HIGH` > `NORMAL` > `LOW` > `LANGUID`.
    #[serde(rename = "priority")]
    pub priority: String,
    #[serde(rename = "time_in_queue_millis")]
    pub time_in_queue_millis: String,
    /// The number that represents when the task has been inserted into the task queue.
    #[serde(rename = "insert_order")]
    pub insert_order: u32,
    /// A general description of the cluster task that may include a reason and origin.
    #[serde(rename = "source")]
    pub source: String,
    /// Indicates whether the pending tasks are currently executing or not.
    #[serde(rename = "executing")]
    pub executing: bool,
    /// A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and
    /// `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
    #[serde(
        rename = "time_in_queue",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub time_in_queue: Option<String>,
}

impl PendingTask {
    pub fn new(
        priority: String,
        time_in_queue_millis: String,
        insert_order: u32,
        source: String,
        executing: bool,
    ) -> PendingTask {
        PendingTask {
            priority,
            time_in_queue_millis,
            insert_order,
            source,
            executing,
            time_in_queue: None,
        }
    }
}