/
lifecycleHook.go
206 lines (174 loc) · 11.7 KB
/
lifecycleHook.go
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
// Code generated by pulumi-language-go DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package autoscaling
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource Type definition for AWS::AutoScaling::LifecycleHook
type LifecycleHook struct {
pulumi.CustomResourceState
// The name of the Auto Scaling group for the lifecycle hook.
AutoScalingGroupName pulumi.StringOutput `pulumi:"autoScalingGroupName"`
// The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are CONTINUE and ABANDON (default).
DefaultResult pulumi.StringPtrOutput `pulumi:"defaultResult"`
// The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour). If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult property.
HeartbeatTimeout pulumi.IntPtrOutput `pulumi:"heartbeatTimeout"`
// The name of the lifecycle hook.
LifecycleHookName pulumi.StringPtrOutput `pulumi:"lifecycleHookName"`
// The instance state to which you want to attach the lifecycle hook.
LifecycleTransition pulumi.StringOutput `pulumi:"lifecycleTransition"`
// Additional information that is included any time Amazon EC2 Auto Scaling sends a message to the notification target.
NotificationMetadata pulumi.StringPtrOutput `pulumi:"notificationMetadata"`
// The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. You can specify an Amazon SQS queue or an Amazon SNS topic. The notification message includes the following information: lifecycle action token, user account ID, Auto Scaling group name, lifecycle hook name, instance ID, lifecycle transition, and notification metadata.
NotificationTargetArn pulumi.StringPtrOutput `pulumi:"notificationTargetArn"`
// The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.
RoleArn pulumi.StringPtrOutput `pulumi:"roleArn"`
}
// NewLifecycleHook registers a new resource with the given unique name, arguments, and options.
func NewLifecycleHook(ctx *pulumi.Context,
name string, args *LifecycleHookArgs, opts ...pulumi.ResourceOption) (*LifecycleHook, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AutoScalingGroupName == nil {
return nil, errors.New("invalid value for required argument 'AutoScalingGroupName'")
}
if args.LifecycleTransition == nil {
return nil, errors.New("invalid value for required argument 'LifecycleTransition'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"autoScalingGroupName",
"lifecycleHookName",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource LifecycleHook
err := ctx.RegisterResource("aws-native:autoscaling:LifecycleHook", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetLifecycleHook gets an existing LifecycleHook resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetLifecycleHook(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *LifecycleHookState, opts ...pulumi.ResourceOption) (*LifecycleHook, error) {
var resource LifecycleHook
err := ctx.ReadResource("aws-native:autoscaling:LifecycleHook", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering LifecycleHook resources.
type lifecycleHookState struct {
}
type LifecycleHookState struct {
}
func (LifecycleHookState) ElementType() reflect.Type {
return reflect.TypeOf((*lifecycleHookState)(nil)).Elem()
}
type lifecycleHookArgs struct {
// The name of the Auto Scaling group for the lifecycle hook.
AutoScalingGroupName string `pulumi:"autoScalingGroupName"`
// The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are CONTINUE and ABANDON (default).
DefaultResult *string `pulumi:"defaultResult"`
// The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour). If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult property.
HeartbeatTimeout *int `pulumi:"heartbeatTimeout"`
// The name of the lifecycle hook.
LifecycleHookName *string `pulumi:"lifecycleHookName"`
// The instance state to which you want to attach the lifecycle hook.
LifecycleTransition string `pulumi:"lifecycleTransition"`
// Additional information that is included any time Amazon EC2 Auto Scaling sends a message to the notification target.
NotificationMetadata *string `pulumi:"notificationMetadata"`
// The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. You can specify an Amazon SQS queue or an Amazon SNS topic. The notification message includes the following information: lifecycle action token, user account ID, Auto Scaling group name, lifecycle hook name, instance ID, lifecycle transition, and notification metadata.
NotificationTargetArn *string `pulumi:"notificationTargetArn"`
// The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.
RoleArn *string `pulumi:"roleArn"`
}
// The set of arguments for constructing a LifecycleHook resource.
type LifecycleHookArgs struct {
// The name of the Auto Scaling group for the lifecycle hook.
AutoScalingGroupName pulumi.StringInput
// The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are CONTINUE and ABANDON (default).
DefaultResult pulumi.StringPtrInput
// The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour). If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult property.
HeartbeatTimeout pulumi.IntPtrInput
// The name of the lifecycle hook.
LifecycleHookName pulumi.StringPtrInput
// The instance state to which you want to attach the lifecycle hook.
LifecycleTransition pulumi.StringInput
// Additional information that is included any time Amazon EC2 Auto Scaling sends a message to the notification target.
NotificationMetadata pulumi.StringPtrInput
// The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. You can specify an Amazon SQS queue or an Amazon SNS topic. The notification message includes the following information: lifecycle action token, user account ID, Auto Scaling group name, lifecycle hook name, instance ID, lifecycle transition, and notification metadata.
NotificationTargetArn pulumi.StringPtrInput
// The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.
RoleArn pulumi.StringPtrInput
}
func (LifecycleHookArgs) ElementType() reflect.Type {
return reflect.TypeOf((*lifecycleHookArgs)(nil)).Elem()
}
type LifecycleHookInput interface {
pulumi.Input
ToLifecycleHookOutput() LifecycleHookOutput
ToLifecycleHookOutputWithContext(ctx context.Context) LifecycleHookOutput
}
func (*LifecycleHook) ElementType() reflect.Type {
return reflect.TypeOf((**LifecycleHook)(nil)).Elem()
}
func (i *LifecycleHook) ToLifecycleHookOutput() LifecycleHookOutput {
return i.ToLifecycleHookOutputWithContext(context.Background())
}
func (i *LifecycleHook) ToLifecycleHookOutputWithContext(ctx context.Context) LifecycleHookOutput {
return pulumi.ToOutputWithContext(ctx, i).(LifecycleHookOutput)
}
type LifecycleHookOutput struct{ *pulumi.OutputState }
func (LifecycleHookOutput) ElementType() reflect.Type {
return reflect.TypeOf((**LifecycleHook)(nil)).Elem()
}
func (o LifecycleHookOutput) ToLifecycleHookOutput() LifecycleHookOutput {
return o
}
func (o LifecycleHookOutput) ToLifecycleHookOutputWithContext(ctx context.Context) LifecycleHookOutput {
return o
}
// The name of the Auto Scaling group for the lifecycle hook.
func (o LifecycleHookOutput) AutoScalingGroupName() pulumi.StringOutput {
return o.ApplyT(func(v *LifecycleHook) pulumi.StringOutput { return v.AutoScalingGroupName }).(pulumi.StringOutput)
}
// The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are CONTINUE and ABANDON (default).
func (o LifecycleHookOutput) DefaultResult() pulumi.StringPtrOutput {
return o.ApplyT(func(v *LifecycleHook) pulumi.StringPtrOutput { return v.DefaultResult }).(pulumi.StringPtrOutput)
}
// The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour). If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult property.
func (o LifecycleHookOutput) HeartbeatTimeout() pulumi.IntPtrOutput {
return o.ApplyT(func(v *LifecycleHook) pulumi.IntPtrOutput { return v.HeartbeatTimeout }).(pulumi.IntPtrOutput)
}
// The name of the lifecycle hook.
func (o LifecycleHookOutput) LifecycleHookName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *LifecycleHook) pulumi.StringPtrOutput { return v.LifecycleHookName }).(pulumi.StringPtrOutput)
}
// The instance state to which you want to attach the lifecycle hook.
func (o LifecycleHookOutput) LifecycleTransition() pulumi.StringOutput {
return o.ApplyT(func(v *LifecycleHook) pulumi.StringOutput { return v.LifecycleTransition }).(pulumi.StringOutput)
}
// Additional information that is included any time Amazon EC2 Auto Scaling sends a message to the notification target.
func (o LifecycleHookOutput) NotificationMetadata() pulumi.StringPtrOutput {
return o.ApplyT(func(v *LifecycleHook) pulumi.StringPtrOutput { return v.NotificationMetadata }).(pulumi.StringPtrOutput)
}
// The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. You can specify an Amazon SQS queue or an Amazon SNS topic. The notification message includes the following information: lifecycle action token, user account ID, Auto Scaling group name, lifecycle hook name, instance ID, lifecycle transition, and notification metadata.
func (o LifecycleHookOutput) NotificationTargetArn() pulumi.StringPtrOutput {
return o.ApplyT(func(v *LifecycleHook) pulumi.StringPtrOutput { return v.NotificationTargetArn }).(pulumi.StringPtrOutput)
}
// The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.
func (o LifecycleHookOutput) RoleArn() pulumi.StringPtrOutput {
return o.ApplyT(func(v *LifecycleHook) pulumi.StringPtrOutput { return v.RoleArn }).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*LifecycleHookInput)(nil)).Elem(), &LifecycleHook{})
pulumi.RegisterOutputType(LifecycleHookOutput{})
}