/
eventHub.go
146 lines (133 loc) · 7.52 KB
/
eventHub.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
// *** 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! ***
// nolint: lll
package eventhub
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manages a Event Hubs as a nested resource within a Event Hubs namespace.
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/r/eventhub.html.markdown.
type EventHub struct {
pulumi.CustomResourceState
// A `captureDescription` block as defined below.
CaptureDescription EventHubCaptureDescriptionPtrOutput `pulumi:"captureDescription"`
// Specifies the number of days to retain the events for this Event Hub. Needs to be between 1 and 7 days; or 1 day when using a Basic SKU for the parent EventHub Namespace.
MessageRetention pulumi.IntOutput `pulumi:"messageRetention"`
// Specifies the name of the EventHub Namespace resource. Changing this forces a new resource to be created.
Name pulumi.StringOutput `pulumi:"name"`
// Specifies the name of the EventHub Namespace. Changing this forces a new resource to be created.
NamespaceName pulumi.StringOutput `pulumi:"namespaceName"`
// Specifies the current number of shards on the Event Hub. Changing this forces a new resource to be created.
PartitionCount pulumi.IntOutput `pulumi:"partitionCount"`
// The identifiers for partitions created for Event Hubs.
PartitionIds pulumi.StringArrayOutput `pulumi:"partitionIds"`
// The name of the resource group in which the EventHub's parent Namespace exists. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
}
// NewEventHub registers a new resource with the given unique name, arguments, and options.
func NewEventHub(ctx *pulumi.Context,
name string, args *EventHubArgs, opts ...pulumi.ResourceOption) (*EventHub, error) {
if args == nil || args.MessageRetention == nil {
return nil, errors.New("missing required argument 'MessageRetention'")
}
if args == nil || args.NamespaceName == nil {
return nil, errors.New("missing required argument 'NamespaceName'")
}
if args == nil || args.PartitionCount == nil {
return nil, errors.New("missing required argument 'PartitionCount'")
}
if args == nil || args.ResourceGroupName == nil {
return nil, errors.New("missing required argument 'ResourceGroupName'")
}
if args == nil {
args = &EventHubArgs{}
}
var resource EventHub
err := ctx.RegisterResource("azure:eventhub/eventHub:EventHub", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetEventHub gets an existing EventHub 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 GetEventHub(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *EventHubState, opts ...pulumi.ResourceOption) (*EventHub, error) {
var resource EventHub
err := ctx.ReadResource("azure:eventhub/eventHub:EventHub", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering EventHub resources.
type eventHubState struct {
// A `captureDescription` block as defined below.
CaptureDescription *EventHubCaptureDescription `pulumi:"captureDescription"`
// Specifies the number of days to retain the events for this Event Hub. Needs to be between 1 and 7 days; or 1 day when using a Basic SKU for the parent EventHub Namespace.
MessageRetention *int `pulumi:"messageRetention"`
// Specifies the name of the EventHub Namespace resource. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// Specifies the name of the EventHub Namespace. Changing this forces a new resource to be created.
NamespaceName *string `pulumi:"namespaceName"`
// Specifies the current number of shards on the Event Hub. Changing this forces a new resource to be created.
PartitionCount *int `pulumi:"partitionCount"`
// The identifiers for partitions created for Event Hubs.
PartitionIds []string `pulumi:"partitionIds"`
// The name of the resource group in which the EventHub's parent Namespace exists. Changing this forces a new resource to be created.
ResourceGroupName *string `pulumi:"resourceGroupName"`
}
type EventHubState struct {
// A `captureDescription` block as defined below.
CaptureDescription EventHubCaptureDescriptionPtrInput
// Specifies the number of days to retain the events for this Event Hub. Needs to be between 1 and 7 days; or 1 day when using a Basic SKU for the parent EventHub Namespace.
MessageRetention pulumi.IntPtrInput
// Specifies the name of the EventHub Namespace resource. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// Specifies the name of the EventHub Namespace. Changing this forces a new resource to be created.
NamespaceName pulumi.StringPtrInput
// Specifies the current number of shards on the Event Hub. Changing this forces a new resource to be created.
PartitionCount pulumi.IntPtrInput
// The identifiers for partitions created for Event Hubs.
PartitionIds pulumi.StringArrayInput
// The name of the resource group in which the EventHub's parent Namespace exists. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringPtrInput
}
func (EventHubState) ElementType() reflect.Type {
return reflect.TypeOf((*eventHubState)(nil)).Elem()
}
type eventHubArgs struct {
// A `captureDescription` block as defined below.
CaptureDescription *EventHubCaptureDescription `pulumi:"captureDescription"`
// Specifies the number of days to retain the events for this Event Hub. Needs to be between 1 and 7 days; or 1 day when using a Basic SKU for the parent EventHub Namespace.
MessageRetention int `pulumi:"messageRetention"`
// Specifies the name of the EventHub Namespace resource. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// Specifies the name of the EventHub Namespace. Changing this forces a new resource to be created.
NamespaceName string `pulumi:"namespaceName"`
// Specifies the current number of shards on the Event Hub. Changing this forces a new resource to be created.
PartitionCount int `pulumi:"partitionCount"`
// The name of the resource group in which the EventHub's parent Namespace exists. Changing this forces a new resource to be created.
ResourceGroupName string `pulumi:"resourceGroupName"`
}
// The set of arguments for constructing a EventHub resource.
type EventHubArgs struct {
// A `captureDescription` block as defined below.
CaptureDescription EventHubCaptureDescriptionPtrInput
// Specifies the number of days to retain the events for this Event Hub. Needs to be between 1 and 7 days; or 1 day when using a Basic SKU for the parent EventHub Namespace.
MessageRetention pulumi.IntInput
// Specifies the name of the EventHub Namespace resource. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// Specifies the name of the EventHub Namespace. Changing this forces a new resource to be created.
NamespaceName pulumi.StringInput
// Specifies the current number of shards on the Event Hub. Changing this forces a new resource to be created.
PartitionCount pulumi.IntInput
// The name of the resource group in which the EventHub's parent Namespace exists. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringInput
}
func (EventHubArgs) ElementType() reflect.Type {
return reflect.TypeOf((*eventHubArgs)(nil)).Elem()
}