aws_sdk_config/operation/put_conformance_pack/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_conformance_pack::_put_conformance_pack_output::PutConformancePackOutputBuilder;
3
4pub use crate::operation::put_conformance_pack::_put_conformance_pack_input::PutConformancePackInputBuilder;
5
6impl crate::operation::put_conformance_pack::builders::PutConformancePackInputBuilder {
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::put_conformance_pack::PutConformancePackOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::put_conformance_pack::PutConformancePackError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.put_conformance_pack();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `PutConformancePack`.
24///
25/// <p>Creates or updates a conformance pack. A conformance pack is a collection of Config rules that can be easily deployed in an account and a region and across an organization. For information on how many conformance packs you can have per account, see <a href="https://docs.aws.amazon.com/config/latest/developerguide/configlimits.html"> <b>Service Limits</b> </a> in the <i>Config Developer Guide</i>.</p><important>
26/// <p>When you use <code>PutConformancePack</code> to deploy conformance packs in your account, the operation can create Config rules and remediation actions without requiring <code>config:PutConfigRule</code> or <code>config:PutRemediationConfigurations</code> permissions in your account IAM policies.</p>
27/// <p>This API uses the <code>AWSServiceRoleForConfigConforms</code> service-linked role in your account to create conformance pack resources. This service-linked role includes the permissions to create Config rules and remediation configurations, even if your account IAM policies explicitly deny these actions.</p>
28/// </important>
29/// <p>This API creates a service-linked role <code>AWSServiceRoleForConfigConforms</code> in your account. The service-linked role is created only when the role does not exist in your account.</p><note>
30/// <p>You must specify only one of the follow parameters: <code>TemplateS3Uri</code>, <code>TemplateBody</code> or <code>TemplateSSMDocumentDetails</code>.</p>
31/// </note>
32#[derive(::std::clone::Clone, ::std::fmt::Debug)]
33pub struct PutConformancePackFluentBuilder {
34 handle: ::std::sync::Arc<crate::client::Handle>,
35 inner: crate::operation::put_conformance_pack::builders::PutConformancePackInputBuilder,
36 config_override: ::std::option::Option<crate::config::Builder>,
37}
38impl
39 crate::client::customize::internal::CustomizableSend<
40 crate::operation::put_conformance_pack::PutConformancePackOutput,
41 crate::operation::put_conformance_pack::PutConformancePackError,
42 > for PutConformancePackFluentBuilder
43{
44 fn send(
45 self,
46 config_override: crate::config::Builder,
47 ) -> crate::client::customize::internal::BoxFuture<
48 crate::client::customize::internal::SendResult<
49 crate::operation::put_conformance_pack::PutConformancePackOutput,
50 crate::operation::put_conformance_pack::PutConformancePackError,
51 >,
52 > {
53 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54 }
55}
56impl PutConformancePackFluentBuilder {
57 /// Creates a new `PutConformancePackFluentBuilder`.
58 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
59 Self {
60 handle,
61 inner: ::std::default::Default::default(),
62 config_override: ::std::option::Option::None,
63 }
64 }
65 /// Access the PutConformancePack as a reference.
66 pub fn as_input(&self) -> &crate::operation::put_conformance_pack::builders::PutConformancePackInputBuilder {
67 &self.inner
68 }
69 /// Sends the request and returns the response.
70 ///
71 /// If an error occurs, an `SdkError` will be returned with additional details that
72 /// can be matched against.
73 ///
74 /// By default, any retryable failures will be retried twice. Retry behavior
75 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
76 /// set when configuring the client.
77 pub async fn send(
78 self,
79 ) -> ::std::result::Result<
80 crate::operation::put_conformance_pack::PutConformancePackOutput,
81 ::aws_smithy_runtime_api::client::result::SdkError<
82 crate::operation::put_conformance_pack::PutConformancePackError,
83 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
84 >,
85 > {
86 let input = self
87 .inner
88 .build()
89 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
90 let runtime_plugins = crate::operation::put_conformance_pack::PutConformancePack::operation_runtime_plugins(
91 self.handle.runtime_plugins.clone(),
92 &self.handle.conf,
93 self.config_override,
94 );
95 crate::operation::put_conformance_pack::PutConformancePack::orchestrate(&runtime_plugins, input).await
96 }
97
98 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
99 pub fn customize(
100 self,
101 ) -> crate::client::customize::CustomizableOperation<
102 crate::operation::put_conformance_pack::PutConformancePackOutput,
103 crate::operation::put_conformance_pack::PutConformancePackError,
104 Self,
105 > {
106 crate::client::customize::CustomizableOperation::new(self)
107 }
108 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
109 self.set_config_override(::std::option::Option::Some(config_override.into()));
110 self
111 }
112
113 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
114 self.config_override = config_override;
115 self
116 }
117 /// <p>The unique name of the conformance pack you want to deploy.</p>
118 pub fn conformance_pack_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119 self.inner = self.inner.conformance_pack_name(input.into());
120 self
121 }
122 /// <p>The unique name of the conformance pack you want to deploy.</p>
123 pub fn set_conformance_pack_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124 self.inner = self.inner.set_conformance_pack_name(input);
125 self
126 }
127 /// <p>The unique name of the conformance pack you want to deploy.</p>
128 pub fn get_conformance_pack_name(&self) -> &::std::option::Option<::std::string::String> {
129 self.inner.get_conformance_pack_name()
130 }
131 /// <p>The location of the file containing the template body (<code>s3://bucketname/prefix</code>). The uri must point to a conformance pack template (max size: 300 KB) that is located in an Amazon S3 bucket in the same Region as the conformance pack.</p><note>
132 /// <p>You must have access to read Amazon S3 bucket. In addition, in order to ensure a successful deployment, the template object must not be in an <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html">archived storage class</a> if this parameter is passed.</p>
133 /// </note>
134 pub fn template_s3_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135 self.inner = self.inner.template_s3_uri(input.into());
136 self
137 }
138 /// <p>The location of the file containing the template body (<code>s3://bucketname/prefix</code>). The uri must point to a conformance pack template (max size: 300 KB) that is located in an Amazon S3 bucket in the same Region as the conformance pack.</p><note>
139 /// <p>You must have access to read Amazon S3 bucket. In addition, in order to ensure a successful deployment, the template object must not be in an <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html">archived storage class</a> if this parameter is passed.</p>
140 /// </note>
141 pub fn set_template_s3_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142 self.inner = self.inner.set_template_s3_uri(input);
143 self
144 }
145 /// <p>The location of the file containing the template body (<code>s3://bucketname/prefix</code>). The uri must point to a conformance pack template (max size: 300 KB) that is located in an Amazon S3 bucket in the same Region as the conformance pack.</p><note>
146 /// <p>You must have access to read Amazon S3 bucket. In addition, in order to ensure a successful deployment, the template object must not be in an <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html">archived storage class</a> if this parameter is passed.</p>
147 /// </note>
148 pub fn get_template_s3_uri(&self) -> &::std::option::Option<::std::string::String> {
149 self.inner.get_template_s3_uri()
150 }
151 /// <p>A string that contains the full conformance pack template body. The structure containing the template body has a minimum length of 1 byte and a maximum length of 51,200 bytes.</p><note>
152 /// <p>You can use a YAML template with two resource types: Config rule (<code>AWS::Config::ConfigRule</code>) and remediation action (<code>AWS::Config::RemediationConfiguration</code>).</p>
153 /// </note>
154 pub fn template_body(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
155 self.inner = self.inner.template_body(input.into());
156 self
157 }
158 /// <p>A string that contains the full conformance pack template body. The structure containing the template body has a minimum length of 1 byte and a maximum length of 51,200 bytes.</p><note>
159 /// <p>You can use a YAML template with two resource types: Config rule (<code>AWS::Config::ConfigRule</code>) and remediation action (<code>AWS::Config::RemediationConfiguration</code>).</p>
160 /// </note>
161 pub fn set_template_body(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162 self.inner = self.inner.set_template_body(input);
163 self
164 }
165 /// <p>A string that contains the full conformance pack template body. The structure containing the template body has a minimum length of 1 byte and a maximum length of 51,200 bytes.</p><note>
166 /// <p>You can use a YAML template with two resource types: Config rule (<code>AWS::Config::ConfigRule</code>) and remediation action (<code>AWS::Config::RemediationConfiguration</code>).</p>
167 /// </note>
168 pub fn get_template_body(&self) -> &::std::option::Option<::std::string::String> {
169 self.inner.get_template_body()
170 }
171 /// <p>The name of the Amazon S3 bucket where Config stores conformance pack templates.</p><note>
172 /// <p>This field is optional.</p>
173 /// </note>
174 pub fn delivery_s3_bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175 self.inner = self.inner.delivery_s3_bucket(input.into());
176 self
177 }
178 /// <p>The name of the Amazon S3 bucket where Config stores conformance pack templates.</p><note>
179 /// <p>This field is optional.</p>
180 /// </note>
181 pub fn set_delivery_s3_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182 self.inner = self.inner.set_delivery_s3_bucket(input);
183 self
184 }
185 /// <p>The name of the Amazon S3 bucket where Config stores conformance pack templates.</p><note>
186 /// <p>This field is optional.</p>
187 /// </note>
188 pub fn get_delivery_s3_bucket(&self) -> &::std::option::Option<::std::string::String> {
189 self.inner.get_delivery_s3_bucket()
190 }
191 /// <p>The prefix for the Amazon S3 bucket.</p><note>
192 /// <p>This field is optional.</p>
193 /// </note>
194 pub fn delivery_s3_key_prefix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
195 self.inner = self.inner.delivery_s3_key_prefix(input.into());
196 self
197 }
198 /// <p>The prefix for the Amazon S3 bucket.</p><note>
199 /// <p>This field is optional.</p>
200 /// </note>
201 pub fn set_delivery_s3_key_prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
202 self.inner = self.inner.set_delivery_s3_key_prefix(input);
203 self
204 }
205 /// <p>The prefix for the Amazon S3 bucket.</p><note>
206 /// <p>This field is optional.</p>
207 /// </note>
208 pub fn get_delivery_s3_key_prefix(&self) -> &::std::option::Option<::std::string::String> {
209 self.inner.get_delivery_s3_key_prefix()
210 }
211 ///
212 /// Appends an item to `ConformancePackInputParameters`.
213 ///
214 /// To override the contents of this collection use [`set_conformance_pack_input_parameters`](Self::set_conformance_pack_input_parameters).
215 ///
216 /// <p>A list of <code>ConformancePackInputParameter</code> objects.</p>
217 pub fn conformance_pack_input_parameters(mut self, input: crate::types::ConformancePackInputParameter) -> Self {
218 self.inner = self.inner.conformance_pack_input_parameters(input);
219 self
220 }
221 /// <p>A list of <code>ConformancePackInputParameter</code> objects.</p>
222 pub fn set_conformance_pack_input_parameters(
223 mut self,
224 input: ::std::option::Option<::std::vec::Vec<crate::types::ConformancePackInputParameter>>,
225 ) -> Self {
226 self.inner = self.inner.set_conformance_pack_input_parameters(input);
227 self
228 }
229 /// <p>A list of <code>ConformancePackInputParameter</code> objects.</p>
230 pub fn get_conformance_pack_input_parameters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ConformancePackInputParameter>> {
231 self.inner.get_conformance_pack_input_parameters()
232 }
233 /// <p>An object of type <code>TemplateSSMDocumentDetails</code>, which contains the name or the Amazon Resource Name (ARN) of the Amazon Web Services Systems Manager document (SSM document) and the version of the SSM document that is used to create a conformance pack.</p>
234 pub fn template_ssm_document_details(mut self, input: crate::types::TemplateSsmDocumentDetails) -> Self {
235 self.inner = self.inner.template_ssm_document_details(input);
236 self
237 }
238 /// <p>An object of type <code>TemplateSSMDocumentDetails</code>, which contains the name or the Amazon Resource Name (ARN) of the Amazon Web Services Systems Manager document (SSM document) and the version of the SSM document that is used to create a conformance pack.</p>
239 pub fn set_template_ssm_document_details(mut self, input: ::std::option::Option<crate::types::TemplateSsmDocumentDetails>) -> Self {
240 self.inner = self.inner.set_template_ssm_document_details(input);
241 self
242 }
243 /// <p>An object of type <code>TemplateSSMDocumentDetails</code>, which contains the name or the Amazon Resource Name (ARN) of the Amazon Web Services Systems Manager document (SSM document) and the version of the SSM document that is used to create a conformance pack.</p>
244 pub fn get_template_ssm_document_details(&self) -> &::std::option::Option<crate::types::TemplateSsmDocumentDetails> {
245 self.inner.get_template_ssm_document_details()
246 }
247}