aws_sdk_ec2/operation/terminate_instances/
_terminate_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 TerminateInstancesInput {
6    /// <p>The IDs of the instances.</p>
7    /// <p>Constraints: Up to 1000 instance IDs. We recommend breaking up this request into smaller batches.</p>
8    pub instance_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
9    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.</p>
10    /// <p>Default: <code>false</code></p>
11    pub skip_os_shutdown: ::std::option::Option<bool>,
12    /// <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>
13    pub dry_run: ::std::option::Option<bool>,
14}
15impl TerminateInstancesInput {
16    /// <p>The IDs of the instances.</p>
17    /// <p>Constraints: Up to 1000 instance IDs. We recommend breaking up this request into smaller batches.</p>
18    ///
19    /// 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()`.
20    pub fn instance_ids(&self) -> &[::std::string::String] {
21        self.instance_ids.as_deref().unwrap_or_default()
22    }
23    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.</p>
24    /// <p>Default: <code>false</code></p>
25    pub fn skip_os_shutdown(&self) -> ::std::option::Option<bool> {
26        self.skip_os_shutdown
27    }
28    /// <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>
29    pub fn dry_run(&self) -> ::std::option::Option<bool> {
30        self.dry_run
31    }
32}
33impl TerminateInstancesInput {
34    /// Creates a new builder-style object to manufacture [`TerminateInstancesInput`](crate::operation::terminate_instances::TerminateInstancesInput).
35    pub fn builder() -> crate::operation::terminate_instances::builders::TerminateInstancesInputBuilder {
36        crate::operation::terminate_instances::builders::TerminateInstancesInputBuilder::default()
37    }
38}
39
40/// A builder for [`TerminateInstancesInput`](crate::operation::terminate_instances::TerminateInstancesInput).
41#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
42#[non_exhaustive]
43pub struct TerminateInstancesInputBuilder {
44    pub(crate) instance_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
45    pub(crate) skip_os_shutdown: ::std::option::Option<bool>,
46    pub(crate) dry_run: ::std::option::Option<bool>,
47}
48impl TerminateInstancesInputBuilder {
49    /// Appends an item to `instance_ids`.
50    ///
51    /// To override the contents of this collection use [`set_instance_ids`](Self::set_instance_ids).
52    ///
53    /// <p>The IDs of the instances.</p>
54    /// <p>Constraints: Up to 1000 instance IDs. We recommend breaking up this request into smaller batches.</p>
55    pub fn instance_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
56        let mut v = self.instance_ids.unwrap_or_default();
57        v.push(input.into());
58        self.instance_ids = ::std::option::Option::Some(v);
59        self
60    }
61    /// <p>The IDs of the instances.</p>
62    /// <p>Constraints: Up to 1000 instance IDs. We recommend breaking up this request into smaller batches.</p>
63    pub fn set_instance_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
64        self.instance_ids = input;
65        self
66    }
67    /// <p>The IDs of the instances.</p>
68    /// <p>Constraints: Up to 1000 instance IDs. We recommend breaking up this request into smaller batches.</p>
69    pub fn get_instance_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
70        &self.instance_ids
71    }
72    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.</p>
73    /// <p>Default: <code>false</code></p>
74    pub fn skip_os_shutdown(mut self, input: bool) -> Self {
75        self.skip_os_shutdown = ::std::option::Option::Some(input);
76        self
77    }
78    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.</p>
79    /// <p>Default: <code>false</code></p>
80    pub fn set_skip_os_shutdown(mut self, input: ::std::option::Option<bool>) -> Self {
81        self.skip_os_shutdown = input;
82        self
83    }
84    /// <p>Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.</p>
85    /// <p>Default: <code>false</code></p>
86    pub fn get_skip_os_shutdown(&self) -> &::std::option::Option<bool> {
87        &self.skip_os_shutdown
88    }
89    /// <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>
90    pub fn dry_run(mut self, input: bool) -> Self {
91        self.dry_run = ::std::option::Option::Some(input);
92        self
93    }
94    /// <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>
95    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
96        self.dry_run = input;
97        self
98    }
99    /// <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>
100    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
101        &self.dry_run
102    }
103    /// Consumes the builder and constructs a [`TerminateInstancesInput`](crate::operation::terminate_instances::TerminateInstancesInput).
104    pub fn build(
105        self,
106    ) -> ::std::result::Result<crate::operation::terminate_instances::TerminateInstancesInput, ::aws_smithy_types::error::operation::BuildError> {
107        ::std::result::Result::Ok(crate::operation::terminate_instances::TerminateInstancesInput {
108            instance_ids: self.instance_ids,
109            skip_os_shutdown: self.skip_os_shutdown,
110            dry_run: self.dry_run,
111        })
112    }
113}