Skip to main content

opensearch_client/common/
node_statistics.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
15
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
18pub struct NodeStatistics {
19    #[serde(rename = "failures", default, skip_serializing_if = "Option::is_none")]
20    pub failures: Option<Vec<common::ErrorCause>>,  /// The number of nodes that responded successfully to the request.
21    #[serde(rename = "successful")]
22    pub successful: u32,  /// The total number of nodes selected by the request.
23    #[serde(rename = "total")]
24    pub total: u32,  /// The number of nodes that rejected the request or failed to respond. If this value is not 0, then a reason for the rejection or failure is included in the response.
25    #[serde(rename = "failed")]
26    pub failed: u32,
27}
28
29impl NodeStatistics {
30    
31    pub fn new(successful: u32, total: u32, failed: u32) -> NodeStatistics {
32        NodeStatistics {
33            failures: None,
34            successful,
35            total,
36            failed,
37        }
38    }
39}