aws-sdk-ec2 1.224.0

AWS SDK for Amazon Elastic Compute Cloud
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct TerminateInstancesInput {
    /// <p>The IDs of the instances.</p>
    /// <p>Constraints: Up to 1000 instance IDs. We recommend breaking up this request into smaller batches.</p>
    pub instance_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>Forces the instances to terminate. The instance will first attempt a graceful shutdown, which includes flushing file system caches and metadata. If the graceful shutdown fails to complete within the timeout period, the instance shuts down forcibly without flushing the file system caches and metadata.</p>
    pub force: ::std::option::Option<bool>,
    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.</p>
    /// <p>Default: <code>false</code></p>
    pub skip_os_shutdown: ::std::option::Option<bool>,
    /// <p>Checks whether you have the required permissions for the operation, 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 dry_run: ::std::option::Option<bool>,
}
impl TerminateInstancesInput {
    /// <p>The IDs of the instances.</p>
    /// <p>Constraints: Up to 1000 instance IDs. We recommend breaking up this request into smaller batches.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.instance_ids.is_none()`.
    pub fn instance_ids(&self) -> &[::std::string::String] {
        self.instance_ids.as_deref().unwrap_or_default()
    }
    /// <p>Forces the instances to terminate. The instance will first attempt a graceful shutdown, which includes flushing file system caches and metadata. If the graceful shutdown fails to complete within the timeout period, the instance shuts down forcibly without flushing the file system caches and metadata.</p>
    pub fn force(&self) -> ::std::option::Option<bool> {
        self.force
    }
    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.</p>
    /// <p>Default: <code>false</code></p>
    pub fn skip_os_shutdown(&self) -> ::std::option::Option<bool> {
        self.skip_os_shutdown
    }
    /// <p>Checks whether you have the required permissions for the operation, 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(&self) -> ::std::option::Option<bool> {
        self.dry_run
    }
}
impl TerminateInstancesInput {
    /// Creates a new builder-style object to manufacture [`TerminateInstancesInput`](crate::operation::terminate_instances::TerminateInstancesInput).
    pub fn builder() -> crate::operation::terminate_instances::builders::TerminateInstancesInputBuilder {
        crate::operation::terminate_instances::builders::TerminateInstancesInputBuilder::default()
    }
}

/// A builder for [`TerminateInstancesInput`](crate::operation::terminate_instances::TerminateInstancesInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct TerminateInstancesInputBuilder {
    pub(crate) instance_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) force: ::std::option::Option<bool>,
    pub(crate) skip_os_shutdown: ::std::option::Option<bool>,
    pub(crate) dry_run: ::std::option::Option<bool>,
}
impl TerminateInstancesInputBuilder {
    /// Appends an item to `instance_ids`.
    ///
    /// To override the contents of this collection use [`set_instance_ids`](Self::set_instance_ids).
    ///
    /// <p>The IDs of the instances.</p>
    /// <p>Constraints: Up to 1000 instance IDs. We recommend breaking up this request into smaller batches.</p>
    pub fn instance_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.instance_ids.unwrap_or_default();
        v.push(input.into());
        self.instance_ids = ::std::option::Option::Some(v);
        self
    }
    /// <p>The IDs of the instances.</p>
    /// <p>Constraints: Up to 1000 instance IDs. We recommend breaking up this request into smaller batches.</p>
    pub fn set_instance_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.instance_ids = input;
        self
    }
    /// <p>The IDs of the instances.</p>
    /// <p>Constraints: Up to 1000 instance IDs. We recommend breaking up this request into smaller batches.</p>
    pub fn get_instance_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.instance_ids
    }
    /// <p>Forces the instances to terminate. The instance will first attempt a graceful shutdown, which includes flushing file system caches and metadata. If the graceful shutdown fails to complete within the timeout period, the instance shuts down forcibly without flushing the file system caches and metadata.</p>
    pub fn force(mut self, input: bool) -> Self {
        self.force = ::std::option::Option::Some(input);
        self
    }
    /// <p>Forces the instances to terminate. The instance will first attempt a graceful shutdown, which includes flushing file system caches and metadata. If the graceful shutdown fails to complete within the timeout period, the instance shuts down forcibly without flushing the file system caches and metadata.</p>
    pub fn set_force(mut self, input: ::std::option::Option<bool>) -> Self {
        self.force = input;
        self
    }
    /// <p>Forces the instances to terminate. The instance will first attempt a graceful shutdown, which includes flushing file system caches and metadata. If the graceful shutdown fails to complete within the timeout period, the instance shuts down forcibly without flushing the file system caches and metadata.</p>
    pub fn get_force(&self) -> &::std::option::Option<bool> {
        &self.force
    }
    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.</p>
    /// <p>Default: <code>false</code></p>
    pub fn skip_os_shutdown(mut self, input: bool) -> Self {
        self.skip_os_shutdown = ::std::option::Option::Some(input);
        self
    }
    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.</p>
    /// <p>Default: <code>false</code></p>
    pub fn set_skip_os_shutdown(mut self, input: ::std::option::Option<bool>) -> Self {
        self.skip_os_shutdown = input;
        self
    }
    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.</p>
    /// <p>Default: <code>false</code></p>
    pub fn get_skip_os_shutdown(&self) -> &::std::option::Option<bool> {
        &self.skip_os_shutdown
    }
    /// <p>Checks whether you have the required permissions for the operation, 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.dry_run = ::std::option::Option::Some(input);
        self
    }
    /// <p>Checks whether you have the required permissions for the operation, 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.dry_run = input;
        self
    }
    /// <p>Checks whether you have the required permissions for the operation, 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.dry_run
    }
    /// Consumes the builder and constructs a [`TerminateInstancesInput`](crate::operation::terminate_instances::TerminateInstancesInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::terminate_instances::TerminateInstancesInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::terminate_instances::TerminateInstancesInput {
            instance_ids: self.instance_ids,
            force: self.force,
            skip_os_shutdown: self.skip_os_shutdown,
            dry_run: self.dry_run,
        })
    }
}