generated from pulumi/pulumi-tf-provider-boilerplate
/
externalTable.go
466 lines (405 loc) · 18.3 KB
/
externalTable.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
461
462
463
464
465
466
// *** 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 snowflake
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-snowflake/sdk/go/snowflake"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := snowflake.NewExternalTable(ctx, "externalTable", &snowflake.ExternalTableArgs{
// Columns: ExternalTableColumnArray{
// &ExternalTableColumnArgs{
// Name: pulumi.String("id"),
// Type: pulumi.String("int"),
// },
// &ExternalTableColumnArgs{
// Name: pulumi.String("data"),
// Type: pulumi.String("text"),
// },
// },
// Comment: pulumi.String("External table"),
// Database: pulumi.String("db"),
// Schema: pulumi.String("schema"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// # format is database name | schema name | external table name
//
// ```sh
// $ pulumi import snowflake:index/externalTable:ExternalTable example 'dbName|schemaName|externalTableName'
// ```
type ExternalTable struct {
pulumi.CustomResourceState
// Specifies whether to automatically refresh the external table metadata once, immediately after the external table is created.
AutoRefresh pulumi.BoolPtrOutput `pulumi:"autoRefresh"`
// Specifies the aws sns topic for the external table.
AwsSnsTopic pulumi.StringPtrOutput `pulumi:"awsSnsTopic"`
// Definitions of a column to create in the external table. Minimum one required.
Columns ExternalTableColumnArrayOutput `pulumi:"columns"`
// Specifies a comment for the external table.
Comment pulumi.StringPtrOutput `pulumi:"comment"`
// Specifies to retain the access permissions from the original table when an external table is recreated using the CREATE OR REPLACE TABLE variant
CopyGrants pulumi.BoolPtrOutput `pulumi:"copyGrants"`
// The database in which to create the external table.
Database pulumi.StringOutput `pulumi:"database"`
// Specifies the file format for the external table.
FileFormat pulumi.StringOutput `pulumi:"fileFormat"`
// Specifies a location for the external table.
Location pulumi.StringOutput `pulumi:"location"`
// Specifies the identifier for the external table; must be unique for the database and schema in which the externalTable is created.
Name pulumi.StringOutput `pulumi:"name"`
// Name of the role that owns the external table.
Owner pulumi.StringOutput `pulumi:"owner"`
// Specifies any partition columns to evaluate for the external table.
PartitionBies pulumi.StringArrayOutput `pulumi:"partitionBies"`
// Specifies the file names and/or paths on the external stage to match.
Pattern pulumi.StringPtrOutput `pulumi:"pattern"`
// Specifies weather to refresh when an external table is created.
RefreshOnCreate pulumi.BoolPtrOutput `pulumi:"refreshOnCreate"`
// The schema in which to create the external table.
Schema pulumi.StringOutput `pulumi:"schema"`
// Definitions of a tag to associate with the resource.
Tags ExternalTableTagArrayOutput `pulumi:"tags"`
}
// NewExternalTable registers a new resource with the given unique name, arguments, and options.
func NewExternalTable(ctx *pulumi.Context,
name string, args *ExternalTableArgs, opts ...pulumi.ResourceOption) (*ExternalTable, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Columns == nil {
return nil, errors.New("invalid value for required argument 'Columns'")
}
if args.Database == nil {
return nil, errors.New("invalid value for required argument 'Database'")
}
if args.FileFormat == nil {
return nil, errors.New("invalid value for required argument 'FileFormat'")
}
if args.Location == nil {
return nil, errors.New("invalid value for required argument 'Location'")
}
if args.Schema == nil {
return nil, errors.New("invalid value for required argument 'Schema'")
}
var resource ExternalTable
err := ctx.RegisterResource("snowflake:index/externalTable:ExternalTable", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetExternalTable gets an existing ExternalTable 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 GetExternalTable(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ExternalTableState, opts ...pulumi.ResourceOption) (*ExternalTable, error) {
var resource ExternalTable
err := ctx.ReadResource("snowflake:index/externalTable:ExternalTable", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ExternalTable resources.
type externalTableState struct {
// Specifies whether to automatically refresh the external table metadata once, immediately after the external table is created.
AutoRefresh *bool `pulumi:"autoRefresh"`
// Specifies the aws sns topic for the external table.
AwsSnsTopic *string `pulumi:"awsSnsTopic"`
// Definitions of a column to create in the external table. Minimum one required.
Columns []ExternalTableColumn `pulumi:"columns"`
// Specifies a comment for the external table.
Comment *string `pulumi:"comment"`
// Specifies to retain the access permissions from the original table when an external table is recreated using the CREATE OR REPLACE TABLE variant
CopyGrants *bool `pulumi:"copyGrants"`
// The database in which to create the external table.
Database *string `pulumi:"database"`
// Specifies the file format for the external table.
FileFormat *string `pulumi:"fileFormat"`
// Specifies a location for the external table.
Location *string `pulumi:"location"`
// Specifies the identifier for the external table; must be unique for the database and schema in which the externalTable is created.
Name *string `pulumi:"name"`
// Name of the role that owns the external table.
Owner *string `pulumi:"owner"`
// Specifies any partition columns to evaluate for the external table.
PartitionBies []string `pulumi:"partitionBies"`
// Specifies the file names and/or paths on the external stage to match.
Pattern *string `pulumi:"pattern"`
// Specifies weather to refresh when an external table is created.
RefreshOnCreate *bool `pulumi:"refreshOnCreate"`
// The schema in which to create the external table.
Schema *string `pulumi:"schema"`
// Definitions of a tag to associate with the resource.
Tags []ExternalTableTag `pulumi:"tags"`
}
type ExternalTableState struct {
// Specifies whether to automatically refresh the external table metadata once, immediately after the external table is created.
AutoRefresh pulumi.BoolPtrInput
// Specifies the aws sns topic for the external table.
AwsSnsTopic pulumi.StringPtrInput
// Definitions of a column to create in the external table. Minimum one required.
Columns ExternalTableColumnArrayInput
// Specifies a comment for the external table.
Comment pulumi.StringPtrInput
// Specifies to retain the access permissions from the original table when an external table is recreated using the CREATE OR REPLACE TABLE variant
CopyGrants pulumi.BoolPtrInput
// The database in which to create the external table.
Database pulumi.StringPtrInput
// Specifies the file format for the external table.
FileFormat pulumi.StringPtrInput
// Specifies a location for the external table.
Location pulumi.StringPtrInput
// Specifies the identifier for the external table; must be unique for the database and schema in which the externalTable is created.
Name pulumi.StringPtrInput
// Name of the role that owns the external table.
Owner pulumi.StringPtrInput
// Specifies any partition columns to evaluate for the external table.
PartitionBies pulumi.StringArrayInput
// Specifies the file names and/or paths on the external stage to match.
Pattern pulumi.StringPtrInput
// Specifies weather to refresh when an external table is created.
RefreshOnCreate pulumi.BoolPtrInput
// The schema in which to create the external table.
Schema pulumi.StringPtrInput
// Definitions of a tag to associate with the resource.
Tags ExternalTableTagArrayInput
}
func (ExternalTableState) ElementType() reflect.Type {
return reflect.TypeOf((*externalTableState)(nil)).Elem()
}
type externalTableArgs struct {
// Specifies whether to automatically refresh the external table metadata once, immediately after the external table is created.
AutoRefresh *bool `pulumi:"autoRefresh"`
// Specifies the aws sns topic for the external table.
AwsSnsTopic *string `pulumi:"awsSnsTopic"`
// Definitions of a column to create in the external table. Minimum one required.
Columns []ExternalTableColumn `pulumi:"columns"`
// Specifies a comment for the external table.
Comment *string `pulumi:"comment"`
// Specifies to retain the access permissions from the original table when an external table is recreated using the CREATE OR REPLACE TABLE variant
CopyGrants *bool `pulumi:"copyGrants"`
// The database in which to create the external table.
Database string `pulumi:"database"`
// Specifies the file format for the external table.
FileFormat string `pulumi:"fileFormat"`
// Specifies a location for the external table.
Location string `pulumi:"location"`
// Specifies the identifier for the external table; must be unique for the database and schema in which the externalTable is created.
Name *string `pulumi:"name"`
// Specifies any partition columns to evaluate for the external table.
PartitionBies []string `pulumi:"partitionBies"`
// Specifies the file names and/or paths on the external stage to match.
Pattern *string `pulumi:"pattern"`
// Specifies weather to refresh when an external table is created.
RefreshOnCreate *bool `pulumi:"refreshOnCreate"`
// The schema in which to create the external table.
Schema string `pulumi:"schema"`
// Definitions of a tag to associate with the resource.
Tags []ExternalTableTag `pulumi:"tags"`
}
// The set of arguments for constructing a ExternalTable resource.
type ExternalTableArgs struct {
// Specifies whether to automatically refresh the external table metadata once, immediately after the external table is created.
AutoRefresh pulumi.BoolPtrInput
// Specifies the aws sns topic for the external table.
AwsSnsTopic pulumi.StringPtrInput
// Definitions of a column to create in the external table. Minimum one required.
Columns ExternalTableColumnArrayInput
// Specifies a comment for the external table.
Comment pulumi.StringPtrInput
// Specifies to retain the access permissions from the original table when an external table is recreated using the CREATE OR REPLACE TABLE variant
CopyGrants pulumi.BoolPtrInput
// The database in which to create the external table.
Database pulumi.StringInput
// Specifies the file format for the external table.
FileFormat pulumi.StringInput
// Specifies a location for the external table.
Location pulumi.StringInput
// Specifies the identifier for the external table; must be unique for the database and schema in which the externalTable is created.
Name pulumi.StringPtrInput
// Specifies any partition columns to evaluate for the external table.
PartitionBies pulumi.StringArrayInput
// Specifies the file names and/or paths on the external stage to match.
Pattern pulumi.StringPtrInput
// Specifies weather to refresh when an external table is created.
RefreshOnCreate pulumi.BoolPtrInput
// The schema in which to create the external table.
Schema pulumi.StringInput
// Definitions of a tag to associate with the resource.
Tags ExternalTableTagArrayInput
}
func (ExternalTableArgs) ElementType() reflect.Type {
return reflect.TypeOf((*externalTableArgs)(nil)).Elem()
}
type ExternalTableInput interface {
pulumi.Input
ToExternalTableOutput() ExternalTableOutput
ToExternalTableOutputWithContext(ctx context.Context) ExternalTableOutput
}
func (*ExternalTable) ElementType() reflect.Type {
return reflect.TypeOf((*ExternalTable)(nil))
}
func (i *ExternalTable) ToExternalTableOutput() ExternalTableOutput {
return i.ToExternalTableOutputWithContext(context.Background())
}
func (i *ExternalTable) ToExternalTableOutputWithContext(ctx context.Context) ExternalTableOutput {
return pulumi.ToOutputWithContext(ctx, i).(ExternalTableOutput)
}
func (i *ExternalTable) ToExternalTablePtrOutput() ExternalTablePtrOutput {
return i.ToExternalTablePtrOutputWithContext(context.Background())
}
func (i *ExternalTable) ToExternalTablePtrOutputWithContext(ctx context.Context) ExternalTablePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ExternalTablePtrOutput)
}
type ExternalTablePtrInput interface {
pulumi.Input
ToExternalTablePtrOutput() ExternalTablePtrOutput
ToExternalTablePtrOutputWithContext(ctx context.Context) ExternalTablePtrOutput
}
type externalTablePtrType ExternalTableArgs
func (*externalTablePtrType) ElementType() reflect.Type {
return reflect.TypeOf((**ExternalTable)(nil))
}
func (i *externalTablePtrType) ToExternalTablePtrOutput() ExternalTablePtrOutput {
return i.ToExternalTablePtrOutputWithContext(context.Background())
}
func (i *externalTablePtrType) ToExternalTablePtrOutputWithContext(ctx context.Context) ExternalTablePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ExternalTablePtrOutput)
}
// ExternalTableArrayInput is an input type that accepts ExternalTableArray and ExternalTableArrayOutput values.
// You can construct a concrete instance of `ExternalTableArrayInput` via:
//
// ExternalTableArray{ ExternalTableArgs{...} }
type ExternalTableArrayInput interface {
pulumi.Input
ToExternalTableArrayOutput() ExternalTableArrayOutput
ToExternalTableArrayOutputWithContext(context.Context) ExternalTableArrayOutput
}
type ExternalTableArray []ExternalTableInput
func (ExternalTableArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ExternalTable)(nil)).Elem()
}
func (i ExternalTableArray) ToExternalTableArrayOutput() ExternalTableArrayOutput {
return i.ToExternalTableArrayOutputWithContext(context.Background())
}
func (i ExternalTableArray) ToExternalTableArrayOutputWithContext(ctx context.Context) ExternalTableArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ExternalTableArrayOutput)
}
// ExternalTableMapInput is an input type that accepts ExternalTableMap and ExternalTableMapOutput values.
// You can construct a concrete instance of `ExternalTableMapInput` via:
//
// ExternalTableMap{ "key": ExternalTableArgs{...} }
type ExternalTableMapInput interface {
pulumi.Input
ToExternalTableMapOutput() ExternalTableMapOutput
ToExternalTableMapOutputWithContext(context.Context) ExternalTableMapOutput
}
type ExternalTableMap map[string]ExternalTableInput
func (ExternalTableMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ExternalTable)(nil)).Elem()
}
func (i ExternalTableMap) ToExternalTableMapOutput() ExternalTableMapOutput {
return i.ToExternalTableMapOutputWithContext(context.Background())
}
func (i ExternalTableMap) ToExternalTableMapOutputWithContext(ctx context.Context) ExternalTableMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ExternalTableMapOutput)
}
type ExternalTableOutput struct{ *pulumi.OutputState }
func (ExternalTableOutput) ElementType() reflect.Type {
return reflect.TypeOf((*ExternalTable)(nil))
}
func (o ExternalTableOutput) ToExternalTableOutput() ExternalTableOutput {
return o
}
func (o ExternalTableOutput) ToExternalTableOutputWithContext(ctx context.Context) ExternalTableOutput {
return o
}
func (o ExternalTableOutput) ToExternalTablePtrOutput() ExternalTablePtrOutput {
return o.ToExternalTablePtrOutputWithContext(context.Background())
}
func (o ExternalTableOutput) ToExternalTablePtrOutputWithContext(ctx context.Context) ExternalTablePtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v ExternalTable) *ExternalTable {
return &v
}).(ExternalTablePtrOutput)
}
type ExternalTablePtrOutput struct{ *pulumi.OutputState }
func (ExternalTablePtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ExternalTable)(nil))
}
func (o ExternalTablePtrOutput) ToExternalTablePtrOutput() ExternalTablePtrOutput {
return o
}
func (o ExternalTablePtrOutput) ToExternalTablePtrOutputWithContext(ctx context.Context) ExternalTablePtrOutput {
return o
}
func (o ExternalTablePtrOutput) Elem() ExternalTableOutput {
return o.ApplyT(func(v *ExternalTable) ExternalTable {
if v != nil {
return *v
}
var ret ExternalTable
return ret
}).(ExternalTableOutput)
}
type ExternalTableArrayOutput struct{ *pulumi.OutputState }
func (ExternalTableArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]ExternalTable)(nil))
}
func (o ExternalTableArrayOutput) ToExternalTableArrayOutput() ExternalTableArrayOutput {
return o
}
func (o ExternalTableArrayOutput) ToExternalTableArrayOutputWithContext(ctx context.Context) ExternalTableArrayOutput {
return o
}
func (o ExternalTableArrayOutput) Index(i pulumi.IntInput) ExternalTableOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) ExternalTable {
return vs[0].([]ExternalTable)[vs[1].(int)]
}).(ExternalTableOutput)
}
type ExternalTableMapOutput struct{ *pulumi.OutputState }
func (ExternalTableMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]ExternalTable)(nil))
}
func (o ExternalTableMapOutput) ToExternalTableMapOutput() ExternalTableMapOutput {
return o
}
func (o ExternalTableMapOutput) ToExternalTableMapOutputWithContext(ctx context.Context) ExternalTableMapOutput {
return o
}
func (o ExternalTableMapOutput) MapIndex(k pulumi.StringInput) ExternalTableOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) ExternalTable {
return vs[0].(map[string]ExternalTable)[vs[1].(string)]
}).(ExternalTableOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ExternalTableInput)(nil)).Elem(), &ExternalTable{})
pulumi.RegisterInputType(reflect.TypeOf((*ExternalTablePtrInput)(nil)).Elem(), &ExternalTable{})
pulumi.RegisterInputType(reflect.TypeOf((*ExternalTableArrayInput)(nil)).Elem(), ExternalTableArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ExternalTableMapInput)(nil)).Elem(), ExternalTableMap{})
pulumi.RegisterOutputType(ExternalTableOutput{})
pulumi.RegisterOutputType(ExternalTablePtrOutput{})
pulumi.RegisterOutputType(ExternalTableArrayOutput{})
pulumi.RegisterOutputType(ExternalTableMapOutput{})
}