aws_sdk_guardduty/operation/create_detector/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_detector::_create_detector_output::CreateDetectorOutputBuilder;
3
4pub use crate::operation::create_detector::_create_detector_input::CreateDetectorInputBuilder;
5
6impl crate::operation::create_detector::builders::CreateDetectorInputBuilder {
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::create_detector::CreateDetectorOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_detector::CreateDetectorError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_detector();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateDetector`.
24///
25/// <p>Creates a single GuardDuty detector. A detector is a resource that represents the GuardDuty service. To start using GuardDuty, you must create a detector in each Region where you enable the service. You can have only one detector per account per Region. All data sources are enabled in a new detector by default.</p>
26/// <ul>
27/// <li>
28/// <p>When you don't specify any <code>features</code>, with an exception to <code>RUNTIME_MONITORING</code>, all the optional features are enabled by default.</p></li>
29/// <li>
30/// <p>When you specify some of the <code>features</code>, any feature that is not specified in the API call gets enabled by default, with an exception to <code>RUNTIME_MONITORING</code>.</p></li>
31/// </ul>
32/// <p>Specifying both EKS Runtime Monitoring (<code>EKS_RUNTIME_MONITORING</code>) and Runtime Monitoring (<code>RUNTIME_MONITORING</code>) will cause an error. You can add only one of these two features because Runtime Monitoring already includes the threat detection for Amazon EKS resources. For more information, see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/runtime-monitoring.html">Runtime Monitoring</a>.</p>
33/// <p>There might be regional differences because some data sources might not be available in all the Amazon Web Services Regions where GuardDuty is presently supported. For more information, see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_regions.html">Regions and endpoints</a>.</p>
34#[derive(::std::clone::Clone, ::std::fmt::Debug)]
35pub struct CreateDetectorFluentBuilder {
36    handle: ::std::sync::Arc<crate::client::Handle>,
37    inner: crate::operation::create_detector::builders::CreateDetectorInputBuilder,
38    config_override: ::std::option::Option<crate::config::Builder>,
39}
40impl
41    crate::client::customize::internal::CustomizableSend<
42        crate::operation::create_detector::CreateDetectorOutput,
43        crate::operation::create_detector::CreateDetectorError,
44    > for CreateDetectorFluentBuilder
45{
46    fn send(
47        self,
48        config_override: crate::config::Builder,
49    ) -> crate::client::customize::internal::BoxFuture<
50        crate::client::customize::internal::SendResult<
51            crate::operation::create_detector::CreateDetectorOutput,
52            crate::operation::create_detector::CreateDetectorError,
53        >,
54    > {
55        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
56    }
57}
58impl CreateDetectorFluentBuilder {
59    /// Creates a new `CreateDetectorFluentBuilder`.
60    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
61        Self {
62            handle,
63            inner: ::std::default::Default::default(),
64            config_override: ::std::option::Option::None,
65        }
66    }
67    /// Access the CreateDetector as a reference.
68    pub fn as_input(&self) -> &crate::operation::create_detector::builders::CreateDetectorInputBuilder {
69        &self.inner
70    }
71    /// Sends the request and returns the response.
72    ///
73    /// If an error occurs, an `SdkError` will be returned with additional details that
74    /// can be matched against.
75    ///
76    /// By default, any retryable failures will be retried twice. Retry behavior
77    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
78    /// set when configuring the client.
79    pub async fn send(
80        self,
81    ) -> ::std::result::Result<
82        crate::operation::create_detector::CreateDetectorOutput,
83        ::aws_smithy_runtime_api::client::result::SdkError<
84            crate::operation::create_detector::CreateDetectorError,
85            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
86        >,
87    > {
88        let input = self
89            .inner
90            .build()
91            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
92        let runtime_plugins = crate::operation::create_detector::CreateDetector::operation_runtime_plugins(
93            self.handle.runtime_plugins.clone(),
94            &self.handle.conf,
95            self.config_override,
96        );
97        crate::operation::create_detector::CreateDetector::orchestrate(&runtime_plugins, input).await
98    }
99
100    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
101    pub fn customize(
102        self,
103    ) -> crate::client::customize::CustomizableOperation<
104        crate::operation::create_detector::CreateDetectorOutput,
105        crate::operation::create_detector::CreateDetectorError,
106        Self,
107    > {
108        crate::client::customize::CustomizableOperation::new(self)
109    }
110    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
111        self.set_config_override(::std::option::Option::Some(config_override.into()));
112        self
113    }
114
115    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
116        self.config_override = config_override;
117        self
118    }
119    /// <p>A Boolean value that specifies whether the detector is to be enabled.</p>
120    pub fn enable(mut self, input: bool) -> Self {
121        self.inner = self.inner.enable(input);
122        self
123    }
124    /// <p>A Boolean value that specifies whether the detector is to be enabled.</p>
125    pub fn set_enable(mut self, input: ::std::option::Option<bool>) -> Self {
126        self.inner = self.inner.set_enable(input);
127        self
128    }
129    /// <p>A Boolean value that specifies whether the detector is to be enabled.</p>
130    pub fn get_enable(&self) -> &::std::option::Option<bool> {
131        self.inner.get_enable()
132    }
133    /// <p>The idempotency token for the create request.</p>
134    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.inner = self.inner.client_token(input.into());
136        self
137    }
138    /// <p>The idempotency token for the create request.</p>
139    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.inner = self.inner.set_client_token(input);
141        self
142    }
143    /// <p>The idempotency token for the create request.</p>
144    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
145        self.inner.get_client_token()
146    }
147    /// <p>A value that specifies how frequently updated findings are exported.</p>
148    pub fn finding_publishing_frequency(mut self, input: crate::types::FindingPublishingFrequency) -> Self {
149        self.inner = self.inner.finding_publishing_frequency(input);
150        self
151    }
152    /// <p>A value that specifies how frequently updated findings are exported.</p>
153    pub fn set_finding_publishing_frequency(mut self, input: ::std::option::Option<crate::types::FindingPublishingFrequency>) -> Self {
154        self.inner = self.inner.set_finding_publishing_frequency(input);
155        self
156    }
157    /// <p>A value that specifies how frequently updated findings are exported.</p>
158    pub fn get_finding_publishing_frequency(&self) -> &::std::option::Option<crate::types::FindingPublishingFrequency> {
159        self.inner.get_finding_publishing_frequency()
160    }
161    /// <p>Describes which data sources will be enabled for the detector.</p>
162    /// <p>There might be regional differences because some data sources might not be available in all the Amazon Web Services Regions where GuardDuty is presently supported. For more information, see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_regions.html">Regions and endpoints</a>.</p>
163    #[deprecated(note = "This parameter is deprecated, use Features instead")]
164    pub fn data_sources(mut self, input: crate::types::DataSourceConfigurations) -> Self {
165        self.inner = self.inner.data_sources(input);
166        self
167    }
168    /// <p>Describes which data sources will be enabled for the detector.</p>
169    /// <p>There might be regional differences because some data sources might not be available in all the Amazon Web Services Regions where GuardDuty is presently supported. For more information, see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_regions.html">Regions and endpoints</a>.</p>
170    #[deprecated(note = "This parameter is deprecated, use Features instead")]
171    pub fn set_data_sources(mut self, input: ::std::option::Option<crate::types::DataSourceConfigurations>) -> Self {
172        self.inner = self.inner.set_data_sources(input);
173        self
174    }
175    /// <p>Describes which data sources will be enabled for the detector.</p>
176    /// <p>There might be regional differences because some data sources might not be available in all the Amazon Web Services Regions where GuardDuty is presently supported. For more information, see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_regions.html">Regions and endpoints</a>.</p>
177    #[deprecated(note = "This parameter is deprecated, use Features instead")]
178    pub fn get_data_sources(&self) -> &::std::option::Option<crate::types::DataSourceConfigurations> {
179        self.inner.get_data_sources()
180    }
181    ///
182    /// Adds a key-value pair to `Tags`.
183    ///
184    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
185    ///
186    /// <p>The tags to be added to a new detector resource.</p>
187    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
188        self.inner = self.inner.tags(k.into(), v.into());
189        self
190    }
191    /// <p>The tags to be added to a new detector resource.</p>
192    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
193        self.inner = self.inner.set_tags(input);
194        self
195    }
196    /// <p>The tags to be added to a new detector resource.</p>
197    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
198        self.inner.get_tags()
199    }
200    ///
201    /// Appends an item to `Features`.
202    ///
203    /// To override the contents of this collection use [`set_features`](Self::set_features).
204    ///
205    /// <p>A list of features that will be configured for the detector.</p>
206    pub fn features(mut self, input: crate::types::DetectorFeatureConfiguration) -> Self {
207        self.inner = self.inner.features(input);
208        self
209    }
210    /// <p>A list of features that will be configured for the detector.</p>
211    pub fn set_features(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DetectorFeatureConfiguration>>) -> Self {
212        self.inner = self.inner.set_features(input);
213        self
214    }
215    /// <p>A list of features that will be configured for the detector.</p>
216    pub fn get_features(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DetectorFeatureConfiguration>> {
217        self.inner.get_features()
218    }
219}