-
Notifications
You must be signed in to change notification settings - Fork 5
/
topic.go
205 lines (192 loc) · 9.69 KB
/
topic.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
// *** 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 datahub
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// The topic is the basic unit of Datahub data source and is used to define one kind of data or stream. It contains a set of subscriptions. You can manage the datahub source of an application by using topics. [Refer to details](https://help.aliyun.com/document_detail/47440.html).
//
// ## Example Usage
//
// Basic Usage
//
// - BLob Topic
// resource "alicloud_datahub_topic" "example" {
// name = "tf_datahub_topic"
// project_name = "tf_datahub_project"
// record_type = "BLOB"
// shard_count = 3
// life_cycle = 7
// comment = "created by terraform"
// }
//
// resource "alicloud_datahub_topic" "example" {
// name = "tf_datahub_topic"
// project_name = "tf_datahub_project"
// record_type = "TUPLE"
// record_schema = {
// bigint_field = "BIGINT"
// timestamp_field = "TIMESTAMP"
// string_field = "STRING"
// double_field = "DOUBLE"
// boolean_field = "BOOLEAN"
// }
// shard_count = 3
// life_cycle = 7
// comment = "created by terraform"
// }
type Topic struct {
pulumi.CustomResourceState
// Comment of the datahub topic. It cannot be longer than 255 characters.
Comment pulumi.StringPtrOutput `pulumi:"comment"`
// Create time of the datahub topic. It is a human-readable string rather than 64-bits UTC.
CreateTime pulumi.StringOutput `pulumi:"createTime"`
// Last modify time of the datahub topic. It is the same as *create_time* at the beginning. It is also a human-readable string rather than 64-bits UTC.
LastModifyTime pulumi.StringOutput `pulumi:"lastModifyTime"`
// How many days this topic lives. The permitted range of values is [1, 7]. The default value is 3.
LifeCycle pulumi.IntPtrOutput `pulumi:"lifeCycle"`
// The name of the datahub topic. Its length is limited to 1-128 and only characters such as letters, digits and '_' are allowed. It is case-insensitive.
Name pulumi.StringOutput `pulumi:"name"`
// The name of the datahub project that this topic belongs to. It is case-insensitive.
ProjectName pulumi.StringOutput `pulumi:"projectName"`
// Schema of this topic, required only for TUPLE topic. Supported data types (case-insensitive) are:
// - BIGINT
// - STRING
// - BOOLEAN
// - DOUBLE
// - TIMESTAMP
RecordSchema pulumi.MapOutput `pulumi:"recordSchema"`
// The type of this topic. Its value must be one of {BLOB, TUPLE}. For BLOB topic, data will be organized as binary and encoded by BASE64. For TUPLE topic, data has fixed schema. The default value is "TUPLE" with a schema {STRING}.
RecordType pulumi.StringPtrOutput `pulumi:"recordType"`
// The number of shards this topic contains. The permitted range of values is [1, 10]. The default value is 1.
ShardCount pulumi.IntPtrOutput `pulumi:"shardCount"`
}
// NewTopic registers a new resource with the given unique name, arguments, and options.
func NewTopic(ctx *pulumi.Context,
name string, args *TopicArgs, opts ...pulumi.ResourceOption) (*Topic, error) {
if args == nil || args.ProjectName == nil {
return nil, errors.New("missing required argument 'ProjectName'")
}
if args == nil {
args = &TopicArgs{}
}
var resource Topic
err := ctx.RegisterResource("alicloud:datahub/topic:Topic", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTopic gets an existing Topic 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 GetTopic(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TopicState, opts ...pulumi.ResourceOption) (*Topic, error) {
var resource Topic
err := ctx.ReadResource("alicloud:datahub/topic:Topic", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Topic resources.
type topicState struct {
// Comment of the datahub topic. It cannot be longer than 255 characters.
Comment *string `pulumi:"comment"`
// Create time of the datahub topic. It is a human-readable string rather than 64-bits UTC.
CreateTime *string `pulumi:"createTime"`
// Last modify time of the datahub topic. It is the same as *create_time* at the beginning. It is also a human-readable string rather than 64-bits UTC.
LastModifyTime *string `pulumi:"lastModifyTime"`
// How many days this topic lives. The permitted range of values is [1, 7]. The default value is 3.
LifeCycle *int `pulumi:"lifeCycle"`
// The name of the datahub topic. Its length is limited to 1-128 and only characters such as letters, digits and '_' are allowed. It is case-insensitive.
Name *string `pulumi:"name"`
// The name of the datahub project that this topic belongs to. It is case-insensitive.
ProjectName *string `pulumi:"projectName"`
// Schema of this topic, required only for TUPLE topic. Supported data types (case-insensitive) are:
// - BIGINT
// - STRING
// - BOOLEAN
// - DOUBLE
// - TIMESTAMP
RecordSchema map[string]interface{} `pulumi:"recordSchema"`
// The type of this topic. Its value must be one of {BLOB, TUPLE}. For BLOB topic, data will be organized as binary and encoded by BASE64. For TUPLE topic, data has fixed schema. The default value is "TUPLE" with a schema {STRING}.
RecordType *string `pulumi:"recordType"`
// The number of shards this topic contains. The permitted range of values is [1, 10]. The default value is 1.
ShardCount *int `pulumi:"shardCount"`
}
type TopicState struct {
// Comment of the datahub topic. It cannot be longer than 255 characters.
Comment pulumi.StringPtrInput
// Create time of the datahub topic. It is a human-readable string rather than 64-bits UTC.
CreateTime pulumi.StringPtrInput
// Last modify time of the datahub topic. It is the same as *create_time* at the beginning. It is also a human-readable string rather than 64-bits UTC.
LastModifyTime pulumi.StringPtrInput
// How many days this topic lives. The permitted range of values is [1, 7]. The default value is 3.
LifeCycle pulumi.IntPtrInput
// The name of the datahub topic. Its length is limited to 1-128 and only characters such as letters, digits and '_' are allowed. It is case-insensitive.
Name pulumi.StringPtrInput
// The name of the datahub project that this topic belongs to. It is case-insensitive.
ProjectName pulumi.StringPtrInput
// Schema of this topic, required only for TUPLE topic. Supported data types (case-insensitive) are:
// - BIGINT
// - STRING
// - BOOLEAN
// - DOUBLE
// - TIMESTAMP
RecordSchema pulumi.MapInput
// The type of this topic. Its value must be one of {BLOB, TUPLE}. For BLOB topic, data will be organized as binary and encoded by BASE64. For TUPLE topic, data has fixed schema. The default value is "TUPLE" with a schema {STRING}.
RecordType pulumi.StringPtrInput
// The number of shards this topic contains. The permitted range of values is [1, 10]. The default value is 1.
ShardCount pulumi.IntPtrInput
}
func (TopicState) ElementType() reflect.Type {
return reflect.TypeOf((*topicState)(nil)).Elem()
}
type topicArgs struct {
// Comment of the datahub topic. It cannot be longer than 255 characters.
Comment *string `pulumi:"comment"`
// How many days this topic lives. The permitted range of values is [1, 7]. The default value is 3.
LifeCycle *int `pulumi:"lifeCycle"`
// The name of the datahub topic. Its length is limited to 1-128 and only characters such as letters, digits and '_' are allowed. It is case-insensitive.
Name *string `pulumi:"name"`
// The name of the datahub project that this topic belongs to. It is case-insensitive.
ProjectName string `pulumi:"projectName"`
// Schema of this topic, required only for TUPLE topic. Supported data types (case-insensitive) are:
// - BIGINT
// - STRING
// - BOOLEAN
// - DOUBLE
// - TIMESTAMP
RecordSchema map[string]interface{} `pulumi:"recordSchema"`
// The type of this topic. Its value must be one of {BLOB, TUPLE}. For BLOB topic, data will be organized as binary and encoded by BASE64. For TUPLE topic, data has fixed schema. The default value is "TUPLE" with a schema {STRING}.
RecordType *string `pulumi:"recordType"`
// The number of shards this topic contains. The permitted range of values is [1, 10]. The default value is 1.
ShardCount *int `pulumi:"shardCount"`
}
// The set of arguments for constructing a Topic resource.
type TopicArgs struct {
// Comment of the datahub topic. It cannot be longer than 255 characters.
Comment pulumi.StringPtrInput
// How many days this topic lives. The permitted range of values is [1, 7]. The default value is 3.
LifeCycle pulumi.IntPtrInput
// The name of the datahub topic. Its length is limited to 1-128 and only characters such as letters, digits and '_' are allowed. It is case-insensitive.
Name pulumi.StringPtrInput
// The name of the datahub project that this topic belongs to. It is case-insensitive.
ProjectName pulumi.StringInput
// Schema of this topic, required only for TUPLE topic. Supported data types (case-insensitive) are:
// - BIGINT
// - STRING
// - BOOLEAN
// - DOUBLE
// - TIMESTAMP
RecordSchema pulumi.MapInput
// The type of this topic. Its value must be one of {BLOB, TUPLE}. For BLOB topic, data will be organized as binary and encoded by BASE64. For TUPLE topic, data has fixed schema. The default value is "TUPLE" with a schema {STRING}.
RecordType pulumi.StringPtrInput
// The number of shards this topic contains. The permitted range of values is [1, 10]. The default value is 1.
ShardCount pulumi.IntPtrInput
}
func (TopicArgs) ElementType() reflect.Type {
return reflect.TypeOf((*topicArgs)(nil)).Elem()
}