aws_sdk_iot/operation/get_percentiles/
_get_percentiles_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct GetPercentilesInput {
6    /// <p>The name of the index to search.</p>
7    pub index_name: ::std::option::Option<::std::string::String>,
8    /// <p>The search query string.</p>
9    pub query_string: ::std::option::Option<::std::string::String>,
10    /// <p>The field to aggregate.</p>
11    pub aggregation_field: ::std::option::Option<::std::string::String>,
12    /// <p>The query version.</p>
13    pub query_version: ::std::option::Option<::std::string::String>,
14    /// <p>The percentile groups returned.</p>
15    pub percents: ::std::option::Option<::std::vec::Vec<f64>>,
16}
17impl GetPercentilesInput {
18    /// <p>The name of the index to search.</p>
19    pub fn index_name(&self) -> ::std::option::Option<&str> {
20        self.index_name.as_deref()
21    }
22    /// <p>The search query string.</p>
23    pub fn query_string(&self) -> ::std::option::Option<&str> {
24        self.query_string.as_deref()
25    }
26    /// <p>The field to aggregate.</p>
27    pub fn aggregation_field(&self) -> ::std::option::Option<&str> {
28        self.aggregation_field.as_deref()
29    }
30    /// <p>The query version.</p>
31    pub fn query_version(&self) -> ::std::option::Option<&str> {
32        self.query_version.as_deref()
33    }
34    /// <p>The percentile groups returned.</p>
35    ///
36    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.percents.is_none()`.
37    pub fn percents(&self) -> &[f64] {
38        self.percents.as_deref().unwrap_or_default()
39    }
40}
41impl GetPercentilesInput {
42    /// Creates a new builder-style object to manufacture [`GetPercentilesInput`](crate::operation::get_percentiles::GetPercentilesInput).
43    pub fn builder() -> crate::operation::get_percentiles::builders::GetPercentilesInputBuilder {
44        crate::operation::get_percentiles::builders::GetPercentilesInputBuilder::default()
45    }
46}
47
48/// A builder for [`GetPercentilesInput`](crate::operation::get_percentiles::GetPercentilesInput).
49#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct GetPercentilesInputBuilder {
52    pub(crate) index_name: ::std::option::Option<::std::string::String>,
53    pub(crate) query_string: ::std::option::Option<::std::string::String>,
54    pub(crate) aggregation_field: ::std::option::Option<::std::string::String>,
55    pub(crate) query_version: ::std::option::Option<::std::string::String>,
56    pub(crate) percents: ::std::option::Option<::std::vec::Vec<f64>>,
57}
58impl GetPercentilesInputBuilder {
59    /// <p>The name of the index to search.</p>
60    pub fn index_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
61        self.index_name = ::std::option::Option::Some(input.into());
62        self
63    }
64    /// <p>The name of the index to search.</p>
65    pub fn set_index_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
66        self.index_name = input;
67        self
68    }
69    /// <p>The name of the index to search.</p>
70    pub fn get_index_name(&self) -> &::std::option::Option<::std::string::String> {
71        &self.index_name
72    }
73    /// <p>The search query string.</p>
74    /// This field is required.
75    pub fn query_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        self.query_string = ::std::option::Option::Some(input.into());
77        self
78    }
79    /// <p>The search query string.</p>
80    pub fn set_query_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81        self.query_string = input;
82        self
83    }
84    /// <p>The search query string.</p>
85    pub fn get_query_string(&self) -> &::std::option::Option<::std::string::String> {
86        &self.query_string
87    }
88    /// <p>The field to aggregate.</p>
89    pub fn aggregation_field(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
90        self.aggregation_field = ::std::option::Option::Some(input.into());
91        self
92    }
93    /// <p>The field to aggregate.</p>
94    pub fn set_aggregation_field(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
95        self.aggregation_field = input;
96        self
97    }
98    /// <p>The field to aggregate.</p>
99    pub fn get_aggregation_field(&self) -> &::std::option::Option<::std::string::String> {
100        &self.aggregation_field
101    }
102    /// <p>The query version.</p>
103    pub fn query_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104        self.query_version = ::std::option::Option::Some(input.into());
105        self
106    }
107    /// <p>The query version.</p>
108    pub fn set_query_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109        self.query_version = input;
110        self
111    }
112    /// <p>The query version.</p>
113    pub fn get_query_version(&self) -> &::std::option::Option<::std::string::String> {
114        &self.query_version
115    }
116    /// Appends an item to `percents`.
117    ///
118    /// To override the contents of this collection use [`set_percents`](Self::set_percents).
119    ///
120    /// <p>The percentile groups returned.</p>
121    pub fn percents(mut self, input: f64) -> Self {
122        let mut v = self.percents.unwrap_or_default();
123        v.push(input);
124        self.percents = ::std::option::Option::Some(v);
125        self
126    }
127    /// <p>The percentile groups returned.</p>
128    pub fn set_percents(mut self, input: ::std::option::Option<::std::vec::Vec<f64>>) -> Self {
129        self.percents = input;
130        self
131    }
132    /// <p>The percentile groups returned.</p>
133    pub fn get_percents(&self) -> &::std::option::Option<::std::vec::Vec<f64>> {
134        &self.percents
135    }
136    /// Consumes the builder and constructs a [`GetPercentilesInput`](crate::operation::get_percentiles::GetPercentilesInput).
137    pub fn build(
138        self,
139    ) -> ::std::result::Result<crate::operation::get_percentiles::GetPercentilesInput, ::aws_smithy_types::error::operation::BuildError> {
140        ::std::result::Result::Ok(crate::operation::get_percentiles::GetPercentilesInput {
141            index_name: self.index_name,
142            query_string: self.query_string,
143            aggregation_field: self.aggregation_field,
144            query_version: self.query_version,
145            percents: self.percents,
146        })
147    }
148}