aws-sdk-ec2 1.221.0

AWS SDK for Amazon Elastic Compute Cloud
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::start_declarative_policies_report::_start_declarative_policies_report_input::StartDeclarativePoliciesReportInputBuilder;

pub use crate::operation::start_declarative_policies_report::_start_declarative_policies_report_output::StartDeclarativePoliciesReportOutputBuilder;

impl crate::operation::start_declarative_policies_report::builders::StartDeclarativePoliciesReportInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.start_declarative_policies_report();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `StartDeclarativePoliciesReport`.
///
/// <p>Generates an account status report. The report is generated asynchronously, and can take several hours to complete.</p>
/// <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>
/// <p>The report is saved to your specified S3 bucket, using the following path structure (with the capitalized placeholders representing your specific values):</p>
/// <p><code>s3://AMZN-S3-DEMO-BUCKET/YOUR-OPTIONAL-S3-PREFIX/ec2_TARGETID_REPORTID_YYYYMMDDTHHMMZ.csv</code></p>
/// <p class="title"><b>Prerequisites for generating a report</b></p>
/// <ul>
/// <li>
/// <p>The <code>StartDeclarativePoliciesReport</code> API can only be called by the management account or delegated administrators for the organization.</p></li>
/// <li>
/// <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 <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_StartDeclarativePoliciesReport.html#API_StartDeclarativePoliciesReport_Examples">Examples</a>.</p></li>
/// <li>
/// <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>
/// <li>
/// <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>
/// </ul>
/// <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>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct StartDeclarativePoliciesReportFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::start_declarative_policies_report::builders::StartDeclarativePoliciesReportInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportOutput,
        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportError,
    > for StartDeclarativePoliciesReportFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportOutput,
            crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl StartDeclarativePoliciesReportFluentBuilder {
    /// Creates a new `StartDeclarativePoliciesReportFluentBuilder`.
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: ::std::default::Default::default(),
            config_override: ::std::option::Option::None,
        }
    }
    /// Access the StartDeclarativePoliciesReport as a reference.
    pub fn as_input(&self) -> &crate::operation::start_declarative_policies_report::builders::StartDeclarativePoliciesReportInputBuilder {
        &self.inner
    }
    /// Sends the request and returns the response.
    ///
    /// If an error occurs, an `SdkError` will be returned with additional details that
    /// can be matched against.
    ///
    /// By default, any retryable failures will be retried twice. Retry behavior
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
    /// set when configuring the client.
    pub async fn send(
        self,
    ) -> ::std::result::Result<
        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let input = self
            .inner
            .build()
            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
        let runtime_plugins = crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReport::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReport::orchestrate(&runtime_plugins, input).await
    }

    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
    pub fn customize(
        self,
    ) -> crate::client::customize::CustomizableOperation<
        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportOutput,
        crate::operation::start_declarative_policies_report::StartDeclarativePoliciesReportError,
        Self,
    > {
        crate::client::customize::CustomizableOperation::new(self)
    }
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
        self.set_config_override(::std::option::Option::Some(config_override.into()));
        self
    }

    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
        self.config_override = config_override;
        self
    }
    /// <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>
    pub fn dry_run(mut self, input: bool) -> Self {
        self.inner = self.inner.dry_run(input);
        self
    }
    /// <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>
    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
        self.inner = self.inner.set_dry_run(input);
        self
    }
    /// <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>
    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
        self.inner.get_dry_run()
    }
    /// <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>
    pub fn s3_bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.s3_bucket(input.into());
        self
    }
    /// <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>
    pub fn set_s3_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_s3_bucket(input);
        self
    }
    /// <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>
    pub fn get_s3_bucket(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_s3_bucket()
    }
    /// <p>The prefix for your S3 object.</p>
    pub fn s3_prefix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.s3_prefix(input.into());
        self
    }
    /// <p>The prefix for your S3 object.</p>
    pub fn set_s3_prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_s3_prefix(input);
        self
    }
    /// <p>The prefix for your S3 object.</p>
    pub fn get_s3_prefix(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_s3_prefix()
    }
    /// <p>The root ID, organizational unit ID, or account ID.</p>
    /// <p>Format:</p>
    /// <ul>
    /// <li>
    /// <p>For root: <code>r-ab12</code></p></li>
    /// <li>
    /// <p>For OU: <code>ou-ab12-cdef1234</code></p></li>
    /// <li>
    /// <p>For account: <code>123456789012</code></p></li>
    /// </ul>
    pub fn target_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.target_id(input.into());
        self
    }
    /// <p>The root ID, organizational unit ID, or account ID.</p>
    /// <p>Format:</p>
    /// <ul>
    /// <li>
    /// <p>For root: <code>r-ab12</code></p></li>
    /// <li>
    /// <p>For OU: <code>ou-ab12-cdef1234</code></p></li>
    /// <li>
    /// <p>For account: <code>123456789012</code></p></li>
    /// </ul>
    pub fn set_target_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_target_id(input);
        self
    }
    /// <p>The root ID, organizational unit ID, or account ID.</p>
    /// <p>Format:</p>
    /// <ul>
    /// <li>
    /// <p>For root: <code>r-ab12</code></p></li>
    /// <li>
    /// <p>For OU: <code>ou-ab12-cdef1234</code></p></li>
    /// <li>
    /// <p>For account: <code>123456789012</code></p></li>
    /// </ul>
    pub fn get_target_id(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_target_id()
    }
    ///
    /// Appends an item to `TagSpecifications`.
    ///
    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
    ///
    /// <p>The tags to apply.</p>
    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
        self.inner = self.inner.tag_specifications(input);
        self
    }
    /// <p>The tags to apply.</p>
    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
        self.inner = self.inner.set_tag_specifications(input);
        self
    }
    /// <p>The tags to apply.</p>
    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
        self.inner.get_tag_specifications()
    }
}