Skip to main content

opensearch_client/cluster/
put_component_template.rs

1/*
2 * opensearch-client
3 *
4 * Rust Client for OpenSearch
5 *
6 * The version of the OpenAPI document: 3.1.0
7 * Contact: alberto.paro@gmail.com
8 * Generated by Paro OpenAPI Generator
9 */
10
11use crate::common;
12use crate::indices;
13use serde::{Deserialize, Serialize};
14
15/// PutComponentTemplate
16/// The template definition.
17
18#[derive(Clone, Default, Debug, Serialize, Deserialize)]
19pub struct PutComponentTemplate {
20    /// This setting overrides the `action.auto_create_index` cluster setting.
21    /// When set to `true` in a component template, indexes are automatically created using that
22    /// template. When set to `false`, data streams matching the component template must always be explicitly created.
23    #[serde(
24        rename = "allow_auto_create",
25        default,
26        skip_serializing_if = "Option::is_none"
27    )]
28    pub allow_auto_create: Option<bool>,
29    #[serde(rename = "template")]
30    pub template: indices::IndexState,
31    #[serde(rename = "version", default, skip_serializing_if = "Option::is_none")]
32    pub version: Option<u32>,
33    #[serde(rename = "_meta", default, skip_serializing_if = "Option::is_none")]
34    pub meta: Option<common::Metadata>,
35}
36
37impl PutComponentTemplate {
38    /// The template definition.
39    pub fn new(template: indices::IndexState) -> PutComponentTemplate {
40        PutComponentTemplate {
41            allow_auto_create: None,
42            template,
43            version: None,
44            meta: None,
45        }
46    }
47}