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 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>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>
12    pub dry_run: ::std::option::Option<bool>,
13    /// <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>
14    /// <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>
15    /// <p>Default: <code>false</code></p>
16    pub force: ::std::option::Option<bool>,
17}
18impl StopInstancesInput {
19    /// <p>The IDs of the instances.</p>
20    ///
21    /// 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()`.
22    pub fn instance_ids(&self) -> &[::std::string::String] {
23        self.instance_ids.as_deref().unwrap_or_default()
24    }
25    /// <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 instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
26    /// <p>Default: <code>false</code></p>
27    pub fn hibernate(&self) -> ::std::option::Option<bool> {
28        self.hibernate
29    }
30    /// <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>
31    pub fn dry_run(&self) -> ::std::option::Option<bool> {
32        self.dry_run
33    }
34    /// <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>
35    /// <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>
36    /// <p>Default: <code>false</code></p>
37    pub fn force(&self) -> ::std::option::Option<bool> {
38        self.force
39    }
40}
41impl StopInstancesInput {
42    /// Creates a new builder-style object to manufacture [`StopInstancesInput`](crate::operation::stop_instances::StopInstancesInput).
43    pub fn builder() -> crate::operation::stop_instances::builders::StopInstancesInputBuilder {
44        crate::operation::stop_instances::builders::StopInstancesInputBuilder::default()
45    }
46}
47
48/// A builder for [`StopInstancesInput`](crate::operation::stop_instances::StopInstancesInput).
49#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct StopInstancesInputBuilder {
52    pub(crate) instance_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
53    pub(crate) hibernate: ::std::option::Option<bool>,
54    pub(crate) dry_run: ::std::option::Option<bool>,
55    pub(crate) force: ::std::option::Option<bool>,
56}
57impl StopInstancesInputBuilder {
58    /// Appends an item to `instance_ids`.
59    ///
60    /// To override the contents of this collection use [`set_instance_ids`](Self::set_instance_ids).
61    ///
62    /// <p>The IDs of the instances.</p>
63    pub fn instance_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64        let mut v = self.instance_ids.unwrap_or_default();
65        v.push(input.into());
66        self.instance_ids = ::std::option::Option::Some(v);
67        self
68    }
69    /// <p>The IDs of the instances.</p>
70    pub fn set_instance_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
71        self.instance_ids = input;
72        self
73    }
74    /// <p>The IDs of the instances.</p>
75    pub fn get_instance_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
76        &self.instance_ids
77    }
78    /// <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 instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
79    /// <p>Default: <code>false</code></p>
80    pub fn hibernate(mut self, input: bool) -> Self {
81        self.hibernate = ::std::option::Option::Some(input);
82        self
83    }
84    /// <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 instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
85    /// <p>Default: <code>false</code></p>
86    pub fn set_hibernate(mut self, input: ::std::option::Option<bool>) -> Self {
87        self.hibernate = input;
88        self
89    }
90    /// <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 instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
91    /// <p>Default: <code>false</code></p>
92    pub fn get_hibernate(&self) -> &::std::option::Option<bool> {
93        &self.hibernate
94    }
95    /// <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>
96    pub fn dry_run(mut self, input: bool) -> Self {
97        self.dry_run = ::std::option::Option::Some(input);
98        self
99    }
100    /// <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>
101    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
102        self.dry_run = input;
103        self
104    }
105    /// <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>
106    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
107        &self.dry_run
108    }
109    /// <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>
110    /// <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>
111    /// <p>Default: <code>false</code></p>
112    pub fn force(mut self, input: bool) -> Self {
113        self.force = ::std::option::Option::Some(input);
114        self
115    }
116    /// <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>
117    /// <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>
118    /// <p>Default: <code>false</code></p>
119    pub fn set_force(mut self, input: ::std::option::Option<bool>) -> Self {
120        self.force = input;
121        self
122    }
123    /// <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>
124    /// <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>
125    /// <p>Default: <code>false</code></p>
126    pub fn get_force(&self) -> &::std::option::Option<bool> {
127        &self.force
128    }
129    /// Consumes the builder and constructs a [`StopInstancesInput`](crate::operation::stop_instances::StopInstancesInput).
130    pub fn build(
131        self,
132    ) -> ::std::result::Result<crate::operation::stop_instances::StopInstancesInput, ::aws_smithy_types::error::operation::BuildError> {
133        ::std::result::Result::Ok(crate::operation::stop_instances::StopInstancesInput {
134            instance_ids: self.instance_ids,
135            hibernate: self.hibernate,
136            dry_run: self.dry_run,
137            force: self.force,
138        })
139    }
140}