/
triggerRecurrence.go
380 lines (327 loc) · 17 KB
/
triggerRecurrence.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
// 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 logicapps
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a Recurrence Trigger within a Logic App Workflow
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/logicapps"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
// Name: pulumi.String("workflow-resources"),
// Location: pulumi.String("West Europe"),
// })
// if err != nil {
// return err
// }
// exampleWorkflow, err := logicapps.NewWorkflow(ctx, "example", &logicapps.WorkflowArgs{
// Name: pulumi.String("workflow1"),
// Location: example.Location,
// ResourceGroupName: example.Name,
// })
// if err != nil {
// return err
// }
// _, err = logicapps.NewTriggerRecurrence(ctx, "example", &logicapps.TriggerRecurrenceArgs{
// Name: pulumi.String("run-every-day"),
// LogicAppId: exampleWorkflow.ID(),
// Frequency: pulumi.String("Day"),
// Interval: pulumi.Int(1),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Logic App Recurrence Triggers can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:logicapps/triggerRecurrence:TriggerRecurrence daily /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Logic/workflows/workflow1/triggers/daily
// ```
type TriggerRecurrence struct {
pulumi.CustomResourceState
// Specifies the Frequency at which this Trigger should be run. Possible values include `Month`, `Week`, `Day`, `Hour`, `Minute` and `Second`.
Frequency pulumi.StringOutput `pulumi:"frequency"`
// Specifies interval used for the Frequency, for example a value of `4` for `interval` and `hour` for `frequency` would run the Trigger every 4 hours.
Interval pulumi.IntOutput `pulumi:"interval"`
// Specifies the ID of the Logic App Workflow. Changing this forces a new resource to be created.
LogicAppId pulumi.StringOutput `pulumi:"logicAppId"`
// Specifies the name of the Recurrence Triggers to be created within the Logic App Workflow. Changing this forces a new resource to be created.
//
// > **NOTE:** This name must be unique across all Triggers within the Logic App Workflow.
Name pulumi.StringOutput `pulumi:"name"`
// A `schedule` block as specified below.
Schedule TriggerRecurrenceSchedulePtrOutput `pulumi:"schedule"`
// Specifies the start date and time for this trigger in RFC3339 format: `2000-01-02T03:04:05Z`.
StartTime pulumi.StringPtrOutput `pulumi:"startTime"`
// Specifies the time zone for this trigger. Supported time zone options are listed [here](https://support.microsoft.com/en-us/help/973627/microsoft-time-zone-index-values)
TimeZone pulumi.StringOutput `pulumi:"timeZone"`
}
// NewTriggerRecurrence registers a new resource with the given unique name, arguments, and options.
func NewTriggerRecurrence(ctx *pulumi.Context,
name string, args *TriggerRecurrenceArgs, opts ...pulumi.ResourceOption) (*TriggerRecurrence, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Frequency == nil {
return nil, errors.New("invalid value for required argument 'Frequency'")
}
if args.Interval == nil {
return nil, errors.New("invalid value for required argument 'Interval'")
}
if args.LogicAppId == nil {
return nil, errors.New("invalid value for required argument 'LogicAppId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource TriggerRecurrence
err := ctx.RegisterResource("azure:logicapps/triggerRecurrence:TriggerRecurrence", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTriggerRecurrence gets an existing TriggerRecurrence 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 GetTriggerRecurrence(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TriggerRecurrenceState, opts ...pulumi.ResourceOption) (*TriggerRecurrence, error) {
var resource TriggerRecurrence
err := ctx.ReadResource("azure:logicapps/triggerRecurrence:TriggerRecurrence", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering TriggerRecurrence resources.
type triggerRecurrenceState struct {
// Specifies the Frequency at which this Trigger should be run. Possible values include `Month`, `Week`, `Day`, `Hour`, `Minute` and `Second`.
Frequency *string `pulumi:"frequency"`
// Specifies interval used for the Frequency, for example a value of `4` for `interval` and `hour` for `frequency` would run the Trigger every 4 hours.
Interval *int `pulumi:"interval"`
// Specifies the ID of the Logic App Workflow. Changing this forces a new resource to be created.
LogicAppId *string `pulumi:"logicAppId"`
// Specifies the name of the Recurrence Triggers to be created within the Logic App Workflow. Changing this forces a new resource to be created.
//
// > **NOTE:** This name must be unique across all Triggers within the Logic App Workflow.
Name *string `pulumi:"name"`
// A `schedule` block as specified below.
Schedule *TriggerRecurrenceSchedule `pulumi:"schedule"`
// Specifies the start date and time for this trigger in RFC3339 format: `2000-01-02T03:04:05Z`.
StartTime *string `pulumi:"startTime"`
// Specifies the time zone for this trigger. Supported time zone options are listed [here](https://support.microsoft.com/en-us/help/973627/microsoft-time-zone-index-values)
TimeZone *string `pulumi:"timeZone"`
}
type TriggerRecurrenceState struct {
// Specifies the Frequency at which this Trigger should be run. Possible values include `Month`, `Week`, `Day`, `Hour`, `Minute` and `Second`.
Frequency pulumi.StringPtrInput
// Specifies interval used for the Frequency, for example a value of `4` for `interval` and `hour` for `frequency` would run the Trigger every 4 hours.
Interval pulumi.IntPtrInput
// Specifies the ID of the Logic App Workflow. Changing this forces a new resource to be created.
LogicAppId pulumi.StringPtrInput
// Specifies the name of the Recurrence Triggers to be created within the Logic App Workflow. Changing this forces a new resource to be created.
//
// > **NOTE:** This name must be unique across all Triggers within the Logic App Workflow.
Name pulumi.StringPtrInput
// A `schedule` block as specified below.
Schedule TriggerRecurrenceSchedulePtrInput
// Specifies the start date and time for this trigger in RFC3339 format: `2000-01-02T03:04:05Z`.
StartTime pulumi.StringPtrInput
// Specifies the time zone for this trigger. Supported time zone options are listed [here](https://support.microsoft.com/en-us/help/973627/microsoft-time-zone-index-values)
TimeZone pulumi.StringPtrInput
}
func (TriggerRecurrenceState) ElementType() reflect.Type {
return reflect.TypeOf((*triggerRecurrenceState)(nil)).Elem()
}
type triggerRecurrenceArgs struct {
// Specifies the Frequency at which this Trigger should be run. Possible values include `Month`, `Week`, `Day`, `Hour`, `Minute` and `Second`.
Frequency string `pulumi:"frequency"`
// Specifies interval used for the Frequency, for example a value of `4` for `interval` and `hour` for `frequency` would run the Trigger every 4 hours.
Interval int `pulumi:"interval"`
// Specifies the ID of the Logic App Workflow. Changing this forces a new resource to be created.
LogicAppId string `pulumi:"logicAppId"`
// Specifies the name of the Recurrence Triggers to be created within the Logic App Workflow. Changing this forces a new resource to be created.
//
// > **NOTE:** This name must be unique across all Triggers within the Logic App Workflow.
Name *string `pulumi:"name"`
// A `schedule` block as specified below.
Schedule *TriggerRecurrenceSchedule `pulumi:"schedule"`
// Specifies the start date and time for this trigger in RFC3339 format: `2000-01-02T03:04:05Z`.
StartTime *string `pulumi:"startTime"`
// Specifies the time zone for this trigger. Supported time zone options are listed [here](https://support.microsoft.com/en-us/help/973627/microsoft-time-zone-index-values)
TimeZone *string `pulumi:"timeZone"`
}
// The set of arguments for constructing a TriggerRecurrence resource.
type TriggerRecurrenceArgs struct {
// Specifies the Frequency at which this Trigger should be run. Possible values include `Month`, `Week`, `Day`, `Hour`, `Minute` and `Second`.
Frequency pulumi.StringInput
// Specifies interval used for the Frequency, for example a value of `4` for `interval` and `hour` for `frequency` would run the Trigger every 4 hours.
Interval pulumi.IntInput
// Specifies the ID of the Logic App Workflow. Changing this forces a new resource to be created.
LogicAppId pulumi.StringInput
// Specifies the name of the Recurrence Triggers to be created within the Logic App Workflow. Changing this forces a new resource to be created.
//
// > **NOTE:** This name must be unique across all Triggers within the Logic App Workflow.
Name pulumi.StringPtrInput
// A `schedule` block as specified below.
Schedule TriggerRecurrenceSchedulePtrInput
// Specifies the start date and time for this trigger in RFC3339 format: `2000-01-02T03:04:05Z`.
StartTime pulumi.StringPtrInput
// Specifies the time zone for this trigger. Supported time zone options are listed [here](https://support.microsoft.com/en-us/help/973627/microsoft-time-zone-index-values)
TimeZone pulumi.StringPtrInput
}
func (TriggerRecurrenceArgs) ElementType() reflect.Type {
return reflect.TypeOf((*triggerRecurrenceArgs)(nil)).Elem()
}
type TriggerRecurrenceInput interface {
pulumi.Input
ToTriggerRecurrenceOutput() TriggerRecurrenceOutput
ToTriggerRecurrenceOutputWithContext(ctx context.Context) TriggerRecurrenceOutput
}
func (*TriggerRecurrence) ElementType() reflect.Type {
return reflect.TypeOf((**TriggerRecurrence)(nil)).Elem()
}
func (i *TriggerRecurrence) ToTriggerRecurrenceOutput() TriggerRecurrenceOutput {
return i.ToTriggerRecurrenceOutputWithContext(context.Background())
}
func (i *TriggerRecurrence) ToTriggerRecurrenceOutputWithContext(ctx context.Context) TriggerRecurrenceOutput {
return pulumi.ToOutputWithContext(ctx, i).(TriggerRecurrenceOutput)
}
// TriggerRecurrenceArrayInput is an input type that accepts TriggerRecurrenceArray and TriggerRecurrenceArrayOutput values.
// You can construct a concrete instance of `TriggerRecurrenceArrayInput` via:
//
// TriggerRecurrenceArray{ TriggerRecurrenceArgs{...} }
type TriggerRecurrenceArrayInput interface {
pulumi.Input
ToTriggerRecurrenceArrayOutput() TriggerRecurrenceArrayOutput
ToTriggerRecurrenceArrayOutputWithContext(context.Context) TriggerRecurrenceArrayOutput
}
type TriggerRecurrenceArray []TriggerRecurrenceInput
func (TriggerRecurrenceArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*TriggerRecurrence)(nil)).Elem()
}
func (i TriggerRecurrenceArray) ToTriggerRecurrenceArrayOutput() TriggerRecurrenceArrayOutput {
return i.ToTriggerRecurrenceArrayOutputWithContext(context.Background())
}
func (i TriggerRecurrenceArray) ToTriggerRecurrenceArrayOutputWithContext(ctx context.Context) TriggerRecurrenceArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(TriggerRecurrenceArrayOutput)
}
// TriggerRecurrenceMapInput is an input type that accepts TriggerRecurrenceMap and TriggerRecurrenceMapOutput values.
// You can construct a concrete instance of `TriggerRecurrenceMapInput` via:
//
// TriggerRecurrenceMap{ "key": TriggerRecurrenceArgs{...} }
type TriggerRecurrenceMapInput interface {
pulumi.Input
ToTriggerRecurrenceMapOutput() TriggerRecurrenceMapOutput
ToTriggerRecurrenceMapOutputWithContext(context.Context) TriggerRecurrenceMapOutput
}
type TriggerRecurrenceMap map[string]TriggerRecurrenceInput
func (TriggerRecurrenceMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*TriggerRecurrence)(nil)).Elem()
}
func (i TriggerRecurrenceMap) ToTriggerRecurrenceMapOutput() TriggerRecurrenceMapOutput {
return i.ToTriggerRecurrenceMapOutputWithContext(context.Background())
}
func (i TriggerRecurrenceMap) ToTriggerRecurrenceMapOutputWithContext(ctx context.Context) TriggerRecurrenceMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(TriggerRecurrenceMapOutput)
}
type TriggerRecurrenceOutput struct{ *pulumi.OutputState }
func (TriggerRecurrenceOutput) ElementType() reflect.Type {
return reflect.TypeOf((**TriggerRecurrence)(nil)).Elem()
}
func (o TriggerRecurrenceOutput) ToTriggerRecurrenceOutput() TriggerRecurrenceOutput {
return o
}
func (o TriggerRecurrenceOutput) ToTriggerRecurrenceOutputWithContext(ctx context.Context) TriggerRecurrenceOutput {
return o
}
// Specifies the Frequency at which this Trigger should be run. Possible values include `Month`, `Week`, `Day`, `Hour`, `Minute` and `Second`.
func (o TriggerRecurrenceOutput) Frequency() pulumi.StringOutput {
return o.ApplyT(func(v *TriggerRecurrence) pulumi.StringOutput { return v.Frequency }).(pulumi.StringOutput)
}
// Specifies interval used for the Frequency, for example a value of `4` for `interval` and `hour` for `frequency` would run the Trigger every 4 hours.
func (o TriggerRecurrenceOutput) Interval() pulumi.IntOutput {
return o.ApplyT(func(v *TriggerRecurrence) pulumi.IntOutput { return v.Interval }).(pulumi.IntOutput)
}
// Specifies the ID of the Logic App Workflow. Changing this forces a new resource to be created.
func (o TriggerRecurrenceOutput) LogicAppId() pulumi.StringOutput {
return o.ApplyT(func(v *TriggerRecurrence) pulumi.StringOutput { return v.LogicAppId }).(pulumi.StringOutput)
}
// Specifies the name of the Recurrence Triggers to be created within the Logic App Workflow. Changing this forces a new resource to be created.
//
// > **NOTE:** This name must be unique across all Triggers within the Logic App Workflow.
func (o TriggerRecurrenceOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *TriggerRecurrence) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// A `schedule` block as specified below.
func (o TriggerRecurrenceOutput) Schedule() TriggerRecurrenceSchedulePtrOutput {
return o.ApplyT(func(v *TriggerRecurrence) TriggerRecurrenceSchedulePtrOutput { return v.Schedule }).(TriggerRecurrenceSchedulePtrOutput)
}
// Specifies the start date and time for this trigger in RFC3339 format: `2000-01-02T03:04:05Z`.
func (o TriggerRecurrenceOutput) StartTime() pulumi.StringPtrOutput {
return o.ApplyT(func(v *TriggerRecurrence) pulumi.StringPtrOutput { return v.StartTime }).(pulumi.StringPtrOutput)
}
// Specifies the time zone for this trigger. Supported time zone options are listed [here](https://support.microsoft.com/en-us/help/973627/microsoft-time-zone-index-values)
func (o TriggerRecurrenceOutput) TimeZone() pulumi.StringOutput {
return o.ApplyT(func(v *TriggerRecurrence) pulumi.StringOutput { return v.TimeZone }).(pulumi.StringOutput)
}
type TriggerRecurrenceArrayOutput struct{ *pulumi.OutputState }
func (TriggerRecurrenceArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*TriggerRecurrence)(nil)).Elem()
}
func (o TriggerRecurrenceArrayOutput) ToTriggerRecurrenceArrayOutput() TriggerRecurrenceArrayOutput {
return o
}
func (o TriggerRecurrenceArrayOutput) ToTriggerRecurrenceArrayOutputWithContext(ctx context.Context) TriggerRecurrenceArrayOutput {
return o
}
func (o TriggerRecurrenceArrayOutput) Index(i pulumi.IntInput) TriggerRecurrenceOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *TriggerRecurrence {
return vs[0].([]*TriggerRecurrence)[vs[1].(int)]
}).(TriggerRecurrenceOutput)
}
type TriggerRecurrenceMapOutput struct{ *pulumi.OutputState }
func (TriggerRecurrenceMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*TriggerRecurrence)(nil)).Elem()
}
func (o TriggerRecurrenceMapOutput) ToTriggerRecurrenceMapOutput() TriggerRecurrenceMapOutput {
return o
}
func (o TriggerRecurrenceMapOutput) ToTriggerRecurrenceMapOutputWithContext(ctx context.Context) TriggerRecurrenceMapOutput {
return o
}
func (o TriggerRecurrenceMapOutput) MapIndex(k pulumi.StringInput) TriggerRecurrenceOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *TriggerRecurrence {
return vs[0].(map[string]*TriggerRecurrence)[vs[1].(string)]
}).(TriggerRecurrenceOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TriggerRecurrenceInput)(nil)).Elem(), &TriggerRecurrence{})
pulumi.RegisterInputType(reflect.TypeOf((*TriggerRecurrenceArrayInput)(nil)).Elem(), TriggerRecurrenceArray{})
pulumi.RegisterInputType(reflect.TypeOf((*TriggerRecurrenceMapInput)(nil)).Elem(), TriggerRecurrenceMap{})
pulumi.RegisterOutputType(TriggerRecurrenceOutput{})
pulumi.RegisterOutputType(TriggerRecurrenceArrayOutput{})
pulumi.RegisterOutputType(TriggerRecurrenceMapOutput{})
}