/
clusterEndpoint.go
387 lines (341 loc) · 16.2 KB
/
clusterEndpoint.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
// *** 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 rds
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages an RDS Aurora Cluster Endpoint.
// You can refer to the [User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Overview.Endpoints.html#Aurora.Endpoints.Cluster).
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/rds"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := rds.NewCluster(ctx, "default", &rds.ClusterArgs{
// ClusterIdentifier: pulumi.String("aurora-cluster-demo"),
// AvailabilityZones: pulumi.StringArray{
// pulumi.String("us-west-2a"),
// pulumi.String("us-west-2b"),
// pulumi.String("us-west-2c"),
// },
// DatabaseName: pulumi.String("mydb"),
// MasterUsername: pulumi.String("foo"),
// MasterPassword: pulumi.String("bar"),
// BackupRetentionPeriod: pulumi.Int(5),
// PreferredBackupWindow: pulumi.String("07:00-09:00"),
// })
// if err != nil {
// return err
// }
// test1, err := rds.NewClusterInstance(ctx, "test1", &rds.ClusterInstanceArgs{
// ApplyImmediately: pulumi.Bool(true),
// ClusterIdentifier: _default.ID(),
// Identifier: pulumi.String("test1"),
// InstanceClass: pulumi.String("db.t2.small"),
// Engine: _default.Engine,
// EngineVersion: _default.EngineVersion,
// })
// if err != nil {
// return err
// }
// test2, err := rds.NewClusterInstance(ctx, "test2", &rds.ClusterInstanceArgs{
// ApplyImmediately: pulumi.Bool(true),
// ClusterIdentifier: _default.ID(),
// Identifier: pulumi.String("test2"),
// InstanceClass: pulumi.String("db.t2.small"),
// Engine: _default.Engine,
// EngineVersion: _default.EngineVersion,
// })
// if err != nil {
// return err
// }
// test3, err := rds.NewClusterInstance(ctx, "test3", &rds.ClusterInstanceArgs{
// ApplyImmediately: pulumi.Bool(true),
// ClusterIdentifier: _default.ID(),
// Identifier: pulumi.String("test3"),
// InstanceClass: pulumi.String("db.t2.small"),
// Engine: _default.Engine,
// EngineVersion: _default.EngineVersion,
// })
// if err != nil {
// return err
// }
// _, err = rds.NewClusterEndpoint(ctx, "eligible", &rds.ClusterEndpointArgs{
// ClusterIdentifier: _default.ID(),
// ClusterEndpointIdentifier: pulumi.String("reader"),
// CustomEndpointType: pulumi.String("READER"),
// ExcludedMembers: pulumi.StringArray{
// test1.ID(),
// test2.ID(),
// },
// })
// if err != nil {
// return err
// }
// _, err = rds.NewClusterEndpoint(ctx, "static", &rds.ClusterEndpointArgs{
// ClusterIdentifier: _default.ID(),
// ClusterEndpointIdentifier: pulumi.String("static"),
// CustomEndpointType: pulumi.String("READER"),
// StaticMembers: pulumi.StringArray{
// test1.ID(),
// test3.ID(),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// RDS Clusters Endpoint can be imported using the `cluster_endpoint_identifier`, e.g.,
//
// ```sh
// $ pulumi import aws:rds/clusterEndpoint:ClusterEndpoint custom_reader aurora-prod-cluster-custom-reader
// ```
//
// [1]https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Overview.Endpoints.html#Aurora.Endpoints.Cluster
type ClusterEndpoint struct {
pulumi.CustomResourceState
// Amazon Resource Name (ARN) of cluster
Arn pulumi.StringOutput `pulumi:"arn"`
// The identifier to use for the new endpoint. This parameter is stored as a lowercase string.
ClusterEndpointIdentifier pulumi.StringOutput `pulumi:"clusterEndpointIdentifier"`
// The cluster identifier.
ClusterIdentifier pulumi.StringOutput `pulumi:"clusterIdentifier"`
// The type of the endpoint. One of: READER , ANY .
CustomEndpointType pulumi.StringOutput `pulumi:"customEndpointType"`
// A custom endpoint for the Aurora cluster
Endpoint pulumi.StringOutput `pulumi:"endpoint"`
// List of DB instance identifiers that aren't part of the custom endpoint group. All other eligible instances are reachable through the custom endpoint. Only relevant if the list of static members is empty. Conflicts with `staticMembers`.
ExcludedMembers pulumi.StringArrayOutput `pulumi:"excludedMembers"`
// List of DB instance identifiers that are part of the custom endpoint group. Conflicts with `excludedMembers`.
StaticMembers pulumi.StringArrayOutput `pulumi:"staticMembers"`
// Key-value map of resource tags. .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"`
}
// NewClusterEndpoint registers a new resource with the given unique name, arguments, and options.
func NewClusterEndpoint(ctx *pulumi.Context,
name string, args *ClusterEndpointArgs, opts ...pulumi.ResourceOption) (*ClusterEndpoint, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ClusterEndpointIdentifier == nil {
return nil, errors.New("invalid value for required argument 'ClusterEndpointIdentifier'")
}
if args.ClusterIdentifier == nil {
return nil, errors.New("invalid value for required argument 'ClusterIdentifier'")
}
if args.CustomEndpointType == nil {
return nil, errors.New("invalid value for required argument 'CustomEndpointType'")
}
var resource ClusterEndpoint
err := ctx.RegisterResource("aws:rds/clusterEndpoint:ClusterEndpoint", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetClusterEndpoint gets an existing ClusterEndpoint 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 GetClusterEndpoint(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ClusterEndpointState, opts ...pulumi.ResourceOption) (*ClusterEndpoint, error) {
var resource ClusterEndpoint
err := ctx.ReadResource("aws:rds/clusterEndpoint:ClusterEndpoint", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ClusterEndpoint resources.
type clusterEndpointState struct {
// Amazon Resource Name (ARN) of cluster
Arn *string `pulumi:"arn"`
// The identifier to use for the new endpoint. This parameter is stored as a lowercase string.
ClusterEndpointIdentifier *string `pulumi:"clusterEndpointIdentifier"`
// The cluster identifier.
ClusterIdentifier *string `pulumi:"clusterIdentifier"`
// The type of the endpoint. One of: READER , ANY .
CustomEndpointType *string `pulumi:"customEndpointType"`
// A custom endpoint for the Aurora cluster
Endpoint *string `pulumi:"endpoint"`
// List of DB instance identifiers that aren't part of the custom endpoint group. All other eligible instances are reachable through the custom endpoint. Only relevant if the list of static members is empty. Conflicts with `staticMembers`.
ExcludedMembers []string `pulumi:"excludedMembers"`
// List of DB instance identifiers that are part of the custom endpoint group. Conflicts with `excludedMembers`.
StaticMembers []string `pulumi:"staticMembers"`
// Key-value map of resource tags. .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 ClusterEndpointState struct {
// Amazon Resource Name (ARN) of cluster
Arn pulumi.StringPtrInput
// The identifier to use for the new endpoint. This parameter is stored as a lowercase string.
ClusterEndpointIdentifier pulumi.StringPtrInput
// The cluster identifier.
ClusterIdentifier pulumi.StringPtrInput
// The type of the endpoint. One of: READER , ANY .
CustomEndpointType pulumi.StringPtrInput
// A custom endpoint for the Aurora cluster
Endpoint pulumi.StringPtrInput
// List of DB instance identifiers that aren't part of the custom endpoint group. All other eligible instances are reachable through the custom endpoint. Only relevant if the list of static members is empty. Conflicts with `staticMembers`.
ExcludedMembers pulumi.StringArrayInput
// List of DB instance identifiers that are part of the custom endpoint group. Conflicts with `excludedMembers`.
StaticMembers pulumi.StringArrayInput
// Key-value map of resource tags. .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 (ClusterEndpointState) ElementType() reflect.Type {
return reflect.TypeOf((*clusterEndpointState)(nil)).Elem()
}
type clusterEndpointArgs struct {
// The identifier to use for the new endpoint. This parameter is stored as a lowercase string.
ClusterEndpointIdentifier string `pulumi:"clusterEndpointIdentifier"`
// The cluster identifier.
ClusterIdentifier string `pulumi:"clusterIdentifier"`
// The type of the endpoint. One of: READER , ANY .
CustomEndpointType string `pulumi:"customEndpointType"`
// List of DB instance identifiers that aren't part of the custom endpoint group. All other eligible instances are reachable through the custom endpoint. Only relevant if the list of static members is empty. Conflicts with `staticMembers`.
ExcludedMembers []string `pulumi:"excludedMembers"`
// List of DB instance identifiers that are part of the custom endpoint group. Conflicts with `excludedMembers`.
StaticMembers []string `pulumi:"staticMembers"`
// Key-value map of resource tags. .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 ClusterEndpoint resource.
type ClusterEndpointArgs struct {
// The identifier to use for the new endpoint. This parameter is stored as a lowercase string.
ClusterEndpointIdentifier pulumi.StringInput
// The cluster identifier.
ClusterIdentifier pulumi.StringInput
// The type of the endpoint. One of: READER , ANY .
CustomEndpointType pulumi.StringInput
// List of DB instance identifiers that aren't part of the custom endpoint group. All other eligible instances are reachable through the custom endpoint. Only relevant if the list of static members is empty. Conflicts with `staticMembers`.
ExcludedMembers pulumi.StringArrayInput
// List of DB instance identifiers that are part of the custom endpoint group. Conflicts with `excludedMembers`.
StaticMembers pulumi.StringArrayInput
// Key-value map of resource tags. .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 (ClusterEndpointArgs) ElementType() reflect.Type {
return reflect.TypeOf((*clusterEndpointArgs)(nil)).Elem()
}
type ClusterEndpointInput interface {
pulumi.Input
ToClusterEndpointOutput() ClusterEndpointOutput
ToClusterEndpointOutputWithContext(ctx context.Context) ClusterEndpointOutput
}
func (*ClusterEndpoint) ElementType() reflect.Type {
return reflect.TypeOf((**ClusterEndpoint)(nil)).Elem()
}
func (i *ClusterEndpoint) ToClusterEndpointOutput() ClusterEndpointOutput {
return i.ToClusterEndpointOutputWithContext(context.Background())
}
func (i *ClusterEndpoint) ToClusterEndpointOutputWithContext(ctx context.Context) ClusterEndpointOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClusterEndpointOutput)
}
// ClusterEndpointArrayInput is an input type that accepts ClusterEndpointArray and ClusterEndpointArrayOutput values.
// You can construct a concrete instance of `ClusterEndpointArrayInput` via:
//
// ClusterEndpointArray{ ClusterEndpointArgs{...} }
type ClusterEndpointArrayInput interface {
pulumi.Input
ToClusterEndpointArrayOutput() ClusterEndpointArrayOutput
ToClusterEndpointArrayOutputWithContext(context.Context) ClusterEndpointArrayOutput
}
type ClusterEndpointArray []ClusterEndpointInput
func (ClusterEndpointArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ClusterEndpoint)(nil)).Elem()
}
func (i ClusterEndpointArray) ToClusterEndpointArrayOutput() ClusterEndpointArrayOutput {
return i.ToClusterEndpointArrayOutputWithContext(context.Background())
}
func (i ClusterEndpointArray) ToClusterEndpointArrayOutputWithContext(ctx context.Context) ClusterEndpointArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClusterEndpointArrayOutput)
}
// ClusterEndpointMapInput is an input type that accepts ClusterEndpointMap and ClusterEndpointMapOutput values.
// You can construct a concrete instance of `ClusterEndpointMapInput` via:
//
// ClusterEndpointMap{ "key": ClusterEndpointArgs{...} }
type ClusterEndpointMapInput interface {
pulumi.Input
ToClusterEndpointMapOutput() ClusterEndpointMapOutput
ToClusterEndpointMapOutputWithContext(context.Context) ClusterEndpointMapOutput
}
type ClusterEndpointMap map[string]ClusterEndpointInput
func (ClusterEndpointMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ClusterEndpoint)(nil)).Elem()
}
func (i ClusterEndpointMap) ToClusterEndpointMapOutput() ClusterEndpointMapOutput {
return i.ToClusterEndpointMapOutputWithContext(context.Background())
}
func (i ClusterEndpointMap) ToClusterEndpointMapOutputWithContext(ctx context.Context) ClusterEndpointMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClusterEndpointMapOutput)
}
type ClusterEndpointOutput struct{ *pulumi.OutputState }
func (ClusterEndpointOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ClusterEndpoint)(nil)).Elem()
}
func (o ClusterEndpointOutput) ToClusterEndpointOutput() ClusterEndpointOutput {
return o
}
func (o ClusterEndpointOutput) ToClusterEndpointOutputWithContext(ctx context.Context) ClusterEndpointOutput {
return o
}
type ClusterEndpointArrayOutput struct{ *pulumi.OutputState }
func (ClusterEndpointArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ClusterEndpoint)(nil)).Elem()
}
func (o ClusterEndpointArrayOutput) ToClusterEndpointArrayOutput() ClusterEndpointArrayOutput {
return o
}
func (o ClusterEndpointArrayOutput) ToClusterEndpointArrayOutputWithContext(ctx context.Context) ClusterEndpointArrayOutput {
return o
}
func (o ClusterEndpointArrayOutput) Index(i pulumi.IntInput) ClusterEndpointOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ClusterEndpoint {
return vs[0].([]*ClusterEndpoint)[vs[1].(int)]
}).(ClusterEndpointOutput)
}
type ClusterEndpointMapOutput struct{ *pulumi.OutputState }
func (ClusterEndpointMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ClusterEndpoint)(nil)).Elem()
}
func (o ClusterEndpointMapOutput) ToClusterEndpointMapOutput() ClusterEndpointMapOutput {
return o
}
func (o ClusterEndpointMapOutput) ToClusterEndpointMapOutputWithContext(ctx context.Context) ClusterEndpointMapOutput {
return o
}
func (o ClusterEndpointMapOutput) MapIndex(k pulumi.StringInput) ClusterEndpointOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ClusterEndpoint {
return vs[0].(map[string]*ClusterEndpoint)[vs[1].(string)]
}).(ClusterEndpointOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ClusterEndpointInput)(nil)).Elem(), &ClusterEndpoint{})
pulumi.RegisterInputType(reflect.TypeOf((*ClusterEndpointArrayInput)(nil)).Elem(), ClusterEndpointArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ClusterEndpointMapInput)(nil)).Elem(), ClusterEndpointMap{})
pulumi.RegisterOutputType(ClusterEndpointOutput{})
pulumi.RegisterOutputType(ClusterEndpointArrayOutput{})
pulumi.RegisterOutputType(ClusterEndpointMapOutput{})
}