Skip to main content

opensearch_client/indices/
data_stream.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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct DataStream {
17    #[serde(
18        rename = "ilm_policy",
19        default,
20        skip_serializing_if = "Option::is_none"
21    )]
22    pub ilm_policy: Option<String>,
23    /// Array of objects containing information about the data stream's backing indexes.
24    /// The last item in this array contains information about the stream's current write index.
25    #[serde(rename = "indices")]
26    pub indices: Vec<indices::DataStreamIndex>,
27    /// If `true`, the data stream is hidden.
28    #[serde(rename = "hidden", default, skip_serializing_if = "Option::is_none")]
29    pub hidden: Option<bool>,
30    /// Indicates if ILM should take precedence over DSL in case both are configured to managed this data stream.
31    #[serde(
32        rename = "prefer_ilm",
33        default,
34        skip_serializing_if = "Option::is_none"
35    )]
36    pub prefer_ilm: Option<bool>,
37    /// Current generation for the data stream. This number acts as a cumulative count of the stream's rollovers, starting at 1.
38    #[serde(rename = "generation")]
39    pub generation: u32,
40    #[serde(rename = "status")]
41    pub status: common::HealthStatus,
42    #[serde(rename = "_meta", default, skip_serializing_if = "Option::is_none")]
43    pub meta: Option<common::Metadata>,
44    /// If `true`, the data stream is created and managed by an OpenSearch stack component and cannot be modified through normal user interaction.
45    #[serde(rename = "system", default, skip_serializing_if = "Option::is_none")]
46    pub system: Option<bool>,
47    #[serde(rename = "template")]
48    pub template: String,
49    #[serde(rename = "timestamp_field")]
50    pub timestamp_field: indices::DataStreamTimestampField,
51    /// 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.
52    #[serde(
53        rename = "replicated",
54        default,
55        skip_serializing_if = "Option::is_none"
56    )]
57    pub replicated: Option<bool>,
58    #[serde(rename = "name")]
59    pub name: String,
60    #[serde(
61        rename = "next_generation_managed_by",
62        default,
63        skip_serializing_if = "Option::is_none"
64    )]
65    pub next_generation_managed_by: Option<String>,
66    /// If `true`, the data stream allows custom routing on write request.
67    #[serde(
68        rename = "allow_custom_routing",
69        default,
70        skip_serializing_if = "Option::is_none"
71    )]
72    pub allow_custom_routing: Option<bool>,
73}
74
75impl DataStream {
76    pub fn new(
77        indices: Vec<indices::DataStreamIndex>,
78        generation: u32,
79        status: common::HealthStatus,
80        template: String,
81        timestamp_field: indices::DataStreamTimestampField,
82        name: String,
83    ) -> DataStream {
84        DataStream {
85            ilm_policy: None,
86            indices,
87            hidden: None,
88            prefer_ilm: None,
89            generation,
90            status,
91            meta: None,
92            system: None,
93            template,
94            timestamp_field,
95            replicated: None,
96            name,
97            next_generation_managed_by: None,
98            allow_custom_routing: None,
99        }
100    }
101}