/
scheduledAction.go
209 lines (176 loc) · 9.38 KB
/
scheduledAction.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
207
208
209
// 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"
)
// The AWS::AutoScaling::ScheduledAction resource specifies an Amazon EC2 Auto Scaling scheduled action so that the Auto Scaling group can change the number of instances available for your application in response to predictable load changes.
type ScheduledAction struct {
pulumi.CustomResourceState
// The name of the Auto Scaling group.
AutoScalingGroupName pulumi.StringOutput `pulumi:"autoScalingGroupName"`
// The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.
DesiredCapacity pulumi.IntPtrOutput `pulumi:"desiredCapacity"`
// The latest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
EndTime pulumi.StringPtrOutput `pulumi:"endTime"`
// The minimum size of the Auto Scaling group.
MaxSize pulumi.IntPtrOutput `pulumi:"maxSize"`
// The minimum size of the Auto Scaling group.
MinSize pulumi.IntPtrOutput `pulumi:"minSize"`
// The recurring schedule for the action, in Unix cron syntax format. When StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.
Recurrence pulumi.StringPtrOutput `pulumi:"recurrence"`
// Auto-generated unique identifier
ScheduledActionName pulumi.StringOutput `pulumi:"scheduledActionName"`
// The earliest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
StartTime pulumi.StringPtrOutput `pulumi:"startTime"`
// The time zone for the cron expression.
TimeZone pulumi.StringPtrOutput `pulumi:"timeZone"`
}
// NewScheduledAction registers a new resource with the given unique name, arguments, and options.
func NewScheduledAction(ctx *pulumi.Context,
name string, args *ScheduledActionArgs, opts ...pulumi.ResourceOption) (*ScheduledAction, 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'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"autoScalingGroupName",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource ScheduledAction
err := ctx.RegisterResource("aws-native:autoscaling:ScheduledAction", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetScheduledAction gets an existing ScheduledAction 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 GetScheduledAction(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ScheduledActionState, opts ...pulumi.ResourceOption) (*ScheduledAction, error) {
var resource ScheduledAction
err := ctx.ReadResource("aws-native:autoscaling:ScheduledAction", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ScheduledAction resources.
type scheduledActionState struct {
}
type ScheduledActionState struct {
}
func (ScheduledActionState) ElementType() reflect.Type {
return reflect.TypeOf((*scheduledActionState)(nil)).Elem()
}
type scheduledActionArgs struct {
// The name of the Auto Scaling group.
AutoScalingGroupName string `pulumi:"autoScalingGroupName"`
// The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.
DesiredCapacity *int `pulumi:"desiredCapacity"`
// The latest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
EndTime *string `pulumi:"endTime"`
// The minimum size of the Auto Scaling group.
MaxSize *int `pulumi:"maxSize"`
// The minimum size of the Auto Scaling group.
MinSize *int `pulumi:"minSize"`
// The recurring schedule for the action, in Unix cron syntax format. When StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.
Recurrence *string `pulumi:"recurrence"`
// The earliest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
StartTime *string `pulumi:"startTime"`
// The time zone for the cron expression.
TimeZone *string `pulumi:"timeZone"`
}
// The set of arguments for constructing a ScheduledAction resource.
type ScheduledActionArgs struct {
// The name of the Auto Scaling group.
AutoScalingGroupName pulumi.StringInput
// The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.
DesiredCapacity pulumi.IntPtrInput
// The latest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
EndTime pulumi.StringPtrInput
// The minimum size of the Auto Scaling group.
MaxSize pulumi.IntPtrInput
// The minimum size of the Auto Scaling group.
MinSize pulumi.IntPtrInput
// The recurring schedule for the action, in Unix cron syntax format. When StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.
Recurrence pulumi.StringPtrInput
// The earliest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
StartTime pulumi.StringPtrInput
// The time zone for the cron expression.
TimeZone pulumi.StringPtrInput
}
func (ScheduledActionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*scheduledActionArgs)(nil)).Elem()
}
type ScheduledActionInput interface {
pulumi.Input
ToScheduledActionOutput() ScheduledActionOutput
ToScheduledActionOutputWithContext(ctx context.Context) ScheduledActionOutput
}
func (*ScheduledAction) ElementType() reflect.Type {
return reflect.TypeOf((**ScheduledAction)(nil)).Elem()
}
func (i *ScheduledAction) ToScheduledActionOutput() ScheduledActionOutput {
return i.ToScheduledActionOutputWithContext(context.Background())
}
func (i *ScheduledAction) ToScheduledActionOutputWithContext(ctx context.Context) ScheduledActionOutput {
return pulumi.ToOutputWithContext(ctx, i).(ScheduledActionOutput)
}
type ScheduledActionOutput struct{ *pulumi.OutputState }
func (ScheduledActionOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ScheduledAction)(nil)).Elem()
}
func (o ScheduledActionOutput) ToScheduledActionOutput() ScheduledActionOutput {
return o
}
func (o ScheduledActionOutput) ToScheduledActionOutputWithContext(ctx context.Context) ScheduledActionOutput {
return o
}
// The name of the Auto Scaling group.
func (o ScheduledActionOutput) AutoScalingGroupName() pulumi.StringOutput {
return o.ApplyT(func(v *ScheduledAction) pulumi.StringOutput { return v.AutoScalingGroupName }).(pulumi.StringOutput)
}
// The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.
func (o ScheduledActionOutput) DesiredCapacity() pulumi.IntPtrOutput {
return o.ApplyT(func(v *ScheduledAction) pulumi.IntPtrOutput { return v.DesiredCapacity }).(pulumi.IntPtrOutput)
}
// The latest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
func (o ScheduledActionOutput) EndTime() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ScheduledAction) pulumi.StringPtrOutput { return v.EndTime }).(pulumi.StringPtrOutput)
}
// The minimum size of the Auto Scaling group.
func (o ScheduledActionOutput) MaxSize() pulumi.IntPtrOutput {
return o.ApplyT(func(v *ScheduledAction) pulumi.IntPtrOutput { return v.MaxSize }).(pulumi.IntPtrOutput)
}
// The minimum size of the Auto Scaling group.
func (o ScheduledActionOutput) MinSize() pulumi.IntPtrOutput {
return o.ApplyT(func(v *ScheduledAction) pulumi.IntPtrOutput { return v.MinSize }).(pulumi.IntPtrOutput)
}
// The recurring schedule for the action, in Unix cron syntax format. When StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.
func (o ScheduledActionOutput) Recurrence() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ScheduledAction) pulumi.StringPtrOutput { return v.Recurrence }).(pulumi.StringPtrOutput)
}
// Auto-generated unique identifier
func (o ScheduledActionOutput) ScheduledActionName() pulumi.StringOutput {
return o.ApplyT(func(v *ScheduledAction) pulumi.StringOutput { return v.ScheduledActionName }).(pulumi.StringOutput)
}
// The earliest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
func (o ScheduledActionOutput) StartTime() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ScheduledAction) pulumi.StringPtrOutput { return v.StartTime }).(pulumi.StringPtrOutput)
}
// The time zone for the cron expression.
func (o ScheduledActionOutput) TimeZone() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ScheduledAction) pulumi.StringPtrOutput { return v.TimeZone }).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ScheduledActionInput)(nil)).Elem(), &ScheduledAction{})
pulumi.RegisterOutputType(ScheduledActionOutput{})
}