opensearch_client/cluster/allocation_explain/
node_allocation_explanation.rs1use crate::common;
12use crate::cluster;
13use serde::{Deserialize, Serialize};
14
15
16
17
18#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
19pub struct NodeAllocationExplanation {
20 #[serde(rename = "weight_ranking", default, skip_serializing_if = "Option::is_none")]
21 pub weight_ranking: Option<u32>,
22 #[serde(rename = "deciders")]
23 pub deciders: Vec<cluster::allocation_explain::AllocationDecision>,
24 #[serde(rename = "node_attributes")]
25 pub node_attributes: serde_json::Value,
26 #[serde(rename = "node_decision")]
27 pub node_decision: String,
28 #[serde(rename = "store", default, skip_serializing_if = "Option::is_none")]
29 pub store: Option<cluster::allocation_explain::AllocationStore>,
30 #[serde(rename = "node_id")]
31 pub node_id: String,
32 #[serde(rename = "transport_address")]
33 pub transport_address: String,
34 #[serde(rename = "node_name")]
35 pub node_name: String,
36}
37
38impl NodeAllocationExplanation {
39
40 pub fn new(deciders: Vec<cluster::allocation_explain::AllocationDecision>, node_attributes: serde_json::Value, node_decision: String, node_id: String, transport_address: String, node_name: String) -> NodeAllocationExplanation {
41 NodeAllocationExplanation {
42 weight_ranking: None,
43 deciders,
44 node_attributes,
45 node_decision,
46 store: None,
47 node_id,
48 transport_address,
49 node_name,
50 }
51 }
52}