-
Notifications
You must be signed in to change notification settings - Fork 151
/
maintenanceWindow.go
428 lines (368 loc) · 19.5 KB
/
maintenanceWindow.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package ssm
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides an SSM Maintenance Window resource
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ssm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ssm.NewMaintenanceWindow(ctx, "production", &ssm.MaintenanceWindowArgs{
// Cutoff: pulumi.Int(1),
// Duration: pulumi.Int(3),
// Schedule: pulumi.String("cron(0 16 ? * TUE *)"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// SSM
//
// Maintenance Windows can be imported using the `maintenance window id`, e.g.
//
// ```sh
// $ pulumi import aws:ssm/maintenanceWindow:MaintenanceWindow imported-window mw-0123456789
// ```
type MaintenanceWindow struct {
pulumi.CustomResourceState
// Whether targets must be registered with the Maintenance Window before tasks can be defined for those targets.
AllowUnassociatedTargets pulumi.BoolPtrOutput `pulumi:"allowUnassociatedTargets"`
// The number of hours before the end of the Maintenance Window that Systems Manager stops scheduling new tasks for execution.
Cutoff pulumi.IntOutput `pulumi:"cutoff"`
// A description for the maintenance window.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The duration of the Maintenance Window in hours.
Duration pulumi.IntOutput `pulumi:"duration"`
// Whether the maintenance window is enabled. Default: `true`.
Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
// Timestamp in [ISO-8601 extended format](https://www.iso.org/iso-8601-date-and-time-format.html) when to no longer run the maintenance window.
EndDate pulumi.StringPtrOutput `pulumi:"endDate"`
// The name of the maintenance window.
Name pulumi.StringOutput `pulumi:"name"`
// The schedule of the Maintenance Window in the form of a [cron](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-maintenance-cron.html) or rate expression.
Schedule pulumi.StringOutput `pulumi:"schedule"`
// The number of days to wait after the date and time specified by a CRON expression before running the maintenance window.
ScheduleOffset pulumi.IntPtrOutput `pulumi:"scheduleOffset"`
// Timezone for schedule in [Internet Assigned Numbers Authority (IANA) Time Zone Database format](https://www.iana.org/time-zones). For example: `America/Los_Angeles`, `etc/UTC`, or `Asia/Seoul`.
ScheduleTimezone pulumi.StringPtrOutput `pulumi:"scheduleTimezone"`
// Timestamp in [ISO-8601 extended format](https://www.iso.org/iso-8601-date-and-time-format.html) when to begin the maintenance window.
StartDate pulumi.StringPtrOutput `pulumi:"startDate"`
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider .
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
}
// NewMaintenanceWindow registers a new resource with the given unique name, arguments, and options.
func NewMaintenanceWindow(ctx *pulumi.Context,
name string, args *MaintenanceWindowArgs, opts ...pulumi.ResourceOption) (*MaintenanceWindow, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Cutoff == nil {
return nil, errors.New("invalid value for required argument 'Cutoff'")
}
if args.Duration == nil {
return nil, errors.New("invalid value for required argument 'Duration'")
}
if args.Schedule == nil {
return nil, errors.New("invalid value for required argument 'Schedule'")
}
var resource MaintenanceWindow
err := ctx.RegisterResource("aws:ssm/maintenanceWindow:MaintenanceWindow", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetMaintenanceWindow gets an existing MaintenanceWindow 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 GetMaintenanceWindow(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *MaintenanceWindowState, opts ...pulumi.ResourceOption) (*MaintenanceWindow, error) {
var resource MaintenanceWindow
err := ctx.ReadResource("aws:ssm/maintenanceWindow:MaintenanceWindow", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering MaintenanceWindow resources.
type maintenanceWindowState struct {
// Whether targets must be registered with the Maintenance Window before tasks can be defined for those targets.
AllowUnassociatedTargets *bool `pulumi:"allowUnassociatedTargets"`
// The number of hours before the end of the Maintenance Window that Systems Manager stops scheduling new tasks for execution.
Cutoff *int `pulumi:"cutoff"`
// A description for the maintenance window.
Description *string `pulumi:"description"`
// The duration of the Maintenance Window in hours.
Duration *int `pulumi:"duration"`
// Whether the maintenance window is enabled. Default: `true`.
Enabled *bool `pulumi:"enabled"`
// Timestamp in [ISO-8601 extended format](https://www.iso.org/iso-8601-date-and-time-format.html) when to no longer run the maintenance window.
EndDate *string `pulumi:"endDate"`
// The name of the maintenance window.
Name *string `pulumi:"name"`
// The schedule of the Maintenance Window in the form of a [cron](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-maintenance-cron.html) or rate expression.
Schedule *string `pulumi:"schedule"`
// The number of days to wait after the date and time specified by a CRON expression before running the maintenance window.
ScheduleOffset *int `pulumi:"scheduleOffset"`
// Timezone for schedule in [Internet Assigned Numbers Authority (IANA) Time Zone Database format](https://www.iana.org/time-zones). For example: `America/Los_Angeles`, `etc/UTC`, or `Asia/Seoul`.
ScheduleTimezone *string `pulumi:"scheduleTimezone"`
// Timestamp in [ISO-8601 extended format](https://www.iso.org/iso-8601-date-and-time-format.html) when to begin the maintenance window.
StartDate *string `pulumi:"startDate"`
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider .
TagsAll map[string]string `pulumi:"tagsAll"`
}
type MaintenanceWindowState struct {
// Whether targets must be registered with the Maintenance Window before tasks can be defined for those targets.
AllowUnassociatedTargets pulumi.BoolPtrInput
// The number of hours before the end of the Maintenance Window that Systems Manager stops scheduling new tasks for execution.
Cutoff pulumi.IntPtrInput
// A description for the maintenance window.
Description pulumi.StringPtrInput
// The duration of the Maintenance Window in hours.
Duration pulumi.IntPtrInput
// Whether the maintenance window is enabled. Default: `true`.
Enabled pulumi.BoolPtrInput
// Timestamp in [ISO-8601 extended format](https://www.iso.org/iso-8601-date-and-time-format.html) when to no longer run the maintenance window.
EndDate pulumi.StringPtrInput
// The name of the maintenance window.
Name pulumi.StringPtrInput
// The schedule of the Maintenance Window in the form of a [cron](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-maintenance-cron.html) or rate expression.
Schedule pulumi.StringPtrInput
// The number of days to wait after the date and time specified by a CRON expression before running the maintenance window.
ScheduleOffset pulumi.IntPtrInput
// Timezone for schedule in [Internet Assigned Numbers Authority (IANA) Time Zone Database format](https://www.iana.org/time-zones). For example: `America/Los_Angeles`, `etc/UTC`, or `Asia/Seoul`.
ScheduleTimezone pulumi.StringPtrInput
// Timestamp in [ISO-8601 extended format](https://www.iso.org/iso-8601-date-and-time-format.html) when to begin the maintenance window.
StartDate pulumi.StringPtrInput
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// A map of tags assigned to the resource, including those inherited from the provider .
TagsAll pulumi.StringMapInput
}
func (MaintenanceWindowState) ElementType() reflect.Type {
return reflect.TypeOf((*maintenanceWindowState)(nil)).Elem()
}
type maintenanceWindowArgs struct {
// Whether targets must be registered with the Maintenance Window before tasks can be defined for those targets.
AllowUnassociatedTargets *bool `pulumi:"allowUnassociatedTargets"`
// The number of hours before the end of the Maintenance Window that Systems Manager stops scheduling new tasks for execution.
Cutoff int `pulumi:"cutoff"`
// A description for the maintenance window.
Description *string `pulumi:"description"`
// The duration of the Maintenance Window in hours.
Duration int `pulumi:"duration"`
// Whether the maintenance window is enabled. Default: `true`.
Enabled *bool `pulumi:"enabled"`
// Timestamp in [ISO-8601 extended format](https://www.iso.org/iso-8601-date-and-time-format.html) when to no longer run the maintenance window.
EndDate *string `pulumi:"endDate"`
// The name of the maintenance window.
Name *string `pulumi:"name"`
// The schedule of the Maintenance Window in the form of a [cron](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-maintenance-cron.html) or rate expression.
Schedule string `pulumi:"schedule"`
// The number of days to wait after the date and time specified by a CRON expression before running the maintenance window.
ScheduleOffset *int `pulumi:"scheduleOffset"`
// Timezone for schedule in [Internet Assigned Numbers Authority (IANA) Time Zone Database format](https://www.iana.org/time-zones). For example: `America/Los_Angeles`, `etc/UTC`, or `Asia/Seoul`.
ScheduleTimezone *string `pulumi:"scheduleTimezone"`
// Timestamp in [ISO-8601 extended format](https://www.iso.org/iso-8601-date-and-time-format.html) when to begin the maintenance window.
StartDate *string `pulumi:"startDate"`
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider .
TagsAll map[string]string `pulumi:"tagsAll"`
}
// The set of arguments for constructing a MaintenanceWindow resource.
type MaintenanceWindowArgs struct {
// Whether targets must be registered with the Maintenance Window before tasks can be defined for those targets.
AllowUnassociatedTargets pulumi.BoolPtrInput
// The number of hours before the end of the Maintenance Window that Systems Manager stops scheduling new tasks for execution.
Cutoff pulumi.IntInput
// A description for the maintenance window.
Description pulumi.StringPtrInput
// The duration of the Maintenance Window in hours.
Duration pulumi.IntInput
// Whether the maintenance window is enabled. Default: `true`.
Enabled pulumi.BoolPtrInput
// Timestamp in [ISO-8601 extended format](https://www.iso.org/iso-8601-date-and-time-format.html) when to no longer run the maintenance window.
EndDate pulumi.StringPtrInput
// The name of the maintenance window.
Name pulumi.StringPtrInput
// The schedule of the Maintenance Window in the form of a [cron](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-maintenance-cron.html) or rate expression.
Schedule pulumi.StringInput
// The number of days to wait after the date and time specified by a CRON expression before running the maintenance window.
ScheduleOffset pulumi.IntPtrInput
// Timezone for schedule in [Internet Assigned Numbers Authority (IANA) Time Zone Database format](https://www.iana.org/time-zones). For example: `America/Los_Angeles`, `etc/UTC`, or `Asia/Seoul`.
ScheduleTimezone pulumi.StringPtrInput
// Timestamp in [ISO-8601 extended format](https://www.iso.org/iso-8601-date-and-time-format.html) when to begin the maintenance window.
StartDate pulumi.StringPtrInput
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// A map of tags assigned to the resource, including those inherited from the provider .
TagsAll pulumi.StringMapInput
}
func (MaintenanceWindowArgs) ElementType() reflect.Type {
return reflect.TypeOf((*maintenanceWindowArgs)(nil)).Elem()
}
type MaintenanceWindowInput interface {
pulumi.Input
ToMaintenanceWindowOutput() MaintenanceWindowOutput
ToMaintenanceWindowOutputWithContext(ctx context.Context) MaintenanceWindowOutput
}
func (*MaintenanceWindow) ElementType() reflect.Type {
return reflect.TypeOf((*MaintenanceWindow)(nil))
}
func (i *MaintenanceWindow) ToMaintenanceWindowOutput() MaintenanceWindowOutput {
return i.ToMaintenanceWindowOutputWithContext(context.Background())
}
func (i *MaintenanceWindow) ToMaintenanceWindowOutputWithContext(ctx context.Context) MaintenanceWindowOutput {
return pulumi.ToOutputWithContext(ctx, i).(MaintenanceWindowOutput)
}
func (i *MaintenanceWindow) ToMaintenanceWindowPtrOutput() MaintenanceWindowPtrOutput {
return i.ToMaintenanceWindowPtrOutputWithContext(context.Background())
}
func (i *MaintenanceWindow) ToMaintenanceWindowPtrOutputWithContext(ctx context.Context) MaintenanceWindowPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(MaintenanceWindowPtrOutput)
}
type MaintenanceWindowPtrInput interface {
pulumi.Input
ToMaintenanceWindowPtrOutput() MaintenanceWindowPtrOutput
ToMaintenanceWindowPtrOutputWithContext(ctx context.Context) MaintenanceWindowPtrOutput
}
type maintenanceWindowPtrType MaintenanceWindowArgs
func (*maintenanceWindowPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**MaintenanceWindow)(nil))
}
func (i *maintenanceWindowPtrType) ToMaintenanceWindowPtrOutput() MaintenanceWindowPtrOutput {
return i.ToMaintenanceWindowPtrOutputWithContext(context.Background())
}
func (i *maintenanceWindowPtrType) ToMaintenanceWindowPtrOutputWithContext(ctx context.Context) MaintenanceWindowPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(MaintenanceWindowPtrOutput)
}
// MaintenanceWindowArrayInput is an input type that accepts MaintenanceWindowArray and MaintenanceWindowArrayOutput values.
// You can construct a concrete instance of `MaintenanceWindowArrayInput` via:
//
// MaintenanceWindowArray{ MaintenanceWindowArgs{...} }
type MaintenanceWindowArrayInput interface {
pulumi.Input
ToMaintenanceWindowArrayOutput() MaintenanceWindowArrayOutput
ToMaintenanceWindowArrayOutputWithContext(context.Context) MaintenanceWindowArrayOutput
}
type MaintenanceWindowArray []MaintenanceWindowInput
func (MaintenanceWindowArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*MaintenanceWindow)(nil))
}
func (i MaintenanceWindowArray) ToMaintenanceWindowArrayOutput() MaintenanceWindowArrayOutput {
return i.ToMaintenanceWindowArrayOutputWithContext(context.Background())
}
func (i MaintenanceWindowArray) ToMaintenanceWindowArrayOutputWithContext(ctx context.Context) MaintenanceWindowArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(MaintenanceWindowArrayOutput)
}
// MaintenanceWindowMapInput is an input type that accepts MaintenanceWindowMap and MaintenanceWindowMapOutput values.
// You can construct a concrete instance of `MaintenanceWindowMapInput` via:
//
// MaintenanceWindowMap{ "key": MaintenanceWindowArgs{...} }
type MaintenanceWindowMapInput interface {
pulumi.Input
ToMaintenanceWindowMapOutput() MaintenanceWindowMapOutput
ToMaintenanceWindowMapOutputWithContext(context.Context) MaintenanceWindowMapOutput
}
type MaintenanceWindowMap map[string]MaintenanceWindowInput
func (MaintenanceWindowMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*MaintenanceWindow)(nil))
}
func (i MaintenanceWindowMap) ToMaintenanceWindowMapOutput() MaintenanceWindowMapOutput {
return i.ToMaintenanceWindowMapOutputWithContext(context.Background())
}
func (i MaintenanceWindowMap) ToMaintenanceWindowMapOutputWithContext(ctx context.Context) MaintenanceWindowMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(MaintenanceWindowMapOutput)
}
type MaintenanceWindowOutput struct {
*pulumi.OutputState
}
func (MaintenanceWindowOutput) ElementType() reflect.Type {
return reflect.TypeOf((*MaintenanceWindow)(nil))
}
func (o MaintenanceWindowOutput) ToMaintenanceWindowOutput() MaintenanceWindowOutput {
return o
}
func (o MaintenanceWindowOutput) ToMaintenanceWindowOutputWithContext(ctx context.Context) MaintenanceWindowOutput {
return o
}
func (o MaintenanceWindowOutput) ToMaintenanceWindowPtrOutput() MaintenanceWindowPtrOutput {
return o.ToMaintenanceWindowPtrOutputWithContext(context.Background())
}
func (o MaintenanceWindowOutput) ToMaintenanceWindowPtrOutputWithContext(ctx context.Context) MaintenanceWindowPtrOutput {
return o.ApplyT(func(v MaintenanceWindow) *MaintenanceWindow {
return &v
}).(MaintenanceWindowPtrOutput)
}
type MaintenanceWindowPtrOutput struct {
*pulumi.OutputState
}
func (MaintenanceWindowPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**MaintenanceWindow)(nil))
}
func (o MaintenanceWindowPtrOutput) ToMaintenanceWindowPtrOutput() MaintenanceWindowPtrOutput {
return o
}
func (o MaintenanceWindowPtrOutput) ToMaintenanceWindowPtrOutputWithContext(ctx context.Context) MaintenanceWindowPtrOutput {
return o
}
type MaintenanceWindowArrayOutput struct{ *pulumi.OutputState }
func (MaintenanceWindowArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]MaintenanceWindow)(nil))
}
func (o MaintenanceWindowArrayOutput) ToMaintenanceWindowArrayOutput() MaintenanceWindowArrayOutput {
return o
}
func (o MaintenanceWindowArrayOutput) ToMaintenanceWindowArrayOutputWithContext(ctx context.Context) MaintenanceWindowArrayOutput {
return o
}
func (o MaintenanceWindowArrayOutput) Index(i pulumi.IntInput) MaintenanceWindowOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) MaintenanceWindow {
return vs[0].([]MaintenanceWindow)[vs[1].(int)]
}).(MaintenanceWindowOutput)
}
type MaintenanceWindowMapOutput struct{ *pulumi.OutputState }
func (MaintenanceWindowMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]MaintenanceWindow)(nil))
}
func (o MaintenanceWindowMapOutput) ToMaintenanceWindowMapOutput() MaintenanceWindowMapOutput {
return o
}
func (o MaintenanceWindowMapOutput) ToMaintenanceWindowMapOutputWithContext(ctx context.Context) MaintenanceWindowMapOutput {
return o
}
func (o MaintenanceWindowMapOutput) MapIndex(k pulumi.StringInput) MaintenanceWindowOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) MaintenanceWindow {
return vs[0].(map[string]MaintenanceWindow)[vs[1].(string)]
}).(MaintenanceWindowOutput)
}
func init() {
pulumi.RegisterOutputType(MaintenanceWindowOutput{})
pulumi.RegisterOutputType(MaintenanceWindowPtrOutput{})
pulumi.RegisterOutputType(MaintenanceWindowArrayOutput{})
pulumi.RegisterOutputType(MaintenanceWindowMapOutput{})
}