/
job.go
441 lines (381 loc) · 20.6 KB
/
job.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
429
430
431
432
433
434
435
436
437
438
439
440
441
// *** 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 streamanalytics
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Manages a Stream Analytics Job.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "fmt"
//
// "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/streamanalytics"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
// Location: pulumi.String("West Europe"),
// })
// if err != nil {
// return err
// }
// _, err = streamanalytics.NewJob(ctx, "exampleJob", &streamanalytics.JobArgs{
// ResourceGroupName: exampleResourceGroup.Name,
// Location: exampleResourceGroup.Location,
// CompatibilityLevel: pulumi.String("1.1"),
// DataLocale: pulumi.String("en-GB"),
// EventsLateArrivalMaxDelayInSeconds: pulumi.Int(60),
// EventsOutOfOrderMaxDelayInSeconds: pulumi.Int(50),
// EventsOutOfOrderPolicy: pulumi.String("Adjust"),
// OutputErrorPolicy: pulumi.String("Drop"),
// StreamingUnits: pulumi.Int(3),
// Tags: pulumi.StringMap{
// "environment": pulumi.String("Example"),
// },
// TransformationQuery: pulumi.String(fmt.Sprintf("%v%v%v", " SELECT *\n", " INTO [YourOutputAlias]\n", " FROM [YourInputAlias]\n")),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Stream Analytics Job's can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:streamanalytics/job:Job example /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/group1/providers/Microsoft.StreamAnalytics/streamingjobs/job1
// ```
type Job struct {
pulumi.CustomResourceState
// Specifies the compatibility level for this job - which controls certain runtime behaviours of the streaming job. Possible values are `1.0` and `1.1`.
CompatibilityLevel pulumi.StringOutput `pulumi:"compatibilityLevel"`
// Specifies the Data Locale of the Job, which [should be a supported .NET Culture](<https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes(v=vs.110).aspx>).
DataLocale pulumi.StringOutput `pulumi:"dataLocale"`
// Specifies the maximum tolerable delay in seconds where events arriving late could be included. Supported range is `-1` (indefinite) to `1814399` (20d 23h 59m 59s). Default is `0`.
EventsLateArrivalMaxDelayInSeconds pulumi.IntPtrOutput `pulumi:"eventsLateArrivalMaxDelayInSeconds"`
// Specifies the maximum tolerable delay in seconds where out-of-order events can be adjusted to be back in order. Supported range is `0` to `599` (9m 59s). Default is `5`.
EventsOutOfOrderMaxDelayInSeconds pulumi.IntPtrOutput `pulumi:"eventsOutOfOrderMaxDelayInSeconds"`
// Specifies the policy which should be applied to events which arrive out of order in the input event stream. Possible values are `Adjust` and `Drop`. Default is `Adjust`.
EventsOutOfOrderPolicy pulumi.StringPtrOutput `pulumi:"eventsOutOfOrderPolicy"`
// The Job ID assigned by the Stream Analytics Job.
JobId pulumi.StringOutput `pulumi:"jobId"`
// The Azure Region in which the Resource Group exists. Changing this forces a new resource to be created.
Location pulumi.StringOutput `pulumi:"location"`
// The name of the Stream Analytics Job. Changing this forces a new resource to be created.
Name pulumi.StringOutput `pulumi:"name"`
// Specifies the policy which should be applied to events which arrive at the output and cannot be written to the external storage due to being malformed (such as missing column values, column values of wrong type or size). Possible values are `Drop` and `Stop`. Default is `Drop`.
OutputErrorPolicy pulumi.StringPtrOutput `pulumi:"outputErrorPolicy"`
// The name of the Resource Group where the Stream Analytics Job should exist. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
// Specifies the number of streaming units that the streaming job uses. Supported values are `1`, `3`, `6` and multiples of `6` up to `120`.
StreamingUnits pulumi.IntOutput `pulumi:"streamingUnits"`
// A mapping of tags assigned to the resource.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// Specifies the query that will be run in the streaming job, [written in Stream Analytics Query Language (SAQL)](https://msdn.microsoft.com/library/azure/dn834998).
TransformationQuery pulumi.StringOutput `pulumi:"transformationQuery"`
}
// NewJob registers a new resource with the given unique name, arguments, and options.
func NewJob(ctx *pulumi.Context,
name string, args *JobArgs, opts ...pulumi.ResourceOption) (*Job, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ResourceGroupName == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
}
if args.StreamingUnits == nil {
return nil, errors.New("invalid value for required argument 'StreamingUnits'")
}
if args.TransformationQuery == nil {
return nil, errors.New("invalid value for required argument 'TransformationQuery'")
}
var resource Job
err := ctx.RegisterResource("azure:streamanalytics/job:Job", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetJob gets an existing Job 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 GetJob(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *JobState, opts ...pulumi.ResourceOption) (*Job, error) {
var resource Job
err := ctx.ReadResource("azure:streamanalytics/job:Job", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Job resources.
type jobState struct {
// Specifies the compatibility level for this job - which controls certain runtime behaviours of the streaming job. Possible values are `1.0` and `1.1`.
CompatibilityLevel *string `pulumi:"compatibilityLevel"`
// Specifies the Data Locale of the Job, which [should be a supported .NET Culture](<https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes(v=vs.110).aspx>).
DataLocale *string `pulumi:"dataLocale"`
// Specifies the maximum tolerable delay in seconds where events arriving late could be included. Supported range is `-1` (indefinite) to `1814399` (20d 23h 59m 59s). Default is `0`.
EventsLateArrivalMaxDelayInSeconds *int `pulumi:"eventsLateArrivalMaxDelayInSeconds"`
// Specifies the maximum tolerable delay in seconds where out-of-order events can be adjusted to be back in order. Supported range is `0` to `599` (9m 59s). Default is `5`.
EventsOutOfOrderMaxDelayInSeconds *int `pulumi:"eventsOutOfOrderMaxDelayInSeconds"`
// Specifies the policy which should be applied to events which arrive out of order in the input event stream. Possible values are `Adjust` and `Drop`. Default is `Adjust`.
EventsOutOfOrderPolicy *string `pulumi:"eventsOutOfOrderPolicy"`
// The Job ID assigned by the Stream Analytics Job.
JobId *string `pulumi:"jobId"`
// The Azure Region in which the Resource Group exists. Changing this forces a new resource to be created.
Location *string `pulumi:"location"`
// The name of the Stream Analytics Job. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// Specifies the policy which should be applied to events which arrive at the output and cannot be written to the external storage due to being malformed (such as missing column values, column values of wrong type or size). Possible values are `Drop` and `Stop`. Default is `Drop`.
OutputErrorPolicy *string `pulumi:"outputErrorPolicy"`
// The name of the Resource Group where the Stream Analytics Job should exist. Changing this forces a new resource to be created.
ResourceGroupName *string `pulumi:"resourceGroupName"`
// Specifies the number of streaming units that the streaming job uses. Supported values are `1`, `3`, `6` and multiples of `6` up to `120`.
StreamingUnits *int `pulumi:"streamingUnits"`
// A mapping of tags assigned to the resource.
Tags map[string]string `pulumi:"tags"`
// Specifies the query that will be run in the streaming job, [written in Stream Analytics Query Language (SAQL)](https://msdn.microsoft.com/library/azure/dn834998).
TransformationQuery *string `pulumi:"transformationQuery"`
}
type JobState struct {
// Specifies the compatibility level for this job - which controls certain runtime behaviours of the streaming job. Possible values are `1.0` and `1.1`.
CompatibilityLevel pulumi.StringPtrInput
// Specifies the Data Locale of the Job, which [should be a supported .NET Culture](<https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes(v=vs.110).aspx>).
DataLocale pulumi.StringPtrInput
// Specifies the maximum tolerable delay in seconds where events arriving late could be included. Supported range is `-1` (indefinite) to `1814399` (20d 23h 59m 59s). Default is `0`.
EventsLateArrivalMaxDelayInSeconds pulumi.IntPtrInput
// Specifies the maximum tolerable delay in seconds where out-of-order events can be adjusted to be back in order. Supported range is `0` to `599` (9m 59s). Default is `5`.
EventsOutOfOrderMaxDelayInSeconds pulumi.IntPtrInput
// Specifies the policy which should be applied to events which arrive out of order in the input event stream. Possible values are `Adjust` and `Drop`. Default is `Adjust`.
EventsOutOfOrderPolicy pulumi.StringPtrInput
// The Job ID assigned by the Stream Analytics Job.
JobId pulumi.StringPtrInput
// The Azure Region in which the Resource Group exists. Changing this forces a new resource to be created.
Location pulumi.StringPtrInput
// The name of the Stream Analytics Job. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// Specifies the policy which should be applied to events which arrive at the output and cannot be written to the external storage due to being malformed (such as missing column values, column values of wrong type or size). Possible values are `Drop` and `Stop`. Default is `Drop`.
OutputErrorPolicy pulumi.StringPtrInput
// The name of the Resource Group where the Stream Analytics Job should exist. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringPtrInput
// Specifies the number of streaming units that the streaming job uses. Supported values are `1`, `3`, `6` and multiples of `6` up to `120`.
StreamingUnits pulumi.IntPtrInput
// A mapping of tags assigned to the resource.
Tags pulumi.StringMapInput
// Specifies the query that will be run in the streaming job, [written in Stream Analytics Query Language (SAQL)](https://msdn.microsoft.com/library/azure/dn834998).
TransformationQuery pulumi.StringPtrInput
}
func (JobState) ElementType() reflect.Type {
return reflect.TypeOf((*jobState)(nil)).Elem()
}
type jobArgs struct {
// Specifies the compatibility level for this job - which controls certain runtime behaviours of the streaming job. Possible values are `1.0` and `1.1`.
CompatibilityLevel *string `pulumi:"compatibilityLevel"`
// Specifies the Data Locale of the Job, which [should be a supported .NET Culture](<https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes(v=vs.110).aspx>).
DataLocale *string `pulumi:"dataLocale"`
// Specifies the maximum tolerable delay in seconds where events arriving late could be included. Supported range is `-1` (indefinite) to `1814399` (20d 23h 59m 59s). Default is `0`.
EventsLateArrivalMaxDelayInSeconds *int `pulumi:"eventsLateArrivalMaxDelayInSeconds"`
// Specifies the maximum tolerable delay in seconds where out-of-order events can be adjusted to be back in order. Supported range is `0` to `599` (9m 59s). Default is `5`.
EventsOutOfOrderMaxDelayInSeconds *int `pulumi:"eventsOutOfOrderMaxDelayInSeconds"`
// Specifies the policy which should be applied to events which arrive out of order in the input event stream. Possible values are `Adjust` and `Drop`. Default is `Adjust`.
EventsOutOfOrderPolicy *string `pulumi:"eventsOutOfOrderPolicy"`
// The Azure Region in which the Resource Group exists. Changing this forces a new resource to be created.
Location *string `pulumi:"location"`
// The name of the Stream Analytics Job. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// Specifies the policy which should be applied to events which arrive at the output and cannot be written to the external storage due to being malformed (such as missing column values, column values of wrong type or size). Possible values are `Drop` and `Stop`. Default is `Drop`.
OutputErrorPolicy *string `pulumi:"outputErrorPolicy"`
// The name of the Resource Group where the Stream Analytics Job should exist. Changing this forces a new resource to be created.
ResourceGroupName string `pulumi:"resourceGroupName"`
// Specifies the number of streaming units that the streaming job uses. Supported values are `1`, `3`, `6` and multiples of `6` up to `120`.
StreamingUnits int `pulumi:"streamingUnits"`
// A mapping of tags assigned to the resource.
Tags map[string]string `pulumi:"tags"`
// Specifies the query that will be run in the streaming job, [written in Stream Analytics Query Language (SAQL)](https://msdn.microsoft.com/library/azure/dn834998).
TransformationQuery string `pulumi:"transformationQuery"`
}
// The set of arguments for constructing a Job resource.
type JobArgs struct {
// Specifies the compatibility level for this job - which controls certain runtime behaviours of the streaming job. Possible values are `1.0` and `1.1`.
CompatibilityLevel pulumi.StringPtrInput
// Specifies the Data Locale of the Job, which [should be a supported .NET Culture](<https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes(v=vs.110).aspx>).
DataLocale pulumi.StringPtrInput
// Specifies the maximum tolerable delay in seconds where events arriving late could be included. Supported range is `-1` (indefinite) to `1814399` (20d 23h 59m 59s). Default is `0`.
EventsLateArrivalMaxDelayInSeconds pulumi.IntPtrInput
// Specifies the maximum tolerable delay in seconds where out-of-order events can be adjusted to be back in order. Supported range is `0` to `599` (9m 59s). Default is `5`.
EventsOutOfOrderMaxDelayInSeconds pulumi.IntPtrInput
// Specifies the policy which should be applied to events which arrive out of order in the input event stream. Possible values are `Adjust` and `Drop`. Default is `Adjust`.
EventsOutOfOrderPolicy pulumi.StringPtrInput
// The Azure Region in which the Resource Group exists. Changing this forces a new resource to be created.
Location pulumi.StringPtrInput
// The name of the Stream Analytics Job. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// Specifies the policy which should be applied to events which arrive at the output and cannot be written to the external storage due to being malformed (such as missing column values, column values of wrong type or size). Possible values are `Drop` and `Stop`. Default is `Drop`.
OutputErrorPolicy pulumi.StringPtrInput
// The name of the Resource Group where the Stream Analytics Job should exist. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringInput
// Specifies the number of streaming units that the streaming job uses. Supported values are `1`, `3`, `6` and multiples of `6` up to `120`.
StreamingUnits pulumi.IntInput
// A mapping of tags assigned to the resource.
Tags pulumi.StringMapInput
// Specifies the query that will be run in the streaming job, [written in Stream Analytics Query Language (SAQL)](https://msdn.microsoft.com/library/azure/dn834998).
TransformationQuery pulumi.StringInput
}
func (JobArgs) ElementType() reflect.Type {
return reflect.TypeOf((*jobArgs)(nil)).Elem()
}
type JobInput interface {
pulumi.Input
ToJobOutput() JobOutput
ToJobOutputWithContext(ctx context.Context) JobOutput
}
func (*Job) ElementType() reflect.Type {
return reflect.TypeOf((*Job)(nil))
}
func (i *Job) ToJobOutput() JobOutput {
return i.ToJobOutputWithContext(context.Background())
}
func (i *Job) ToJobOutputWithContext(ctx context.Context) JobOutput {
return pulumi.ToOutputWithContext(ctx, i).(JobOutput)
}
func (i *Job) ToJobPtrOutput() JobPtrOutput {
return i.ToJobPtrOutputWithContext(context.Background())
}
func (i *Job) ToJobPtrOutputWithContext(ctx context.Context) JobPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(JobPtrOutput)
}
type JobPtrInput interface {
pulumi.Input
ToJobPtrOutput() JobPtrOutput
ToJobPtrOutputWithContext(ctx context.Context) JobPtrOutput
}
type jobPtrType JobArgs
func (*jobPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Job)(nil))
}
func (i *jobPtrType) ToJobPtrOutput() JobPtrOutput {
return i.ToJobPtrOutputWithContext(context.Background())
}
func (i *jobPtrType) ToJobPtrOutputWithContext(ctx context.Context) JobPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(JobPtrOutput)
}
// JobArrayInput is an input type that accepts JobArray and JobArrayOutput values.
// You can construct a concrete instance of `JobArrayInput` via:
//
// JobArray{ JobArgs{...} }
type JobArrayInput interface {
pulumi.Input
ToJobArrayOutput() JobArrayOutput
ToJobArrayOutputWithContext(context.Context) JobArrayOutput
}
type JobArray []JobInput
func (JobArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*Job)(nil))
}
func (i JobArray) ToJobArrayOutput() JobArrayOutput {
return i.ToJobArrayOutputWithContext(context.Background())
}
func (i JobArray) ToJobArrayOutputWithContext(ctx context.Context) JobArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(JobArrayOutput)
}
// JobMapInput is an input type that accepts JobMap and JobMapOutput values.
// You can construct a concrete instance of `JobMapInput` via:
//
// JobMap{ "key": JobArgs{...} }
type JobMapInput interface {
pulumi.Input
ToJobMapOutput() JobMapOutput
ToJobMapOutputWithContext(context.Context) JobMapOutput
}
type JobMap map[string]JobInput
func (JobMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*Job)(nil))
}
func (i JobMap) ToJobMapOutput() JobMapOutput {
return i.ToJobMapOutputWithContext(context.Background())
}
func (i JobMap) ToJobMapOutputWithContext(ctx context.Context) JobMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(JobMapOutput)
}
type JobOutput struct {
*pulumi.OutputState
}
func (JobOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Job)(nil))
}
func (o JobOutput) ToJobOutput() JobOutput {
return o
}
func (o JobOutput) ToJobOutputWithContext(ctx context.Context) JobOutput {
return o
}
func (o JobOutput) ToJobPtrOutput() JobPtrOutput {
return o.ToJobPtrOutputWithContext(context.Background())
}
func (o JobOutput) ToJobPtrOutputWithContext(ctx context.Context) JobPtrOutput {
return o.ApplyT(func(v Job) *Job {
return &v
}).(JobPtrOutput)
}
type JobPtrOutput struct {
*pulumi.OutputState
}
func (JobPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Job)(nil))
}
func (o JobPtrOutput) ToJobPtrOutput() JobPtrOutput {
return o
}
func (o JobPtrOutput) ToJobPtrOutputWithContext(ctx context.Context) JobPtrOutput {
return o
}
type JobArrayOutput struct{ *pulumi.OutputState }
func (JobArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]Job)(nil))
}
func (o JobArrayOutput) ToJobArrayOutput() JobArrayOutput {
return o
}
func (o JobArrayOutput) ToJobArrayOutputWithContext(ctx context.Context) JobArrayOutput {
return o
}
func (o JobArrayOutput) Index(i pulumi.IntInput) JobOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Job {
return vs[0].([]Job)[vs[1].(int)]
}).(JobOutput)
}
type JobMapOutput struct{ *pulumi.OutputState }
func (JobMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]Job)(nil))
}
func (o JobMapOutput) ToJobMapOutput() JobMapOutput {
return o
}
func (o JobMapOutput) ToJobMapOutputWithContext(ctx context.Context) JobMapOutput {
return o
}
func (o JobMapOutput) MapIndex(k pulumi.StringInput) JobOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Job {
return vs[0].(map[string]Job)[vs[1].(string)]
}).(JobOutput)
}
func init() {
pulumi.RegisterOutputType(JobOutput{})
pulumi.RegisterOutputType(JobPtrOutput{})
pulumi.RegisterOutputType(JobArrayOutput{})
pulumi.RegisterOutputType(JobMapOutput{})
}