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 crate::common;
use serde::{Deserialize, Serialize};

/// RemoteStoreUploadStats
/// Statistics related to uploads to the remote segment store.

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RemoteStoreUploadStats {
    /// 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 = "total_time_spent",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub total_time_spent: Option<String>,
    /// 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 = "max_refresh_time_lag",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub max_refresh_time_lag: Option<String>,
    #[serde(rename = "total_time_spent_in_millis")]
    pub total_time_spent_in_millis: String,
    /// The amount of data, in bytes, uploaded or downloaded to/from the remote segment store.
    #[serde(rename = "total_upload_size")]
    pub total_upload_size: common::RemoteStoreUploadDownloadStats,
    /// Statistics related to segment store upload backpressure.
    #[serde(rename = "pressure", default, skip_serializing_if = "Option::is_none")]
    pub pressure: Option<common::RemoteStoreUploadPressureStats>,
    /// The amount of lag during upload between the remote segment store and the local store.
    #[serde(rename = "refresh_size_lag")]
    pub refresh_size_lag: common::RemoteStoreUploadRefreshSizeLagStats,
    #[serde(rename = "max_refresh_time_lag_in_millis")]
    pub max_refresh_time_lag_in_millis: String,
}

impl RemoteStoreUploadStats {
    /// Statistics related to uploads to the remote segment store.
    pub fn new(
        total_time_spent_in_millis: String,
        total_upload_size: common::RemoteStoreUploadDownloadStats,
        refresh_size_lag: common::RemoteStoreUploadRefreshSizeLagStats,
        max_refresh_time_lag_in_millis: String,
    ) -> RemoteStoreUploadStats {
        RemoteStoreUploadStats {
            total_time_spent: None,
            max_refresh_time_lag: None,
            total_time_spent_in_millis,
            total_upload_size,
            pressure: None,
            refresh_size_lag,
            max_refresh_time_lag_in_millis,
        }
    }
}