/
cluster.go
517 lines (471 loc) · 20.6 KB
/
cluster.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
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
// *** 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 dax
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a DAX Cluster resource.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/dax"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := dax.NewCluster(ctx, "bar", &dax.ClusterArgs{
// ClusterName: pulumi.String("cluster-example"),
// IamRoleArn: pulumi.Any(data.Aws_iam_role.Example.Arn),
// NodeType: pulumi.String("dax.r4.large"),
// ReplicationFactor: pulumi.Int(1),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// DAX Clusters can be imported using the `cluster_name`, e.g.,
//
// ```sh
// $ pulumi import aws:dax/cluster:Cluster my_cluster my_cluster
// ```
//
// [1]http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.concepts.cluster.html#DAX.concepts.nodes
type Cluster struct {
pulumi.CustomResourceState
// The ARN of the DAX cluster
Arn pulumi.StringOutput `pulumi:"arn"`
// List of Availability Zones in which the
// nodes will be created
AvailabilityZones pulumi.StringArrayOutput `pulumi:"availabilityZones"`
// The DNS name of the DAX cluster without the port appended
ClusterAddress pulumi.StringOutput `pulumi:"clusterAddress"`
// The type of encryption the
// cluster's endpoint should support. Valid values are: `NONE` and `TLS`.
// Default value is `NONE`.
ClusterEndpointEncryptionType pulumi.StringPtrOutput `pulumi:"clusterEndpointEncryptionType"`
// Group identifier. DAX converts this name to
// lowercase
ClusterName pulumi.StringOutput `pulumi:"clusterName"`
// The configuration endpoint for this DAX cluster,
// consisting of a DNS name and a port number
ConfigurationEndpoint pulumi.StringOutput `pulumi:"configurationEndpoint"`
// Description for the cluster
Description pulumi.StringPtrOutput `pulumi:"description"`
// A valid Amazon Resource Name (ARN) that identifies
// an IAM role. At runtime, DAX will assume this role and use the role's
// permissions to access DynamoDB on your behalf
IamRoleArn pulumi.StringOutput `pulumi:"iamRoleArn"`
// Specifies the weekly time range for when
// maintenance on the cluster is performed. The format is `ddd:hh24:mi-ddd:hh24:mi`
// (24H Clock UTC). The minimum maintenance window is a 60 minute period. Example:
// `sun:05:00-sun:09:00`
MaintenanceWindow pulumi.StringOutput `pulumi:"maintenanceWindow"`
// The compute and memory capacity of the nodes. See
// [Nodes](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.concepts.cluster.html#DAX.concepts.nodes) for supported node types
NodeType pulumi.StringOutput `pulumi:"nodeType"`
// List of node objects including `id`, `address`, `port` and
// `availabilityZone`. Referenceable e.g., as
// `${aws_dax_cluster.test.nodes.0.address}`
Nodes ClusterNodeArrayOutput `pulumi:"nodes"`
// An Amazon Resource Name (ARN) of an
// SNS topic to send DAX notifications to. Example:
// `arn:aws:sns:us-east-1:012345678999:my_sns_topic`
NotificationTopicArn pulumi.StringPtrOutput `pulumi:"notificationTopicArn"`
// Name of the parameter group to associate
// with this DAX cluster
ParameterGroupName pulumi.StringOutput `pulumi:"parameterGroupName"`
// The port used by the configuration endpoint
Port pulumi.IntOutput `pulumi:"port"`
// The number of nodes in the DAX cluster. A
// replication factor of 1 will create a single-node cluster, without any read
// replicas
ReplicationFactor pulumi.IntOutput `pulumi:"replicationFactor"`
// One or more VPC security groups associated
// with the cluster
SecurityGroupIds pulumi.StringArrayOutput `pulumi:"securityGroupIds"`
// Encrypt at rest options
ServerSideEncryption ClusterServerSideEncryptionPtrOutput `pulumi:"serverSideEncryption"`
// Name of the subnet group to be used for the
// cluster
SubnetGroupName pulumi.StringOutput `pulumi:"subnetGroupName"`
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider .
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
}
// NewCluster registers a new resource with the given unique name, arguments, and options.
func NewCluster(ctx *pulumi.Context,
name string, args *ClusterArgs, opts ...pulumi.ResourceOption) (*Cluster, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ClusterName == nil {
return nil, errors.New("invalid value for required argument 'ClusterName'")
}
if args.IamRoleArn == nil {
return nil, errors.New("invalid value for required argument 'IamRoleArn'")
}
if args.NodeType == nil {
return nil, errors.New("invalid value for required argument 'NodeType'")
}
if args.ReplicationFactor == nil {
return nil, errors.New("invalid value for required argument 'ReplicationFactor'")
}
var resource Cluster
err := ctx.RegisterResource("aws:dax/cluster:Cluster", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetCluster gets an existing Cluster 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 GetCluster(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ClusterState, opts ...pulumi.ResourceOption) (*Cluster, error) {
var resource Cluster
err := ctx.ReadResource("aws:dax/cluster:Cluster", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Cluster resources.
type clusterState struct {
// The ARN of the DAX cluster
Arn *string `pulumi:"arn"`
// List of Availability Zones in which the
// nodes will be created
AvailabilityZones []string `pulumi:"availabilityZones"`
// The DNS name of the DAX cluster without the port appended
ClusterAddress *string `pulumi:"clusterAddress"`
// The type of encryption the
// cluster's endpoint should support. Valid values are: `NONE` and `TLS`.
// Default value is `NONE`.
ClusterEndpointEncryptionType *string `pulumi:"clusterEndpointEncryptionType"`
// Group identifier. DAX converts this name to
// lowercase
ClusterName *string `pulumi:"clusterName"`
// The configuration endpoint for this DAX cluster,
// consisting of a DNS name and a port number
ConfigurationEndpoint *string `pulumi:"configurationEndpoint"`
// Description for the cluster
Description *string `pulumi:"description"`
// A valid Amazon Resource Name (ARN) that identifies
// an IAM role. At runtime, DAX will assume this role and use the role's
// permissions to access DynamoDB on your behalf
IamRoleArn *string `pulumi:"iamRoleArn"`
// Specifies the weekly time range for when
// maintenance on the cluster is performed. The format is `ddd:hh24:mi-ddd:hh24:mi`
// (24H Clock UTC). The minimum maintenance window is a 60 minute period. Example:
// `sun:05:00-sun:09:00`
MaintenanceWindow *string `pulumi:"maintenanceWindow"`
// The compute and memory capacity of the nodes. See
// [Nodes](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.concepts.cluster.html#DAX.concepts.nodes) for supported node types
NodeType *string `pulumi:"nodeType"`
// List of node objects including `id`, `address`, `port` and
// `availabilityZone`. Referenceable e.g., as
// `${aws_dax_cluster.test.nodes.0.address}`
Nodes []ClusterNode `pulumi:"nodes"`
// An Amazon Resource Name (ARN) of an
// SNS topic to send DAX notifications to. Example:
// `arn:aws:sns:us-east-1:012345678999:my_sns_topic`
NotificationTopicArn *string `pulumi:"notificationTopicArn"`
// Name of the parameter group to associate
// with this DAX cluster
ParameterGroupName *string `pulumi:"parameterGroupName"`
// The port used by the configuration endpoint
Port *int `pulumi:"port"`
// The number of nodes in the DAX cluster. A
// replication factor of 1 will create a single-node cluster, without any read
// replicas
ReplicationFactor *int `pulumi:"replicationFactor"`
// One or more VPC security groups associated
// with the cluster
SecurityGroupIds []string `pulumi:"securityGroupIds"`
// Encrypt at rest options
ServerSideEncryption *ClusterServerSideEncryption `pulumi:"serverSideEncryption"`
// Name of the subnet group to be used for the
// cluster
SubnetGroupName *string `pulumi:"subnetGroupName"`
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider .
TagsAll map[string]string `pulumi:"tagsAll"`
}
type ClusterState struct {
// The ARN of the DAX cluster
Arn pulumi.StringPtrInput
// List of Availability Zones in which the
// nodes will be created
AvailabilityZones pulumi.StringArrayInput
// The DNS name of the DAX cluster without the port appended
ClusterAddress pulumi.StringPtrInput
// The type of encryption the
// cluster's endpoint should support. Valid values are: `NONE` and `TLS`.
// Default value is `NONE`.
ClusterEndpointEncryptionType pulumi.StringPtrInput
// Group identifier. DAX converts this name to
// lowercase
ClusterName pulumi.StringPtrInput
// The configuration endpoint for this DAX cluster,
// consisting of a DNS name and a port number
ConfigurationEndpoint pulumi.StringPtrInput
// Description for the cluster
Description pulumi.StringPtrInput
// A valid Amazon Resource Name (ARN) that identifies
// an IAM role. At runtime, DAX will assume this role and use the role's
// permissions to access DynamoDB on your behalf
IamRoleArn pulumi.StringPtrInput
// Specifies the weekly time range for when
// maintenance on the cluster is performed. The format is `ddd:hh24:mi-ddd:hh24:mi`
// (24H Clock UTC). The minimum maintenance window is a 60 minute period. Example:
// `sun:05:00-sun:09:00`
MaintenanceWindow pulumi.StringPtrInput
// The compute and memory capacity of the nodes. See
// [Nodes](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.concepts.cluster.html#DAX.concepts.nodes) for supported node types
NodeType pulumi.StringPtrInput
// List of node objects including `id`, `address`, `port` and
// `availabilityZone`. Referenceable e.g., as
// `${aws_dax_cluster.test.nodes.0.address}`
Nodes ClusterNodeArrayInput
// An Amazon Resource Name (ARN) of an
// SNS topic to send DAX notifications to. Example:
// `arn:aws:sns:us-east-1:012345678999:my_sns_topic`
NotificationTopicArn pulumi.StringPtrInput
// Name of the parameter group to associate
// with this DAX cluster
ParameterGroupName pulumi.StringPtrInput
// The port used by the configuration endpoint
Port pulumi.IntPtrInput
// The number of nodes in the DAX cluster. A
// replication factor of 1 will create a single-node cluster, without any read
// replicas
ReplicationFactor pulumi.IntPtrInput
// One or more VPC security groups associated
// with the cluster
SecurityGroupIds pulumi.StringArrayInput
// Encrypt at rest options
ServerSideEncryption ClusterServerSideEncryptionPtrInput
// Name of the subnet group to be used for the
// cluster
SubnetGroupName pulumi.StringPtrInput
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// A map of tags assigned to the resource, including those inherited from the provider .
TagsAll pulumi.StringMapInput
}
func (ClusterState) ElementType() reflect.Type {
return reflect.TypeOf((*clusterState)(nil)).Elem()
}
type clusterArgs struct {
// List of Availability Zones in which the
// nodes will be created
AvailabilityZones []string `pulumi:"availabilityZones"`
// The type of encryption the
// cluster's endpoint should support. Valid values are: `NONE` and `TLS`.
// Default value is `NONE`.
ClusterEndpointEncryptionType *string `pulumi:"clusterEndpointEncryptionType"`
// Group identifier. DAX converts this name to
// lowercase
ClusterName string `pulumi:"clusterName"`
// Description for the cluster
Description *string `pulumi:"description"`
// A valid Amazon Resource Name (ARN) that identifies
// an IAM role. At runtime, DAX will assume this role and use the role's
// permissions to access DynamoDB on your behalf
IamRoleArn string `pulumi:"iamRoleArn"`
// Specifies the weekly time range for when
// maintenance on the cluster is performed. The format is `ddd:hh24:mi-ddd:hh24:mi`
// (24H Clock UTC). The minimum maintenance window is a 60 minute period. Example:
// `sun:05:00-sun:09:00`
MaintenanceWindow *string `pulumi:"maintenanceWindow"`
// The compute and memory capacity of the nodes. See
// [Nodes](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.concepts.cluster.html#DAX.concepts.nodes) for supported node types
NodeType string `pulumi:"nodeType"`
// An Amazon Resource Name (ARN) of an
// SNS topic to send DAX notifications to. Example:
// `arn:aws:sns:us-east-1:012345678999:my_sns_topic`
NotificationTopicArn *string `pulumi:"notificationTopicArn"`
// Name of the parameter group to associate
// with this DAX cluster
ParameterGroupName *string `pulumi:"parameterGroupName"`
// The number of nodes in the DAX cluster. A
// replication factor of 1 will create a single-node cluster, without any read
// replicas
ReplicationFactor int `pulumi:"replicationFactor"`
// One or more VPC security groups associated
// with the cluster
SecurityGroupIds []string `pulumi:"securityGroupIds"`
// Encrypt at rest options
ServerSideEncryption *ClusterServerSideEncryption `pulumi:"serverSideEncryption"`
// Name of the subnet group to be used for the
// cluster
SubnetGroupName *string `pulumi:"subnetGroupName"`
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
}
// The set of arguments for constructing a Cluster resource.
type ClusterArgs struct {
// List of Availability Zones in which the
// nodes will be created
AvailabilityZones pulumi.StringArrayInput
// The type of encryption the
// cluster's endpoint should support. Valid values are: `NONE` and `TLS`.
// Default value is `NONE`.
ClusterEndpointEncryptionType pulumi.StringPtrInput
// Group identifier. DAX converts this name to
// lowercase
ClusterName pulumi.StringInput
// Description for the cluster
Description pulumi.StringPtrInput
// A valid Amazon Resource Name (ARN) that identifies
// an IAM role. At runtime, DAX will assume this role and use the role's
// permissions to access DynamoDB on your behalf
IamRoleArn pulumi.StringInput
// Specifies the weekly time range for when
// maintenance on the cluster is performed. The format is `ddd:hh24:mi-ddd:hh24:mi`
// (24H Clock UTC). The minimum maintenance window is a 60 minute period. Example:
// `sun:05:00-sun:09:00`
MaintenanceWindow pulumi.StringPtrInput
// The compute and memory capacity of the nodes. See
// [Nodes](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.concepts.cluster.html#DAX.concepts.nodes) for supported node types
NodeType pulumi.StringInput
// An Amazon Resource Name (ARN) of an
// SNS topic to send DAX notifications to. Example:
// `arn:aws:sns:us-east-1:012345678999:my_sns_topic`
NotificationTopicArn pulumi.StringPtrInput
// Name of the parameter group to associate
// with this DAX cluster
ParameterGroupName pulumi.StringPtrInput
// The number of nodes in the DAX cluster. A
// replication factor of 1 will create a single-node cluster, without any read
// replicas
ReplicationFactor pulumi.IntInput
// One or more VPC security groups associated
// with the cluster
SecurityGroupIds pulumi.StringArrayInput
// Encrypt at rest options
ServerSideEncryption ClusterServerSideEncryptionPtrInput
// Name of the subnet group to be used for the
// cluster
SubnetGroupName pulumi.StringPtrInput
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
}
func (ClusterArgs) ElementType() reflect.Type {
return reflect.TypeOf((*clusterArgs)(nil)).Elem()
}
type ClusterInput interface {
pulumi.Input
ToClusterOutput() ClusterOutput
ToClusterOutputWithContext(ctx context.Context) ClusterOutput
}
func (*Cluster) ElementType() reflect.Type {
return reflect.TypeOf((**Cluster)(nil)).Elem()
}
func (i *Cluster) ToClusterOutput() ClusterOutput {
return i.ToClusterOutputWithContext(context.Background())
}
func (i *Cluster) ToClusterOutputWithContext(ctx context.Context) ClusterOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClusterOutput)
}
// ClusterArrayInput is an input type that accepts ClusterArray and ClusterArrayOutput values.
// You can construct a concrete instance of `ClusterArrayInput` via:
//
// ClusterArray{ ClusterArgs{...} }
type ClusterArrayInput interface {
pulumi.Input
ToClusterArrayOutput() ClusterArrayOutput
ToClusterArrayOutputWithContext(context.Context) ClusterArrayOutput
}
type ClusterArray []ClusterInput
func (ClusterArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Cluster)(nil)).Elem()
}
func (i ClusterArray) ToClusterArrayOutput() ClusterArrayOutput {
return i.ToClusterArrayOutputWithContext(context.Background())
}
func (i ClusterArray) ToClusterArrayOutputWithContext(ctx context.Context) ClusterArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClusterArrayOutput)
}
// ClusterMapInput is an input type that accepts ClusterMap and ClusterMapOutput values.
// You can construct a concrete instance of `ClusterMapInput` via:
//
// ClusterMap{ "key": ClusterArgs{...} }
type ClusterMapInput interface {
pulumi.Input
ToClusterMapOutput() ClusterMapOutput
ToClusterMapOutputWithContext(context.Context) ClusterMapOutput
}
type ClusterMap map[string]ClusterInput
func (ClusterMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Cluster)(nil)).Elem()
}
func (i ClusterMap) ToClusterMapOutput() ClusterMapOutput {
return i.ToClusterMapOutputWithContext(context.Background())
}
func (i ClusterMap) ToClusterMapOutputWithContext(ctx context.Context) ClusterMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClusterMapOutput)
}
type ClusterOutput struct{ *pulumi.OutputState }
func (ClusterOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Cluster)(nil)).Elem()
}
func (o ClusterOutput) ToClusterOutput() ClusterOutput {
return o
}
func (o ClusterOutput) ToClusterOutputWithContext(ctx context.Context) ClusterOutput {
return o
}
type ClusterArrayOutput struct{ *pulumi.OutputState }
func (ClusterArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Cluster)(nil)).Elem()
}
func (o ClusterArrayOutput) ToClusterArrayOutput() ClusterArrayOutput {
return o
}
func (o ClusterArrayOutput) ToClusterArrayOutputWithContext(ctx context.Context) ClusterArrayOutput {
return o
}
func (o ClusterArrayOutput) Index(i pulumi.IntInput) ClusterOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Cluster {
return vs[0].([]*Cluster)[vs[1].(int)]
}).(ClusterOutput)
}
type ClusterMapOutput struct{ *pulumi.OutputState }
func (ClusterMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Cluster)(nil)).Elem()
}
func (o ClusterMapOutput) ToClusterMapOutput() ClusterMapOutput {
return o
}
func (o ClusterMapOutput) ToClusterMapOutputWithContext(ctx context.Context) ClusterMapOutput {
return o
}
func (o ClusterMapOutput) MapIndex(k pulumi.StringInput) ClusterOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Cluster {
return vs[0].(map[string]*Cluster)[vs[1].(string)]
}).(ClusterOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ClusterInput)(nil)).Elem(), &Cluster{})
pulumi.RegisterInputType(reflect.TypeOf((*ClusterArrayInput)(nil)).Elem(), ClusterArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ClusterMapInput)(nil)).Elem(), ClusterMap{})
pulumi.RegisterOutputType(ClusterOutput{})
pulumi.RegisterOutputType(ClusterArrayOutput{})
pulumi.RegisterOutputType(ClusterMapOutput{})
}