/
iotHubDataConnection.go
460 lines (400 loc) · 21 KB
/
iotHubDataConnection.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
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
// *** 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 kusto
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Manages a Kusto (also known as Azure Data Explorer) IotHub Data Connection
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/iot"
// "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/kusto"
// "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
// }
// exampleCluster, err := kusto.NewCluster(ctx, "exampleCluster", &kusto.ClusterArgs{
// Location: exampleResourceGroup.Location,
// ResourceGroupName: exampleResourceGroup.Name,
// Sku: &kusto.ClusterSkuArgs{
// Name: pulumi.String("Standard_D13_v2"),
// Capacity: pulumi.Int(2),
// },
// })
// if err != nil {
// return err
// }
// exampleDatabase, err := kusto.NewDatabase(ctx, "exampleDatabase", &kusto.DatabaseArgs{
// ResourceGroupName: exampleResourceGroup.Name,
// Location: exampleResourceGroup.Location,
// ClusterName: exampleCluster.Name,
// HotCachePeriod: pulumi.String("P7D"),
// SoftDeletePeriod: pulumi.String("P31D"),
// })
// if err != nil {
// return err
// }
// exampleIoTHub, err := iot.NewIoTHub(ctx, "exampleIoTHub", &iot.IoTHubArgs{
// ResourceGroupName: exampleResourceGroup.Name,
// Location: exampleResourceGroup.Location,
// Sku: &iot.IoTHubSkuArgs{
// Name: pulumi.String("B1"),
// Capacity: pulumi.Int(1),
// },
// })
// if err != nil {
// return err
// }
// exampleSharedAccessPolicy, err := iot.NewSharedAccessPolicy(ctx, "exampleSharedAccessPolicy", &iot.SharedAccessPolicyArgs{
// ResourceGroupName: exampleResourceGroup.Name,
// IothubName: exampleIoTHub.Name,
// RegistryRead: pulumi.Bool(true),
// })
// if err != nil {
// return err
// }
// exampleConsumerGroup, err := iot.NewConsumerGroup(ctx, "exampleConsumerGroup", &iot.ConsumerGroupArgs{
// ResourceGroupName: exampleResourceGroup.Name,
// IothubName: exampleIoTHub.Name,
// EventhubEndpointName: pulumi.String("events"),
// })
// if err != nil {
// return err
// }
// _, err = kusto.NewIotHubDataConnection(ctx, "exampleIotHubDataConnection", &kusto.IotHubDataConnectionArgs{
// ResourceGroupName: exampleResourceGroup.Name,
// Location: exampleResourceGroup.Location,
// ClusterName: exampleCluster.Name,
// DatabaseName: exampleDatabase.Name,
// IothubId: exampleIoTHub.ID(),
// ConsumerGroup: exampleConsumerGroup.Name,
// SharedAccessPolicyName: exampleSharedAccessPolicy.Name,
// EventSystemProperties: pulumi.StringArray{
// pulumi.String("message-id"),
// pulumi.String("sequence-number"),
// pulumi.String("to"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Kusto IotHub Data Connections can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:kusto/iotHubDataConnection:IotHubDataConnection example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Kusto/Clusters/cluster1/Databases/database1/DataConnections/dataConnection1
// ```
type IotHubDataConnection struct {
pulumi.CustomResourceState
// Specifies the name of the Kusto Cluster this data connection will be added to. Changing this forces a new resource to be created.
ClusterName pulumi.StringOutput `pulumi:"clusterName"`
// Specifies the IotHub consumer group this data connection will use for ingestion. Changing this forces a new resource to be created.
ConsumerGroup pulumi.StringOutput `pulumi:"consumerGroup"`
// Specifies the name of the Kusto Database this data connection will be added to. Changing this forces a new resource to be created.
DatabaseName pulumi.StringOutput `pulumi:"databaseName"`
// Specifies the System Properties that each IoT Hub message should contain. Changing this forces a new resource to be created.
EventSystemProperties pulumi.StringArrayOutput `pulumi:"eventSystemProperties"`
// Specifies the resource id of the IotHub this data connection will use for ingestion. Changing this forces a new resource to be created.
IothubId pulumi.StringOutput `pulumi:"iothubId"`
// The location where the Kusto Database should be created. Changing this forces a new resource to be created.
Location pulumi.StringOutput `pulumi:"location"`
// The name of the Kusto IotHub Data Connection to create. Changing this forces a new resource to be created.
Name pulumi.StringOutput `pulumi:"name"`
// Specifies the Resource Group where the Kusto Database should exist. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
// Specifies the IotHub Shared Access Policy this data connection will use for ingestion, which must have read permission. Changing this forces a new resource to be created.
SharedAccessPolicyName pulumi.StringOutput `pulumi:"sharedAccessPolicyName"`
}
// NewIotHubDataConnection registers a new resource with the given unique name, arguments, and options.
func NewIotHubDataConnection(ctx *pulumi.Context,
name string, args *IotHubDataConnectionArgs, opts ...pulumi.ResourceOption) (*IotHubDataConnection, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ClusterName == nil {
return nil, errors.New("invalid value for required argument 'ClusterName'")
}
if args.ConsumerGroup == nil {
return nil, errors.New("invalid value for required argument 'ConsumerGroup'")
}
if args.DatabaseName == nil {
return nil, errors.New("invalid value for required argument 'DatabaseName'")
}
if args.IothubId == nil {
return nil, errors.New("invalid value for required argument 'IothubId'")
}
if args.ResourceGroupName == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
}
if args.SharedAccessPolicyName == nil {
return nil, errors.New("invalid value for required argument 'SharedAccessPolicyName'")
}
var resource IotHubDataConnection
err := ctx.RegisterResource("azure:kusto/iotHubDataConnection:IotHubDataConnection", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetIotHubDataConnection gets an existing IotHubDataConnection 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 GetIotHubDataConnection(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *IotHubDataConnectionState, opts ...pulumi.ResourceOption) (*IotHubDataConnection, error) {
var resource IotHubDataConnection
err := ctx.ReadResource("azure:kusto/iotHubDataConnection:IotHubDataConnection", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering IotHubDataConnection resources.
type iotHubDataConnectionState struct {
// Specifies the name of the Kusto Cluster this data connection will be added to. Changing this forces a new resource to be created.
ClusterName *string `pulumi:"clusterName"`
// Specifies the IotHub consumer group this data connection will use for ingestion. Changing this forces a new resource to be created.
ConsumerGroup *string `pulumi:"consumerGroup"`
// Specifies the name of the Kusto Database this data connection will be added to. Changing this forces a new resource to be created.
DatabaseName *string `pulumi:"databaseName"`
// Specifies the System Properties that each IoT Hub message should contain. Changing this forces a new resource to be created.
EventSystemProperties []string `pulumi:"eventSystemProperties"`
// Specifies the resource id of the IotHub this data connection will use for ingestion. Changing this forces a new resource to be created.
IothubId *string `pulumi:"iothubId"`
// The location where the Kusto Database should be created. Changing this forces a new resource to be created.
Location *string `pulumi:"location"`
// The name of the Kusto IotHub Data Connection to create. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// Specifies the Resource Group where the Kusto Database should exist. Changing this forces a new resource to be created.
ResourceGroupName *string `pulumi:"resourceGroupName"`
// Specifies the IotHub Shared Access Policy this data connection will use for ingestion, which must have read permission. Changing this forces a new resource to be created.
SharedAccessPolicyName *string `pulumi:"sharedAccessPolicyName"`
}
type IotHubDataConnectionState struct {
// Specifies the name of the Kusto Cluster this data connection will be added to. Changing this forces a new resource to be created.
ClusterName pulumi.StringPtrInput
// Specifies the IotHub consumer group this data connection will use for ingestion. Changing this forces a new resource to be created.
ConsumerGroup pulumi.StringPtrInput
// Specifies the name of the Kusto Database this data connection will be added to. Changing this forces a new resource to be created.
DatabaseName pulumi.StringPtrInput
// Specifies the System Properties that each IoT Hub message should contain. Changing this forces a new resource to be created.
EventSystemProperties pulumi.StringArrayInput
// Specifies the resource id of the IotHub this data connection will use for ingestion. Changing this forces a new resource to be created.
IothubId pulumi.StringPtrInput
// The location where the Kusto Database should be created. Changing this forces a new resource to be created.
Location pulumi.StringPtrInput
// The name of the Kusto IotHub Data Connection to create. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// Specifies the Resource Group where the Kusto Database should exist. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringPtrInput
// Specifies the IotHub Shared Access Policy this data connection will use for ingestion, which must have read permission. Changing this forces a new resource to be created.
SharedAccessPolicyName pulumi.StringPtrInput
}
func (IotHubDataConnectionState) ElementType() reflect.Type {
return reflect.TypeOf((*iotHubDataConnectionState)(nil)).Elem()
}
type iotHubDataConnectionArgs struct {
// Specifies the name of the Kusto Cluster this data connection will be added to. Changing this forces a new resource to be created.
ClusterName string `pulumi:"clusterName"`
// Specifies the IotHub consumer group this data connection will use for ingestion. Changing this forces a new resource to be created.
ConsumerGroup string `pulumi:"consumerGroup"`
// Specifies the name of the Kusto Database this data connection will be added to. Changing this forces a new resource to be created.
DatabaseName string `pulumi:"databaseName"`
// Specifies the System Properties that each IoT Hub message should contain. Changing this forces a new resource to be created.
EventSystemProperties []string `pulumi:"eventSystemProperties"`
// Specifies the resource id of the IotHub this data connection will use for ingestion. Changing this forces a new resource to be created.
IothubId string `pulumi:"iothubId"`
// The location where the Kusto Database should be created. Changing this forces a new resource to be created.
Location *string `pulumi:"location"`
// The name of the Kusto IotHub Data Connection to create. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// Specifies the Resource Group where the Kusto Database should exist. Changing this forces a new resource to be created.
ResourceGroupName string `pulumi:"resourceGroupName"`
// Specifies the IotHub Shared Access Policy this data connection will use for ingestion, which must have read permission. Changing this forces a new resource to be created.
SharedAccessPolicyName string `pulumi:"sharedAccessPolicyName"`
}
// The set of arguments for constructing a IotHubDataConnection resource.
type IotHubDataConnectionArgs struct {
// Specifies the name of the Kusto Cluster this data connection will be added to. Changing this forces a new resource to be created.
ClusterName pulumi.StringInput
// Specifies the IotHub consumer group this data connection will use for ingestion. Changing this forces a new resource to be created.
ConsumerGroup pulumi.StringInput
// Specifies the name of the Kusto Database this data connection will be added to. Changing this forces a new resource to be created.
DatabaseName pulumi.StringInput
// Specifies the System Properties that each IoT Hub message should contain. Changing this forces a new resource to be created.
EventSystemProperties pulumi.StringArrayInput
// Specifies the resource id of the IotHub this data connection will use for ingestion. Changing this forces a new resource to be created.
IothubId pulumi.StringInput
// The location where the Kusto Database should be created. Changing this forces a new resource to be created.
Location pulumi.StringPtrInput
// The name of the Kusto IotHub Data Connection to create. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// Specifies the Resource Group where the Kusto Database should exist. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringInput
// Specifies the IotHub Shared Access Policy this data connection will use for ingestion, which must have read permission. Changing this forces a new resource to be created.
SharedAccessPolicyName pulumi.StringInput
}
func (IotHubDataConnectionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*iotHubDataConnectionArgs)(nil)).Elem()
}
type IotHubDataConnectionInput interface {
pulumi.Input
ToIotHubDataConnectionOutput() IotHubDataConnectionOutput
ToIotHubDataConnectionOutputWithContext(ctx context.Context) IotHubDataConnectionOutput
}
func (*IotHubDataConnection) ElementType() reflect.Type {
return reflect.TypeOf((*IotHubDataConnection)(nil))
}
func (i *IotHubDataConnection) ToIotHubDataConnectionOutput() IotHubDataConnectionOutput {
return i.ToIotHubDataConnectionOutputWithContext(context.Background())
}
func (i *IotHubDataConnection) ToIotHubDataConnectionOutputWithContext(ctx context.Context) IotHubDataConnectionOutput {
return pulumi.ToOutputWithContext(ctx, i).(IotHubDataConnectionOutput)
}
func (i *IotHubDataConnection) ToIotHubDataConnectionPtrOutput() IotHubDataConnectionPtrOutput {
return i.ToIotHubDataConnectionPtrOutputWithContext(context.Background())
}
func (i *IotHubDataConnection) ToIotHubDataConnectionPtrOutputWithContext(ctx context.Context) IotHubDataConnectionPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(IotHubDataConnectionPtrOutput)
}
type IotHubDataConnectionPtrInput interface {
pulumi.Input
ToIotHubDataConnectionPtrOutput() IotHubDataConnectionPtrOutput
ToIotHubDataConnectionPtrOutputWithContext(ctx context.Context) IotHubDataConnectionPtrOutput
}
type iotHubDataConnectionPtrType IotHubDataConnectionArgs
func (*iotHubDataConnectionPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**IotHubDataConnection)(nil))
}
func (i *iotHubDataConnectionPtrType) ToIotHubDataConnectionPtrOutput() IotHubDataConnectionPtrOutput {
return i.ToIotHubDataConnectionPtrOutputWithContext(context.Background())
}
func (i *iotHubDataConnectionPtrType) ToIotHubDataConnectionPtrOutputWithContext(ctx context.Context) IotHubDataConnectionPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(IotHubDataConnectionPtrOutput)
}
// IotHubDataConnectionArrayInput is an input type that accepts IotHubDataConnectionArray and IotHubDataConnectionArrayOutput values.
// You can construct a concrete instance of `IotHubDataConnectionArrayInput` via:
//
// IotHubDataConnectionArray{ IotHubDataConnectionArgs{...} }
type IotHubDataConnectionArrayInput interface {
pulumi.Input
ToIotHubDataConnectionArrayOutput() IotHubDataConnectionArrayOutput
ToIotHubDataConnectionArrayOutputWithContext(context.Context) IotHubDataConnectionArrayOutput
}
type IotHubDataConnectionArray []IotHubDataConnectionInput
func (IotHubDataConnectionArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*IotHubDataConnection)(nil))
}
func (i IotHubDataConnectionArray) ToIotHubDataConnectionArrayOutput() IotHubDataConnectionArrayOutput {
return i.ToIotHubDataConnectionArrayOutputWithContext(context.Background())
}
func (i IotHubDataConnectionArray) ToIotHubDataConnectionArrayOutputWithContext(ctx context.Context) IotHubDataConnectionArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(IotHubDataConnectionArrayOutput)
}
// IotHubDataConnectionMapInput is an input type that accepts IotHubDataConnectionMap and IotHubDataConnectionMapOutput values.
// You can construct a concrete instance of `IotHubDataConnectionMapInput` via:
//
// IotHubDataConnectionMap{ "key": IotHubDataConnectionArgs{...} }
type IotHubDataConnectionMapInput interface {
pulumi.Input
ToIotHubDataConnectionMapOutput() IotHubDataConnectionMapOutput
ToIotHubDataConnectionMapOutputWithContext(context.Context) IotHubDataConnectionMapOutput
}
type IotHubDataConnectionMap map[string]IotHubDataConnectionInput
func (IotHubDataConnectionMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*IotHubDataConnection)(nil))
}
func (i IotHubDataConnectionMap) ToIotHubDataConnectionMapOutput() IotHubDataConnectionMapOutput {
return i.ToIotHubDataConnectionMapOutputWithContext(context.Background())
}
func (i IotHubDataConnectionMap) ToIotHubDataConnectionMapOutputWithContext(ctx context.Context) IotHubDataConnectionMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(IotHubDataConnectionMapOutput)
}
type IotHubDataConnectionOutput struct {
*pulumi.OutputState
}
func (IotHubDataConnectionOutput) ElementType() reflect.Type {
return reflect.TypeOf((*IotHubDataConnection)(nil))
}
func (o IotHubDataConnectionOutput) ToIotHubDataConnectionOutput() IotHubDataConnectionOutput {
return o
}
func (o IotHubDataConnectionOutput) ToIotHubDataConnectionOutputWithContext(ctx context.Context) IotHubDataConnectionOutput {
return o
}
func (o IotHubDataConnectionOutput) ToIotHubDataConnectionPtrOutput() IotHubDataConnectionPtrOutput {
return o.ToIotHubDataConnectionPtrOutputWithContext(context.Background())
}
func (o IotHubDataConnectionOutput) ToIotHubDataConnectionPtrOutputWithContext(ctx context.Context) IotHubDataConnectionPtrOutput {
return o.ApplyT(func(v IotHubDataConnection) *IotHubDataConnection {
return &v
}).(IotHubDataConnectionPtrOutput)
}
type IotHubDataConnectionPtrOutput struct {
*pulumi.OutputState
}
func (IotHubDataConnectionPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**IotHubDataConnection)(nil))
}
func (o IotHubDataConnectionPtrOutput) ToIotHubDataConnectionPtrOutput() IotHubDataConnectionPtrOutput {
return o
}
func (o IotHubDataConnectionPtrOutput) ToIotHubDataConnectionPtrOutputWithContext(ctx context.Context) IotHubDataConnectionPtrOutput {
return o
}
type IotHubDataConnectionArrayOutput struct{ *pulumi.OutputState }
func (IotHubDataConnectionArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]IotHubDataConnection)(nil))
}
func (o IotHubDataConnectionArrayOutput) ToIotHubDataConnectionArrayOutput() IotHubDataConnectionArrayOutput {
return o
}
func (o IotHubDataConnectionArrayOutput) ToIotHubDataConnectionArrayOutputWithContext(ctx context.Context) IotHubDataConnectionArrayOutput {
return o
}
func (o IotHubDataConnectionArrayOutput) Index(i pulumi.IntInput) IotHubDataConnectionOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) IotHubDataConnection {
return vs[0].([]IotHubDataConnection)[vs[1].(int)]
}).(IotHubDataConnectionOutput)
}
type IotHubDataConnectionMapOutput struct{ *pulumi.OutputState }
func (IotHubDataConnectionMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]IotHubDataConnection)(nil))
}
func (o IotHubDataConnectionMapOutput) ToIotHubDataConnectionMapOutput() IotHubDataConnectionMapOutput {
return o
}
func (o IotHubDataConnectionMapOutput) ToIotHubDataConnectionMapOutputWithContext(ctx context.Context) IotHubDataConnectionMapOutput {
return o
}
func (o IotHubDataConnectionMapOutput) MapIndex(k pulumi.StringInput) IotHubDataConnectionOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) IotHubDataConnection {
return vs[0].(map[string]IotHubDataConnection)[vs[1].(string)]
}).(IotHubDataConnectionOutput)
}
func init() {
pulumi.RegisterOutputType(IotHubDataConnectionOutput{})
pulumi.RegisterOutputType(IotHubDataConnectionPtrOutput{})
pulumi.RegisterOutputType(IotHubDataConnectionArrayOutput{})
pulumi.RegisterOutputType(IotHubDataConnectionMapOutput{})
}