Skip to main content

aws_sdk_securityhub/operation/get_finding_statistics_v2/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_finding_statistics_v2::_get_finding_statistics_v2_input::GetFindingStatisticsV2InputBuilder;
3
4pub use crate::operation::get_finding_statistics_v2::_get_finding_statistics_v2_output::GetFindingStatisticsV2OutputBuilder;
5
6impl crate::operation::get_finding_statistics_v2::builders::GetFindingStatisticsV2InputBuilder {
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_finding_statistics_v2::GetFindingStatisticsV2Output,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_finding_statistics_v2::GetFindingStatisticsV2Error,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_finding_statistics_v2();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetFindingStatisticsV2`.
24///
25/// <p>Returns aggregated statistical data about findings.</p>
26/// <p>You can use the <code>Scopes</code> parameter to define the data boundary for the query. Currently, <code>Scopes</code> supports <code>AwsOrganizations</code>, which lets you aggregate findings from your entire organization or from specific organizational units. Only the delegated administrator account can use <code>Scopes</code>.</p>
27/// <p><code>GetFindingStatisticsV2</code> uses <code>securityhub:GetAdhocInsightResults</code> in the <code>Action</code> element of an IAM policy statement. You must have permission to perform the <code>securityhub:GetAdhocInsightResults</code> action.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct GetFindingStatisticsV2FluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::get_finding_statistics_v2::builders::GetFindingStatisticsV2InputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::get_finding_statistics_v2::GetFindingStatisticsV2Output,
37        crate::operation::get_finding_statistics_v2::GetFindingStatisticsV2Error,
38    > for GetFindingStatisticsV2FluentBuilder
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_finding_statistics_v2::GetFindingStatisticsV2Output,
46            crate::operation::get_finding_statistics_v2::GetFindingStatisticsV2Error,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl GetFindingStatisticsV2FluentBuilder {
53    /// Creates a new `GetFindingStatisticsV2FluentBuilder`.
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 GetFindingStatisticsV2 as a reference.
62    pub fn as_input(&self) -> &crate::operation::get_finding_statistics_v2::builders::GetFindingStatisticsV2InputBuilder {
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_finding_statistics_v2::GetFindingStatisticsV2Output,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::get_finding_statistics_v2::GetFindingStatisticsV2Error,
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_finding_statistics_v2::GetFindingStatisticsV2::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::get_finding_statistics_v2::GetFindingStatisticsV2::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_finding_statistics_v2::GetFindingStatisticsV2Output,
99        crate::operation::get_finding_statistics_v2::GetFindingStatisticsV2Error,
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    ///
114    /// Appends an item to `GroupByRules`.
115    ///
116    /// To override the contents of this collection use [`set_group_by_rules`](Self::set_group_by_rules).
117    ///
118    /// <p>Specifies how security findings should be aggregated and organized in the statistical analysis. It can accept up to 5 <code>groupBy</code> fields in a single call.</p>
119    pub fn group_by_rules(mut self, input: crate::types::GroupByRule) -> Self {
120        self.inner = self.inner.group_by_rules(input);
121        self
122    }
123    /// <p>Specifies how security findings should be aggregated and organized in the statistical analysis. It can accept up to 5 <code>groupBy</code> fields in a single call.</p>
124    pub fn set_group_by_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GroupByRule>>) -> Self {
125        self.inner = self.inner.set_group_by_rules(input);
126        self
127    }
128    /// <p>Specifies how security findings should be aggregated and organized in the statistical analysis. It can accept up to 5 <code>groupBy</code> fields in a single call.</p>
129    pub fn get_group_by_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GroupByRule>> {
130        self.inner.get_group_by_rules()
131    }
132    /// <p>Limits the results to findings from specific organizational units or from the delegated administrator's organization. Only the delegated administrator account can use this parameter. Other accounts receive an <code>AccessDeniedException</code>.</p>
133    /// <p>This parameter is optional. If you omit it, the delegated administrator sees statistics from all accounts across the entire organization. Other accounts see only statistics for their own findings.</p>
134    /// <p>You can specify up to 10 entries in <code>Scopes.AwsOrganizations</code>. If multiple entries are specified, the entries are combined using OR logic.</p>
135    pub fn scopes(mut self, input: crate::types::FindingScopes) -> Self {
136        self.inner = self.inner.scopes(input);
137        self
138    }
139    /// <p>Limits the results to findings from specific organizational units or from the delegated administrator's organization. Only the delegated administrator account can use this parameter. Other accounts receive an <code>AccessDeniedException</code>.</p>
140    /// <p>This parameter is optional. If you omit it, the delegated administrator sees statistics from all accounts across the entire organization. Other accounts see only statistics for their own findings.</p>
141    /// <p>You can specify up to 10 entries in <code>Scopes.AwsOrganizations</code>. If multiple entries are specified, the entries are combined using OR logic.</p>
142    pub fn set_scopes(mut self, input: ::std::option::Option<crate::types::FindingScopes>) -> Self {
143        self.inner = self.inner.set_scopes(input);
144        self
145    }
146    /// <p>Limits the results to findings from specific organizational units or from the delegated administrator's organization. Only the delegated administrator account can use this parameter. Other accounts receive an <code>AccessDeniedException</code>.</p>
147    /// <p>This parameter is optional. If you omit it, the delegated administrator sees statistics from all accounts across the entire organization. Other accounts see only statistics for their own findings.</p>
148    /// <p>You can specify up to 10 entries in <code>Scopes.AwsOrganizations</code>. If multiple entries are specified, the entries are combined using OR logic.</p>
149    pub fn get_scopes(&self) -> &::std::option::Option<crate::types::FindingScopes> {
150        self.inner.get_scopes()
151    }
152    /// <p>Orders the aggregation count in descending or ascending order. Descending order is the default.</p>
153    pub fn sort_order(mut self, input: crate::types::SortOrder) -> Self {
154        self.inner = self.inner.sort_order(input);
155        self
156    }
157    /// <p>Orders the aggregation count in descending or ascending order. Descending order is the default.</p>
158    pub fn set_sort_order(mut self, input: ::std::option::Option<crate::types::SortOrder>) -> Self {
159        self.inner = self.inner.set_sort_order(input);
160        self
161    }
162    /// <p>Orders the aggregation count in descending or ascending order. Descending order is the default.</p>
163    pub fn get_sort_order(&self) -> &::std::option::Option<crate::types::SortOrder> {
164        self.inner.get_sort_order()
165    }
166    /// <p>The maximum number of results to be returned.</p>
167    pub fn max_statistic_results(mut self, input: i32) -> Self {
168        self.inner = self.inner.max_statistic_results(input);
169        self
170    }
171    /// <p>The maximum number of results to be returned.</p>
172    pub fn set_max_statistic_results(mut self, input: ::std::option::Option<i32>) -> Self {
173        self.inner = self.inner.set_max_statistic_results(input);
174        self
175    }
176    /// <p>The maximum number of results to be returned.</p>
177    pub fn get_max_statistic_results(&self) -> &::std::option::Option<i32> {
178        self.inner.get_max_statistic_results()
179    }
180}