generated from pulumi/pulumi-tf-provider-boilerplate
/
table.go
441 lines (386 loc) · 17.9 KB
/
table.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
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package ots
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides an OTS table resource.
//
// > **NOTE:** From Provider version 1.10.0, the provider field 'ots_instance_name' has been deprecated and
// you should use resource alicloud_ots_table's new field 'instance_name' and 'table_name' to re-import this resource.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-alicloud/sdk/go/alicloud/ots"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
// "github.com/rhysmdnz/pulumi-alicloud/sdk/go/alicloud/ots"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// cfg := config.New(ctx, "")
// name := "terraformtest"
// if param := cfg.Get("name"); param != "" {
// name = param
// }
// foo, err := ots.NewInstance(ctx, "foo", &ots.InstanceArgs{
// Description: pulumi.String(name),
// AccessedBy: pulumi.String("Any"),
// Tags: pulumi.AnyMap{
// "Created": pulumi.Any("TF"),
// "For": pulumi.Any("acceptance test"),
// },
// })
// if err != nil {
// return err
// }
// _, err = ots.NewTable(ctx, "basic", &ots.TableArgs{
// InstanceName: foo.Name,
// TableName: pulumi.String(name),
// PrimaryKeys: ots.TablePrimaryKeyArray{
// &ots.TablePrimaryKeyArgs{
// Name: pulumi.String("pk1"),
// Type: pulumi.String("Integer"),
// },
// &ots.TablePrimaryKeyArgs{
// Name: pulumi.String("pk2"),
// Type: pulumi.String("String"),
// },
// &ots.TablePrimaryKeyArgs{
// Name: pulumi.String("pk3"),
// Type: pulumi.String("Binary"),
// },
// },
// DefinedColumns: ots.TableDefinedColumnArray{
// &ots.TableDefinedColumnArgs{
// Name: pulumi.String("col1"),
// Type: pulumi.String("Integer"),
// },
// &ots.TableDefinedColumnArgs{
// Name: pulumi.String("col2"),
// Type: pulumi.String("String"),
// },
// &ots.TableDefinedColumnArgs{
// Name: pulumi.String("col3"),
// Type: pulumi.String("Binary"),
// },
// },
// TimeToLive: -1,
// MaxVersion: pulumi.Int(1),
// DeviationCellVersionInSec: pulumi.String("1"),
// EnableSse: pulumi.Bool(true),
// SseKeyType: pulumi.String("SSE_KMS_SERVICE"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// OTS table can be imported using id, e.g.
//
// ```sh
//
// $ pulumi import alicloud:ots/table:Table table my-ots:ots_table
//
// ```
type Table struct {
pulumi.CustomResourceState
// The property of `TableMeta` which indicates the structure information of a table. It describes the attribute value of defined column. The number of `definedColumn` should not be more than 32.
DefinedColumns TableDefinedColumnArrayOutput `pulumi:"definedColumns"`
// The max version offset of the table. The valid value is 1-9223372036854775807. Defaults to 86400.
DeviationCellVersionInSec pulumi.StringPtrOutput `pulumi:"deviationCellVersionInSec"`
// Whether enable OTS server side encryption. Default value is false.
EnableSse pulumi.BoolPtrOutput `pulumi:"enableSse"`
// The name of the OTS instance in which table will located.
InstanceName pulumi.StringOutput `pulumi:"instanceName"`
// The maximum number of versions stored in this table. The valid value is 1-2147483647.
MaxVersion pulumi.IntOutput `pulumi:"maxVersion"`
// The property of `TableMeta` which indicates the structure information of a table. It describes the attribute value of primary key. The number of `primaryKey` should not be less than one and not be more than four.
PrimaryKeys TablePrimaryKeyArrayOutput `pulumi:"primaryKeys"`
// The key type of OTS server side encryption. Only `SSE_KMS_SERVICE` is allowed.
SseKeyType pulumi.StringPtrOutput `pulumi:"sseKeyType"`
// The table name of the OTS instance. If changed, a new table would be created.
TableName pulumi.StringOutput `pulumi:"tableName"`
// The retention time of data stored in this table (unit: second). The value maximum is 2147483647 and -1 means never expired.
TimeToLive pulumi.IntOutput `pulumi:"timeToLive"`
}
// NewTable registers a new resource with the given unique name, arguments, and options.
func NewTable(ctx *pulumi.Context,
name string, args *TableArgs, opts ...pulumi.ResourceOption) (*Table, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.InstanceName == nil {
return nil, errors.New("invalid value for required argument 'InstanceName'")
}
if args.MaxVersion == nil {
return nil, errors.New("invalid value for required argument 'MaxVersion'")
}
if args.PrimaryKeys == nil {
return nil, errors.New("invalid value for required argument 'PrimaryKeys'")
}
if args.TableName == nil {
return nil, errors.New("invalid value for required argument 'TableName'")
}
if args.TimeToLive == nil {
return nil, errors.New("invalid value for required argument 'TimeToLive'")
}
opts = pkgResourceDefaultOpts(opts)
var resource Table
err := ctx.RegisterResource("alicloud:ots/table:Table", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTable gets an existing Table 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 GetTable(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TableState, opts ...pulumi.ResourceOption) (*Table, error) {
var resource Table
err := ctx.ReadResource("alicloud:ots/table:Table", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Table resources.
type tableState struct {
// The property of `TableMeta` which indicates the structure information of a table. It describes the attribute value of defined column. The number of `definedColumn` should not be more than 32.
DefinedColumns []TableDefinedColumn `pulumi:"definedColumns"`
// The max version offset of the table. The valid value is 1-9223372036854775807. Defaults to 86400.
DeviationCellVersionInSec *string `pulumi:"deviationCellVersionInSec"`
// Whether enable OTS server side encryption. Default value is false.
EnableSse *bool `pulumi:"enableSse"`
// The name of the OTS instance in which table will located.
InstanceName *string `pulumi:"instanceName"`
// The maximum number of versions stored in this table. The valid value is 1-2147483647.
MaxVersion *int `pulumi:"maxVersion"`
// The property of `TableMeta` which indicates the structure information of a table. It describes the attribute value of primary key. The number of `primaryKey` should not be less than one and not be more than four.
PrimaryKeys []TablePrimaryKey `pulumi:"primaryKeys"`
// The key type of OTS server side encryption. Only `SSE_KMS_SERVICE` is allowed.
SseKeyType *string `pulumi:"sseKeyType"`
// The table name of the OTS instance. If changed, a new table would be created.
TableName *string `pulumi:"tableName"`
// The retention time of data stored in this table (unit: second). The value maximum is 2147483647 and -1 means never expired.
TimeToLive *int `pulumi:"timeToLive"`
}
type TableState struct {
// The property of `TableMeta` which indicates the structure information of a table. It describes the attribute value of defined column. The number of `definedColumn` should not be more than 32.
DefinedColumns TableDefinedColumnArrayInput
// The max version offset of the table. The valid value is 1-9223372036854775807. Defaults to 86400.
DeviationCellVersionInSec pulumi.StringPtrInput
// Whether enable OTS server side encryption. Default value is false.
EnableSse pulumi.BoolPtrInput
// The name of the OTS instance in which table will located.
InstanceName pulumi.StringPtrInput
// The maximum number of versions stored in this table. The valid value is 1-2147483647.
MaxVersion pulumi.IntPtrInput
// The property of `TableMeta` which indicates the structure information of a table. It describes the attribute value of primary key. The number of `primaryKey` should not be less than one and not be more than four.
PrimaryKeys TablePrimaryKeyArrayInput
// The key type of OTS server side encryption. Only `SSE_KMS_SERVICE` is allowed.
SseKeyType pulumi.StringPtrInput
// The table name of the OTS instance. If changed, a new table would be created.
TableName pulumi.StringPtrInput
// The retention time of data stored in this table (unit: second). The value maximum is 2147483647 and -1 means never expired.
TimeToLive pulumi.IntPtrInput
}
func (TableState) ElementType() reflect.Type {
return reflect.TypeOf((*tableState)(nil)).Elem()
}
type tableArgs struct {
// The property of `TableMeta` which indicates the structure information of a table. It describes the attribute value of defined column. The number of `definedColumn` should not be more than 32.
DefinedColumns []TableDefinedColumn `pulumi:"definedColumns"`
// The max version offset of the table. The valid value is 1-9223372036854775807. Defaults to 86400.
DeviationCellVersionInSec *string `pulumi:"deviationCellVersionInSec"`
// Whether enable OTS server side encryption. Default value is false.
EnableSse *bool `pulumi:"enableSse"`
// The name of the OTS instance in which table will located.
InstanceName string `pulumi:"instanceName"`
// The maximum number of versions stored in this table. The valid value is 1-2147483647.
MaxVersion int `pulumi:"maxVersion"`
// The property of `TableMeta` which indicates the structure information of a table. It describes the attribute value of primary key. The number of `primaryKey` should not be less than one and not be more than four.
PrimaryKeys []TablePrimaryKey `pulumi:"primaryKeys"`
// The key type of OTS server side encryption. Only `SSE_KMS_SERVICE` is allowed.
SseKeyType *string `pulumi:"sseKeyType"`
// The table name of the OTS instance. If changed, a new table would be created.
TableName string `pulumi:"tableName"`
// The retention time of data stored in this table (unit: second). The value maximum is 2147483647 and -1 means never expired.
TimeToLive int `pulumi:"timeToLive"`
}
// The set of arguments for constructing a Table resource.
type TableArgs struct {
// The property of `TableMeta` which indicates the structure information of a table. It describes the attribute value of defined column. The number of `definedColumn` should not be more than 32.
DefinedColumns TableDefinedColumnArrayInput
// The max version offset of the table. The valid value is 1-9223372036854775807. Defaults to 86400.
DeviationCellVersionInSec pulumi.StringPtrInput
// Whether enable OTS server side encryption. Default value is false.
EnableSse pulumi.BoolPtrInput
// The name of the OTS instance in which table will located.
InstanceName pulumi.StringInput
// The maximum number of versions stored in this table. The valid value is 1-2147483647.
MaxVersion pulumi.IntInput
// The property of `TableMeta` which indicates the structure information of a table. It describes the attribute value of primary key. The number of `primaryKey` should not be less than one and not be more than four.
PrimaryKeys TablePrimaryKeyArrayInput
// The key type of OTS server side encryption. Only `SSE_KMS_SERVICE` is allowed.
SseKeyType pulumi.StringPtrInput
// The table name of the OTS instance. If changed, a new table would be created.
TableName pulumi.StringInput
// The retention time of data stored in this table (unit: second). The value maximum is 2147483647 and -1 means never expired.
TimeToLive pulumi.IntInput
}
func (TableArgs) ElementType() reflect.Type {
return reflect.TypeOf((*tableArgs)(nil)).Elem()
}
type TableInput interface {
pulumi.Input
ToTableOutput() TableOutput
ToTableOutputWithContext(ctx context.Context) TableOutput
}
func (*Table) ElementType() reflect.Type {
return reflect.TypeOf((**Table)(nil)).Elem()
}
func (i *Table) ToTableOutput() TableOutput {
return i.ToTableOutputWithContext(context.Background())
}
func (i *Table) ToTableOutputWithContext(ctx context.Context) TableOutput {
return pulumi.ToOutputWithContext(ctx, i).(TableOutput)
}
// TableArrayInput is an input type that accepts TableArray and TableArrayOutput values.
// You can construct a concrete instance of `TableArrayInput` via:
//
// TableArray{ TableArgs{...} }
type TableArrayInput interface {
pulumi.Input
ToTableArrayOutput() TableArrayOutput
ToTableArrayOutputWithContext(context.Context) TableArrayOutput
}
type TableArray []TableInput
func (TableArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Table)(nil)).Elem()
}
func (i TableArray) ToTableArrayOutput() TableArrayOutput {
return i.ToTableArrayOutputWithContext(context.Background())
}
func (i TableArray) ToTableArrayOutputWithContext(ctx context.Context) TableArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(TableArrayOutput)
}
// TableMapInput is an input type that accepts TableMap and TableMapOutput values.
// You can construct a concrete instance of `TableMapInput` via:
//
// TableMap{ "key": TableArgs{...} }
type TableMapInput interface {
pulumi.Input
ToTableMapOutput() TableMapOutput
ToTableMapOutputWithContext(context.Context) TableMapOutput
}
type TableMap map[string]TableInput
func (TableMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Table)(nil)).Elem()
}
func (i TableMap) ToTableMapOutput() TableMapOutput {
return i.ToTableMapOutputWithContext(context.Background())
}
func (i TableMap) ToTableMapOutputWithContext(ctx context.Context) TableMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(TableMapOutput)
}
type TableOutput struct{ *pulumi.OutputState }
func (TableOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Table)(nil)).Elem()
}
func (o TableOutput) ToTableOutput() TableOutput {
return o
}
func (o TableOutput) ToTableOutputWithContext(ctx context.Context) TableOutput {
return o
}
// The property of `TableMeta` which indicates the structure information of a table. It describes the attribute value of defined column. The number of `definedColumn` should not be more than 32.
func (o TableOutput) DefinedColumns() TableDefinedColumnArrayOutput {
return o.ApplyT(func(v *Table) TableDefinedColumnArrayOutput { return v.DefinedColumns }).(TableDefinedColumnArrayOutput)
}
// The max version offset of the table. The valid value is 1-9223372036854775807. Defaults to 86400.
func (o TableOutput) DeviationCellVersionInSec() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Table) pulumi.StringPtrOutput { return v.DeviationCellVersionInSec }).(pulumi.StringPtrOutput)
}
// Whether enable OTS server side encryption. Default value is false.
func (o TableOutput) EnableSse() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *Table) pulumi.BoolPtrOutput { return v.EnableSse }).(pulumi.BoolPtrOutput)
}
// The name of the OTS instance in which table will located.
func (o TableOutput) InstanceName() pulumi.StringOutput {
return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.InstanceName }).(pulumi.StringOutput)
}
// The maximum number of versions stored in this table. The valid value is 1-2147483647.
func (o TableOutput) MaxVersion() pulumi.IntOutput {
return o.ApplyT(func(v *Table) pulumi.IntOutput { return v.MaxVersion }).(pulumi.IntOutput)
}
// The property of `TableMeta` which indicates the structure information of a table. It describes the attribute value of primary key. The number of `primaryKey` should not be less than one and not be more than four.
func (o TableOutput) PrimaryKeys() TablePrimaryKeyArrayOutput {
return o.ApplyT(func(v *Table) TablePrimaryKeyArrayOutput { return v.PrimaryKeys }).(TablePrimaryKeyArrayOutput)
}
// The key type of OTS server side encryption. Only `SSE_KMS_SERVICE` is allowed.
func (o TableOutput) SseKeyType() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Table) pulumi.StringPtrOutput { return v.SseKeyType }).(pulumi.StringPtrOutput)
}
// The table name of the OTS instance. If changed, a new table would be created.
func (o TableOutput) TableName() pulumi.StringOutput {
return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.TableName }).(pulumi.StringOutput)
}
// The retention time of data stored in this table (unit: second). The value maximum is 2147483647 and -1 means never expired.
func (o TableOutput) TimeToLive() pulumi.IntOutput {
return o.ApplyT(func(v *Table) pulumi.IntOutput { return v.TimeToLive }).(pulumi.IntOutput)
}
type TableArrayOutput struct{ *pulumi.OutputState }
func (TableArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Table)(nil)).Elem()
}
func (o TableArrayOutput) ToTableArrayOutput() TableArrayOutput {
return o
}
func (o TableArrayOutput) ToTableArrayOutputWithContext(ctx context.Context) TableArrayOutput {
return o
}
func (o TableArrayOutput) Index(i pulumi.IntInput) TableOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Table {
return vs[0].([]*Table)[vs[1].(int)]
}).(TableOutput)
}
type TableMapOutput struct{ *pulumi.OutputState }
func (TableMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Table)(nil)).Elem()
}
func (o TableMapOutput) ToTableMapOutput() TableMapOutput {
return o
}
func (o TableMapOutput) ToTableMapOutputWithContext(ctx context.Context) TableMapOutput {
return o
}
func (o TableMapOutput) MapIndex(k pulumi.StringInput) TableOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Table {
return vs[0].(map[string]*Table)[vs[1].(string)]
}).(TableOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TableInput)(nil)).Elem(), &Table{})
pulumi.RegisterInputType(reflect.TypeOf((*TableArrayInput)(nil)).Elem(), TableArray{})
pulumi.RegisterInputType(reflect.TypeOf((*TableMapInput)(nil)).Elem(), TableMap{})
pulumi.RegisterOutputType(TableOutput{})
pulumi.RegisterOutputType(TableArrayOutput{})
pulumi.RegisterOutputType(TableMapOutput{})
}