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 DataStream {
    #[serde(
        rename = "ilm_policy",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub ilm_policy: Option<String>,
    /// Array of objects containing information about the data stream's backing indexes.
    /// The last item in this array contains information about the stream's current write index.
    #[serde(rename = "indices")]
    pub indices: Vec<indices::DataStreamIndex>,
    /// If `true`, the data stream is hidden.
    #[serde(rename = "hidden", default, skip_serializing_if = "Option::is_none")]
    pub hidden: Option<bool>,
    /// Indicates if ILM should take precedence over DSL in case both are configured to managed this data stream.
    #[serde(
        rename = "prefer_ilm",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub prefer_ilm: Option<bool>,
    /// Current generation for the data stream. This number acts as a cumulative count of the stream's rollovers, starting at 1.
    #[serde(rename = "generation")]
    pub generation: u32,
    #[serde(rename = "status")]
    pub status: common::HealthStatus,
    #[serde(rename = "_meta", default, skip_serializing_if = "Option::is_none")]
    pub meta: Option<common::Metadata>,
    /// If `true`, the data stream is created and managed by an OpenSearch stack component and cannot be modified through normal user interaction.
    #[serde(rename = "system", default, skip_serializing_if = "Option::is_none")]
    pub system: Option<bool>,
    #[serde(rename = "template")]
    pub template: String,
    #[serde(rename = "timestamp_field")]
    pub timestamp_field: indices::DataStreamTimestampField,
    /// If `true`, the data stream is created and managed by cross-cluster replication and the local cluster can not write into this data stream or change its mappings.
    #[serde(
        rename = "replicated",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub replicated: Option<bool>,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(
        rename = "next_generation_managed_by",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub next_generation_managed_by: Option<String>,
    /// If `true`, the data stream allows custom routing on write request.
    #[serde(
        rename = "allow_custom_routing",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub allow_custom_routing: Option<bool>,
}

impl DataStream {
    pub fn new(
        indices: Vec<indices::DataStreamIndex>,
        generation: u32,
        status: common::HealthStatus,
        template: String,
        timestamp_field: indices::DataStreamTimestampField,
        name: String,
    ) -> DataStream {
        DataStream {
            ilm_policy: None,
            indices,
            hidden: None,
            prefer_ilm: None,
            generation,
            status,
            meta: None,
            system: None,
            template,
            timestamp_field,
            replicated: None,
            name,
            next_generation_managed_by: None,
            allow_custom_routing: None,
        }
    }
}