1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Describes information used to specify a lifecycle hook for an Auto Scaling group.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html">Amazon EC2 Auto Scaling lifecycle hooks</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct LifecycleHookSpecification {
    /// <p>The name of the lifecycle hook.</p>
    pub lifecycle_hook_name: ::std::option::Option<::std::string::String>,
    /// <p>The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.</p>
    /// <ul>
    /// <li> <p>To create a lifecycle hook for scale-out events, specify <code>autoscaling:EC2_INSTANCE_LAUNCHING</code>.</p> </li>
    /// <li> <p>To create a lifecycle hook for scale-in events, specify <code>autoscaling:EC2_INSTANCE_TERMINATING</code>.</p> </li>
    /// </ul>
    pub lifecycle_transition: ::std::option::Option<::std::string::String>,
    /// <p>Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.</p>
    pub notification_metadata: ::std::option::Option<::std::string::String>,
    /// <p>The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from <code>30</code> to <code>7200</code> seconds. The default value is <code>3600</code> seconds (1 hour).</p>
    pub heartbeat_timeout: ::std::option::Option<i32>,
    /// <p>The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The default value is <code>ABANDON</code>.</p>
    /// <p>Valid values: <code>CONTINUE</code> | <code>ABANDON</code> </p>
    pub default_result: ::std::option::Option<::std::string::String>,
    /// <p>The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook. You can specify an Amazon SNS topic or an Amazon SQS queue.</p>
    pub notification_target_arn: ::std::option::Option<::std::string::String>,
    /// <p>The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. For information about creating this role, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/prepare-for-lifecycle-notifications.html#lifecycle-hook-notification-target">Configure a notification target for a lifecycle hook</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
    /// <p>Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue.</p>
    pub role_arn: ::std::option::Option<::std::string::String>,
}
impl LifecycleHookSpecification {
    /// <p>The name of the lifecycle hook.</p>
    pub fn lifecycle_hook_name(&self) -> ::std::option::Option<&str> {
        self.lifecycle_hook_name.as_deref()
    }
    /// <p>The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.</p>
    /// <ul>
    /// <li> <p>To create a lifecycle hook for scale-out events, specify <code>autoscaling:EC2_INSTANCE_LAUNCHING</code>.</p> </li>
    /// <li> <p>To create a lifecycle hook for scale-in events, specify <code>autoscaling:EC2_INSTANCE_TERMINATING</code>.</p> </li>
    /// </ul>
    pub fn lifecycle_transition(&self) -> ::std::option::Option<&str> {
        self.lifecycle_transition.as_deref()
    }
    /// <p>Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.</p>
    pub fn notification_metadata(&self) -> ::std::option::Option<&str> {
        self.notification_metadata.as_deref()
    }
    /// <p>The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from <code>30</code> to <code>7200</code> seconds. The default value is <code>3600</code> seconds (1 hour).</p>
    pub fn heartbeat_timeout(&self) -> ::std::option::Option<i32> {
        self.heartbeat_timeout
    }
    /// <p>The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The default value is <code>ABANDON</code>.</p>
    /// <p>Valid values: <code>CONTINUE</code> | <code>ABANDON</code> </p>
    pub fn default_result(&self) -> ::std::option::Option<&str> {
        self.default_result.as_deref()
    }
    /// <p>The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook. You can specify an Amazon SNS topic or an Amazon SQS queue.</p>
    pub fn notification_target_arn(&self) -> ::std::option::Option<&str> {
        self.notification_target_arn.as_deref()
    }
    /// <p>The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. For information about creating this role, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/prepare-for-lifecycle-notifications.html#lifecycle-hook-notification-target">Configure a notification target for a lifecycle hook</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
    /// <p>Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue.</p>
    pub fn role_arn(&self) -> ::std::option::Option<&str> {
        self.role_arn.as_deref()
    }
}
impl LifecycleHookSpecification {
    /// Creates a new builder-style object to manufacture [`LifecycleHookSpecification`](crate::types::LifecycleHookSpecification).
    pub fn builder() -> crate::types::builders::LifecycleHookSpecificationBuilder {
        crate::types::builders::LifecycleHookSpecificationBuilder::default()
    }
}

/// A builder for [`LifecycleHookSpecification`](crate::types::LifecycleHookSpecification).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct LifecycleHookSpecificationBuilder {
    pub(crate) lifecycle_hook_name: ::std::option::Option<::std::string::String>,
    pub(crate) lifecycle_transition: ::std::option::Option<::std::string::String>,
    pub(crate) notification_metadata: ::std::option::Option<::std::string::String>,
    pub(crate) heartbeat_timeout: ::std::option::Option<i32>,
    pub(crate) default_result: ::std::option::Option<::std::string::String>,
    pub(crate) notification_target_arn: ::std::option::Option<::std::string::String>,
    pub(crate) role_arn: ::std::option::Option<::std::string::String>,
}
impl LifecycleHookSpecificationBuilder {
    /// <p>The name of the lifecycle hook.</p>
    pub fn lifecycle_hook_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.lifecycle_hook_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the lifecycle hook.</p>
    pub fn set_lifecycle_hook_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.lifecycle_hook_name = input;
        self
    }
    /// <p>The name of the lifecycle hook.</p>
    pub fn get_lifecycle_hook_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.lifecycle_hook_name
    }
    /// <p>The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.</p>
    /// <ul>
    /// <li> <p>To create a lifecycle hook for scale-out events, specify <code>autoscaling:EC2_INSTANCE_LAUNCHING</code>.</p> </li>
    /// <li> <p>To create a lifecycle hook for scale-in events, specify <code>autoscaling:EC2_INSTANCE_TERMINATING</code>.</p> </li>
    /// </ul>
    pub fn lifecycle_transition(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.lifecycle_transition = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.</p>
    /// <ul>
    /// <li> <p>To create a lifecycle hook for scale-out events, specify <code>autoscaling:EC2_INSTANCE_LAUNCHING</code>.</p> </li>
    /// <li> <p>To create a lifecycle hook for scale-in events, specify <code>autoscaling:EC2_INSTANCE_TERMINATING</code>.</p> </li>
    /// </ul>
    pub fn set_lifecycle_transition(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.lifecycle_transition = input;
        self
    }
    /// <p>The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.</p>
    /// <ul>
    /// <li> <p>To create a lifecycle hook for scale-out events, specify <code>autoscaling:EC2_INSTANCE_LAUNCHING</code>.</p> </li>
    /// <li> <p>To create a lifecycle hook for scale-in events, specify <code>autoscaling:EC2_INSTANCE_TERMINATING</code>.</p> </li>
    /// </ul>
    pub fn get_lifecycle_transition(&self) -> &::std::option::Option<::std::string::String> {
        &self.lifecycle_transition
    }
    /// <p>Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.</p>
    pub fn notification_metadata(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.notification_metadata = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.</p>
    pub fn set_notification_metadata(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.notification_metadata = input;
        self
    }
    /// <p>Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.</p>
    pub fn get_notification_metadata(&self) -> &::std::option::Option<::std::string::String> {
        &self.notification_metadata
    }
    /// <p>The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from <code>30</code> to <code>7200</code> seconds. The default value is <code>3600</code> seconds (1 hour).</p>
    pub fn heartbeat_timeout(mut self, input: i32) -> Self {
        self.heartbeat_timeout = ::std::option::Option::Some(input);
        self
    }
    /// <p>The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from <code>30</code> to <code>7200</code> seconds. The default value is <code>3600</code> seconds (1 hour).</p>
    pub fn set_heartbeat_timeout(mut self, input: ::std::option::Option<i32>) -> Self {
        self.heartbeat_timeout = input;
        self
    }
    /// <p>The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from <code>30</code> to <code>7200</code> seconds. The default value is <code>3600</code> seconds (1 hour).</p>
    pub fn get_heartbeat_timeout(&self) -> &::std::option::Option<i32> {
        &self.heartbeat_timeout
    }
    /// <p>The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The default value is <code>ABANDON</code>.</p>
    /// <p>Valid values: <code>CONTINUE</code> | <code>ABANDON</code> </p>
    pub fn default_result(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.default_result = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The default value is <code>ABANDON</code>.</p>
    /// <p>Valid values: <code>CONTINUE</code> | <code>ABANDON</code> </p>
    pub fn set_default_result(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.default_result = input;
        self
    }
    /// <p>The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The default value is <code>ABANDON</code>.</p>
    /// <p>Valid values: <code>CONTINUE</code> | <code>ABANDON</code> </p>
    pub fn get_default_result(&self) -> &::std::option::Option<::std::string::String> {
        &self.default_result
    }
    /// <p>The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook. You can specify an Amazon SNS topic or an Amazon SQS queue.</p>
    pub fn notification_target_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.notification_target_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook. You can specify an Amazon SNS topic or an Amazon SQS queue.</p>
    pub fn set_notification_target_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.notification_target_arn = input;
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook. You can specify an Amazon SNS topic or an Amazon SQS queue.</p>
    pub fn get_notification_target_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.notification_target_arn
    }
    /// <p>The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. For information about creating this role, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/prepare-for-lifecycle-notifications.html#lifecycle-hook-notification-target">Configure a notification target for a lifecycle hook</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
    /// <p>Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue.</p>
    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.role_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. For information about creating this role, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/prepare-for-lifecycle-notifications.html#lifecycle-hook-notification-target">Configure a notification target for a lifecycle hook</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
    /// <p>Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue.</p>
    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.role_arn = input;
        self
    }
    /// <p>The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. For information about creating this role, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/prepare-for-lifecycle-notifications.html#lifecycle-hook-notification-target">Configure a notification target for a lifecycle hook</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
    /// <p>Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue.</p>
    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.role_arn
    }
    /// Consumes the builder and constructs a [`LifecycleHookSpecification`](crate::types::LifecycleHookSpecification).
    pub fn build(self) -> crate::types::LifecycleHookSpecification {
        crate::types::LifecycleHookSpecification {
            lifecycle_hook_name: self.lifecycle_hook_name,
            lifecycle_transition: self.lifecycle_transition,
            notification_metadata: self.notification_metadata,
            heartbeat_timeout: self.heartbeat_timeout,
            default_result: self.default_result,
            notification_target_arn: self.notification_target_arn,
            role_arn: self.role_arn,
        }
    }
}