-
Notifications
You must be signed in to change notification settings - Fork 51
/
eventhubDataConnection.go
265 lines (252 loc) · 13.7 KB
/
eventhubDataConnection.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
// *** 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 (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Manages a Kusto (also known as Azure Data Explorer) EventHub 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/eventhub"
// "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 {
// rg, err := core.NewResourceGroup(ctx, "rg", &core.ResourceGroupArgs{
// Location: pulumi.String("East US"),
// })
// if err != nil {
// return err
// }
// cluster, err := kusto.NewCluster(ctx, "cluster", &kusto.ClusterArgs{
// Location: rg.Location,
// ResourceGroupName: rg.Name,
// Sku: &kusto.ClusterSkuArgs{
// Name: pulumi.String("Standard_D13_v2"),
// Capacity: pulumi.Int(2),
// },
// })
// if err != nil {
// return err
// }
// database, err := kusto.NewDatabase(ctx, "database", &kusto.DatabaseArgs{
// ResourceGroupName: rg.Name,
// Location: rg.Location,
// ClusterName: cluster.Name,
// HotCachePeriod: pulumi.String("P7D"),
// SoftDeletePeriod: pulumi.String("P31D"),
// })
// if err != nil {
// return err
// }
// eventhubNs, err := eventhub.NewEventHubNamespace(ctx, "eventhubNs", &eventhub.EventHubNamespaceArgs{
// Location: rg.Location,
// ResourceGroupName: rg.Name,
// Sku: pulumi.String("Standard"),
// })
// if err != nil {
// return err
// }
// eventhub, err := eventhub.NewEventHub(ctx, "eventhub", &eventhub.EventHubArgs{
// NamespaceName: eventhubNs.Name,
// ResourceGroupName: rg.Name,
// PartitionCount: pulumi.Int(1),
// MessageRetention: pulumi.Int(1),
// })
// if err != nil {
// return err
// }
// consumerGroup, err := eventhub.NewConsumerGroup(ctx, "consumerGroup", &eventhub.ConsumerGroupArgs{
// NamespaceName: eventhubNs.Name,
// EventhubName: eventhub.Name,
// ResourceGroupName: rg.Name,
// })
// if err != nil {
// return err
// }
// _, err = kusto.NewEventhubDataConnection(ctx, "eventhubConnection", &kusto.EventhubDataConnectionArgs{
// ResourceGroupName: rg.Name,
// Location: rg.Location,
// ClusterName: cluster.Name,
// DatabaseName: database.Name,
// EventhubId: pulumi.Any(azurerm_eventhub.Evenhub.Id),
// ConsumerGroup: consumerGroup.Name,
// TableName: pulumi.String("my-table"),
// MappingRuleName: pulumi.String("my-table-mapping"),
// DataFormat: pulumi.String("JSON"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type EventhubDataConnection 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 EventHub 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 data format of the EventHub messages. Allowed values: `AVRO`, `CSV`, `JSON`, `MULTIJSON`, `PSV`, `RAW`, `SCSV`, `SINGLEJSON`, `SOHSV`, `TSV` and `TXT`
DataFormat pulumi.StringPtrOutput `pulumi:"dataFormat"`
// 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 resource id of the EventHub this data connection will use for ingestion. Changing this forces a new resource to be created.
EventhubId pulumi.StringOutput `pulumi:"eventhubId"`
// The location where the Kusto Database should be created. Changing this forces a new resource to be created.
Location pulumi.StringOutput `pulumi:"location"`
// Specifies the mapping rule used for the message ingestion. Mapping rule must exist before resource is created.
MappingRuleName pulumi.StringPtrOutput `pulumi:"mappingRuleName"`
// The name of the Kusto EventHub 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 target table name used for the message ingestion. Table must exist before resource is created.
TableName pulumi.StringPtrOutput `pulumi:"tableName"`
}
// NewEventhubDataConnection registers a new resource with the given unique name, arguments, and options.
func NewEventhubDataConnection(ctx *pulumi.Context,
name string, args *EventhubDataConnectionArgs, opts ...pulumi.ResourceOption) (*EventhubDataConnection, error) {
if args == nil || args.ClusterName == nil {
return nil, errors.New("missing required argument 'ClusterName'")
}
if args == nil || args.ConsumerGroup == nil {
return nil, errors.New("missing required argument 'ConsumerGroup'")
}
if args == nil || args.DatabaseName == nil {
return nil, errors.New("missing required argument 'DatabaseName'")
}
if args == nil || args.EventhubId == nil {
return nil, errors.New("missing required argument 'EventhubId'")
}
if args == nil || args.ResourceGroupName == nil {
return nil, errors.New("missing required argument 'ResourceGroupName'")
}
if args == nil {
args = &EventhubDataConnectionArgs{}
}
var resource EventhubDataConnection
err := ctx.RegisterResource("azure:kusto/eventhubDataConnection:EventhubDataConnection", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetEventhubDataConnection gets an existing EventhubDataConnection 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 GetEventhubDataConnection(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *EventhubDataConnectionState, opts ...pulumi.ResourceOption) (*EventhubDataConnection, error) {
var resource EventhubDataConnection
err := ctx.ReadResource("azure:kusto/eventhubDataConnection:EventhubDataConnection", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering EventhubDataConnection resources.
type eventhubDataConnectionState 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 EventHub consumer group this data connection will use for ingestion. Changing this forces a new resource to be created.
ConsumerGroup *string `pulumi:"consumerGroup"`
// Specifies the data format of the EventHub messages. Allowed values: `AVRO`, `CSV`, `JSON`, `MULTIJSON`, `PSV`, `RAW`, `SCSV`, `SINGLEJSON`, `SOHSV`, `TSV` and `TXT`
DataFormat *string `pulumi:"dataFormat"`
// 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 resource id of the EventHub this data connection will use for ingestion. Changing this forces a new resource to be created.
EventhubId *string `pulumi:"eventhubId"`
// The location where the Kusto Database should be created. Changing this forces a new resource to be created.
Location *string `pulumi:"location"`
// Specifies the mapping rule used for the message ingestion. Mapping rule must exist before resource is created.
MappingRuleName *string `pulumi:"mappingRuleName"`
// The name of the Kusto EventHub 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 target table name used for the message ingestion. Table must exist before resource is created.
TableName *string `pulumi:"tableName"`
}
type EventhubDataConnectionState 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 EventHub consumer group this data connection will use for ingestion. Changing this forces a new resource to be created.
ConsumerGroup pulumi.StringPtrInput
// Specifies the data format of the EventHub messages. Allowed values: `AVRO`, `CSV`, `JSON`, `MULTIJSON`, `PSV`, `RAW`, `SCSV`, `SINGLEJSON`, `SOHSV`, `TSV` and `TXT`
DataFormat 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 resource id of the EventHub this data connection will use for ingestion. Changing this forces a new resource to be created.
EventhubId pulumi.StringPtrInput
// The location where the Kusto Database should be created. Changing this forces a new resource to be created.
Location pulumi.StringPtrInput
// Specifies the mapping rule used for the message ingestion. Mapping rule must exist before resource is created.
MappingRuleName pulumi.StringPtrInput
// The name of the Kusto EventHub 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 target table name used for the message ingestion. Table must exist before resource is created.
TableName pulumi.StringPtrInput
}
func (EventhubDataConnectionState) ElementType() reflect.Type {
return reflect.TypeOf((*eventhubDataConnectionState)(nil)).Elem()
}
type eventhubDataConnectionArgs 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 EventHub consumer group this data connection will use for ingestion. Changing this forces a new resource to be created.
ConsumerGroup string `pulumi:"consumerGroup"`
// Specifies the data format of the EventHub messages. Allowed values: `AVRO`, `CSV`, `JSON`, `MULTIJSON`, `PSV`, `RAW`, `SCSV`, `SINGLEJSON`, `SOHSV`, `TSV` and `TXT`
DataFormat *string `pulumi:"dataFormat"`
// 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 resource id of the EventHub this data connection will use for ingestion. Changing this forces a new resource to be created.
EventhubId string `pulumi:"eventhubId"`
// The location where the Kusto Database should be created. Changing this forces a new resource to be created.
Location *string `pulumi:"location"`
// Specifies the mapping rule used for the message ingestion. Mapping rule must exist before resource is created.
MappingRuleName *string `pulumi:"mappingRuleName"`
// The name of the Kusto EventHub 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 target table name used for the message ingestion. Table must exist before resource is created.
TableName *string `pulumi:"tableName"`
}
// The set of arguments for constructing a EventhubDataConnection resource.
type EventhubDataConnectionArgs 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 EventHub consumer group this data connection will use for ingestion. Changing this forces a new resource to be created.
ConsumerGroup pulumi.StringInput
// Specifies the data format of the EventHub messages. Allowed values: `AVRO`, `CSV`, `JSON`, `MULTIJSON`, `PSV`, `RAW`, `SCSV`, `SINGLEJSON`, `SOHSV`, `TSV` and `TXT`
DataFormat 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.StringInput
// Specifies the resource id of the EventHub this data connection will use for ingestion. Changing this forces a new resource to be created.
EventhubId pulumi.StringInput
// The location where the Kusto Database should be created. Changing this forces a new resource to be created.
Location pulumi.StringPtrInput
// Specifies the mapping rule used for the message ingestion. Mapping rule must exist before resource is created.
MappingRuleName pulumi.StringPtrInput
// The name of the Kusto EventHub 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 target table name used for the message ingestion. Table must exist before resource is created.
TableName pulumi.StringPtrInput
}
func (EventhubDataConnectionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*eventhubDataConnectionArgs)(nil)).Elem()
}