/
clusterSnapshot.go
387 lines (328 loc) · 15.7 KB
/
clusterSnapshot.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
// 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 docdb
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a DocumentDB database cluster snapshot for DocumentDB clusters.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/docdb"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := docdb.NewClusterSnapshot(ctx, "example", &docdb.ClusterSnapshotArgs{
// DbClusterIdentifier: pulumi.Any(exampleAwsDocdbCluster.Id),
// DbClusterSnapshotIdentifier: pulumi.String("resourcetestsnapshot1234"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Using `pulumi import`, import `aws_docdb_cluster_snapshot` using the cluster snapshot identifier. For example:
//
// ```sh
// $ pulumi import aws:docdb/clusterSnapshot:ClusterSnapshot example my-cluster-snapshot
// ```
type ClusterSnapshot struct {
pulumi.CustomResourceState
// List of EC2 Availability Zones that instances in the DocumentDB cluster snapshot can be restored in.
AvailabilityZones pulumi.StringArrayOutput `pulumi:"availabilityZones"`
// The DocumentDB Cluster Identifier from which to take the snapshot.
DbClusterIdentifier pulumi.StringOutput `pulumi:"dbClusterIdentifier"`
// The Amazon Resource Name (ARN) for the DocumentDB Cluster Snapshot.
DbClusterSnapshotArn pulumi.StringOutput `pulumi:"dbClusterSnapshotArn"`
// The Identifier for the snapshot.
DbClusterSnapshotIdentifier pulumi.StringOutput `pulumi:"dbClusterSnapshotIdentifier"`
// Specifies the name of the database engine.
Engine pulumi.StringOutput `pulumi:"engine"`
// Version of the database engine for this DocumentDB cluster snapshot.
EngineVersion pulumi.StringOutput `pulumi:"engineVersion"`
// If storageEncrypted is true, the AWS KMS key identifier for the encrypted DocumentDB cluster snapshot.
KmsKeyId pulumi.StringOutput `pulumi:"kmsKeyId"`
// Port that the DocumentDB cluster was listening on at the time of the snapshot.
Port pulumi.IntOutput `pulumi:"port"`
SnapshotType pulumi.StringOutput `pulumi:"snapshotType"`
SourceDbClusterSnapshotArn pulumi.StringOutput `pulumi:"sourceDbClusterSnapshotArn"`
// The status of this DocumentDB Cluster Snapshot.
Status pulumi.StringOutput `pulumi:"status"`
// Specifies whether the DocumentDB cluster snapshot is encrypted.
StorageEncrypted pulumi.BoolOutput `pulumi:"storageEncrypted"`
// The VPC ID associated with the DocumentDB cluster snapshot.
VpcId pulumi.StringOutput `pulumi:"vpcId"`
}
// NewClusterSnapshot registers a new resource with the given unique name, arguments, and options.
func NewClusterSnapshot(ctx *pulumi.Context,
name string, args *ClusterSnapshotArgs, opts ...pulumi.ResourceOption) (*ClusterSnapshot, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DbClusterIdentifier == nil {
return nil, errors.New("invalid value for required argument 'DbClusterIdentifier'")
}
if args.DbClusterSnapshotIdentifier == nil {
return nil, errors.New("invalid value for required argument 'DbClusterSnapshotIdentifier'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource ClusterSnapshot
err := ctx.RegisterResource("aws:docdb/clusterSnapshot:ClusterSnapshot", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetClusterSnapshot gets an existing ClusterSnapshot 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 GetClusterSnapshot(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ClusterSnapshotState, opts ...pulumi.ResourceOption) (*ClusterSnapshot, error) {
var resource ClusterSnapshot
err := ctx.ReadResource("aws:docdb/clusterSnapshot:ClusterSnapshot", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ClusterSnapshot resources.
type clusterSnapshotState struct {
// List of EC2 Availability Zones that instances in the DocumentDB cluster snapshot can be restored in.
AvailabilityZones []string `pulumi:"availabilityZones"`
// The DocumentDB Cluster Identifier from which to take the snapshot.
DbClusterIdentifier *string `pulumi:"dbClusterIdentifier"`
// The Amazon Resource Name (ARN) for the DocumentDB Cluster Snapshot.
DbClusterSnapshotArn *string `pulumi:"dbClusterSnapshotArn"`
// The Identifier for the snapshot.
DbClusterSnapshotIdentifier *string `pulumi:"dbClusterSnapshotIdentifier"`
// Specifies the name of the database engine.
Engine *string `pulumi:"engine"`
// Version of the database engine for this DocumentDB cluster snapshot.
EngineVersion *string `pulumi:"engineVersion"`
// If storageEncrypted is true, the AWS KMS key identifier for the encrypted DocumentDB cluster snapshot.
KmsKeyId *string `pulumi:"kmsKeyId"`
// Port that the DocumentDB cluster was listening on at the time of the snapshot.
Port *int `pulumi:"port"`
SnapshotType *string `pulumi:"snapshotType"`
SourceDbClusterSnapshotArn *string `pulumi:"sourceDbClusterSnapshotArn"`
// The status of this DocumentDB Cluster Snapshot.
Status *string `pulumi:"status"`
// Specifies whether the DocumentDB cluster snapshot is encrypted.
StorageEncrypted *bool `pulumi:"storageEncrypted"`
// The VPC ID associated with the DocumentDB cluster snapshot.
VpcId *string `pulumi:"vpcId"`
}
type ClusterSnapshotState struct {
// List of EC2 Availability Zones that instances in the DocumentDB cluster snapshot can be restored in.
AvailabilityZones pulumi.StringArrayInput
// The DocumentDB Cluster Identifier from which to take the snapshot.
DbClusterIdentifier pulumi.StringPtrInput
// The Amazon Resource Name (ARN) for the DocumentDB Cluster Snapshot.
DbClusterSnapshotArn pulumi.StringPtrInput
// The Identifier for the snapshot.
DbClusterSnapshotIdentifier pulumi.StringPtrInput
// Specifies the name of the database engine.
Engine pulumi.StringPtrInput
// Version of the database engine for this DocumentDB cluster snapshot.
EngineVersion pulumi.StringPtrInput
// If storageEncrypted is true, the AWS KMS key identifier for the encrypted DocumentDB cluster snapshot.
KmsKeyId pulumi.StringPtrInput
// Port that the DocumentDB cluster was listening on at the time of the snapshot.
Port pulumi.IntPtrInput
SnapshotType pulumi.StringPtrInput
SourceDbClusterSnapshotArn pulumi.StringPtrInput
// The status of this DocumentDB Cluster Snapshot.
Status pulumi.StringPtrInput
// Specifies whether the DocumentDB cluster snapshot is encrypted.
StorageEncrypted pulumi.BoolPtrInput
// The VPC ID associated with the DocumentDB cluster snapshot.
VpcId pulumi.StringPtrInput
}
func (ClusterSnapshotState) ElementType() reflect.Type {
return reflect.TypeOf((*clusterSnapshotState)(nil)).Elem()
}
type clusterSnapshotArgs struct {
// The DocumentDB Cluster Identifier from which to take the snapshot.
DbClusterIdentifier string `pulumi:"dbClusterIdentifier"`
// The Identifier for the snapshot.
DbClusterSnapshotIdentifier string `pulumi:"dbClusterSnapshotIdentifier"`
}
// The set of arguments for constructing a ClusterSnapshot resource.
type ClusterSnapshotArgs struct {
// The DocumentDB Cluster Identifier from which to take the snapshot.
DbClusterIdentifier pulumi.StringInput
// The Identifier for the snapshot.
DbClusterSnapshotIdentifier pulumi.StringInput
}
func (ClusterSnapshotArgs) ElementType() reflect.Type {
return reflect.TypeOf((*clusterSnapshotArgs)(nil)).Elem()
}
type ClusterSnapshotInput interface {
pulumi.Input
ToClusterSnapshotOutput() ClusterSnapshotOutput
ToClusterSnapshotOutputWithContext(ctx context.Context) ClusterSnapshotOutput
}
func (*ClusterSnapshot) ElementType() reflect.Type {
return reflect.TypeOf((**ClusterSnapshot)(nil)).Elem()
}
func (i *ClusterSnapshot) ToClusterSnapshotOutput() ClusterSnapshotOutput {
return i.ToClusterSnapshotOutputWithContext(context.Background())
}
func (i *ClusterSnapshot) ToClusterSnapshotOutputWithContext(ctx context.Context) ClusterSnapshotOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClusterSnapshotOutput)
}
// ClusterSnapshotArrayInput is an input type that accepts ClusterSnapshotArray and ClusterSnapshotArrayOutput values.
// You can construct a concrete instance of `ClusterSnapshotArrayInput` via:
//
// ClusterSnapshotArray{ ClusterSnapshotArgs{...} }
type ClusterSnapshotArrayInput interface {
pulumi.Input
ToClusterSnapshotArrayOutput() ClusterSnapshotArrayOutput
ToClusterSnapshotArrayOutputWithContext(context.Context) ClusterSnapshotArrayOutput
}
type ClusterSnapshotArray []ClusterSnapshotInput
func (ClusterSnapshotArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ClusterSnapshot)(nil)).Elem()
}
func (i ClusterSnapshotArray) ToClusterSnapshotArrayOutput() ClusterSnapshotArrayOutput {
return i.ToClusterSnapshotArrayOutputWithContext(context.Background())
}
func (i ClusterSnapshotArray) ToClusterSnapshotArrayOutputWithContext(ctx context.Context) ClusterSnapshotArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClusterSnapshotArrayOutput)
}
// ClusterSnapshotMapInput is an input type that accepts ClusterSnapshotMap and ClusterSnapshotMapOutput values.
// You can construct a concrete instance of `ClusterSnapshotMapInput` via:
//
// ClusterSnapshotMap{ "key": ClusterSnapshotArgs{...} }
type ClusterSnapshotMapInput interface {
pulumi.Input
ToClusterSnapshotMapOutput() ClusterSnapshotMapOutput
ToClusterSnapshotMapOutputWithContext(context.Context) ClusterSnapshotMapOutput
}
type ClusterSnapshotMap map[string]ClusterSnapshotInput
func (ClusterSnapshotMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ClusterSnapshot)(nil)).Elem()
}
func (i ClusterSnapshotMap) ToClusterSnapshotMapOutput() ClusterSnapshotMapOutput {
return i.ToClusterSnapshotMapOutputWithContext(context.Background())
}
func (i ClusterSnapshotMap) ToClusterSnapshotMapOutputWithContext(ctx context.Context) ClusterSnapshotMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClusterSnapshotMapOutput)
}
type ClusterSnapshotOutput struct{ *pulumi.OutputState }
func (ClusterSnapshotOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ClusterSnapshot)(nil)).Elem()
}
func (o ClusterSnapshotOutput) ToClusterSnapshotOutput() ClusterSnapshotOutput {
return o
}
func (o ClusterSnapshotOutput) ToClusterSnapshotOutputWithContext(ctx context.Context) ClusterSnapshotOutput {
return o
}
// List of EC2 Availability Zones that instances in the DocumentDB cluster snapshot can be restored in.
func (o ClusterSnapshotOutput) AvailabilityZones() pulumi.StringArrayOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringArrayOutput { return v.AvailabilityZones }).(pulumi.StringArrayOutput)
}
// The DocumentDB Cluster Identifier from which to take the snapshot.
func (o ClusterSnapshotOutput) DbClusterIdentifier() pulumi.StringOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.DbClusterIdentifier }).(pulumi.StringOutput)
}
// The Amazon Resource Name (ARN) for the DocumentDB Cluster Snapshot.
func (o ClusterSnapshotOutput) DbClusterSnapshotArn() pulumi.StringOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.DbClusterSnapshotArn }).(pulumi.StringOutput)
}
// The Identifier for the snapshot.
func (o ClusterSnapshotOutput) DbClusterSnapshotIdentifier() pulumi.StringOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.DbClusterSnapshotIdentifier }).(pulumi.StringOutput)
}
// Specifies the name of the database engine.
func (o ClusterSnapshotOutput) Engine() pulumi.StringOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.Engine }).(pulumi.StringOutput)
}
// Version of the database engine for this DocumentDB cluster snapshot.
func (o ClusterSnapshotOutput) EngineVersion() pulumi.StringOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.EngineVersion }).(pulumi.StringOutput)
}
// If storageEncrypted is true, the AWS KMS key identifier for the encrypted DocumentDB cluster snapshot.
func (o ClusterSnapshotOutput) KmsKeyId() pulumi.StringOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.KmsKeyId }).(pulumi.StringOutput)
}
// Port that the DocumentDB cluster was listening on at the time of the snapshot.
func (o ClusterSnapshotOutput) Port() pulumi.IntOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.IntOutput { return v.Port }).(pulumi.IntOutput)
}
func (o ClusterSnapshotOutput) SnapshotType() pulumi.StringOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.SnapshotType }).(pulumi.StringOutput)
}
func (o ClusterSnapshotOutput) SourceDbClusterSnapshotArn() pulumi.StringOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.SourceDbClusterSnapshotArn }).(pulumi.StringOutput)
}
// The status of this DocumentDB Cluster Snapshot.
func (o ClusterSnapshotOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
// Specifies whether the DocumentDB cluster snapshot is encrypted.
func (o ClusterSnapshotOutput) StorageEncrypted() pulumi.BoolOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.BoolOutput { return v.StorageEncrypted }).(pulumi.BoolOutput)
}
// The VPC ID associated with the DocumentDB cluster snapshot.
func (o ClusterSnapshotOutput) VpcId() pulumi.StringOutput {
return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput)
}
type ClusterSnapshotArrayOutput struct{ *pulumi.OutputState }
func (ClusterSnapshotArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ClusterSnapshot)(nil)).Elem()
}
func (o ClusterSnapshotArrayOutput) ToClusterSnapshotArrayOutput() ClusterSnapshotArrayOutput {
return o
}
func (o ClusterSnapshotArrayOutput) ToClusterSnapshotArrayOutputWithContext(ctx context.Context) ClusterSnapshotArrayOutput {
return o
}
func (o ClusterSnapshotArrayOutput) Index(i pulumi.IntInput) ClusterSnapshotOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ClusterSnapshot {
return vs[0].([]*ClusterSnapshot)[vs[1].(int)]
}).(ClusterSnapshotOutput)
}
type ClusterSnapshotMapOutput struct{ *pulumi.OutputState }
func (ClusterSnapshotMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ClusterSnapshot)(nil)).Elem()
}
func (o ClusterSnapshotMapOutput) ToClusterSnapshotMapOutput() ClusterSnapshotMapOutput {
return o
}
func (o ClusterSnapshotMapOutput) ToClusterSnapshotMapOutputWithContext(ctx context.Context) ClusterSnapshotMapOutput {
return o
}
func (o ClusterSnapshotMapOutput) MapIndex(k pulumi.StringInput) ClusterSnapshotOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ClusterSnapshot {
return vs[0].(map[string]*ClusterSnapshot)[vs[1].(string)]
}).(ClusterSnapshotOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ClusterSnapshotInput)(nil)).Elem(), &ClusterSnapshot{})
pulumi.RegisterInputType(reflect.TypeOf((*ClusterSnapshotArrayInput)(nil)).Elem(), ClusterSnapshotArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ClusterSnapshotMapInput)(nil)).Elem(), ClusterSnapshotMap{})
pulumi.RegisterOutputType(ClusterSnapshotOutput{})
pulumi.RegisterOutputType(ClusterSnapshotArrayOutput{})
pulumi.RegisterOutputType(ClusterSnapshotMapOutput{})
}