aws_sdk_cloudformation/operation/delete_stack/
_delete_stack_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The input for <code>DeleteStack</code> action.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct DeleteStackInput {
7    /// <p>The name or the unique stack ID that's associated with the stack.</p>
8    pub stack_name: ::std::option::Option<::std::string::String>,
9    /// <p>For stacks in the <code>DELETE_FAILED</code> state, a list of resource logical IDs that are associated with the resources you want to retain. During deletion, CloudFormation deletes the stack but doesn't delete the retained resources.</p>
10    /// <p>Retaining resources is useful when you can't delete a resource, such as a non-empty S3 bucket, but you want to delete the stack.</p>
11    pub retain_resources: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
12    /// <p>The Amazon Resource Name (ARN) of an IAM role that CloudFormation assumes to delete the stack. CloudFormation uses the role's credentials to make calls on your behalf.</p>
13    /// <p>If you don't specify a value, CloudFormation uses the role that was previously associated with the stack. If no role is available, CloudFormation uses a temporary session that's generated from your user credentials.</p>
14    pub role_arn: ::std::option::Option<::std::string::String>,
15    /// <p>A unique identifier for this <code>DeleteStack</code> request. Specify this token if you plan to retry requests so that CloudFormation knows that you're not attempting to delete a stack with the same name. You might retry <code>DeleteStack</code> requests to ensure that CloudFormation successfully received them.</p>
16    /// <p>All events initiated by a given stack operation are assigned the same client request token, which you can use to track operations. For example, if you execute a <code>CreateStack</code> operation with the token <code>token1</code>, then all the <code>StackEvents</code> generated by that operation will have <code>ClientRequestToken</code> set as <code>token1</code>.</p>
17    /// <p>In the console, stack operations display the client request token on the Events tab. Stack operations that are initiated from the console use the token format <i>Console-StackOperation-ID</i>, which helps you easily identify the stack operation . For example, if you create a stack using the console, each stack event would be assigned the same token in the following format: <code>Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002</code>.</p>
18    pub client_request_token: ::std::option::Option<::std::string::String>,
19    /// <p>Specifies the deletion mode for the stack. Possible values are:</p>
20    /// <ul>
21    /// <li>
22    /// <p><code>STANDARD</code> - Use the standard behavior. Specifying this value is the same as not specifying this parameter.</p></li>
23    /// <li>
24    /// <p><code>FORCE_DELETE_STACK</code> - Delete the stack if it's stuck in a <code>DELETE_FAILED</code> state due to resource deletion failure.</p></li>
25    /// </ul>
26    pub deletion_mode: ::std::option::Option<crate::types::DeletionMode>,
27}
28impl DeleteStackInput {
29    /// <p>The name or the unique stack ID that's associated with the stack.</p>
30    pub fn stack_name(&self) -> ::std::option::Option<&str> {
31        self.stack_name.as_deref()
32    }
33    /// <p>For stacks in the <code>DELETE_FAILED</code> state, a list of resource logical IDs that are associated with the resources you want to retain. During deletion, CloudFormation deletes the stack but doesn't delete the retained resources.</p>
34    /// <p>Retaining resources is useful when you can't delete a resource, such as a non-empty S3 bucket, but you want to delete the stack.</p>
35    ///
36    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.retain_resources.is_none()`.
37    pub fn retain_resources(&self) -> &[::std::string::String] {
38        self.retain_resources.as_deref().unwrap_or_default()
39    }
40    /// <p>The Amazon Resource Name (ARN) of an IAM role that CloudFormation assumes to delete the stack. CloudFormation uses the role's credentials to make calls on your behalf.</p>
41    /// <p>If you don't specify a value, CloudFormation uses the role that was previously associated with the stack. If no role is available, CloudFormation uses a temporary session that's generated from your user credentials.</p>
42    pub fn role_arn(&self) -> ::std::option::Option<&str> {
43        self.role_arn.as_deref()
44    }
45    /// <p>A unique identifier for this <code>DeleteStack</code> request. Specify this token if you plan to retry requests so that CloudFormation knows that you're not attempting to delete a stack with the same name. You might retry <code>DeleteStack</code> requests to ensure that CloudFormation successfully received them.</p>
46    /// <p>All events initiated by a given stack operation are assigned the same client request token, which you can use to track operations. For example, if you execute a <code>CreateStack</code> operation with the token <code>token1</code>, then all the <code>StackEvents</code> generated by that operation will have <code>ClientRequestToken</code> set as <code>token1</code>.</p>
47    /// <p>In the console, stack operations display the client request token on the Events tab. Stack operations that are initiated from the console use the token format <i>Console-StackOperation-ID</i>, which helps you easily identify the stack operation . For example, if you create a stack using the console, each stack event would be assigned the same token in the following format: <code>Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002</code>.</p>
48    pub fn client_request_token(&self) -> ::std::option::Option<&str> {
49        self.client_request_token.as_deref()
50    }
51    /// <p>Specifies the deletion mode for the stack. Possible values are:</p>
52    /// <ul>
53    /// <li>
54    /// <p><code>STANDARD</code> - Use the standard behavior. Specifying this value is the same as not specifying this parameter.</p></li>
55    /// <li>
56    /// <p><code>FORCE_DELETE_STACK</code> - Delete the stack if it's stuck in a <code>DELETE_FAILED</code> state due to resource deletion failure.</p></li>
57    /// </ul>
58    pub fn deletion_mode(&self) -> ::std::option::Option<&crate::types::DeletionMode> {
59        self.deletion_mode.as_ref()
60    }
61}
62impl DeleteStackInput {
63    /// Creates a new builder-style object to manufacture [`DeleteStackInput`](crate::operation::delete_stack::DeleteStackInput).
64    pub fn builder() -> crate::operation::delete_stack::builders::DeleteStackInputBuilder {
65        crate::operation::delete_stack::builders::DeleteStackInputBuilder::default()
66    }
67}
68
69/// A builder for [`DeleteStackInput`](crate::operation::delete_stack::DeleteStackInput).
70#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
71#[non_exhaustive]
72pub struct DeleteStackInputBuilder {
73    pub(crate) stack_name: ::std::option::Option<::std::string::String>,
74    pub(crate) retain_resources: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
75    pub(crate) role_arn: ::std::option::Option<::std::string::String>,
76    pub(crate) client_request_token: ::std::option::Option<::std::string::String>,
77    pub(crate) deletion_mode: ::std::option::Option<crate::types::DeletionMode>,
78}
79impl DeleteStackInputBuilder {
80    /// <p>The name or the unique stack ID that's associated with the stack.</p>
81    /// This field is required.
82    pub fn stack_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
83        self.stack_name = ::std::option::Option::Some(input.into());
84        self
85    }
86    /// <p>The name or the unique stack ID that's associated with the stack.</p>
87    pub fn set_stack_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
88        self.stack_name = input;
89        self
90    }
91    /// <p>The name or the unique stack ID that's associated with the stack.</p>
92    pub fn get_stack_name(&self) -> &::std::option::Option<::std::string::String> {
93        &self.stack_name
94    }
95    /// Appends an item to `retain_resources`.
96    ///
97    /// To override the contents of this collection use [`set_retain_resources`](Self::set_retain_resources).
98    ///
99    /// <p>For stacks in the <code>DELETE_FAILED</code> state, a list of resource logical IDs that are associated with the resources you want to retain. During deletion, CloudFormation deletes the stack but doesn't delete the retained resources.</p>
100    /// <p>Retaining resources is useful when you can't delete a resource, such as a non-empty S3 bucket, but you want to delete the stack.</p>
101    pub fn retain_resources(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
102        let mut v = self.retain_resources.unwrap_or_default();
103        v.push(input.into());
104        self.retain_resources = ::std::option::Option::Some(v);
105        self
106    }
107    /// <p>For stacks in the <code>DELETE_FAILED</code> state, a list of resource logical IDs that are associated with the resources you want to retain. During deletion, CloudFormation deletes the stack but doesn't delete the retained resources.</p>
108    /// <p>Retaining resources is useful when you can't delete a resource, such as a non-empty S3 bucket, but you want to delete the stack.</p>
109    pub fn set_retain_resources(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
110        self.retain_resources = input;
111        self
112    }
113    /// <p>For stacks in the <code>DELETE_FAILED</code> state, a list of resource logical IDs that are associated with the resources you want to retain. During deletion, CloudFormation deletes the stack but doesn't delete the retained resources.</p>
114    /// <p>Retaining resources is useful when you can't delete a resource, such as a non-empty S3 bucket, but you want to delete the stack.</p>
115    pub fn get_retain_resources(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
116        &self.retain_resources
117    }
118    /// <p>The Amazon Resource Name (ARN) of an IAM role that CloudFormation assumes to delete the stack. CloudFormation uses the role's credentials to make calls on your behalf.</p>
119    /// <p>If you don't specify a value, CloudFormation uses the role that was previously associated with the stack. If no role is available, CloudFormation uses a temporary session that's generated from your user credentials.</p>
120    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.role_arn = ::std::option::Option::Some(input.into());
122        self
123    }
124    /// <p>The Amazon Resource Name (ARN) of an IAM role that CloudFormation assumes to delete the stack. CloudFormation uses the role's credentials to make calls on your behalf.</p>
125    /// <p>If you don't specify a value, CloudFormation uses the role that was previously associated with the stack. If no role is available, CloudFormation uses a temporary session that's generated from your user credentials.</p>
126    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127        self.role_arn = input;
128        self
129    }
130    /// <p>The Amazon Resource Name (ARN) of an IAM role that CloudFormation assumes to delete the stack. CloudFormation uses the role's credentials to make calls on your behalf.</p>
131    /// <p>If you don't specify a value, CloudFormation uses the role that was previously associated with the stack. If no role is available, CloudFormation uses a temporary session that's generated from your user credentials.</p>
132    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
133        &self.role_arn
134    }
135    /// <p>A unique identifier for this <code>DeleteStack</code> request. Specify this token if you plan to retry requests so that CloudFormation knows that you're not attempting to delete a stack with the same name. You might retry <code>DeleteStack</code> requests to ensure that CloudFormation successfully received them.</p>
136    /// <p>All events initiated by a given stack operation are assigned the same client request token, which you can use to track operations. For example, if you execute a <code>CreateStack</code> operation with the token <code>token1</code>, then all the <code>StackEvents</code> generated by that operation will have <code>ClientRequestToken</code> set as <code>token1</code>.</p>
137    /// <p>In the console, stack operations display the client request token on the Events tab. Stack operations that are initiated from the console use the token format <i>Console-StackOperation-ID</i>, which helps you easily identify the stack operation . For example, if you create a stack using the console, each stack event would be assigned the same token in the following format: <code>Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002</code>.</p>
138    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139        self.client_request_token = ::std::option::Option::Some(input.into());
140        self
141    }
142    /// <p>A unique identifier for this <code>DeleteStack</code> request. Specify this token if you plan to retry requests so that CloudFormation knows that you're not attempting to delete a stack with the same name. You might retry <code>DeleteStack</code> requests to ensure that CloudFormation successfully received them.</p>
143    /// <p>All events initiated by a given stack operation are assigned the same client request token, which you can use to track operations. For example, if you execute a <code>CreateStack</code> operation with the token <code>token1</code>, then all the <code>StackEvents</code> generated by that operation will have <code>ClientRequestToken</code> set as <code>token1</code>.</p>
144    /// <p>In the console, stack operations display the client request token on the Events tab. Stack operations that are initiated from the console use the token format <i>Console-StackOperation-ID</i>, which helps you easily identify the stack operation . For example, if you create a stack using the console, each stack event would be assigned the same token in the following format: <code>Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002</code>.</p>
145    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146        self.client_request_token = input;
147        self
148    }
149    /// <p>A unique identifier for this <code>DeleteStack</code> request. Specify this token if you plan to retry requests so that CloudFormation knows that you're not attempting to delete a stack with the same name. You might retry <code>DeleteStack</code> requests to ensure that CloudFormation successfully received them.</p>
150    /// <p>All events initiated by a given stack operation are assigned the same client request token, which you can use to track operations. For example, if you execute a <code>CreateStack</code> operation with the token <code>token1</code>, then all the <code>StackEvents</code> generated by that operation will have <code>ClientRequestToken</code> set as <code>token1</code>.</p>
151    /// <p>In the console, stack operations display the client request token on the Events tab. Stack operations that are initiated from the console use the token format <i>Console-StackOperation-ID</i>, which helps you easily identify the stack operation . For example, if you create a stack using the console, each stack event would be assigned the same token in the following format: <code>Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002</code>.</p>
152    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
153        &self.client_request_token
154    }
155    /// <p>Specifies the deletion mode for the stack. Possible values are:</p>
156    /// <ul>
157    /// <li>
158    /// <p><code>STANDARD</code> - Use the standard behavior. Specifying this value is the same as not specifying this parameter.</p></li>
159    /// <li>
160    /// <p><code>FORCE_DELETE_STACK</code> - Delete the stack if it's stuck in a <code>DELETE_FAILED</code> state due to resource deletion failure.</p></li>
161    /// </ul>
162    pub fn deletion_mode(mut self, input: crate::types::DeletionMode) -> Self {
163        self.deletion_mode = ::std::option::Option::Some(input);
164        self
165    }
166    /// <p>Specifies the deletion mode for the stack. Possible values are:</p>
167    /// <ul>
168    /// <li>
169    /// <p><code>STANDARD</code> - Use the standard behavior. Specifying this value is the same as not specifying this parameter.</p></li>
170    /// <li>
171    /// <p><code>FORCE_DELETE_STACK</code> - Delete the stack if it's stuck in a <code>DELETE_FAILED</code> state due to resource deletion failure.</p></li>
172    /// </ul>
173    pub fn set_deletion_mode(mut self, input: ::std::option::Option<crate::types::DeletionMode>) -> Self {
174        self.deletion_mode = input;
175        self
176    }
177    /// <p>Specifies the deletion mode for the stack. Possible values are:</p>
178    /// <ul>
179    /// <li>
180    /// <p><code>STANDARD</code> - Use the standard behavior. Specifying this value is the same as not specifying this parameter.</p></li>
181    /// <li>
182    /// <p><code>FORCE_DELETE_STACK</code> - Delete the stack if it's stuck in a <code>DELETE_FAILED</code> state due to resource deletion failure.</p></li>
183    /// </ul>
184    pub fn get_deletion_mode(&self) -> &::std::option::Option<crate::types::DeletionMode> {
185        &self.deletion_mode
186    }
187    /// Consumes the builder and constructs a [`DeleteStackInput`](crate::operation::delete_stack::DeleteStackInput).
188    pub fn build(self) -> ::std::result::Result<crate::operation::delete_stack::DeleteStackInput, ::aws_smithy_types::error::operation::BuildError> {
189        ::std::result::Result::Ok(crate::operation::delete_stack::DeleteStackInput {
190            stack_name: self.stack_name,
191            retain_resources: self.retain_resources,
192            role_arn: self.role_arn,
193            client_request_token: self.client_request_token,
194            deletion_mode: self.deletion_mode,
195        })
196    }
197}