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