-
Notifications
You must be signed in to change notification settings - Fork 2
/
maintenanceWindow.go
143 lines (130 loc) · 6.36 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
// *** 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 pagerduty
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// A [maintenance window](https://v2.developer.pagerduty.com/v2/page/api-reference#!/Maintenance_Windows/get_maintenance_windows) is used to temporarily disable one or more services for a set period of time. No incidents will be triggered and no notifications will be received while a service is disabled by a maintenance window.
//
// Maintenance windows are specified to start at a certain time and end after they have begun. Once started, a maintenance window cannot be deleted; it can only be ended immediately to re-enable the service.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-pagerduty/sdk/go/pagerduty"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := pagerduty.NewMaintenanceWindow(ctx, "example", &pagerduty.MaintenanceWindowArgs{
// EndTime: pulumi.String("2015-11-09T22:00:00-05:00"),
// Services: pulumi.StringArray{
// pulumi.Any(pagerduty_service.Example.Id),
// },
// StartTime: pulumi.String("2015-11-09T20:00:00-05:00"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type MaintenanceWindow struct {
pulumi.CustomResourceState
// A description for the maintenance window.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The maintenance window's end time. This is when the services will start creating incidents again. This date must be in the future and after the `startTime`.
EndTime pulumi.StringOutput `pulumi:"endTime"`
// A list of service IDs to include in the maintenance window.
Services pulumi.StringArrayOutput `pulumi:"services"`
// The maintenance window's start time. This is when the services will stop creating incidents. If this date is in the past, it will be updated to be the current time.
StartTime pulumi.StringOutput `pulumi:"startTime"`
}
// 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 || args.EndTime == nil {
return nil, errors.New("missing required argument 'EndTime'")
}
if args == nil || args.Services == nil {
return nil, errors.New("missing required argument 'Services'")
}
if args == nil || args.StartTime == nil {
return nil, errors.New("missing required argument 'StartTime'")
}
if args == nil {
args = &MaintenanceWindowArgs{}
}
var resource MaintenanceWindow
err := ctx.RegisterResource("pagerduty:index/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("pagerduty:index/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 {
// A description for the maintenance window.
Description *string `pulumi:"description"`
// The maintenance window's end time. This is when the services will start creating incidents again. This date must be in the future and after the `startTime`.
EndTime *string `pulumi:"endTime"`
// A list of service IDs to include in the maintenance window.
Services []string `pulumi:"services"`
// The maintenance window's start time. This is when the services will stop creating incidents. If this date is in the past, it will be updated to be the current time.
StartTime *string `pulumi:"startTime"`
}
type MaintenanceWindowState struct {
// A description for the maintenance window.
Description pulumi.StringPtrInput
// The maintenance window's end time. This is when the services will start creating incidents again. This date must be in the future and after the `startTime`.
EndTime pulumi.StringPtrInput
// A list of service IDs to include in the maintenance window.
Services pulumi.StringArrayInput
// The maintenance window's start time. This is when the services will stop creating incidents. If this date is in the past, it will be updated to be the current time.
StartTime pulumi.StringPtrInput
}
func (MaintenanceWindowState) ElementType() reflect.Type {
return reflect.TypeOf((*maintenanceWindowState)(nil)).Elem()
}
type maintenanceWindowArgs struct {
// A description for the maintenance window.
Description *string `pulumi:"description"`
// The maintenance window's end time. This is when the services will start creating incidents again. This date must be in the future and after the `startTime`.
EndTime string `pulumi:"endTime"`
// A list of service IDs to include in the maintenance window.
Services []string `pulumi:"services"`
// The maintenance window's start time. This is when the services will stop creating incidents. If this date is in the past, it will be updated to be the current time.
StartTime string `pulumi:"startTime"`
}
// The set of arguments for constructing a MaintenanceWindow resource.
type MaintenanceWindowArgs struct {
// A description for the maintenance window.
Description pulumi.StringPtrInput
// The maintenance window's end time. This is when the services will start creating incidents again. This date must be in the future and after the `startTime`.
EndTime pulumi.StringInput
// A list of service IDs to include in the maintenance window.
Services pulumi.StringArrayInput
// The maintenance window's start time. This is when the services will stop creating incidents. If this date is in the past, it will be updated to be the current time.
StartTime pulumi.StringInput
}
func (MaintenanceWindowArgs) ElementType() reflect.Type {
return reflect.TypeOf((*maintenanceWindowArgs)(nil)).Elem()
}