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