aws_sdk_ec2/operation/start_declarative_policies_report/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_declarative_policies_report::_start_declarative_policies_report_output::StartDeclarativePoliciesReportOutputBuilder;
3
4pub use crate::operation::start_declarative_policies_report::_start_declarative_policies_report_input::StartDeclarativePoliciesReportInputBuilder;
5
6impl crate::operation::start_declarative_policies_report::builders::StartDeclarativePoliciesReportInputBuilder {
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::start_declarative_policies_report::StartDeclarativePoliciesReportOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_declarative_policies_report();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartDeclarativePoliciesReport`.
24///
25/// <p>Generates an account status report. The report is generated asynchronously, and can take several hours to complete.</p>
26/// <p>The report provides the current status of all attributes supported by declarative policies for the accounts within the specified scope. The scope is determined by the specified <code>TargetId</code>, which can represent an individual account, or all the accounts that fall under the specified organizational unit (OU) or root (the entire Amazon Web Services Organization).</p>
27/// <p>The report is saved to your specified S3 bucket, using the following path structure (with the <i>italicized placeholders</i> representing your specific values):</p>
28/// <p><code>s3://<i>amzn-s3-demo-bucket</i>/<i>your-optional-s3-prefix</i>/ec2_<i>targetId</i>_<i>reportId</i>_<i>yyyyMMdd</i>T<i>hhmm</i>Z.csv</code></p>
29/// <p class="title"><b>Prerequisites for generating a report</b></p>
30/// <ul>
31/// <li>
32/// <p>The <code>StartDeclarativePoliciesReport</code> API can only be called by the management account or delegated administrators for the organization.</p></li>
33/// <li>
34/// <p>An S3 bucket must be available before generating the report (you can create a new one or use an existing one), it must be in the same Region where the report generation request is made, and it must have an appropriate bucket policy. For a sample S3 policy, see <i>Sample Amazon S3 policy</i> under .</p></li>
35/// <li>
36/// <p>Trusted access must be enabled for the service for which the declarative policy will enforce a baseline configuration. If you use the Amazon Web Services Organizations console, this is done automatically when you enable declarative policies. The API uses the following service principal to identify the EC2 service: <code>ec2.amazonaws.com</code>. For more information on how to enable trusted access with the Amazon Web Services CLI and Amazon Web Services SDKs, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_integrate_services.html">Using Organizations with other Amazon Web Services services</a> in the <i>Amazon Web Services Organizations User Guide</i>.</p></li>
37/// <li>
38/// <p>Only one report per organization can be generated at a time. Attempting to generate a report while another is in progress will result in an error.</p></li>
39/// </ul>
40/// <p>For more information, including the required IAM permissions to run this API, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_declarative_status-report.html">Generating the account status report for declarative policies</a> in the <i>Amazon Web Services Organizations User Guide</i>.</p>
41#[derive(::std::clone::Clone, ::std::fmt::Debug)]
42pub struct StartDeclarativePoliciesReportFluentBuilder {
43    handle: ::std::sync::Arc<crate::client::Handle>,
44    inner: crate::operation::start_declarative_policies_report::builders::StartDeclarativePoliciesReportInputBuilder,
45    config_override: ::std::option::Option<crate::config::Builder>,
46}
47impl
48    crate::client::customize::internal::CustomizableSend<
49        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportOutput,
50        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportError,
51    > for StartDeclarativePoliciesReportFluentBuilder
52{
53    fn send(
54        self,
55        config_override: crate::config::Builder,
56    ) -> crate::client::customize::internal::BoxFuture<
57        crate::client::customize::internal::SendResult<
58            crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportOutput,
59            crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportError,
60        >,
61    > {
62        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
63    }
64}
65impl StartDeclarativePoliciesReportFluentBuilder {
66    /// Creates a new `StartDeclarativePoliciesReportFluentBuilder`.
67    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
68        Self {
69            handle,
70            inner: ::std::default::Default::default(),
71            config_override: ::std::option::Option::None,
72        }
73    }
74    /// Access the StartDeclarativePoliciesReport as a reference.
75    pub fn as_input(&self) -> &crate::operation::start_declarative_policies_report::builders::StartDeclarativePoliciesReportInputBuilder {
76        &self.inner
77    }
78    /// Sends the request and returns the response.
79    ///
80    /// If an error occurs, an `SdkError` will be returned with additional details that
81    /// can be matched against.
82    ///
83    /// By default, any retryable failures will be retried twice. Retry behavior
84    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
85    /// set when configuring the client.
86    pub async fn send(
87        self,
88    ) -> ::std::result::Result<
89        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportOutput,
90        ::aws_smithy_runtime_api::client::result::SdkError<
91            crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportError,
92            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
93        >,
94    > {
95        let input = self
96            .inner
97            .build()
98            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
99        let runtime_plugins = crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReport::operation_runtime_plugins(
100            self.handle.runtime_plugins.clone(),
101            &self.handle.conf,
102            self.config_override,
103        );
104        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReport::orchestrate(&runtime_plugins, input).await
105    }
106
107    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
108    pub fn customize(
109        self,
110    ) -> crate::client::customize::CustomizableOperation<
111        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportOutput,
112        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportError,
113        Self,
114    > {
115        crate::client::customize::CustomizableOperation::new(self)
116    }
117    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
118        self.set_config_override(::std::option::Option::Some(config_override.into()));
119        self
120    }
121
122    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
123        self.config_override = config_override;
124        self
125    }
126    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
127    pub fn dry_run(mut self, input: bool) -> Self {
128        self.inner = self.inner.dry_run(input);
129        self
130    }
131    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
132    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
133        self.inner = self.inner.set_dry_run(input);
134        self
135    }
136    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
137    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
138        self.inner.get_dry_run()
139    }
140    /// <p>The name of the S3 bucket where the report will be saved. The bucket must be in the same Region where the report generation request is made.</p>
141    pub fn s3_bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        self.inner = self.inner.s3_bucket(input.into());
143        self
144    }
145    /// <p>The name of the S3 bucket where the report will be saved. The bucket must be in the same Region where the report generation request is made.</p>
146    pub fn set_s3_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.inner = self.inner.set_s3_bucket(input);
148        self
149    }
150    /// <p>The name of the S3 bucket where the report will be saved. The bucket must be in the same Region where the report generation request is made.</p>
151    pub fn get_s3_bucket(&self) -> &::std::option::Option<::std::string::String> {
152        self.inner.get_s3_bucket()
153    }
154    /// <p>The prefix for your S3 object.</p>
155    pub fn s3_prefix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156        self.inner = self.inner.s3_prefix(input.into());
157        self
158    }
159    /// <p>The prefix for your S3 object.</p>
160    pub fn set_s3_prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161        self.inner = self.inner.set_s3_prefix(input);
162        self
163    }
164    /// <p>The prefix for your S3 object.</p>
165    pub fn get_s3_prefix(&self) -> &::std::option::Option<::std::string::String> {
166        self.inner.get_s3_prefix()
167    }
168    /// <p>The root ID, organizational unit ID, or account ID.</p>
169    /// <p>Format:</p>
170    /// <ul>
171    /// <li>
172    /// <p>For root: <code>r-ab12</code></p></li>
173    /// <li>
174    /// <p>For OU: <code>ou-ab12-cdef1234</code></p></li>
175    /// <li>
176    /// <p>For account: <code>123456789012</code></p></li>
177    /// </ul>
178    pub fn target_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
179        self.inner = self.inner.target_id(input.into());
180        self
181    }
182    /// <p>The root ID, organizational unit ID, or account ID.</p>
183    /// <p>Format:</p>
184    /// <ul>
185    /// <li>
186    /// <p>For root: <code>r-ab12</code></p></li>
187    /// <li>
188    /// <p>For OU: <code>ou-ab12-cdef1234</code></p></li>
189    /// <li>
190    /// <p>For account: <code>123456789012</code></p></li>
191    /// </ul>
192    pub fn set_target_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
193        self.inner = self.inner.set_target_id(input);
194        self
195    }
196    /// <p>The root ID, organizational unit ID, or account ID.</p>
197    /// <p>Format:</p>
198    /// <ul>
199    /// <li>
200    /// <p>For root: <code>r-ab12</code></p></li>
201    /// <li>
202    /// <p>For OU: <code>ou-ab12-cdef1234</code></p></li>
203    /// <li>
204    /// <p>For account: <code>123456789012</code></p></li>
205    /// </ul>
206    pub fn get_target_id(&self) -> &::std::option::Option<::std::string::String> {
207        self.inner.get_target_id()
208    }
209    ///
210    /// Appends an item to `TagSpecifications`.
211    ///
212    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
213    ///
214    /// <p>The tags to apply.</p>
215    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
216        self.inner = self.inner.tag_specifications(input);
217        self
218    }
219    /// <p>The tags to apply.</p>
220    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
221        self.inner = self.inner.set_tag_specifications(input);
222        self
223    }
224    /// <p>The tags to apply.</p>
225    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
226        self.inner.get_tag_specifications()
227    }
228}