Skip to main content

opensearch_client/common/
node_attributes.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 serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct NodeAttributes {
16    #[serde(rename = "id", default, skip_serializing_if = "Option::is_none")]
17    pub id: Option<String>,
18    #[serde(rename = "ephemeral_id")]
19    pub ephemeral_id: String,
20    /// Node roles.
21    #[serde(rename = "roles", default, skip_serializing_if = "Option::is_none")]
22    pub roles: Option<Vec<common::NodeRole>>,
23    #[serde(rename = "transport_address")]
24    pub transport_address: String,
25    /// Lists node attributes.
26    #[serde(rename = "attributes")]
27    pub attributes: serde_json::Value,
28    #[serde(
29        rename = "external_id",
30        default,
31        skip_serializing_if = "Option::is_none"
32    )]
33    pub external_id: Option<String>,
34    #[serde(rename = "name")]
35    pub name: String,
36}
37
38impl NodeAttributes {
39    pub fn new(
40        ephemeral_id: String,
41        transport_address: String,
42        attributes: serde_json::Value,
43        name: String,
44    ) -> NodeAttributes {
45        NodeAttributes {
46            id: None,
47            ephemeral_id,
48            roles: None,
49            transport_address,
50            attributes,
51            external_id: None,
52            name,
53        }
54    }
55}