/
partition.go
289 lines (243 loc) · 12.3 KB
/
partition.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
// *** 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 glue
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Glue Partition Resource.
//
// ## Import
//
// Glue Partitions can be imported with their catalog ID (usually AWS account ID), database name, table name and partition values e.g.,
//
// ```sh
// $ pulumi import aws:glue/partition:Partition part 123456789012:MyDatabase:MyTable:val1#val2
// ```
type Partition struct {
pulumi.CustomResourceState
// ID of the Glue Catalog and database to create the table in. If omitted, this defaults to the AWS Account ID plus the database name.
CatalogId pulumi.StringOutput `pulumi:"catalogId"`
// The time at which the partition was created.
CreationTime pulumi.StringOutput `pulumi:"creationTime"`
// Name of the metadata database where the table metadata resides. For Hive compatibility, this must be all lowercase.
DatabaseName pulumi.StringOutput `pulumi:"databaseName"`
// The last time at which the partition was accessed.
LastAccessedTime pulumi.StringOutput `pulumi:"lastAccessedTime"`
// The last time at which column statistics were computed for this partition.
LastAnalyzedTime pulumi.StringOutput `pulumi:"lastAnalyzedTime"`
// A map of initialization parameters for the SerDe, in key-value form.
Parameters pulumi.StringMapOutput `pulumi:"parameters"`
// The values that define the partition.
PartitionValues pulumi.StringArrayOutput `pulumi:"partitionValues"`
// A storage descriptor object containing information about the physical storage of this table. You can refer to the [Glue Developer Guide](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-tables.html#aws-glue-api-catalog-tables-StorageDescriptor) for a full explanation of this object.
StorageDescriptor PartitionStorageDescriptorPtrOutput `pulumi:"storageDescriptor"`
TableName pulumi.StringOutput `pulumi:"tableName"`
}
// NewPartition registers a new resource with the given unique name, arguments, and options.
func NewPartition(ctx *pulumi.Context,
name string, args *PartitionArgs, opts ...pulumi.ResourceOption) (*Partition, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DatabaseName == nil {
return nil, errors.New("invalid value for required argument 'DatabaseName'")
}
if args.PartitionValues == nil {
return nil, errors.New("invalid value for required argument 'PartitionValues'")
}
if args.TableName == nil {
return nil, errors.New("invalid value for required argument 'TableName'")
}
var resource Partition
err := ctx.RegisterResource("aws:glue/partition:Partition", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetPartition gets an existing Partition 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 GetPartition(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *PartitionState, opts ...pulumi.ResourceOption) (*Partition, error) {
var resource Partition
err := ctx.ReadResource("aws:glue/partition:Partition", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Partition resources.
type partitionState struct {
// ID of the Glue Catalog and database to create the table in. If omitted, this defaults to the AWS Account ID plus the database name.
CatalogId *string `pulumi:"catalogId"`
// The time at which the partition was created.
CreationTime *string `pulumi:"creationTime"`
// Name of the metadata database where the table metadata resides. For Hive compatibility, this must be all lowercase.
DatabaseName *string `pulumi:"databaseName"`
// The last time at which the partition was accessed.
LastAccessedTime *string `pulumi:"lastAccessedTime"`
// The last time at which column statistics were computed for this partition.
LastAnalyzedTime *string `pulumi:"lastAnalyzedTime"`
// A map of initialization parameters for the SerDe, in key-value form.
Parameters map[string]string `pulumi:"parameters"`
// The values that define the partition.
PartitionValues []string `pulumi:"partitionValues"`
// A storage descriptor object containing information about the physical storage of this table. You can refer to the [Glue Developer Guide](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-tables.html#aws-glue-api-catalog-tables-StorageDescriptor) for a full explanation of this object.
StorageDescriptor *PartitionStorageDescriptor `pulumi:"storageDescriptor"`
TableName *string `pulumi:"tableName"`
}
type PartitionState struct {
// ID of the Glue Catalog and database to create the table in. If omitted, this defaults to the AWS Account ID plus the database name.
CatalogId pulumi.StringPtrInput
// The time at which the partition was created.
CreationTime pulumi.StringPtrInput
// Name of the metadata database where the table metadata resides. For Hive compatibility, this must be all lowercase.
DatabaseName pulumi.StringPtrInput
// The last time at which the partition was accessed.
LastAccessedTime pulumi.StringPtrInput
// The last time at which column statistics were computed for this partition.
LastAnalyzedTime pulumi.StringPtrInput
// A map of initialization parameters for the SerDe, in key-value form.
Parameters pulumi.StringMapInput
// The values that define the partition.
PartitionValues pulumi.StringArrayInput
// A storage descriptor object containing information about the physical storage of this table. You can refer to the [Glue Developer Guide](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-tables.html#aws-glue-api-catalog-tables-StorageDescriptor) for a full explanation of this object.
StorageDescriptor PartitionStorageDescriptorPtrInput
TableName pulumi.StringPtrInput
}
func (PartitionState) ElementType() reflect.Type {
return reflect.TypeOf((*partitionState)(nil)).Elem()
}
type partitionArgs struct {
// ID of the Glue Catalog and database to create the table in. If omitted, this defaults to the AWS Account ID plus the database name.
CatalogId *string `pulumi:"catalogId"`
// Name of the metadata database where the table metadata resides. For Hive compatibility, this must be all lowercase.
DatabaseName string `pulumi:"databaseName"`
// A map of initialization parameters for the SerDe, in key-value form.
Parameters map[string]string `pulumi:"parameters"`
// The values that define the partition.
PartitionValues []string `pulumi:"partitionValues"`
// A storage descriptor object containing information about the physical storage of this table. You can refer to the [Glue Developer Guide](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-tables.html#aws-glue-api-catalog-tables-StorageDescriptor) for a full explanation of this object.
StorageDescriptor *PartitionStorageDescriptor `pulumi:"storageDescriptor"`
TableName string `pulumi:"tableName"`
}
// The set of arguments for constructing a Partition resource.
type PartitionArgs struct {
// ID of the Glue Catalog and database to create the table in. If omitted, this defaults to the AWS Account ID plus the database name.
CatalogId pulumi.StringPtrInput
// Name of the metadata database where the table metadata resides. For Hive compatibility, this must be all lowercase.
DatabaseName pulumi.StringInput
// A map of initialization parameters for the SerDe, in key-value form.
Parameters pulumi.StringMapInput
// The values that define the partition.
PartitionValues pulumi.StringArrayInput
// A storage descriptor object containing information about the physical storage of this table. You can refer to the [Glue Developer Guide](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-tables.html#aws-glue-api-catalog-tables-StorageDescriptor) for a full explanation of this object.
StorageDescriptor PartitionStorageDescriptorPtrInput
TableName pulumi.StringInput
}
func (PartitionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*partitionArgs)(nil)).Elem()
}
type PartitionInput interface {
pulumi.Input
ToPartitionOutput() PartitionOutput
ToPartitionOutputWithContext(ctx context.Context) PartitionOutput
}
func (*Partition) ElementType() reflect.Type {
return reflect.TypeOf((**Partition)(nil)).Elem()
}
func (i *Partition) ToPartitionOutput() PartitionOutput {
return i.ToPartitionOutputWithContext(context.Background())
}
func (i *Partition) ToPartitionOutputWithContext(ctx context.Context) PartitionOutput {
return pulumi.ToOutputWithContext(ctx, i).(PartitionOutput)
}
// PartitionArrayInput is an input type that accepts PartitionArray and PartitionArrayOutput values.
// You can construct a concrete instance of `PartitionArrayInput` via:
//
// PartitionArray{ PartitionArgs{...} }
type PartitionArrayInput interface {
pulumi.Input
ToPartitionArrayOutput() PartitionArrayOutput
ToPartitionArrayOutputWithContext(context.Context) PartitionArrayOutput
}
type PartitionArray []PartitionInput
func (PartitionArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Partition)(nil)).Elem()
}
func (i PartitionArray) ToPartitionArrayOutput() PartitionArrayOutput {
return i.ToPartitionArrayOutputWithContext(context.Background())
}
func (i PartitionArray) ToPartitionArrayOutputWithContext(ctx context.Context) PartitionArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(PartitionArrayOutput)
}
// PartitionMapInput is an input type that accepts PartitionMap and PartitionMapOutput values.
// You can construct a concrete instance of `PartitionMapInput` via:
//
// PartitionMap{ "key": PartitionArgs{...} }
type PartitionMapInput interface {
pulumi.Input
ToPartitionMapOutput() PartitionMapOutput
ToPartitionMapOutputWithContext(context.Context) PartitionMapOutput
}
type PartitionMap map[string]PartitionInput
func (PartitionMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Partition)(nil)).Elem()
}
func (i PartitionMap) ToPartitionMapOutput() PartitionMapOutput {
return i.ToPartitionMapOutputWithContext(context.Background())
}
func (i PartitionMap) ToPartitionMapOutputWithContext(ctx context.Context) PartitionMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(PartitionMapOutput)
}
type PartitionOutput struct{ *pulumi.OutputState }
func (PartitionOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Partition)(nil)).Elem()
}
func (o PartitionOutput) ToPartitionOutput() PartitionOutput {
return o
}
func (o PartitionOutput) ToPartitionOutputWithContext(ctx context.Context) PartitionOutput {
return o
}
type PartitionArrayOutput struct{ *pulumi.OutputState }
func (PartitionArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Partition)(nil)).Elem()
}
func (o PartitionArrayOutput) ToPartitionArrayOutput() PartitionArrayOutput {
return o
}
func (o PartitionArrayOutput) ToPartitionArrayOutputWithContext(ctx context.Context) PartitionArrayOutput {
return o
}
func (o PartitionArrayOutput) Index(i pulumi.IntInput) PartitionOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Partition {
return vs[0].([]*Partition)[vs[1].(int)]
}).(PartitionOutput)
}
type PartitionMapOutput struct{ *pulumi.OutputState }
func (PartitionMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Partition)(nil)).Elem()
}
func (o PartitionMapOutput) ToPartitionMapOutput() PartitionMapOutput {
return o
}
func (o PartitionMapOutput) ToPartitionMapOutputWithContext(ctx context.Context) PartitionMapOutput {
return o
}
func (o PartitionMapOutput) MapIndex(k pulumi.StringInput) PartitionOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Partition {
return vs[0].(map[string]*Partition)[vs[1].(string)]
}).(PartitionOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*PartitionInput)(nil)).Elem(), &Partition{})
pulumi.RegisterInputType(reflect.TypeOf((*PartitionArrayInput)(nil)).Elem(), PartitionArray{})
pulumi.RegisterInputType(reflect.TypeOf((*PartitionMapInput)(nil)).Elem(), PartitionMap{})
pulumi.RegisterOutputType(PartitionOutput{})
pulumi.RegisterOutputType(PartitionArrayOutput{})
pulumi.RegisterOutputType(PartitionMapOutput{})
}