opensearch-client 0.3.1

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct IndexSettingsLifecycle {
    #[serde(rename = "name")]
    pub name: String,
    /// Certain APIs may return values, including numbers such as epoch timestamps, as strings. This setting captures
    /// this behavior while keeping the semantics of the field type.
    ///
    /// Depending on the target language, code generators can keep the union or remove it and leniently parse
    /// strings to the target type.
    #[serde(
        rename = "origination_date",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub origination_date: Option<common::StringifiedEpochTimeUnitMillis>,
    /// The index alias to update when the index rolls over. Specify when using a policy that contains a rollover action.
    /// When the index rolls over, the alias is updated to reflect that the index is no longer the write index. For more
    /// information about rolling indexes, see Rollover.
    #[serde(
        rename = "rollover_alias",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub rollover_alias: Option<String>,
    #[serde(rename = "step", default, skip_serializing_if = "Option::is_none")]
    pub step: Option<indices::IndexSettingsLifecycleStep>,
    /// Certain APIs may return values, including numbers such as epoch timestamps, as strings. This setting captures
    /// this behavior while keeping the semantics of the field type.
    ///
    /// Depending on the target language, code generators can keep the union or remove it and leniently parse
    /// strings to the target type.
    #[serde(
        rename = "indexing_complete",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub indexing_complete: Option<common::StringifiedBoolean>,
    /// Set to `true` to parse the origination date from the index name. This origination date is used to calculate the index age
    /// for its phase transitions. The index name must match the pattern `^.*-{date_format}-\\d+`, where the `date_format` is
    /// `yyyy.MM.dd` and the trailing digits are optional. An index that was rolled over would normally match the full format,
    /// for example `logs-2016.10.31-000002`). If the index name doesn't match the pattern, index creation fails.
    #[serde(
        rename = "parse_origination_date",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub parse_origination_date: Option<bool>,
}

impl IndexSettingsLifecycle {
    pub fn new(name: String) -> IndexSettingsLifecycle {
        IndexSettingsLifecycle {
            name,
            origination_date: None,
            rollover_alias: None,
            step: None,
            indexing_complete: None,
            parse_origination_date: None,
        }
    }
}