aws-sdk-accessanalyzer 1.105.0

AWS SDK for Access Analyzer
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::start_policy_preview_job::_start_policy_preview_job_input::StartPolicyPreviewJobInputBuilder;

pub use crate::operation::start_policy_preview_job::_start_policy_preview_job_output::StartPolicyPreviewJobOutputBuilder;

impl crate::operation::start_policy_preview_job::builders::StartPolicyPreviewJobInputBuilder {
    /// 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_policy_preview_job::StartPolicyPreviewJobOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::start_policy_preview_job::StartPolicyPreviewJobError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.start_policy_preview_job();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `StartPolicyPreviewJob`.
///
/// <p>Creates a policy preview analysis job to evaluate the impact of Service Control Policies (SCPs) before deployment. The analysis uses historical CloudTrail authorization events to identify potential access denials, helping you prevent service disruptions.</p>
/// <p>The job analyzes CloudTrail events within a specified time window and generates a report identifying which events would be denied by the proposed policy. The report is stored in the specified Amazon S3 location.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct StartPolicyPreviewJobFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::start_policy_preview_job::builders::StartPolicyPreviewJobInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::start_policy_preview_job::StartPolicyPreviewJobOutput,
        crate::operation::start_policy_preview_job::StartPolicyPreviewJobError,
    > for StartPolicyPreviewJobFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::start_policy_preview_job::StartPolicyPreviewJobOutput,
            crate::operation::start_policy_preview_job::StartPolicyPreviewJobError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl StartPolicyPreviewJobFluentBuilder {
    /// Creates a new `StartPolicyPreviewJobFluentBuilder`.
    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 StartPolicyPreviewJob as a reference.
    pub fn as_input(&self) -> &crate::operation::start_policy_preview_job::builders::StartPolicyPreviewJobInputBuilder {
        &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_policy_preview_job::StartPolicyPreviewJobOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::start_policy_preview_job::StartPolicyPreviewJobError,
            ::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_policy_preview_job::StartPolicyPreviewJob::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::start_policy_preview_job::StartPolicyPreviewJob::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_policy_preview_job::StartPolicyPreviewJobOutput,
        crate::operation::start_policy_preview_job::StartPolicyPreviewJobError,
        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
    }
    ///
    /// Appends an item to `policyConfigurations`.
    ///
    /// To override the contents of this collection use [`set_policy_configurations`](Self::set_policy_configurations).
    ///
    /// <p>A list of policy configurations to analyze. Currently limited to one configuration per request. Each configuration specifies the job type, target ID, and policy documents to test.</p>
    pub fn policy_configurations(mut self, input: crate::types::PolicyConfiguration) -> Self {
        self.inner = self.inner.policy_configurations(input);
        self
    }
    /// <p>A list of policy configurations to analyze. Currently limited to one configuration per request. Each configuration specifies the job type, target ID, and policy documents to test.</p>
    pub fn set_policy_configurations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PolicyConfiguration>>) -> Self {
        self.inner = self.inner.set_policy_configurations(input);
        self
    }
    /// <p>A list of policy configurations to analyze. Currently limited to one configuration per request. Each configuration specifies the job type, target ID, and policy documents to test.</p>
    pub fn get_policy_configurations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PolicyConfiguration>> {
        self.inner.get_policy_configurations()
    }
    /// <p>The start of the CloudTrail event analysis window. The analysis will evaluate events from this time forward.</p>
    pub fn start_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.inner = self.inner.start_time(input);
        self
    }
    /// <p>The start of the CloudTrail event analysis window. The analysis will evaluate events from this time forward.</p>
    pub fn set_start_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.inner = self.inner.set_start_time(input);
        self
    }
    /// <p>The start of the CloudTrail event analysis window. The analysis will evaluate events from this time forward.</p>
    pub fn get_start_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        self.inner.get_start_time()
    }
    /// <p>The end of the analysis window. If not specified, defaults to the time of the request. The analysis will evaluate CloudTrail events up to this time.</p>
    pub fn end_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.inner = self.inner.end_time(input);
        self
    }
    /// <p>The end of the analysis window. If not specified, defaults to the time of the request. The analysis will evaluate CloudTrail events up to this time.</p>
    pub fn set_end_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.inner = self.inner.set_end_time(input);
        self
    }
    /// <p>The end of the analysis window. If not specified, defaults to the time of the request. The analysis will evaluate CloudTrail events up to this time.</p>
    pub fn get_end_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        self.inner.get_end_time()
    }
    /// <p>The Amazon S3 URI where the completed analysis report will be stored. The Amazon S3 bucket must grant access to the IAM Access Analyzer service principal in its resource policy. The report will be stored at the path: <code>outputS3Uri/jobId/timestamp/</code>.</p>
    pub fn output_s3_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.output_s3_uri(input.into());
        self
    }
    /// <p>The Amazon S3 URI where the completed analysis report will be stored. The Amazon S3 bucket must grant access to the IAM Access Analyzer service principal in its resource policy. The report will be stored at the path: <code>outputS3Uri/jobId/timestamp/</code>.</p>
    pub fn set_output_s3_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_output_s3_uri(input);
        self
    }
    /// <p>The Amazon S3 URI where the completed analysis report will be stored. The Amazon S3 bucket must grant access to the IAM Access Analyzer service principal in its resource policy. The report will be stored at the path: <code>outputS3Uri/jobId/timestamp/</code>.</p>
    pub fn get_output_s3_uri(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_output_s3_uri()
    }
    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, subsequent retries with the same client token return the result from the original successful request and have no additional effect.</p>
    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.client_token(input.into());
        self
    }
    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, subsequent retries with the same client token return the result from the original successful request and have no additional effect.</p>
    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_client_token(input);
        self
    }
    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, subsequent retries with the same client token return the result from the original successful request and have no additional effect.</p>
    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_client_token()
    }
}