aws-sdk-ec2 1.222.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::deregister_image::_deregister_image_input::DeregisterImageInputBuilder;

pub use crate::operation::deregister_image::_deregister_image_output::DeregisterImageOutputBuilder;

impl crate::operation::deregister_image::builders::DeregisterImageInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::deregister_image::DeregisterImageOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::deregister_image::DeregisterImageError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.deregister_image();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `DeregisterImage`.
///
/// <p>Deregisters the specified AMI. A deregistered AMI can't be used to launch new instances.</p>
/// <p>If a deregistered EBS-backed AMI matches a Recycle Bin retention rule, it moves to the Recycle Bin for the specified retention period. It can be restored before its retention period expires, after which it is permanently deleted. If the deregistered AMI doesn't match a retention rule, it is permanently deleted immediately. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recycle-bin.html">Recover deleted Amazon EBS snapshots and EBS-backed AMIs with Recycle Bin</a> in the <i>Amazon EBS User Guide</i>.</p>
/// <p>When deregistering an EBS-backed AMI, you can optionally delete its associated snapshots at the same time. However, if a snapshot is associated with multiple AMIs, it won't be deleted even if specified for deletion, although the AMI will still be deregistered.</p>
/// <p>Deregistering an AMI does not delete the following:</p>
/// <ul>
/// <li>
/// <p>Instances already launched from the AMI. You'll continue to incur usage costs for the instances until you terminate them.</p></li>
/// <li>
/// <p>For EBS-backed AMIs: Snapshots that are associated with multiple AMIs. You'll continue to incur snapshot storage costs.</p></li>
/// <li>
/// <p>For instance store-backed AMIs: The files uploaded to Amazon S3 during AMI creation. You'll continue to incur S3 storage costs.</p></li>
/// </ul>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/deregister-ami.html">Deregister an Amazon EC2 AMI</a> in the <i>Amazon EC2 User Guide</i>.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct DeregisterImageFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::deregister_image::builders::DeregisterImageInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::deregister_image::DeregisterImageOutput,
        crate::operation::deregister_image::DeregisterImageError,
    > for DeregisterImageFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::deregister_image::DeregisterImageOutput,
            crate::operation::deregister_image::DeregisterImageError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl DeregisterImageFluentBuilder {
    /// Creates a new `DeregisterImageFluentBuilder`.
    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 DeregisterImage as a reference.
    pub fn as_input(&self) -> &crate::operation::deregister_image::builders::DeregisterImageInputBuilder {
        &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::deregister_image::DeregisterImageOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::deregister_image::DeregisterImageError,
            ::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::deregister_image::DeregisterImage::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::deregister_image::DeregisterImage::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::deregister_image::DeregisterImageOutput,
        crate::operation::deregister_image::DeregisterImageError,
        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>The ID of the AMI.</p>
    pub fn image_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.image_id(input.into());
        self
    }
    /// <p>The ID of the AMI.</p>
    pub fn set_image_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_image_id(input);
        self
    }
    /// <p>The ID of the AMI.</p>
    pub fn get_image_id(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_image_id()
    }
    /// <p>Specifies whether to delete the snapshots associated with the AMI during deregistration.</p><note>
    /// <p>If a snapshot is associated with multiple AMIs, it is not deleted, regardless of this setting.</p>
    /// </note>
    /// <p>Default: The snapshots are not deleted.</p>
    pub fn delete_associated_snapshots(mut self, input: bool) -> Self {
        self.inner = self.inner.delete_associated_snapshots(input);
        self
    }
    /// <p>Specifies whether to delete the snapshots associated with the AMI during deregistration.</p><note>
    /// <p>If a snapshot is associated with multiple AMIs, it is not deleted, regardless of this setting.</p>
    /// </note>
    /// <p>Default: The snapshots are not deleted.</p>
    pub fn set_delete_associated_snapshots(mut self, input: ::std::option::Option<bool>) -> Self {
        self.inner = self.inner.set_delete_associated_snapshots(input);
        self
    }
    /// <p>Specifies whether to delete the snapshots associated with the AMI during deregistration.</p><note>
    /// <p>If a snapshot is associated with multiple AMIs, it is not deleted, regardless of this setting.</p>
    /// </note>
    /// <p>Default: The snapshots are not deleted.</p>
    pub fn get_delete_associated_snapshots(&self) -> &::std::option::Option<bool> {
        self.inner.get_delete_associated_snapshots()
    }
    /// <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()
    }
}