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};

/// IndexTemplate
/// New index template definition to be simulated, if no index template name is specified.

#[derive(Clone, Default, Debug, Serialize, Deserialize)]
pub struct IndexTemplate {
    #[serde(rename = "_meta", default, skip_serializing_if = "Option::is_none")]
    pub meta: Option<common::Metadata>,
    #[serde(
        rename = "data_stream",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub data_stream: Option<indices::IndexTemplateDataStreamConfiguration>,
    #[serde(rename = "template", default, skip_serializing_if = "Option::is_none")]
    pub template: Option<indices::IndexTemplateSummary>,
    #[serde(
        rename = "allow_auto_create",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub allow_auto_create: Option<bool>,
    /// Priority to determine index template precedence when a new data stream or index is created.
    /// The index template with the highest priority is chosen.
    /// If no priority is specified the template is treated as though it is of priority 0 (lowest priority).
    /// This number is not automatically generated by OpenSearch.
    #[serde(rename = "priority", default, skip_serializing_if = "Option::is_none")]
    pub priority: Option<u32>,
    /// An ordered list of component template names.
    /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence.
    #[serde(
        rename = "composed_of",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub composed_of: Option<Vec<String>>,
    #[serde(rename = "version", default, skip_serializing_if = "Option::is_none")]
    pub version: Option<u32>,
    /// A comma-separated list of aliases to retrieve. Supports wildcards (`*`).  To retrieve all aliases, omit this parameter or use `*` or `_all`.
    #[serde(rename = "index_patterns")]
    pub index_patterns: common::Names,
}

impl IndexTemplate {
    /// New index template definition to be simulated, if no index template name is specified.
    pub fn new(index_patterns: common::Names) -> IndexTemplate {
        IndexTemplate {
            meta: None,
            data_stream: None,
            template: None,
            allow_auto_create: None,
            priority: None,
            composed_of: None,
            version: None,
            index_patterns,
        }
    }
}