aws_sdk_securityhub/operation/enable_security_hub/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::enable_security_hub::_enable_security_hub_output::EnableSecurityHubOutputBuilder;
3
4pub use crate::operation::enable_security_hub::_enable_security_hub_input::EnableSecurityHubInputBuilder;
5
6impl crate::operation::enable_security_hub::builders::EnableSecurityHubInputBuilder {
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::enable_security_hub::EnableSecurityHubOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::enable_security_hub::EnableSecurityHubError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.enable_security_hub();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `EnableSecurityHub`.
24///
25/// <p>Enables Security Hub for your account in the current Region or the Region you specify in the request.</p>
26/// <p>When you enable Security Hub, you grant to Security Hub the permissions necessary to gather findings from other services that are integrated with Security Hub.</p>
27/// <p>When you use the <code>EnableSecurityHub</code> operation to enable Security Hub, you also automatically enable the following standards:</p>
28/// <ul>
29/// <li>
30/// <p>Center for Internet Security (CIS) Amazon Web Services Foundations Benchmark v1.2.0</p></li>
31/// <li>
32/// <p>Amazon Web Services Foundational Security Best Practices</p></li>
33/// </ul>
34/// <p>Other standards are not automatically enabled.</p>
35/// <p>To opt out of automatically enabled standards, set <code>EnableDefaultStandards</code> to <code>false</code>.</p>
36/// <p>After you enable Security Hub, to enable a standard, use the <code>BatchEnableStandards</code> operation. To disable a standard, use the <code>BatchDisableStandards</code> operation.</p>
37/// <p>To learn more, see the <a href="https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-settingup.html">setup information</a> in the <i>Security Hub User Guide</i>.</p>
38#[derive(::std::clone::Clone, ::std::fmt::Debug)]
39pub struct EnableSecurityHubFluentBuilder {
40 handle: ::std::sync::Arc<crate::client::Handle>,
41 inner: crate::operation::enable_security_hub::builders::EnableSecurityHubInputBuilder,
42 config_override: ::std::option::Option<crate::config::Builder>,
43}
44impl
45 crate::client::customize::internal::CustomizableSend<
46 crate::operation::enable_security_hub::EnableSecurityHubOutput,
47 crate::operation::enable_security_hub::EnableSecurityHubError,
48 > for EnableSecurityHubFluentBuilder
49{
50 fn send(
51 self,
52 config_override: crate::config::Builder,
53 ) -> crate::client::customize::internal::BoxFuture<
54 crate::client::customize::internal::SendResult<
55 crate::operation::enable_security_hub::EnableSecurityHubOutput,
56 crate::operation::enable_security_hub::EnableSecurityHubError,
57 >,
58 > {
59 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
60 }
61}
62impl EnableSecurityHubFluentBuilder {
63 /// Creates a new `EnableSecurityHubFluentBuilder`.
64 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
65 Self {
66 handle,
67 inner: ::std::default::Default::default(),
68 config_override: ::std::option::Option::None,
69 }
70 }
71 /// Access the EnableSecurityHub as a reference.
72 pub fn as_input(&self) -> &crate::operation::enable_security_hub::builders::EnableSecurityHubInputBuilder {
73 &self.inner
74 }
75 /// Sends the request and returns the response.
76 ///
77 /// If an error occurs, an `SdkError` will be returned with additional details that
78 /// can be matched against.
79 ///
80 /// By default, any retryable failures will be retried twice. Retry behavior
81 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
82 /// set when configuring the client.
83 pub async fn send(
84 self,
85 ) -> ::std::result::Result<
86 crate::operation::enable_security_hub::EnableSecurityHubOutput,
87 ::aws_smithy_runtime_api::client::result::SdkError<
88 crate::operation::enable_security_hub::EnableSecurityHubError,
89 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
90 >,
91 > {
92 let input = self
93 .inner
94 .build()
95 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
96 let runtime_plugins = crate::operation::enable_security_hub::EnableSecurityHub::operation_runtime_plugins(
97 self.handle.runtime_plugins.clone(),
98 &self.handle.conf,
99 self.config_override,
100 );
101 crate::operation::enable_security_hub::EnableSecurityHub::orchestrate(&runtime_plugins, input).await
102 }
103
104 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
105 pub fn customize(
106 self,
107 ) -> crate::client::customize::CustomizableOperation<
108 crate::operation::enable_security_hub::EnableSecurityHubOutput,
109 crate::operation::enable_security_hub::EnableSecurityHubError,
110 Self,
111 > {
112 crate::client::customize::CustomizableOperation::new(self)
113 }
114 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
115 self.set_config_override(::std::option::Option::Some(config_override.into()));
116 self
117 }
118
119 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
120 self.config_override = config_override;
121 self
122 }
123 ///
124 /// Adds a key-value pair to `Tags`.
125 ///
126 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
127 ///
128 /// <p>The tags to add to the hub resource when you enable Security Hub.</p>
129 pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
130 self.inner = self.inner.tags(k.into(), v.into());
131 self
132 }
133 /// <p>The tags to add to the hub resource when you enable Security Hub.</p>
134 pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
135 self.inner = self.inner.set_tags(input);
136 self
137 }
138 /// <p>The tags to add to the hub resource when you enable Security Hub.</p>
139 pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
140 self.inner.get_tags()
141 }
142 /// <p>Whether to enable the security standards that Security Hub has designated as automatically enabled. If you don't provide a value for <code>EnableDefaultStandards</code>, it is set to <code>true</code>. To not enable the automatically enabled standards, set <code>EnableDefaultStandards</code> to <code>false</code>.</p>
143 pub fn enable_default_standards(mut self, input: bool) -> Self {
144 self.inner = self.inner.enable_default_standards(input);
145 self
146 }
147 /// <p>Whether to enable the security standards that Security Hub has designated as automatically enabled. If you don't provide a value for <code>EnableDefaultStandards</code>, it is set to <code>true</code>. To not enable the automatically enabled standards, set <code>EnableDefaultStandards</code> to <code>false</code>.</p>
148 pub fn set_enable_default_standards(mut self, input: ::std::option::Option<bool>) -> Self {
149 self.inner = self.inner.set_enable_default_standards(input);
150 self
151 }
152 /// <p>Whether to enable the security standards that Security Hub has designated as automatically enabled. If you don't provide a value for <code>EnableDefaultStandards</code>, it is set to <code>true</code>. To not enable the automatically enabled standards, set <code>EnableDefaultStandards</code> to <code>false</code>.</p>
153 pub fn get_enable_default_standards(&self) -> &::std::option::Option<bool> {
154 self.inner.get_enable_default_standards()
155 }
156 /// <p>This field, used when enabling Security Hub, specifies whether the calling account has consolidated control findings turned on. If the value for this field is set to <code>SECURITY_CONTROL</code>, Security Hub generates a single finding for a control check even when the check applies to multiple enabled standards.</p>
157 /// <p>If the value for this field is set to <code>STANDARD_CONTROL</code>, Security Hub generates separate findings for a control check when the check applies to multiple enabled standards.</p>
158 /// <p>The value for this field in a member account matches the value in the administrator account. For accounts that aren't part of an organization, the default value of this field is <code>SECURITY_CONTROL</code> if you enabled Security Hub on or after February 23, 2023.</p>
159 pub fn control_finding_generator(mut self, input: crate::types::ControlFindingGenerator) -> Self {
160 self.inner = self.inner.control_finding_generator(input);
161 self
162 }
163 /// <p>This field, used when enabling Security Hub, specifies whether the calling account has consolidated control findings turned on. If the value for this field is set to <code>SECURITY_CONTROL</code>, Security Hub generates a single finding for a control check even when the check applies to multiple enabled standards.</p>
164 /// <p>If the value for this field is set to <code>STANDARD_CONTROL</code>, Security Hub generates separate findings for a control check when the check applies to multiple enabled standards.</p>
165 /// <p>The value for this field in a member account matches the value in the administrator account. For accounts that aren't part of an organization, the default value of this field is <code>SECURITY_CONTROL</code> if you enabled Security Hub on or after February 23, 2023.</p>
166 pub fn set_control_finding_generator(mut self, input: ::std::option::Option<crate::types::ControlFindingGenerator>) -> Self {
167 self.inner = self.inner.set_control_finding_generator(input);
168 self
169 }
170 /// <p>This field, used when enabling Security Hub, specifies whether the calling account has consolidated control findings turned on. If the value for this field is set to <code>SECURITY_CONTROL</code>, Security Hub generates a single finding for a control check even when the check applies to multiple enabled standards.</p>
171 /// <p>If the value for this field is set to <code>STANDARD_CONTROL</code>, Security Hub generates separate findings for a control check when the check applies to multiple enabled standards.</p>
172 /// <p>The value for this field in a member account matches the value in the administrator account. For accounts that aren't part of an organization, the default value of this field is <code>SECURITY_CONTROL</code> if you enabled Security Hub on or after February 23, 2023.</p>
173 pub fn get_control_finding_generator(&self) -> &::std::option::Option<crate::types::ControlFindingGenerator> {
174 self.inner.get_control_finding_generator()
175 }
176}