aws_sdk_guardduty/operation/get_findings_statistics/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_findings_statistics::_get_findings_statistics_output::GetFindingsStatisticsOutputBuilder;
3
4pub use crate::operation::get_findings_statistics::_get_findings_statistics_input::GetFindingsStatisticsInputBuilder;
5
6impl crate::operation::get_findings_statistics::builders::GetFindingsStatisticsInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::get_findings_statistics::GetFindingsStatisticsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_findings_statistics::GetFindingsStatisticsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_findings_statistics();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetFindingsStatistics`.
24///
25/// <p>Lists GuardDuty findings statistics for the specified detector ID.</p>
26/// <p>You must provide either <code>findingStatisticTypes</code> or <code>groupBy</code> parameter, and not both. You can use the <code>maxResults</code> and <code>orderBy</code> parameters only when using <code>groupBy</code>.</p>
27/// <p>There might be regional differences because some flags might not be available in all the Regions where GuardDuty is currently supported. For more information, see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_regions.html">Regions and endpoints</a>.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct GetFindingsStatisticsFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::get_findings_statistics::builders::GetFindingsStatisticsInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::get_findings_statistics::GetFindingsStatisticsOutput,
37        crate::operation::get_findings_statistics::GetFindingsStatisticsError,
38    > for GetFindingsStatisticsFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::get_findings_statistics::GetFindingsStatisticsOutput,
46            crate::operation::get_findings_statistics::GetFindingsStatisticsError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl GetFindingsStatisticsFluentBuilder {
53    /// Creates a new `GetFindingsStatisticsFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the GetFindingsStatistics as a reference.
62    pub fn as_input(&self) -> &crate::operation::get_findings_statistics::builders::GetFindingsStatisticsInputBuilder {
63        &self.inner
64    }
65    /// Sends the request and returns the response.
66    ///
67    /// If an error occurs, an `SdkError` will be returned with additional details that
68    /// can be matched against.
69    ///
70    /// By default, any retryable failures will be retried twice. Retry behavior
71    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72    /// set when configuring the client.
73    pub async fn send(
74        self,
75    ) -> ::std::result::Result<
76        crate::operation::get_findings_statistics::GetFindingsStatisticsOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::get_findings_statistics::GetFindingsStatisticsError,
79            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80        >,
81    > {
82        let input = self
83            .inner
84            .build()
85            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86        let runtime_plugins = crate::operation::get_findings_statistics::GetFindingsStatistics::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::get_findings_statistics::GetFindingsStatistics::orchestrate(&runtime_plugins, input).await
92    }
93
94    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95    pub fn customize(
96        self,
97    ) -> crate::client::customize::CustomizableOperation<
98        crate::operation::get_findings_statistics::GetFindingsStatisticsOutput,
99        crate::operation::get_findings_statistics::GetFindingsStatisticsError,
100        Self,
101    > {
102        crate::client::customize::CustomizableOperation::new(self)
103    }
104    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105        self.set_config_override(::std::option::Option::Some(config_override.into()));
106        self
107    }
108
109    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110        self.config_override = config_override;
111        self
112    }
113    /// <p>The ID of the detector whose findings statistics you want to retrieve.</p>
114    /// <p>To find the <code>detectorId</code> in the current Region, see the Settings page in the GuardDuty console, or run the <a href="https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html">ListDetectors</a> API.</p>
115    pub fn detector_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.inner = self.inner.detector_id(input.into());
117        self
118    }
119    /// <p>The ID of the detector whose findings statistics you want to retrieve.</p>
120    /// <p>To find the <code>detectorId</code> in the current Region, see the Settings page in the GuardDuty console, or run the <a href="https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html">ListDetectors</a> API.</p>
121    pub fn set_detector_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.inner = self.inner.set_detector_id(input);
123        self
124    }
125    /// <p>The ID of the detector whose findings statistics you want to retrieve.</p>
126    /// <p>To find the <code>detectorId</code> in the current Region, see the Settings page in the GuardDuty console, or run the <a href="https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html">ListDetectors</a> API.</p>
127    pub fn get_detector_id(&self) -> &::std::option::Option<::std::string::String> {
128        self.inner.get_detector_id()
129    }
130    ///
131    /// Appends an item to `FindingStatisticTypes`.
132    ///
133    /// To override the contents of this collection use [`set_finding_statistic_types`](Self::set_finding_statistic_types).
134    ///
135    /// <p>The types of finding statistics to retrieve.</p>
136    #[deprecated(note = "This parameter is deprecated, please use GroupBy instead")]
137    pub fn finding_statistic_types(mut self, input: crate::types::FindingStatisticType) -> Self {
138        self.inner = self.inner.finding_statistic_types(input);
139        self
140    }
141    /// <p>The types of finding statistics to retrieve.</p>
142    #[deprecated(note = "This parameter is deprecated, please use GroupBy instead")]
143    pub fn set_finding_statistic_types(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FindingStatisticType>>) -> Self {
144        self.inner = self.inner.set_finding_statistic_types(input);
145        self
146    }
147    /// <p>The types of finding statistics to retrieve.</p>
148    #[deprecated(note = "This parameter is deprecated, please use GroupBy instead")]
149    pub fn get_finding_statistic_types(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FindingStatisticType>> {
150        self.inner.get_finding_statistic_types()
151    }
152    /// <p>Represents the criteria that is used for querying findings.</p>
153    pub fn finding_criteria(mut self, input: crate::types::FindingCriteria) -> Self {
154        self.inner = self.inner.finding_criteria(input);
155        self
156    }
157    /// <p>Represents the criteria that is used for querying findings.</p>
158    pub fn set_finding_criteria(mut self, input: ::std::option::Option<crate::types::FindingCriteria>) -> Self {
159        self.inner = self.inner.set_finding_criteria(input);
160        self
161    }
162    /// <p>Represents the criteria that is used for querying findings.</p>
163    pub fn get_finding_criteria(&self) -> &::std::option::Option<crate::types::FindingCriteria> {
164        self.inner.get_finding_criteria()
165    }
166    /// <p>Displays the findings statistics grouped by one of the listed valid values.</p>
167    pub fn group_by(mut self, input: crate::types::GroupByType) -> Self {
168        self.inner = self.inner.group_by(input);
169        self
170    }
171    /// <p>Displays the findings statistics grouped by one of the listed valid values.</p>
172    pub fn set_group_by(mut self, input: ::std::option::Option<crate::types::GroupByType>) -> Self {
173        self.inner = self.inner.set_group_by(input);
174        self
175    }
176    /// <p>Displays the findings statistics grouped by one of the listed valid values.</p>
177    pub fn get_group_by(&self) -> &::std::option::Option<crate::types::GroupByType> {
178        self.inner.get_group_by()
179    }
180    /// <p>Displays the sorted findings in the requested order. The default value of <code>orderBy</code> is <code>DESC</code>.</p>
181    /// <p>You can use this parameter only with the <code>groupBy</code> parameter.</p>
182    pub fn order_by(mut self, input: crate::types::OrderBy) -> Self {
183        self.inner = self.inner.order_by(input);
184        self
185    }
186    /// <p>Displays the sorted findings in the requested order. The default value of <code>orderBy</code> is <code>DESC</code>.</p>
187    /// <p>You can use this parameter only with the <code>groupBy</code> parameter.</p>
188    pub fn set_order_by(mut self, input: ::std::option::Option<crate::types::OrderBy>) -> Self {
189        self.inner = self.inner.set_order_by(input);
190        self
191    }
192    /// <p>Displays the sorted findings in the requested order. The default value of <code>orderBy</code> is <code>DESC</code>.</p>
193    /// <p>You can use this parameter only with the <code>groupBy</code> parameter.</p>
194    pub fn get_order_by(&self) -> &::std::option::Option<crate::types::OrderBy> {
195        self.inner.get_order_by()
196    }
197    /// <p>The maximum number of results to be returned in the response. The default value is 25.</p>
198    /// <p>You can use this parameter only with the <code>groupBy</code> parameter.</p>
199    pub fn max_results(mut self, input: i32) -> Self {
200        self.inner = self.inner.max_results(input);
201        self
202    }
203    /// <p>The maximum number of results to be returned in the response. The default value is 25.</p>
204    /// <p>You can use this parameter only with the <code>groupBy</code> parameter.</p>
205    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
206        self.inner = self.inner.set_max_results(input);
207        self
208    }
209    /// <p>The maximum number of results to be returned in the response. The default value is 25.</p>
210    /// <p>You can use this parameter only with the <code>groupBy</code> parameter.</p>
211    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
212        self.inner.get_max_results()
213    }
214}