/
automationActionsRunner.go
381 lines (327 loc) · 15.7 KB
/
automationActionsRunner.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
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package pagerduty
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-pagerduty/sdk/v4/go/pagerduty/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// An Automation Actions [runner](https://developer.pagerduty.com/api-reference/d78999fb7e863-create-an-automation-action-runner) is the method for how actions are executed. This can be done locally using an installed runner agent or as a connection to a PD Runbook Automation instance.
//
// > Only Runbook Automation (runbook) runners can be created.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-pagerduty/sdk/v4/go/pagerduty"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// cfg := config.New(ctx, "")
// rUNBOOKAPIKEY := cfg.Require("rUNBOOKAPIKEY")
// _, err := pagerduty.NewAutomationActionsRunner(ctx, "example", &pagerduty.AutomationActionsRunnerArgs{
// Description: pulumi.String("Description of the Runner created via TF"),
// RunnerType: pulumi.String("runbook"),
// RunbookBaseUri: pulumi.String("rdcat.stg"),
// RunbookApiKey: pulumi.String(rUNBOOKAPIKEY),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// -> In the example below the `runbook_api_key` attribute has been omitted to avoid resource replacement after the import.
//
// Runners can be imported using the `id`, e.g.
//
// resource "pagerduty_automation_actions_runner" "example" {
//
// name = "Runner created via TF"
//
// description = "Description of the Runner created via TF"
//
// runner_type = "runbook"
//
// runbook_base_uri = "rdcat.stg"
//
// }
//
// ```sh
// $ pulumi import pagerduty:index/automationActionsRunner:AutomationActionsRunner example 01DER7CUUBF7TH4116K0M4WKPU
// ```
type AutomationActionsRunner struct {
pulumi.CustomResourceState
// The time runner was created. Represented as an ISO 8601 timestamp.
CreationTime pulumi.StringOutput `pulumi:"creationTime"`
// The description of the runner. Max length is 1024 characters.
Description pulumi.StringPtrOutput `pulumi:"description"`
// (Optional) The last time runner has been seen. Represented as an ISO 8601 timestamp.
LastSeen pulumi.StringOutput `pulumi:"lastSeen"`
// The name of the runner. Max length is 255 characters.
Name pulumi.StringOutput `pulumi:"name"`
// The unique User API Token created in Runbook Automation.
RunbookApiKey pulumi.StringPtrOutput `pulumi:"runbookApiKey"`
// The subdomain for your Runbook Automation Instance.
RunbookBaseUri pulumi.StringPtrOutput `pulumi:"runbookBaseUri"`
// The type of runner. The only allowed values is `runbook`.
RunnerType pulumi.StringOutput `pulumi:"runnerType"`
// The type of object. The value returned will be `runner`.
Type pulumi.StringOutput `pulumi:"type"`
}
// NewAutomationActionsRunner registers a new resource with the given unique name, arguments, and options.
func NewAutomationActionsRunner(ctx *pulumi.Context,
name string, args *AutomationActionsRunnerArgs, opts ...pulumi.ResourceOption) (*AutomationActionsRunner, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.RunnerType == nil {
return nil, errors.New("invalid value for required argument 'RunnerType'")
}
if args.RunbookApiKey != nil {
args.RunbookApiKey = pulumi.ToSecret(args.RunbookApiKey).(pulumi.StringPtrInput)
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"runbookApiKey",
})
opts = append(opts, secrets)
opts = internal.PkgResourceDefaultOpts(opts)
var resource AutomationActionsRunner
err := ctx.RegisterResource("pagerduty:index/automationActionsRunner:AutomationActionsRunner", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAutomationActionsRunner gets an existing AutomationActionsRunner 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 GetAutomationActionsRunner(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AutomationActionsRunnerState, opts ...pulumi.ResourceOption) (*AutomationActionsRunner, error) {
var resource AutomationActionsRunner
err := ctx.ReadResource("pagerduty:index/automationActionsRunner:AutomationActionsRunner", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering AutomationActionsRunner resources.
type automationActionsRunnerState struct {
// The time runner was created. Represented as an ISO 8601 timestamp.
CreationTime *string `pulumi:"creationTime"`
// The description of the runner. Max length is 1024 characters.
Description *string `pulumi:"description"`
// (Optional) The last time runner has been seen. Represented as an ISO 8601 timestamp.
LastSeen *string `pulumi:"lastSeen"`
// The name of the runner. Max length is 255 characters.
Name *string `pulumi:"name"`
// The unique User API Token created in Runbook Automation.
RunbookApiKey *string `pulumi:"runbookApiKey"`
// The subdomain for your Runbook Automation Instance.
RunbookBaseUri *string `pulumi:"runbookBaseUri"`
// The type of runner. The only allowed values is `runbook`.
RunnerType *string `pulumi:"runnerType"`
// The type of object. The value returned will be `runner`.
Type *string `pulumi:"type"`
}
type AutomationActionsRunnerState struct {
// The time runner was created. Represented as an ISO 8601 timestamp.
CreationTime pulumi.StringPtrInput
// The description of the runner. Max length is 1024 characters.
Description pulumi.StringPtrInput
// (Optional) The last time runner has been seen. Represented as an ISO 8601 timestamp.
LastSeen pulumi.StringPtrInput
// The name of the runner. Max length is 255 characters.
Name pulumi.StringPtrInput
// The unique User API Token created in Runbook Automation.
RunbookApiKey pulumi.StringPtrInput
// The subdomain for your Runbook Automation Instance.
RunbookBaseUri pulumi.StringPtrInput
// The type of runner. The only allowed values is `runbook`.
RunnerType pulumi.StringPtrInput
// The type of object. The value returned will be `runner`.
Type pulumi.StringPtrInput
}
func (AutomationActionsRunnerState) ElementType() reflect.Type {
return reflect.TypeOf((*automationActionsRunnerState)(nil)).Elem()
}
type automationActionsRunnerArgs struct {
// The description of the runner. Max length is 1024 characters.
Description *string `pulumi:"description"`
// (Optional) The last time runner has been seen. Represented as an ISO 8601 timestamp.
LastSeen *string `pulumi:"lastSeen"`
// The name of the runner. Max length is 255 characters.
Name *string `pulumi:"name"`
// The unique User API Token created in Runbook Automation.
RunbookApiKey *string `pulumi:"runbookApiKey"`
// The subdomain for your Runbook Automation Instance.
RunbookBaseUri *string `pulumi:"runbookBaseUri"`
// The type of runner. The only allowed values is `runbook`.
RunnerType string `pulumi:"runnerType"`
}
// The set of arguments for constructing a AutomationActionsRunner resource.
type AutomationActionsRunnerArgs struct {
// The description of the runner. Max length is 1024 characters.
Description pulumi.StringPtrInput
// (Optional) The last time runner has been seen. Represented as an ISO 8601 timestamp.
LastSeen pulumi.StringPtrInput
// The name of the runner. Max length is 255 characters.
Name pulumi.StringPtrInput
// The unique User API Token created in Runbook Automation.
RunbookApiKey pulumi.StringPtrInput
// The subdomain for your Runbook Automation Instance.
RunbookBaseUri pulumi.StringPtrInput
// The type of runner. The only allowed values is `runbook`.
RunnerType pulumi.StringInput
}
func (AutomationActionsRunnerArgs) ElementType() reflect.Type {
return reflect.TypeOf((*automationActionsRunnerArgs)(nil)).Elem()
}
type AutomationActionsRunnerInput interface {
pulumi.Input
ToAutomationActionsRunnerOutput() AutomationActionsRunnerOutput
ToAutomationActionsRunnerOutputWithContext(ctx context.Context) AutomationActionsRunnerOutput
}
func (*AutomationActionsRunner) ElementType() reflect.Type {
return reflect.TypeOf((**AutomationActionsRunner)(nil)).Elem()
}
func (i *AutomationActionsRunner) ToAutomationActionsRunnerOutput() AutomationActionsRunnerOutput {
return i.ToAutomationActionsRunnerOutputWithContext(context.Background())
}
func (i *AutomationActionsRunner) ToAutomationActionsRunnerOutputWithContext(ctx context.Context) AutomationActionsRunnerOutput {
return pulumi.ToOutputWithContext(ctx, i).(AutomationActionsRunnerOutput)
}
// AutomationActionsRunnerArrayInput is an input type that accepts AutomationActionsRunnerArray and AutomationActionsRunnerArrayOutput values.
// You can construct a concrete instance of `AutomationActionsRunnerArrayInput` via:
//
// AutomationActionsRunnerArray{ AutomationActionsRunnerArgs{...} }
type AutomationActionsRunnerArrayInput interface {
pulumi.Input
ToAutomationActionsRunnerArrayOutput() AutomationActionsRunnerArrayOutput
ToAutomationActionsRunnerArrayOutputWithContext(context.Context) AutomationActionsRunnerArrayOutput
}
type AutomationActionsRunnerArray []AutomationActionsRunnerInput
func (AutomationActionsRunnerArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AutomationActionsRunner)(nil)).Elem()
}
func (i AutomationActionsRunnerArray) ToAutomationActionsRunnerArrayOutput() AutomationActionsRunnerArrayOutput {
return i.ToAutomationActionsRunnerArrayOutputWithContext(context.Background())
}
func (i AutomationActionsRunnerArray) ToAutomationActionsRunnerArrayOutputWithContext(ctx context.Context) AutomationActionsRunnerArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(AutomationActionsRunnerArrayOutput)
}
// AutomationActionsRunnerMapInput is an input type that accepts AutomationActionsRunnerMap and AutomationActionsRunnerMapOutput values.
// You can construct a concrete instance of `AutomationActionsRunnerMapInput` via:
//
// AutomationActionsRunnerMap{ "key": AutomationActionsRunnerArgs{...} }
type AutomationActionsRunnerMapInput interface {
pulumi.Input
ToAutomationActionsRunnerMapOutput() AutomationActionsRunnerMapOutput
ToAutomationActionsRunnerMapOutputWithContext(context.Context) AutomationActionsRunnerMapOutput
}
type AutomationActionsRunnerMap map[string]AutomationActionsRunnerInput
func (AutomationActionsRunnerMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AutomationActionsRunner)(nil)).Elem()
}
func (i AutomationActionsRunnerMap) ToAutomationActionsRunnerMapOutput() AutomationActionsRunnerMapOutput {
return i.ToAutomationActionsRunnerMapOutputWithContext(context.Background())
}
func (i AutomationActionsRunnerMap) ToAutomationActionsRunnerMapOutputWithContext(ctx context.Context) AutomationActionsRunnerMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(AutomationActionsRunnerMapOutput)
}
type AutomationActionsRunnerOutput struct{ *pulumi.OutputState }
func (AutomationActionsRunnerOutput) ElementType() reflect.Type {
return reflect.TypeOf((**AutomationActionsRunner)(nil)).Elem()
}
func (o AutomationActionsRunnerOutput) ToAutomationActionsRunnerOutput() AutomationActionsRunnerOutput {
return o
}
func (o AutomationActionsRunnerOutput) ToAutomationActionsRunnerOutputWithContext(ctx context.Context) AutomationActionsRunnerOutput {
return o
}
// The time runner was created. Represented as an ISO 8601 timestamp.
func (o AutomationActionsRunnerOutput) CreationTime() pulumi.StringOutput {
return o.ApplyT(func(v *AutomationActionsRunner) pulumi.StringOutput { return v.CreationTime }).(pulumi.StringOutput)
}
// The description of the runner. Max length is 1024 characters.
func (o AutomationActionsRunnerOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *AutomationActionsRunner) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// (Optional) The last time runner has been seen. Represented as an ISO 8601 timestamp.
func (o AutomationActionsRunnerOutput) LastSeen() pulumi.StringOutput {
return o.ApplyT(func(v *AutomationActionsRunner) pulumi.StringOutput { return v.LastSeen }).(pulumi.StringOutput)
}
// The name of the runner. Max length is 255 characters.
func (o AutomationActionsRunnerOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *AutomationActionsRunner) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The unique User API Token created in Runbook Automation.
func (o AutomationActionsRunnerOutput) RunbookApiKey() pulumi.StringPtrOutput {
return o.ApplyT(func(v *AutomationActionsRunner) pulumi.StringPtrOutput { return v.RunbookApiKey }).(pulumi.StringPtrOutput)
}
// The subdomain for your Runbook Automation Instance.
func (o AutomationActionsRunnerOutput) RunbookBaseUri() pulumi.StringPtrOutput {
return o.ApplyT(func(v *AutomationActionsRunner) pulumi.StringPtrOutput { return v.RunbookBaseUri }).(pulumi.StringPtrOutput)
}
// The type of runner. The only allowed values is `runbook`.
func (o AutomationActionsRunnerOutput) RunnerType() pulumi.StringOutput {
return o.ApplyT(func(v *AutomationActionsRunner) pulumi.StringOutput { return v.RunnerType }).(pulumi.StringOutput)
}
// The type of object. The value returned will be `runner`.
func (o AutomationActionsRunnerOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v *AutomationActionsRunner) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
}
type AutomationActionsRunnerArrayOutput struct{ *pulumi.OutputState }
func (AutomationActionsRunnerArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AutomationActionsRunner)(nil)).Elem()
}
func (o AutomationActionsRunnerArrayOutput) ToAutomationActionsRunnerArrayOutput() AutomationActionsRunnerArrayOutput {
return o
}
func (o AutomationActionsRunnerArrayOutput) ToAutomationActionsRunnerArrayOutputWithContext(ctx context.Context) AutomationActionsRunnerArrayOutput {
return o
}
func (o AutomationActionsRunnerArrayOutput) Index(i pulumi.IntInput) AutomationActionsRunnerOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AutomationActionsRunner {
return vs[0].([]*AutomationActionsRunner)[vs[1].(int)]
}).(AutomationActionsRunnerOutput)
}
type AutomationActionsRunnerMapOutput struct{ *pulumi.OutputState }
func (AutomationActionsRunnerMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AutomationActionsRunner)(nil)).Elem()
}
func (o AutomationActionsRunnerMapOutput) ToAutomationActionsRunnerMapOutput() AutomationActionsRunnerMapOutput {
return o
}
func (o AutomationActionsRunnerMapOutput) ToAutomationActionsRunnerMapOutputWithContext(ctx context.Context) AutomationActionsRunnerMapOutput {
return o
}
func (o AutomationActionsRunnerMapOutput) MapIndex(k pulumi.StringInput) AutomationActionsRunnerOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AutomationActionsRunner {
return vs[0].(map[string]*AutomationActionsRunner)[vs[1].(string)]
}).(AutomationActionsRunnerOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*AutomationActionsRunnerInput)(nil)).Elem(), &AutomationActionsRunner{})
pulumi.RegisterInputType(reflect.TypeOf((*AutomationActionsRunnerArrayInput)(nil)).Elem(), AutomationActionsRunnerArray{})
pulumi.RegisterInputType(reflect.TypeOf((*AutomationActionsRunnerMapInput)(nil)).Elem(), AutomationActionsRunnerMap{})
pulumi.RegisterOutputType(AutomationActionsRunnerOutput{})
pulumi.RegisterOutputType(AutomationActionsRunnerArrayOutput{})
pulumi.RegisterOutputType(AutomationActionsRunnerMapOutput{})
}