aws_sdk_ec2/operation/stop_instances/
_stop_instances_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct StopInstancesInput {
6    /// <p>The IDs of the instances.</p>
7    pub instance_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
8    /// <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>
9    /// <p>Default: <code>false</code></p>
10    pub hibernate: ::std::option::Option<bool>,
11    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is stopped.</p><important>
12    /// <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>
13    /// </important>
14    /// <p>Default: <code>false</code></p>
15    pub skip_os_shutdown: ::std::option::Option<bool>,
16    /// <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>
17    pub dry_run: ::std::option::Option<bool>,
18    /// <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>
19    /// <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>
20    /// <p>Default: <code>false</code></p>
21    pub force: ::std::option::Option<bool>,
22}
23impl StopInstancesInput {
24    /// <p>The IDs of the instances.</p>
25    ///
26    /// 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()`.
27    pub fn instance_ids(&self) -> &[::std::string::String] {
28        self.instance_ids.as_deref().unwrap_or_default()
29    }
30    /// <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>
31    /// <p>Default: <code>false</code></p>
32    pub fn hibernate(&self) -> ::std::option::Option<bool> {
33        self.hibernate
34    }
35    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is stopped.</p><important>
36    /// <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>
37    /// </important>
38    /// <p>Default: <code>false</code></p>
39    pub fn skip_os_shutdown(&self) -> ::std::option::Option<bool> {
40        self.skip_os_shutdown
41    }
42    /// <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>
43    pub fn dry_run(&self) -> ::std::option::Option<bool> {
44        self.dry_run
45    }
46    /// <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>
47    /// <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>
48    /// <p>Default: <code>false</code></p>
49    pub fn force(&self) -> ::std::option::Option<bool> {
50        self.force
51    }
52}
53impl StopInstancesInput {
54    /// Creates a new builder-style object to manufacture [`StopInstancesInput`](crate::operation::stop_instances::StopInstancesInput).
55    pub fn builder() -> crate::operation::stop_instances::builders::StopInstancesInputBuilder {
56        crate::operation::stop_instances::builders::StopInstancesInputBuilder::default()
57    }
58}
59
60/// A builder for [`StopInstancesInput`](crate::operation::stop_instances::StopInstancesInput).
61#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
62#[non_exhaustive]
63pub struct StopInstancesInputBuilder {
64    pub(crate) instance_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
65    pub(crate) hibernate: ::std::option::Option<bool>,
66    pub(crate) skip_os_shutdown: ::std::option::Option<bool>,
67    pub(crate) dry_run: ::std::option::Option<bool>,
68    pub(crate) force: ::std::option::Option<bool>,
69}
70impl StopInstancesInputBuilder {
71    /// Appends an item to `instance_ids`.
72    ///
73    /// To override the contents of this collection use [`set_instance_ids`](Self::set_instance_ids).
74    ///
75    /// <p>The IDs of the instances.</p>
76    pub fn instance_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
77        let mut v = self.instance_ids.unwrap_or_default();
78        v.push(input.into());
79        self.instance_ids = ::std::option::Option::Some(v);
80        self
81    }
82    /// <p>The IDs of the instances.</p>
83    pub fn set_instance_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
84        self.instance_ids = input;
85        self
86    }
87    /// <p>The IDs of the instances.</p>
88    pub fn get_instance_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
89        &self.instance_ids
90    }
91    /// <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>
92    /// <p>Default: <code>false</code></p>
93    pub fn hibernate(mut self, input: bool) -> Self {
94        self.hibernate = ::std::option::Option::Some(input);
95        self
96    }
97    /// <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>
98    /// <p>Default: <code>false</code></p>
99    pub fn set_hibernate(mut self, input: ::std::option::Option<bool>) -> Self {
100        self.hibernate = input;
101        self
102    }
103    /// <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>
104    /// <p>Default: <code>false</code></p>
105    pub fn get_hibernate(&self) -> &::std::option::Option<bool> {
106        &self.hibernate
107    }
108    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is stopped.</p><important>
109    /// <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>
110    /// </important>
111    /// <p>Default: <code>false</code></p>
112    pub fn skip_os_shutdown(mut self, input: bool) -> Self {
113        self.skip_os_shutdown = ::std::option::Option::Some(input);
114        self
115    }
116    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is stopped.</p><important>
117    /// <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>
118    /// </important>
119    /// <p>Default: <code>false</code></p>
120    pub fn set_skip_os_shutdown(mut self, input: ::std::option::Option<bool>) -> Self {
121        self.skip_os_shutdown = input;
122        self
123    }
124    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is stopped.</p><important>
125    /// <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>
126    /// </important>
127    /// <p>Default: <code>false</code></p>
128    pub fn get_skip_os_shutdown(&self) -> &::std::option::Option<bool> {
129        &self.skip_os_shutdown
130    }
131    /// <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>
132    pub fn dry_run(mut self, input: bool) -> Self {
133        self.dry_run = ::std::option::Option::Some(input);
134        self
135    }
136    /// <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>
137    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
138        self.dry_run = input;
139        self
140    }
141    /// <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>
142    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
143        &self.dry_run
144    }
145    /// <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>
146    /// <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>
147    /// <p>Default: <code>false</code></p>
148    pub fn force(mut self, input: bool) -> Self {
149        self.force = ::std::option::Option::Some(input);
150        self
151    }
152    /// <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>
153    /// <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>
154    /// <p>Default: <code>false</code></p>
155    pub fn set_force(mut self, input: ::std::option::Option<bool>) -> Self {
156        self.force = input;
157        self
158    }
159    /// <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>
160    /// <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>
161    /// <p>Default: <code>false</code></p>
162    pub fn get_force(&self) -> &::std::option::Option<bool> {
163        &self.force
164    }
165    /// Consumes the builder and constructs a [`StopInstancesInput`](crate::operation::stop_instances::StopInstancesInput).
166    pub fn build(
167        self,
168    ) -> ::std::result::Result<crate::operation::stop_instances::StopInstancesInput, ::aws_smithy_types::error::operation::BuildError> {
169        ::std::result::Result::Ok(crate::operation::stop_instances::StopInstancesInput {
170            instance_ids: self.instance_ids,
171            hibernate: self.hibernate,
172            skip_os_shutdown: self.skip_os_shutdown,
173            dry_run: self.dry_run,
174            force: self.force,
175        })
176    }
177}