/
workflow.go
372 lines (312 loc) · 12 KB
/
workflow.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
// *** 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 glue
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Provides a Glue Workflow resource.
// The workflow graph (DAG) can be build using the `glue.Trigger` resource.
// See the example below for creating a graph with four nodes (two triggers and two jobs).
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v3/go/aws/glue"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := glue.NewWorkflow(ctx, "example", nil)
// if err != nil {
// return err
// }
// _, err = glue.NewTrigger(ctx, "example_start", &glue.TriggerArgs{
// Type: pulumi.String("ON_DEMAND"),
// WorkflowName: example.Name,
// Actions: glue.TriggerActionArray{
// &glue.TriggerActionArgs{
// JobName: pulumi.String("example-job"),
// },
// },
// })
// if err != nil {
// return err
// }
// _, err = glue.NewTrigger(ctx, "example_inner", &glue.TriggerArgs{
// Type: pulumi.String("CONDITIONAL"),
// WorkflowName: example.Name,
// Predicate: &glue.TriggerPredicateArgs{
// Conditions: glue.TriggerPredicateConditionArray{
// &glue.TriggerPredicateConditionArgs{
// JobName: pulumi.String("example-job"),
// State: pulumi.String("SUCCEEDED"),
// },
// },
// },
// Actions: glue.TriggerActionArray{
// &glue.TriggerActionArgs{
// JobName: pulumi.String("another-example-job"),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Glue Workflows can be imported using `name`, e.g.
//
// ```sh
// $ pulumi import aws:glue/workflow:Workflow MyWorkflow MyWorkflow
// ```
type Workflow struct {
pulumi.CustomResourceState
// Amazon Resource Name (ARN) of Glue Workflow
Arn pulumi.StringOutput `pulumi:"arn"`
// A map of default run properties for this workflow. These properties are passed to all jobs associated to the workflow.
DefaultRunProperties pulumi.MapOutput `pulumi:"defaultRunProperties"`
// Description of the workflow.
Description pulumi.StringPtrOutput `pulumi:"description"`
// Prevents exceeding the maximum number of concurrent runs of any of the component jobs. If you leave this parameter blank, there is no limit to the number of concurrent workflow runs.
MaxConcurrentRuns pulumi.IntPtrOutput `pulumi:"maxConcurrentRuns"`
// The name you assign to this workflow.
Name pulumi.StringOutput `pulumi:"name"`
// Key-value map of resource tags
Tags pulumi.StringMapOutput `pulumi:"tags"`
}
// NewWorkflow registers a new resource with the given unique name, arguments, and options.
func NewWorkflow(ctx *pulumi.Context,
name string, args *WorkflowArgs, opts ...pulumi.ResourceOption) (*Workflow, error) {
if args == nil {
args = &WorkflowArgs{}
}
var resource Workflow
err := ctx.RegisterResource("aws:glue/workflow:Workflow", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetWorkflow gets an existing Workflow 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 GetWorkflow(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *WorkflowState, opts ...pulumi.ResourceOption) (*Workflow, error) {
var resource Workflow
err := ctx.ReadResource("aws:glue/workflow:Workflow", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Workflow resources.
type workflowState struct {
// Amazon Resource Name (ARN) of Glue Workflow
Arn *string `pulumi:"arn"`
// A map of default run properties for this workflow. These properties are passed to all jobs associated to the workflow.
DefaultRunProperties map[string]interface{} `pulumi:"defaultRunProperties"`
// Description of the workflow.
Description *string `pulumi:"description"`
// Prevents exceeding the maximum number of concurrent runs of any of the component jobs. If you leave this parameter blank, there is no limit to the number of concurrent workflow runs.
MaxConcurrentRuns *int `pulumi:"maxConcurrentRuns"`
// The name you assign to this workflow.
Name *string `pulumi:"name"`
// Key-value map of resource tags
Tags map[string]string `pulumi:"tags"`
}
type WorkflowState struct {
// Amazon Resource Name (ARN) of Glue Workflow
Arn pulumi.StringPtrInput
// A map of default run properties for this workflow. These properties are passed to all jobs associated to the workflow.
DefaultRunProperties pulumi.MapInput
// Description of the workflow.
Description pulumi.StringPtrInput
// Prevents exceeding the maximum number of concurrent runs of any of the component jobs. If you leave this parameter blank, there is no limit to the number of concurrent workflow runs.
MaxConcurrentRuns pulumi.IntPtrInput
// The name you assign to this workflow.
Name pulumi.StringPtrInput
// Key-value map of resource tags
Tags pulumi.StringMapInput
}
func (WorkflowState) ElementType() reflect.Type {
return reflect.TypeOf((*workflowState)(nil)).Elem()
}
type workflowArgs struct {
// A map of default run properties for this workflow. These properties are passed to all jobs associated to the workflow.
DefaultRunProperties map[string]interface{} `pulumi:"defaultRunProperties"`
// Description of the workflow.
Description *string `pulumi:"description"`
// Prevents exceeding the maximum number of concurrent runs of any of the component jobs. If you leave this parameter blank, there is no limit to the number of concurrent workflow runs.
MaxConcurrentRuns *int `pulumi:"maxConcurrentRuns"`
// The name you assign to this workflow.
Name *string `pulumi:"name"`
// Key-value map of resource tags
Tags map[string]string `pulumi:"tags"`
}
// The set of arguments for constructing a Workflow resource.
type WorkflowArgs struct {
// A map of default run properties for this workflow. These properties are passed to all jobs associated to the workflow.
DefaultRunProperties pulumi.MapInput
// Description of the workflow.
Description pulumi.StringPtrInput
// Prevents exceeding the maximum number of concurrent runs of any of the component jobs. If you leave this parameter blank, there is no limit to the number of concurrent workflow runs.
MaxConcurrentRuns pulumi.IntPtrInput
// The name you assign to this workflow.
Name pulumi.StringPtrInput
// Key-value map of resource tags
Tags pulumi.StringMapInput
}
func (WorkflowArgs) ElementType() reflect.Type {
return reflect.TypeOf((*workflowArgs)(nil)).Elem()
}
type WorkflowInput interface {
pulumi.Input
ToWorkflowOutput() WorkflowOutput
ToWorkflowOutputWithContext(ctx context.Context) WorkflowOutput
}
func (*Workflow) ElementType() reflect.Type {
return reflect.TypeOf((*Workflow)(nil))
}
func (i *Workflow) ToWorkflowOutput() WorkflowOutput {
return i.ToWorkflowOutputWithContext(context.Background())
}
func (i *Workflow) ToWorkflowOutputWithContext(ctx context.Context) WorkflowOutput {
return pulumi.ToOutputWithContext(ctx, i).(WorkflowOutput)
}
func (i *Workflow) ToWorkflowPtrOutput() WorkflowPtrOutput {
return i.ToWorkflowPtrOutputWithContext(context.Background())
}
func (i *Workflow) ToWorkflowPtrOutputWithContext(ctx context.Context) WorkflowPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(WorkflowPtrOutput)
}
type WorkflowPtrInput interface {
pulumi.Input
ToWorkflowPtrOutput() WorkflowPtrOutput
ToWorkflowPtrOutputWithContext(ctx context.Context) WorkflowPtrOutput
}
type workflowPtrType WorkflowArgs
func (*workflowPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Workflow)(nil))
}
func (i *workflowPtrType) ToWorkflowPtrOutput() WorkflowPtrOutput {
return i.ToWorkflowPtrOutputWithContext(context.Background())
}
func (i *workflowPtrType) ToWorkflowPtrOutputWithContext(ctx context.Context) WorkflowPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(WorkflowPtrOutput)
}
// WorkflowArrayInput is an input type that accepts WorkflowArray and WorkflowArrayOutput values.
// You can construct a concrete instance of `WorkflowArrayInput` via:
//
// WorkflowArray{ WorkflowArgs{...} }
type WorkflowArrayInput interface {
pulumi.Input
ToWorkflowArrayOutput() WorkflowArrayOutput
ToWorkflowArrayOutputWithContext(context.Context) WorkflowArrayOutput
}
type WorkflowArray []WorkflowInput
func (WorkflowArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*Workflow)(nil))
}
func (i WorkflowArray) ToWorkflowArrayOutput() WorkflowArrayOutput {
return i.ToWorkflowArrayOutputWithContext(context.Background())
}
func (i WorkflowArray) ToWorkflowArrayOutputWithContext(ctx context.Context) WorkflowArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(WorkflowArrayOutput)
}
// WorkflowMapInput is an input type that accepts WorkflowMap and WorkflowMapOutput values.
// You can construct a concrete instance of `WorkflowMapInput` via:
//
// WorkflowMap{ "key": WorkflowArgs{...} }
type WorkflowMapInput interface {
pulumi.Input
ToWorkflowMapOutput() WorkflowMapOutput
ToWorkflowMapOutputWithContext(context.Context) WorkflowMapOutput
}
type WorkflowMap map[string]WorkflowInput
func (WorkflowMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*Workflow)(nil))
}
func (i WorkflowMap) ToWorkflowMapOutput() WorkflowMapOutput {
return i.ToWorkflowMapOutputWithContext(context.Background())
}
func (i WorkflowMap) ToWorkflowMapOutputWithContext(ctx context.Context) WorkflowMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(WorkflowMapOutput)
}
type WorkflowOutput struct {
*pulumi.OutputState
}
func (WorkflowOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Workflow)(nil))
}
func (o WorkflowOutput) ToWorkflowOutput() WorkflowOutput {
return o
}
func (o WorkflowOutput) ToWorkflowOutputWithContext(ctx context.Context) WorkflowOutput {
return o
}
func (o WorkflowOutput) ToWorkflowPtrOutput() WorkflowPtrOutput {
return o.ToWorkflowPtrOutputWithContext(context.Background())
}
func (o WorkflowOutput) ToWorkflowPtrOutputWithContext(ctx context.Context) WorkflowPtrOutput {
return o.ApplyT(func(v Workflow) *Workflow {
return &v
}).(WorkflowPtrOutput)
}
type WorkflowPtrOutput struct {
*pulumi.OutputState
}
func (WorkflowPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Workflow)(nil))
}
func (o WorkflowPtrOutput) ToWorkflowPtrOutput() WorkflowPtrOutput {
return o
}
func (o WorkflowPtrOutput) ToWorkflowPtrOutputWithContext(ctx context.Context) WorkflowPtrOutput {
return o
}
type WorkflowArrayOutput struct{ *pulumi.OutputState }
func (WorkflowArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]Workflow)(nil))
}
func (o WorkflowArrayOutput) ToWorkflowArrayOutput() WorkflowArrayOutput {
return o
}
func (o WorkflowArrayOutput) ToWorkflowArrayOutputWithContext(ctx context.Context) WorkflowArrayOutput {
return o
}
func (o WorkflowArrayOutput) Index(i pulumi.IntInput) WorkflowOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Workflow {
return vs[0].([]Workflow)[vs[1].(int)]
}).(WorkflowOutput)
}
type WorkflowMapOutput struct{ *pulumi.OutputState }
func (WorkflowMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]Workflow)(nil))
}
func (o WorkflowMapOutput) ToWorkflowMapOutput() WorkflowMapOutput {
return o
}
func (o WorkflowMapOutput) ToWorkflowMapOutputWithContext(ctx context.Context) WorkflowMapOutput {
return o
}
func (o WorkflowMapOutput) MapIndex(k pulumi.StringInput) WorkflowOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Workflow {
return vs[0].(map[string]Workflow)[vs[1].(string)]
}).(WorkflowOutput)
}
func init() {
pulumi.RegisterOutputType(WorkflowOutput{})
pulumi.RegisterOutputType(WorkflowPtrOutput{})
pulumi.RegisterOutputType(WorkflowArrayOutput{})
pulumi.RegisterOutputType(WorkflowMapOutput{})
}