aws-sdk-rds 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/lib/aws-sdk-rds.rb +73 -0
  3. data/lib/aws-sdk-rds/account_quota.rb +100 -0
  4. data/lib/aws-sdk-rds/certificate.rb +123 -0
  5. data/lib/aws-sdk-rds/client.rb +9214 -0
  6. data/lib/aws-sdk-rds/client_api.rb +3027 -0
  7. data/lib/aws-sdk-rds/customizations.rb +7 -0
  8. data/lib/aws-sdk-rds/db_cluster.rb +1074 -0
  9. data/lib/aws-sdk-rds/db_cluster_parameter_group.rb +230 -0
  10. data/lib/aws-sdk-rds/db_cluster_snapshot.rb +478 -0
  11. data/lib/aws-sdk-rds/db_engine.rb +241 -0
  12. data/lib/aws-sdk-rds/db_engine_version.rb +263 -0
  13. data/lib/aws-sdk-rds/db_instance.rb +2680 -0
  14. data/lib/aws-sdk-rds/db_log_file.rb +170 -0
  15. data/lib/aws-sdk-rds/db_parameter_group.rb +455 -0
  16. data/lib/aws-sdk-rds/db_parameter_group_family.rb +167 -0
  17. data/lib/aws-sdk-rds/db_security_group.rb +358 -0
  18. data/lib/aws-sdk-rds/db_snapshot.rb +714 -0
  19. data/lib/aws-sdk-rds/db_snapshot_attribute.rb +160 -0
  20. data/lib/aws-sdk-rds/db_subnet_group.rb +188 -0
  21. data/lib/aws-sdk-rds/errors.rb +23 -0
  22. data/lib/aws-sdk-rds/event.rb +134 -0
  23. data/lib/aws-sdk-rds/event_category_map.rb +98 -0
  24. data/lib/aws-sdk-rds/event_subscription.rb +352 -0
  25. data/lib/aws-sdk-rds/option_group.rb +283 -0
  26. data/lib/aws-sdk-rds/option_group_option.rb +166 -0
  27. data/lib/aws-sdk-rds/parameter.rb +144 -0
  28. data/lib/aws-sdk-rds/pending_maintenance_action.rb +211 -0
  29. data/lib/aws-sdk-rds/reserved_db_instance.rb +191 -0
  30. data/lib/aws-sdk-rds/reserved_db_instances_offering.rb +183 -0
  31. data/lib/aws-sdk-rds/resource.rb +2384 -0
  32. data/lib/aws-sdk-rds/resource_pending_maintenance_action_list.rb +111 -0
  33. data/lib/aws-sdk-rds/types.rb +10965 -0
  34. data/lib/aws-sdk-rds/waiters.rb +149 -0
  35. metadata +106 -0
@@ -0,0 +1,7 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing for info on making contributions:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
@@ -0,0 +1,1074 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing for info on making contributions:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ module Aws
9
+ module RDS
10
+ class DBCluster
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(id, options = {})
15
+ # @param [String] id
16
+ # @option options [Client] :client
17
+ # @overload def initialize(options = {})
18
+ # @option options [required, String] :id
19
+ # @option options [Client] :client
20
+ def initialize(*args)
21
+ options = Hash === args.last ? args.pop.dup : {}
22
+ @id = extract_id(args, options)
23
+ @data = options.delete(:data)
24
+ @client = options.delete(:client) || Client.new(options)
25
+ end
26
+
27
+ # @!group Read-Only Attributes
28
+
29
+ # @return [String]
30
+ def id
31
+ @id
32
+ end
33
+ alias :db_cluster_identifier :id
34
+
35
+ # Specifies the allocated storage size in gigabytes (GB).
36
+ # @return [Integer]
37
+ def allocated_storage
38
+ data.allocated_storage
39
+ end
40
+
41
+ # Provides the list of EC2 Availability Zones that instances in the DB
42
+ # cluster can be created in.
43
+ # @return [Array<String>]
44
+ def availability_zones
45
+ data.availability_zones
46
+ end
47
+
48
+ # Specifies the number of days for which automatic DB snapshots are
49
+ # retained.
50
+ # @return [Integer]
51
+ def backup_retention_period
52
+ data.backup_retention_period
53
+ end
54
+
55
+ # If present, specifies the name of the character set that this cluster
56
+ # is associated with.
57
+ # @return [String]
58
+ def character_set_name
59
+ data.character_set_name
60
+ end
61
+
62
+ # Contains the name of the initial database of this DB cluster that was
63
+ # provided at create time, if one was specified when the DB cluster was
64
+ # created. This same name is returned for the life of the DB cluster.
65
+ # @return [String]
66
+ def database_name
67
+ data.database_name
68
+ end
69
+
70
+ # Specifies the name of the DB cluster parameter group for the DB
71
+ # cluster.
72
+ # @return [String]
73
+ def db_cluster_parameter_group
74
+ data.db_cluster_parameter_group
75
+ end
76
+
77
+ # Specifies information on the subnet group associated with the DB
78
+ # cluster, including the name, description, and subnets in the subnet
79
+ # group.
80
+ # @return [String]
81
+ def db_subnet_group
82
+ data.db_subnet_group
83
+ end
84
+
85
+ # Specifies the current state of this DB cluster.
86
+ # @return [String]
87
+ def status
88
+ data.status
89
+ end
90
+
91
+ # Specifies the progress of the operation as a percentage.
92
+ # @return [String]
93
+ def percent_progress
94
+ data.percent_progress
95
+ end
96
+
97
+ # Specifies the earliest time to which a database can be restored with
98
+ # point-in-time restore.
99
+ # @return [Time]
100
+ def earliest_restorable_time
101
+ data.earliest_restorable_time
102
+ end
103
+
104
+ # Specifies the connection endpoint for the primary instance of the DB
105
+ # cluster.
106
+ # @return [String]
107
+ def endpoint
108
+ data.endpoint
109
+ end
110
+
111
+ # The reader endpoint for the DB cluster. The reader endpoint for a DB
112
+ # cluster load-balances connections across the Aurora Replicas that are
113
+ # available in a DB cluster. As clients request new connections to the
114
+ # reader endpoint, Aurora distributes the connection requests among the
115
+ # Aurora Replicas in the DB cluster. This functionality can help balance
116
+ # your read workload across multiple Aurora Replicas in your DB cluster.
117
+ #
118
+ # If a failover occurs, and the Aurora Replica that you are connected to
119
+ # is promoted to be the primary instance, your connection will be
120
+ # dropped. To continue sending your read workload to other Aurora
121
+ # Replicas in the cluster, you can then recoonect to the reader
122
+ # endpoint.
123
+ # @return [String]
124
+ def reader_endpoint
125
+ data.reader_endpoint
126
+ end
127
+
128
+ # Provides the name of the database engine to be used for this DB
129
+ # cluster.
130
+ # @return [String]
131
+ def engine
132
+ data.engine
133
+ end
134
+
135
+ # Indicates the database engine version.
136
+ # @return [String]
137
+ def engine_version
138
+ data.engine_version
139
+ end
140
+
141
+ # Specifies the latest time to which a database can be restored with
142
+ # point-in-time restore.
143
+ # @return [Time]
144
+ def latest_restorable_time
145
+ data.latest_restorable_time
146
+ end
147
+
148
+ # Specifies the port that the database engine is listening on.
149
+ # @return [Integer]
150
+ def port
151
+ data.port
152
+ end
153
+
154
+ # Contains the master username for the DB cluster.
155
+ # @return [String]
156
+ def master_username
157
+ data.master_username
158
+ end
159
+
160
+ # Provides the list of option group memberships for this DB cluster.
161
+ # @return [Array<Types::DBClusterOptionGroupStatus>]
162
+ def db_cluster_option_group_memberships
163
+ data.db_cluster_option_group_memberships
164
+ end
165
+
166
+ # Specifies the daily time range during which automated backups are
167
+ # created if automated backups are enabled, as determined by the
168
+ # `BackupRetentionPeriod`.
169
+ # @return [String]
170
+ def preferred_backup_window
171
+ data.preferred_backup_window
172
+ end
173
+
174
+ # Specifies the weekly time range during which system maintenance can
175
+ # occur, in Universal Coordinated Time (UTC).
176
+ # @return [String]
177
+ def preferred_maintenance_window
178
+ data.preferred_maintenance_window
179
+ end
180
+
181
+ # Contains the identifier of the source DB cluster if this DB cluster is
182
+ # a Read Replica.
183
+ # @return [String]
184
+ def replication_source_identifier
185
+ data.replication_source_identifier
186
+ end
187
+
188
+ # Contains one or more identifiers of the Read Replicas associated with
189
+ # this DB cluster.
190
+ # @return [Array<String>]
191
+ def read_replica_identifiers
192
+ data.read_replica_identifiers
193
+ end
194
+
195
+ # Provides the list of instances that make up the DB cluster.
196
+ # @return [Array<Types::DBClusterMember>]
197
+ def db_cluster_members
198
+ data.db_cluster_members
199
+ end
200
+
201
+ # Provides a list of VPC security groups that the DB cluster belongs to.
202
+ # @return [Array<Types::VpcSecurityGroupMembership>]
203
+ def vpc_security_groups
204
+ data.vpc_security_groups
205
+ end
206
+
207
+ # Specifies the ID that Amazon Route 53 assigns when you create a hosted
208
+ # zone.
209
+ # @return [String]
210
+ def hosted_zone_id
211
+ data.hosted_zone_id
212
+ end
213
+
214
+ # Specifies whether the DB cluster is encrypted.
215
+ # @return [Boolean]
216
+ def storage_encrypted
217
+ data.storage_encrypted
218
+ end
219
+
220
+ # If `StorageEncrypted` is true, the KMS key identifier for the
221
+ # encrypted DB cluster.
222
+ # @return [String]
223
+ def kms_key_id
224
+ data.kms_key_id
225
+ end
226
+
227
+ # The region-unique, immutable identifier for the DB cluster. This
228
+ # identifier is found in AWS CloudTrail log entries whenever the KMS key
229
+ # for the DB cluster is accessed.
230
+ # @return [String]
231
+ def db_cluster_resource_id
232
+ data.db_cluster_resource_id
233
+ end
234
+
235
+ # The Amazon Resource Name (ARN) for the DB cluster.
236
+ # @return [String]
237
+ def db_cluster_arn
238
+ data.db_cluster_arn
239
+ end
240
+
241
+ # Provides a list of the AWS Identity and Access Management (IAM) roles
242
+ # that are associated with the DB cluster. IAM roles that are associated
243
+ # with a DB cluster grant permission for the DB cluster to access other
244
+ # AWS services on your behalf.
245
+ # @return [Array<Types::DBClusterRole>]
246
+ def associated_roles
247
+ data.associated_roles
248
+ end
249
+
250
+ # @!endgroup
251
+
252
+ # @return [Client]
253
+ def client
254
+ @client
255
+ end
256
+
257
+ # Loads, or reloads {#data} for the current {DBCluster}.
258
+ # Returns `self` making it possible to chain methods.
259
+ #
260
+ # db_cluster.reload.data
261
+ #
262
+ # @return [self]
263
+ def load
264
+ resp = @client.describe_db_clusters(db_cluster_identifier: @id)
265
+ @data = resp.dbclusters[0]
266
+ self
267
+ end
268
+ alias :reload :load
269
+
270
+ # @return [Types::DBCluster]
271
+ # Returns the data for this {DBCluster}. Calls
272
+ # {Client#describe_db_clusters} if {#data_loaded?} is `false`.
273
+ def data
274
+ load unless @data
275
+ @data
276
+ end
277
+
278
+ # @return [Boolean]
279
+ # Returns `true` if this resource is loaded. Accessing attributes or
280
+ # {#data} on an unloaded resource will trigger a call to {#load}.
281
+ def data_loaded?
282
+ !!@data
283
+ end
284
+
285
+ # @!group Actions
286
+
287
+ # @example Request syntax with placeholder values
288
+ #
289
+ # dbcluster = db_cluster.create({
290
+ # availability_zones: ["String"],
291
+ # backup_retention_period: 1,
292
+ # character_set_name: "String",
293
+ # database_name: "String",
294
+ # db_cluster_parameter_group_name: "String",
295
+ # vpc_security_group_ids: ["String"],
296
+ # db_subnet_group_name: "String",
297
+ # engine: "String", # required
298
+ # engine_version: "String",
299
+ # port: 1,
300
+ # master_username: "String",
301
+ # master_user_password: "String",
302
+ # option_group_name: "String",
303
+ # preferred_backup_window: "String",
304
+ # preferred_maintenance_window: "String",
305
+ # replication_source_identifier: "String",
306
+ # tags: [
307
+ # {
308
+ # key: "String",
309
+ # value: "String",
310
+ # },
311
+ # ],
312
+ # storage_encrypted: false,
313
+ # kms_key_id: "String",
314
+ # })
315
+ # @param [Hash] options ({})
316
+ # @option options [Array<String>] :availability_zones
317
+ # A list of EC2 Availability Zones that instances in the DB cluster can
318
+ # be created in. For information on regions and Availability Zones, see
319
+ # [Regions and Availability Zones][1].
320
+ #
321
+ #
322
+ #
323
+ # [1]: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html
324
+ # @option options [Integer] :backup_retention_period
325
+ # The number of days for which automated backups are retained. You must
326
+ # specify a minimum value of 1.
327
+ #
328
+ # Default: 1
329
+ #
330
+ # Constraints:
331
+ #
332
+ # * Must be a value from 1 to 35
333
+ #
334
+ # ^
335
+ # @option options [String] :character_set_name
336
+ # A value that indicates that the DB cluster should be associated with
337
+ # the specified CharacterSet.
338
+ # @option options [String] :database_name
339
+ # The name for your database of up to 8 alpha-numeric characters. If you
340
+ # do not provide a name, Amazon RDS will not create a database in the DB
341
+ # cluster you are creating.
342
+ # @option options [String] :db_cluster_parameter_group_name
343
+ # The name of the DB cluster parameter group to associate with this DB
344
+ # cluster. If this argument is omitted, `default.aurora5.6` will be
345
+ # used.
346
+ #
347
+ # Constraints:
348
+ #
349
+ # * Must be 1 to 255 alphanumeric characters
350
+ #
351
+ # * First character must be a letter
352
+ #
353
+ # * Cannot end with a hyphen or contain two consecutive hyphens
354
+ # @option options [Array<String>] :vpc_security_group_ids
355
+ # A list of EC2 VPC security groups to associate with this DB cluster.
356
+ # @option options [String] :db_subnet_group_name
357
+ # A DB subnet group to associate with this DB cluster.
358
+ #
359
+ # Constraints: Must contain no more than 255 alphanumeric characters,
360
+ # periods, underscores, spaces, or hyphens. Must not be default.
361
+ #
362
+ # Example: `mySubnetgroup`
363
+ # @option options [required, String] :engine
364
+ # The name of the database engine to be used for this DB cluster.
365
+ #
366
+ # Valid Values: `aurora`
367
+ # @option options [String] :engine_version
368
+ # The version number of the database engine to use.
369
+ #
370
+ # **Aurora**
371
+ #
372
+ # Example: `5.6.10a`
373
+ # @option options [Integer] :port
374
+ # The port number on which the instances in the DB cluster accept
375
+ # connections.
376
+ #
377
+ # Default: `3306`
378
+ # @option options [String] :master_username
379
+ # The name of the master user for the DB cluster.
380
+ #
381
+ # Constraints:
382
+ #
383
+ # * Must be 1 to 16 alphanumeric characters.
384
+ #
385
+ # * First character must be a letter.
386
+ #
387
+ # * Cannot be a reserved word for the chosen database engine.
388
+ # @option options [String] :master_user_password
389
+ # The password for the master database user. This password can contain
390
+ # any printable ASCII character except "/", """, or "@".
391
+ #
392
+ # Constraints: Must contain from 8 to 41 characters.
393
+ # @option options [String] :option_group_name
394
+ # A value that indicates that the DB cluster should be associated with
395
+ # the specified option group.
396
+ #
397
+ # Permanent options cannot be removed from an option group. The option
398
+ # group cannot be removed from a DB cluster once it is associated with a
399
+ # DB cluster.
400
+ # @option options [String] :preferred_backup_window
401
+ # The daily time range during which automated backups are created if
402
+ # automated backups are enabled using the `BackupRetentionPeriod`
403
+ # parameter.
404
+ #
405
+ # Default: A 30-minute window selected at random from an 8-hour block of
406
+ # time per region. To see the time blocks available, see [ Adjusting the
407
+ # Preferred Maintenance Window][1] in the *Amazon RDS User Guide.*
408
+ #
409
+ # Constraints:
410
+ #
411
+ # * Must be in the format `hh24:mi-hh24:mi`.
412
+ #
413
+ # * Times should be in Universal Coordinated Time (UTC).
414
+ #
415
+ # * Must not conflict with the preferred maintenance window.
416
+ #
417
+ # * Must be at least 30 minutes.
418
+ #
419
+ #
420
+ #
421
+ # [1]: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/AdjustingTheMaintenanceWindow.html
422
+ # @option options [String] :preferred_maintenance_window
423
+ # The weekly time range during which system maintenance can occur, in
424
+ # Universal Coordinated Time (UTC).
425
+ #
426
+ # Format: `ddd:hh24:mi-ddd:hh24:mi`
427
+ #
428
+ # Default: A 30-minute window selected at random from an 8-hour block of
429
+ # time per region, occurring on a random day of the week. To see the
430
+ # time blocks available, see [ Adjusting the Preferred Maintenance
431
+ # Window][1] in the *Amazon RDS User Guide.*
432
+ #
433
+ # Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
434
+ #
435
+ # Constraints: Minimum 30-minute window.
436
+ #
437
+ #
438
+ #
439
+ # [1]: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/AdjustingTheMaintenanceWindow.html
440
+ # @option options [String] :replication_source_identifier
441
+ # The Amazon Resource Name (ARN) of the source DB cluster if this DB
442
+ # cluster is created as a Read Replica.
443
+ # @option options [Array<Types::Tag>] :tags
444
+ # A list of tags.
445
+ # @option options [Boolean] :storage_encrypted
446
+ # Specifies whether the DB cluster is encrypted.
447
+ # @option options [String] :kms_key_id
448
+ # The KMS key identifier for an encrypted DB cluster.
449
+ #
450
+ # The KMS key identifier is the Amazon Resource Name (ARN) for the KMS
451
+ # encryption key. If you are creating a DB cluster with the same AWS
452
+ # account that owns the KMS encryption key used to encrypt the new DB
453
+ # cluster, then you can use the KMS key alias instead of the ARN for the
454
+ # KM encryption key.
455
+ #
456
+ # If the `StorageEncrypted` parameter is true, and you do not specify a
457
+ # value for the `KmsKeyId` parameter, then Amazon RDS will use your
458
+ # default encryption key. AWS KMS creates the default encryption key for
459
+ # your AWS account. Your AWS account has a different default encryption
460
+ # key for each AWS region.
461
+ # @return [DBCluster]
462
+ def create(options = {})
463
+ options = options.merge(db_cluster_identifier: @id)
464
+ resp = @client.create_db_cluster(options)
465
+ DBCluster.new(
466
+ id: resp.data.db_cluster.db_cluster_identifier,
467
+ data: resp.data.db_cluster,
468
+ client: @client
469
+ )
470
+ end
471
+
472
+ # @example Request syntax with placeholder values
473
+ #
474
+ # dbclustersnapshot = db_cluster.create_snapshot({
475
+ # db_cluster_snapshot_identifier: "String", # required
476
+ # tags: [
477
+ # {
478
+ # key: "String",
479
+ # value: "String",
480
+ # },
481
+ # ],
482
+ # })
483
+ # @param [Hash] options ({})
484
+ # @option options [required, String] :db_cluster_snapshot_identifier
485
+ # The identifier of the DB cluster snapshot. This parameter is stored as
486
+ # a lowercase string.
487
+ #
488
+ # Constraints:
489
+ #
490
+ # * Must contain from 1 to 63 alphanumeric characters or hyphens.
491
+ #
492
+ # * First character must be a letter.
493
+ #
494
+ # * Cannot end with a hyphen or contain two consecutive hyphens.
495
+ #
496
+ # Example: `my-cluster1-snapshot1`
497
+ # @option options [Array<Types::Tag>] :tags
498
+ # The tags to be assigned to the DB cluster snapshot.
499
+ # @return [DBClusterSnapshot]
500
+ def create_snapshot(options = {})
501
+ options = options.merge(db_cluster_identifier: @id)
502
+ resp = @client.create_db_cluster_snapshot(options)
503
+ DBClusterSnapshot.new(
504
+ cluster_id: resp.data.db_cluster_snapshot.db_cluster_identifier,
505
+ snapshot_id: resp.data.db_cluster_snapshot.db_cluster_snapshot_identifier,
506
+ data: resp.data.db_cluster_snapshot,
507
+ client: @client
508
+ )
509
+ end
510
+
511
+ # @example Request syntax with placeholder values
512
+ #
513
+ # dbcluster = db_cluster.delete({
514
+ # skip_final_snapshot: false,
515
+ # final_db_snapshot_identifier: "String",
516
+ # })
517
+ # @param [Hash] options ({})
518
+ # @option options [Boolean] :skip_final_snapshot
519
+ # Determines whether a final DB cluster snapshot is created before the
520
+ # DB cluster is deleted. If `true` is specified, no DB cluster snapshot
521
+ # is created. If `false` is specified, a DB cluster snapshot is created
522
+ # before the DB cluster is deleted.
523
+ #
524
+ # <note markdown="1"> You must specify a `FinalDBSnapshotIdentifier` parameter if
525
+ # `SkipFinalSnapshot` is `false`.
526
+ #
527
+ # </note>
528
+ #
529
+ # Default: `false`
530
+ # @option options [String] :final_db_snapshot_identifier
531
+ # The DB cluster snapshot identifier of the new DB cluster snapshot
532
+ # created when `SkipFinalSnapshot` is set to `false`.
533
+ #
534
+ # <note markdown="1"> Specifying this parameter and also setting the `SkipFinalShapshot`
535
+ # parameter to true results in an error.
536
+ #
537
+ # </note>
538
+ #
539
+ # Constraints:
540
+ #
541
+ # * Must be 1 to 255 alphanumeric characters
542
+ #
543
+ # * First character must be a letter
544
+ #
545
+ # * Cannot end with a hyphen or contain two consecutive hyphens
546
+ # @return [DBCluster]
547
+ def delete(options = {})
548
+ options = options.merge(db_cluster_identifier: @id)
549
+ resp = @client.delete_db_cluster(options)
550
+ DBCluster.new(
551
+ id: resp.data.db_cluster.db_cluster_identifier,
552
+ data: resp.data.db_cluster,
553
+ client: @client
554
+ )
555
+ end
556
+
557
+ # @example Request syntax with placeholder values
558
+ #
559
+ # dbcluster = db_cluster.failover({
560
+ # target_db_instance_identifier: "String",
561
+ # })
562
+ # @param [Hash] options ({})
563
+ # @option options [String] :target_db_instance_identifier
564
+ # The name of the instance to promote to the primary instance.
565
+ #
566
+ # You must specify the instance identifier for an Aurora Replica in the
567
+ # DB cluster. For example, `mydbcluster-replica1`.
568
+ # @return [DBCluster]
569
+ def failover(options = {})
570
+ options = options.merge(db_cluster_identifier: @id)
571
+ resp = @client.failover_db_cluster(options)
572
+ DBCluster.new(
573
+ id: resp.data.db_cluster.db_cluster_identifier,
574
+ data: resp.data.db_cluster,
575
+ client: @client
576
+ )
577
+ end
578
+
579
+ # @example Request syntax with placeholder values
580
+ #
581
+ # dbcluster = db_cluster.modify({
582
+ # new_db_cluster_identifier: "String",
583
+ # apply_immediately: false,
584
+ # backup_retention_period: 1,
585
+ # db_cluster_parameter_group_name: "String",
586
+ # vpc_security_group_ids: ["String"],
587
+ # port: 1,
588
+ # master_user_password: "String",
589
+ # option_group_name: "String",
590
+ # preferred_backup_window: "String",
591
+ # preferred_maintenance_window: "String",
592
+ # })
593
+ # @param [Hash] options ({})
594
+ # @option options [String] :new_db_cluster_identifier
595
+ # The new DB cluster identifier for the DB cluster when renaming a DB
596
+ # cluster. This value is stored as a lowercase string.
597
+ #
598
+ # Constraints:
599
+ #
600
+ # * Must contain from 1 to 63 alphanumeric characters or hyphens
601
+ #
602
+ # * First character must be a letter
603
+ #
604
+ # * Cannot end with a hyphen or contain two consecutive hyphens
605
+ #
606
+ # Example: `my-cluster2`
607
+ # @option options [Boolean] :apply_immediately
608
+ # A value that specifies whether the modifications in this request and
609
+ # any pending modifications are asynchronously applied as soon as
610
+ # possible, regardless of the `PreferredMaintenanceWindow` setting for
611
+ # the DB cluster. If this parameter is set to `false`, changes to the DB
612
+ # cluster are applied during the next maintenance window.
613
+ #
614
+ # The `ApplyImmediately` parameter only affects the
615
+ # `NewDBClusterIdentifier` and `MasterUserPassword` values. If you set
616
+ # the `ApplyImmediately` parameter value to false, then changes to the
617
+ # `NewDBClusterIdentifier` and `MasterUserPassword` values are applied
618
+ # during the next maintenance window. All other changes are applied
619
+ # immediately, regardless of the value of the `ApplyImmediately`
620
+ # parameter.
621
+ #
622
+ # Default: `false`
623
+ # @option options [Integer] :backup_retention_period
624
+ # The number of days for which automated backups are retained. You must
625
+ # specify a minimum value of 1.
626
+ #
627
+ # Default: 1
628
+ #
629
+ # Constraints:
630
+ #
631
+ # * Must be a value from 1 to 35
632
+ #
633
+ # ^
634
+ # @option options [String] :db_cluster_parameter_group_name
635
+ # The name of the DB cluster parameter group to use for the DB cluster.
636
+ # @option options [Array<String>] :vpc_security_group_ids
637
+ # A lst of VPC security groups that the DB cluster will belong to.
638
+ # @option options [Integer] :port
639
+ # The port number on which the DB cluster accepts connections.
640
+ #
641
+ # Constraints: Value must be `1150-65535`
642
+ #
643
+ # Default: The same port as the original DB cluster.
644
+ # @option options [String] :master_user_password
645
+ # The new password for the master database user. This password can
646
+ # contain any printable ASCII character except "/", """, or "@".
647
+ #
648
+ # Constraints: Must contain from 8 to 41 characters.
649
+ # @option options [String] :option_group_name
650
+ # A value that indicates that the DB cluster should be associated with
651
+ # the specified option group. Changing this parameter does not result in
652
+ # an outage except in the following case, and the change is applied
653
+ # during the next maintenance window unless the `ApplyImmediately`
654
+ # parameter is set to `true` for this request. If the parameter change
655
+ # results in an option group that enables OEM, this change can cause a
656
+ # brief (sub-second) period during which new connections are rejected
657
+ # but existing connections are not interrupted.
658
+ #
659
+ # Permanent options cannot be removed from an option group. The option
660
+ # group cannot be removed from a DB cluster once it is associated with a
661
+ # DB cluster.
662
+ # @option options [String] :preferred_backup_window
663
+ # The daily time range during which automated backups are created if
664
+ # automated backups are enabled, using the `BackupRetentionPeriod`
665
+ # parameter.
666
+ #
667
+ # Default: A 30-minute window selected at random from an 8-hour block of
668
+ # time per region. To see the time blocks available, see [ Adjusting the
669
+ # Preferred Maintenance Window][1] in the *Amazon RDS User Guide.*
670
+ #
671
+ # Constraints:
672
+ #
673
+ # * Must be in the format `hh24:mi-hh24:mi`.
674
+ #
675
+ # * Times should be in Universal Coordinated Time (UTC).
676
+ #
677
+ # * Must not conflict with the preferred maintenance window.
678
+ #
679
+ # * Must be at least 30 minutes.
680
+ #
681
+ #
682
+ #
683
+ # [1]: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/AdjustingTheMaintenanceWindow.html
684
+ # @option options [String] :preferred_maintenance_window
685
+ # The weekly time range during which system maintenance can occur, in
686
+ # Universal Coordinated Time (UTC).
687
+ #
688
+ # Format: `ddd:hh24:mi-ddd:hh24:mi`
689
+ #
690
+ # Default: A 30-minute window selected at random from an 8-hour block of
691
+ # time per region, occurring on a random day of the week. To see the
692
+ # time blocks available, see [ Adjusting the Preferred Maintenance
693
+ # Window][1] in the *Amazon RDS User Guide.*
694
+ #
695
+ # Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
696
+ #
697
+ # Constraints: Minimum 30-minute window.
698
+ #
699
+ #
700
+ #
701
+ # [1]: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/AdjustingTheMaintenanceWindow.html
702
+ # @return [DBCluster]
703
+ def modify(options = {})
704
+ options = options.merge(db_cluster_identifier: @id)
705
+ resp = @client.modify_db_cluster(options)
706
+ DBCluster.new(
707
+ id: resp.data.db_cluster.db_cluster_identifier,
708
+ data: resp.data.db_cluster,
709
+ client: @client
710
+ )
711
+ end
712
+
713
+ # @example Request syntax with placeholder values
714
+ #
715
+ # dbcluster = db_cluster.restore({
716
+ # db_cluster_identifier: "String", # required
717
+ # restore_to_time: Time.now,
718
+ # use_latest_restorable_time: false,
719
+ # port: 1,
720
+ # db_subnet_group_name: "String",
721
+ # option_group_name: "String",
722
+ # vpc_security_group_ids: ["String"],
723
+ # tags: [
724
+ # {
725
+ # key: "String",
726
+ # value: "String",
727
+ # },
728
+ # ],
729
+ # kms_key_id: "String",
730
+ # })
731
+ # @param [Hash] options ({})
732
+ # @option options [required, String] :db_cluster_identifier
733
+ # The name of the new DB cluster to be created.
734
+ #
735
+ # Constraints:
736
+ #
737
+ # * Must contain from 1 to 63 alphanumeric characters or hyphens
738
+ #
739
+ # * First character must be a letter
740
+ #
741
+ # * Cannot end with a hyphen or contain two consecutive hyphens
742
+ # @option options [Time,DateTime,Date,Integer,String] :restore_to_time
743
+ # The date and time to restore the DB cluster to.
744
+ #
745
+ # Valid Values: Value must be a time in Universal Coordinated Time (UTC)
746
+ # format
747
+ #
748
+ # Constraints:
749
+ #
750
+ # * Must be before the latest restorable time for the DB instance
751
+ #
752
+ # * Cannot be specified if `UseLatestRestorableTime` parameter is true
753
+ #
754
+ # Example: `2015-03-07T23:45:00Z`
755
+ # @option options [Boolean] :use_latest_restorable_time
756
+ # A value that is set to `true` to restore the DB cluster to the latest
757
+ # restorable backup time, and `false` otherwise.
758
+ #
759
+ # Default: `false`
760
+ #
761
+ # Constraints: Cannot be specified if `RestoreToTime` parameter is
762
+ # provided.
763
+ # @option options [Integer] :port
764
+ # The port number on which the new DB cluster accepts connections.
765
+ #
766
+ # Constraints: Value must be `1150-65535`
767
+ #
768
+ # Default: The same port as the original DB cluster.
769
+ # @option options [String] :db_subnet_group_name
770
+ # The DB subnet group name to use for the new DB cluster.
771
+ #
772
+ # Constraints: Must contain no more than 255 alphanumeric characters,
773
+ # periods, underscores, spaces, or hyphens. Must not be default.
774
+ #
775
+ # Example: `mySubnetgroup`
776
+ # @option options [String] :option_group_name
777
+ # The name of the option group for the new DB cluster.
778
+ # @option options [Array<String>] :vpc_security_group_ids
779
+ # A lst of VPC security groups that the new DB cluster belongs to.
780
+ # @option options [Array<Types::Tag>] :tags
781
+ # A list of tags.
782
+ # @option options [String] :kms_key_id
783
+ # The KMS key identifier to use when restoring an encrypted DB cluster
784
+ # from an encrypted DB cluster.
785
+ #
786
+ # The KMS key identifier is the Amazon Resource Name (ARN) for the KMS
787
+ # encryption key. If you are restoring a DB cluster with the same AWS
788
+ # account that owns the KMS encryption key used to encrypt the new DB
789
+ # cluster, then you can use the KMS key alias instead of the ARN for the
790
+ # KMS encryption key.
791
+ #
792
+ # You can restore to a new DB cluster and encrypt the new DB cluster
793
+ # with a KMS key that is different than the KMS key used to encrypt the
794
+ # source DB cluster. The new DB cluster will be encrypted with the KMS
795
+ # key identified by the `KmsKeyId` parameter.
796
+ #
797
+ # If you do not specify a value for the `KmsKeyId` parameter, then the
798
+ # following will occur:
799
+ #
800
+ # * If the DB cluster is encrypted, then the restored DB cluster is
801
+ # encrypted using the KMS key that was used to encrypt the source DB
802
+ # cluster.
803
+ #
804
+ # * If the DB cluster is not encrypted, then the restored DB cluster is
805
+ # not encrypted.
806
+ #
807
+ # If `DBClusterIdentifier` refers to a DB cluster that is note
808
+ # encrypted, then the restore request is rejected.
809
+ # @return [DBCluster]
810
+ def restore(options = {})
811
+ options = options.merge(source_db_cluster_identifier: @id)
812
+ resp = @client.restore_db_cluster_to_point_in_time(options)
813
+ DBCluster.new(
814
+ id: resp.data.db_cluster.db_cluster_identifier,
815
+ data: resp.data.db_cluster,
816
+ client: @client
817
+ )
818
+ end
819
+
820
+ # @!group Associations
821
+
822
+ # @example Request syntax with placeholder values
823
+ #
824
+ # events = db_cluster.events({
825
+ # start_time: Time.now,
826
+ # end_time: Time.now,
827
+ # duration: 1,
828
+ # event_categories: ["String"],
829
+ # filters: [
830
+ # {
831
+ # name: "String", # required
832
+ # values: ["String"], # required
833
+ # },
834
+ # ],
835
+ # })
836
+ # @param [Hash] options ({})
837
+ # @option options [Time,DateTime,Date,Integer,String] :start_time
838
+ # The beginning of the time interval to retrieve events for, specified
839
+ # in ISO 8601 format. For more information about ISO 8601, go to the
840
+ # [ISO8601 Wikipedia page.][1]
841
+ #
842
+ # Example: 2009-07-08T18:00Z
843
+ #
844
+ #
845
+ #
846
+ # [1]: http://en.wikipedia.org/wiki/ISO_8601
847
+ # @option options [Time,DateTime,Date,Integer,String] :end_time
848
+ # The end of the time interval for which to retrieve events, specified
849
+ # in ISO 8601 format. For more information about ISO 8601, go to the
850
+ # [ISO8601 Wikipedia page.][1]
851
+ #
852
+ # Example: 2009-07-08T18:00Z
853
+ #
854
+ #
855
+ #
856
+ # [1]: http://en.wikipedia.org/wiki/ISO_8601
857
+ # @option options [Integer] :duration
858
+ # The number of minutes to retrieve events for.
859
+ #
860
+ # Default: 60
861
+ # @option options [Array<String>] :event_categories
862
+ # A list of event categories that trigger notifications for a event
863
+ # notification subscription.
864
+ # @option options [Array<Types::Filter>] :filters
865
+ # This parameter is not currently supported.
866
+ # @return [Event::Collection]
867
+ def events(options = {})
868
+ batches = Enumerator.new do |y|
869
+ options = options.merge(
870
+ source_type: "db-cluster",
871
+ source_identifier: @id
872
+ )
873
+ resp = @client.describe_events(options)
874
+ resp.each_page do |page|
875
+ batch = []
876
+ page.data.events.each do |e|
877
+ batch << Event.new(
878
+ source_id: e.source_identifier,
879
+ date: e.date,
880
+ data: e,
881
+ client: @client
882
+ )
883
+ end
884
+ y.yield(batch)
885
+ end
886
+ end
887
+ Event::Collection.new(batches)
888
+ end
889
+
890
+ # @return [DBInstance::Collection]
891
+ def members
892
+ batch = []
893
+ data.db_cluster_members.each do |d|
894
+ batch << DBInstance.new(
895
+ id: d.db_instance_identifier,
896
+ data: d,
897
+ client: @client
898
+ )
899
+ end
900
+ DBInstance::Collection.new([batch], size: batch.size)
901
+ end
902
+
903
+ # @return [OptionGroup::Collection]
904
+ def option_groups
905
+ batch = []
906
+ data.db_cluster_option_group_memberships.each do |d|
907
+ batch << OptionGroup.new(
908
+ name: d.db_cluster_option_group_name,
909
+ data: d,
910
+ client: @client
911
+ )
912
+ end
913
+ OptionGroup::Collection.new([batch], size: batch.size)
914
+ end
915
+
916
+ # @return [DBClusterParameterGroup, nil]
917
+ def parameter_group
918
+ if data.db_cluster_parameter_group
919
+ DBClusterParameterGroup.new(
920
+ name: data.db_cluster_parameter_group,
921
+ client: @client
922
+ )
923
+ else
924
+ nil
925
+ end
926
+ end
927
+
928
+ # @example Request syntax with placeholder values
929
+ #
930
+ # snapshots = db_cluster.snapshots({
931
+ # db_cluster_snapshot_identifier: "String",
932
+ # snapshot_type: "String",
933
+ # filters: [
934
+ # {
935
+ # name: "String", # required
936
+ # values: ["String"], # required
937
+ # },
938
+ # ],
939
+ # max_records: 1,
940
+ # marker: "String",
941
+ # include_shared: false,
942
+ # include_public: false,
943
+ # })
944
+ # @param [Hash] options ({})
945
+ # @option options [String] :db_cluster_snapshot_identifier
946
+ # A specific DB cluster snapshot identifier to describe. This parameter
947
+ # cannot be used in conjunction with the `DBClusterIdentifier`
948
+ # parameter. This value is stored as a lowercase string.
949
+ #
950
+ # Constraints:
951
+ #
952
+ # * Must be 1 to 255 alphanumeric characters
953
+ #
954
+ # * First character must be a letter
955
+ #
956
+ # * Cannot end with a hyphen or contain two consecutive hyphens
957
+ #
958
+ # * If this identifier is for an automated snapshot, the `SnapshotType`
959
+ # parameter must also be specified.
960
+ # @option options [String] :snapshot_type
961
+ # The type of DB cluster snapshots to be returned. You can specify one
962
+ # of the following values:
963
+ #
964
+ # * `automated` - Return all DB cluster snapshots that have been
965
+ # automatically taken by Amazon RDS for my AWS account.
966
+ #
967
+ # * `manual` - Return all DB cluster snapshots that have been taken by
968
+ # my AWS account.
969
+ #
970
+ # * `shared` - Return all manual DB cluster snapshots that have been
971
+ # shared to my AWS account.
972
+ #
973
+ # * `public` - Return all DB cluster snapshots that have been marked as
974
+ # public.
975
+ #
976
+ # If you don't specify a `SnapshotType` value, then both automated and
977
+ # manual DB cluster snapshots are returned. You can include shared DB
978
+ # cluster snapshots with these results by setting the `IncludeShared`
979
+ # parameter to `true`. You can include public DB cluster snapshots with
980
+ # these results by setting the `IncludePublic` parameter to `true`.
981
+ #
982
+ # The `IncludeShared` and `IncludePublic` parameters don't apply for
983
+ # `SnapshotType` values of `manual` or `automated`. The `IncludePublic`
984
+ # parameter doesn't apply when `SnapshotType` is set to `shared`. The
985
+ # `IncludeShared` parameter doesn't apply when `SnapshotType` is set to
986
+ # `public`.
987
+ # @option options [Array<Types::Filter>] :filters
988
+ # This parameter is not currently supported.
989
+ # @option options [Integer] :max_records
990
+ # The maximum number of records to include in the response. If more
991
+ # records exist than the specified `MaxRecords` value, a pagination
992
+ # token called a marker is included in the response so that the
993
+ # remaining results can be retrieved.
994
+ #
995
+ # Default: 100
996
+ #
997
+ # Constraints: Minimum 20, maximum 100.
998
+ # @option options [String] :marker
999
+ # An optional pagination token provided by a previous
1000
+ # `DescribeDBClusterSnapshots` request. If this parameter is specified,
1001
+ # the response includes only records beyond the marker, up to the value
1002
+ # specified by `MaxRecords`.
1003
+ # @option options [Boolean] :include_shared
1004
+ # Set this value to `true` to include shared manual DB cluster snapshots
1005
+ # from other AWS accounts that this AWS account has been given
1006
+ # permission to copy or restore, otherwise set this value to `false`.
1007
+ # The default is `false`.
1008
+ #
1009
+ # You can give an AWS account permission to restore a manual DB cluster
1010
+ # snapshot from another AWS account by the
1011
+ # ModifyDBClusterSnapshotAttribute API action.
1012
+ # @option options [Boolean] :include_public
1013
+ # Set this value to `true` to include manual DB cluster snapshots that
1014
+ # are public and can be copied or restored by any AWS account, otherwise
1015
+ # set this value to `false`. The default is `false`. The default is
1016
+ # false.
1017
+ #
1018
+ # You can share a manual DB cluster snapshot as public by using the
1019
+ # ModifyDBClusterSnapshotAttribute API action.
1020
+ # @return [DBClusterSnapshot::Collection]
1021
+ def snapshots(options = {})
1022
+ batches = Enumerator.new do |y|
1023
+ batch = []
1024
+ options = options.merge(db_cluster_identifier: @id)
1025
+ resp = @client.describe_db_cluster_snapshots(options)
1026
+ resp.data.db_cluster_snapshots.each do |d|
1027
+ batch << DBClusterSnapshot.new(
1028
+ cluster_id: @id,
1029
+ snapshot_id: d.db_cluster_snapshot_identifier,
1030
+ data: d,
1031
+ client: @client
1032
+ )
1033
+ end
1034
+ y.yield(batch)
1035
+ end
1036
+ DBClusterSnapshot::Collection.new(batches)
1037
+ end
1038
+
1039
+ # @return [DBSubnetGroup, nil]
1040
+ def subnet_group
1041
+ if data.db_subnet_group
1042
+ DBSubnetGroup.new(
1043
+ name: data.db_subnet_group,
1044
+ client: @client
1045
+ )
1046
+ else
1047
+ nil
1048
+ end
1049
+ end
1050
+
1051
+ # @deprecated
1052
+ # @api private
1053
+ def identifiers
1054
+ { id: @id }
1055
+ end
1056
+ deprecated(:identifiers)
1057
+
1058
+ private
1059
+
1060
+ def extract_id(args, options)
1061
+ value = args[0] || options.delete(:id)
1062
+ case value
1063
+ when String then value
1064
+ when nil then raise ArgumentError, "missing required option :id"
1065
+ else
1066
+ msg = "expected :id to be a String, got #{value.class}"
1067
+ raise ArgumentError, msg
1068
+ end
1069
+ end
1070
+
1071
+ class Collection < Aws::Resources::Collection; end
1072
+ end
1073
+ end
1074
+ end