aws-sdk-ec2 1.218.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 StopInstancesInput {
    /// <p>The IDs of the instances.</p>
    pub instance_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>Hibernates the instance if the instance was enabled for hibernation at launch. If the instance cannot hibernate successfully, a normal shutdown occurs. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html">Hibernate your Amazon EC2 instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
    /// <p>Default: <code>false</code></p>
    pub hibernate: ::std::option::Option<bool>,
    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is stopped.</p><important>
    /// <p>Bypassing the graceful OS shutdown might result in data loss or corruption (for example, memory contents not flushed to disk or loss of in-flight IOs) or skipped shutdown scripts.</p>
    /// </important>
    /// <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>,
    /// <p>Forces the instance to stop. 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>
    /// <p>After using this option, you must perform file system check and repair procedures. This option is not recommended for Windows instances. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.html">Troubleshoot Amazon EC2 instance stop issues</a> in the <i>Amazon EC2 User Guide</i>.</p>
    /// <p>Default: <code>false</code></p>
    pub force: ::std::option::Option<bool>,
}
impl StopInstancesInput {
    /// <p>The IDs of the instances.</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>Hibernates the instance if the instance was enabled for hibernation at launch. If the instance cannot hibernate successfully, a normal shutdown occurs. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html">Hibernate your Amazon EC2 instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
    /// <p>Default: <code>false</code></p>
    pub fn hibernate(&self) -> ::std::option::Option<bool> {
        self.hibernate
    }
    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is stopped.</p><important>
    /// <p>Bypassing the graceful OS shutdown might result in data loss or corruption (for example, memory contents not flushed to disk or loss of in-flight IOs) or skipped shutdown scripts.</p>
    /// </important>
    /// <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
    }
    /// <p>Forces the instance to stop. 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>
    /// <p>After using this option, you must perform file system check and repair procedures. This option is not recommended for Windows instances. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.html">Troubleshoot Amazon EC2 instance stop issues</a> in the <i>Amazon EC2 User Guide</i>.</p>
    /// <p>Default: <code>false</code></p>
    pub fn force(&self) -> ::std::option::Option<bool> {
        self.force
    }
}
impl StopInstancesInput {
    /// Creates a new builder-style object to manufacture [`StopInstancesInput`](crate::operation::stop_instances::StopInstancesInput).
    pub fn builder() -> crate::operation::stop_instances::builders::StopInstancesInputBuilder {
        crate::operation::stop_instances::builders::StopInstancesInputBuilder::default()
    }
}

/// A builder for [`StopInstancesInput`](crate::operation::stop_instances::StopInstancesInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct StopInstancesInputBuilder {
    pub(crate) instance_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) hibernate: ::std::option::Option<bool>,
    pub(crate) skip_os_shutdown: ::std::option::Option<bool>,
    pub(crate) dry_run: ::std::option::Option<bool>,
    pub(crate) force: ::std::option::Option<bool>,
}
impl StopInstancesInputBuilder {
    /// 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>
    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>
    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>
    pub fn get_instance_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.instance_ids
    }
    /// <p>Hibernates the instance if the instance was enabled for hibernation at launch. If the instance cannot hibernate successfully, a normal shutdown occurs. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html">Hibernate your Amazon EC2 instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
    /// <p>Default: <code>false</code></p>
    pub fn hibernate(mut self, input: bool) -> Self {
        self.hibernate = ::std::option::Option::Some(input);
        self
    }
    /// <p>Hibernates the instance if the instance was enabled for hibernation at launch. If the instance cannot hibernate successfully, a normal shutdown occurs. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html">Hibernate your Amazon EC2 instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
    /// <p>Default: <code>false</code></p>
    pub fn set_hibernate(mut self, input: ::std::option::Option<bool>) -> Self {
        self.hibernate = input;
        self
    }
    /// <p>Hibernates the instance if the instance was enabled for hibernation at launch. If the instance cannot hibernate successfully, a normal shutdown occurs. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html">Hibernate your Amazon EC2 instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
    /// <p>Default: <code>false</code></p>
    pub fn get_hibernate(&self) -> &::std::option::Option<bool> {
        &self.hibernate
    }
    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is stopped.</p><important>
    /// <p>Bypassing the graceful OS shutdown might result in data loss or corruption (for example, memory contents not flushed to disk or loss of in-flight IOs) or skipped shutdown scripts.</p>
    /// </important>
    /// <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 stopped.</p><important>
    /// <p>Bypassing the graceful OS shutdown might result in data loss or corruption (for example, memory contents not flushed to disk or loss of in-flight IOs) or skipped shutdown scripts.</p>
    /// </important>
    /// <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 stopped.</p><important>
    /// <p>Bypassing the graceful OS shutdown might result in data loss or corruption (for example, memory contents not flushed to disk or loss of in-flight IOs) or skipped shutdown scripts.</p>
    /// </important>
    /// <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
    }
    /// <p>Forces the instance to stop. 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>
    /// <p>After using this option, you must perform file system check and repair procedures. This option is not recommended for Windows instances. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.html">Troubleshoot Amazon EC2 instance stop issues</a> in the <i>Amazon EC2 User Guide</i>.</p>
    /// <p>Default: <code>false</code></p>
    pub fn force(mut self, input: bool) -> Self {
        self.force = ::std::option::Option::Some(input);
        self
    }
    /// <p>Forces the instance to stop. 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>
    /// <p>After using this option, you must perform file system check and repair procedures. This option is not recommended for Windows instances. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.html">Troubleshoot Amazon EC2 instance stop issues</a> in the <i>Amazon EC2 User Guide</i>.</p>
    /// <p>Default: <code>false</code></p>
    pub fn set_force(mut self, input: ::std::option::Option<bool>) -> Self {
        self.force = input;
        self
    }
    /// <p>Forces the instance to stop. 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>
    /// <p>After using this option, you must perform file system check and repair procedures. This option is not recommended for Windows instances. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.html">Troubleshoot Amazon EC2 instance stop issues</a> in the <i>Amazon EC2 User Guide</i>.</p>
    /// <p>Default: <code>false</code></p>
    pub fn get_force(&self) -> &::std::option::Option<bool> {
        &self.force
    }
    /// Consumes the builder and constructs a [`StopInstancesInput`](crate::operation::stop_instances::StopInstancesInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::stop_instances::StopInstancesInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::stop_instances::StopInstancesInput {
            instance_ids: self.instance_ids,
            hibernate: self.hibernate,
            skip_os_shutdown: self.skip_os_shutdown,
            dry_run: self.dry_run,
            force: self.force,
        })
    }
}