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