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,714 @@
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 DBSnapshot
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(instance_id, snapshot_id, options = {})
15
+ # @param [String] instance_id
16
+ # @param [String] snapshot_id
17
+ # @option options [Client] :client
18
+ # @overload def initialize(options = {})
19
+ # @option options [required, String] :instance_id
20
+ # @option options [required, String] :snapshot_id
21
+ # @option options [Client] :client
22
+ def initialize(*args)
23
+ options = Hash === args.last ? args.pop.dup : {}
24
+ @instance_id = extract_instance_id(args, options)
25
+ @snapshot_id = extract_snapshot_id(args, options)
26
+ @data = options.delete(:data)
27
+ @client = options.delete(:client) || Client.new(options)
28
+ end
29
+
30
+ # @!group Read-Only Attributes
31
+
32
+ # @return [String]
33
+ def instance_id
34
+ @instance_id
35
+ end
36
+ alias :db_instance_identifier :instance_id
37
+
38
+ # @return [String]
39
+ def snapshot_id
40
+ @snapshot_id
41
+ end
42
+ alias :db_snapshot_identifier :snapshot_id
43
+
44
+ # Provides the time when the snapshot was taken, in Universal
45
+ # Coordinated Time (UTC).
46
+ # @return [Time]
47
+ def snapshot_create_time
48
+ data.snapshot_create_time
49
+ end
50
+
51
+ # Specifies the name of the database engine.
52
+ # @return [String]
53
+ def engine
54
+ data.engine
55
+ end
56
+
57
+ # Specifies the allocated storage size in gigabytes (GB).
58
+ # @return [Integer]
59
+ def allocated_storage
60
+ data.allocated_storage
61
+ end
62
+
63
+ # Specifies the status of this DB snapshot.
64
+ # @return [String]
65
+ def status
66
+ data.status
67
+ end
68
+
69
+ # Specifies the port that the database engine was listening on at the
70
+ # time of the snapshot.
71
+ # @return [Integer]
72
+ def port
73
+ data.port
74
+ end
75
+
76
+ # Specifies the name of the Availability Zone the DB instance was
77
+ # located in at the time of the DB snapshot.
78
+ # @return [String]
79
+ def availability_zone
80
+ data.availability_zone
81
+ end
82
+
83
+ # Provides the VPC ID associated with the DB snapshot.
84
+ # @return [String]
85
+ def vpc_id
86
+ data.vpc_id
87
+ end
88
+
89
+ # Specifies the time when the snapshot was taken, in Universal
90
+ # Coordinated Time (UTC).
91
+ # @return [Time]
92
+ def instance_create_time
93
+ data.instance_create_time
94
+ end
95
+
96
+ # Provides the master username for the DB snapshot.
97
+ # @return [String]
98
+ def master_username
99
+ data.master_username
100
+ end
101
+
102
+ # Specifies the version of the database engine.
103
+ # @return [String]
104
+ def engine_version
105
+ data.engine_version
106
+ end
107
+
108
+ # License model information for the restored DB instance.
109
+ # @return [String]
110
+ def license_model
111
+ data.license_model
112
+ end
113
+
114
+ # Provides the type of the DB snapshot.
115
+ # @return [String]
116
+ def snapshot_type
117
+ data.snapshot_type
118
+ end
119
+
120
+ # Specifies the Provisioned IOPS (I/O operations per second) value of
121
+ # the DB instance at the time of the snapshot.
122
+ # @return [Integer]
123
+ def iops
124
+ data.iops
125
+ end
126
+
127
+ # Provides the option group name for the DB snapshot.
128
+ # @return [String]
129
+ def option_group_name
130
+ data.option_group_name
131
+ end
132
+
133
+ # The percentage of the estimated data that has been transferred.
134
+ # @return [Integer]
135
+ def percent_progress
136
+ data.percent_progress
137
+ end
138
+
139
+ # The region that the DB snapshot was created in or copied from.
140
+ # @return [String]
141
+ def source_region
142
+ data.source_region
143
+ end
144
+
145
+ # The DB snapshot Arn that the DB snapshot was copied from. It only has
146
+ # value in case of cross customer or cross region copy.
147
+ # @return [String]
148
+ def source_db_snapshot_identifier
149
+ data.source_db_snapshot_identifier
150
+ end
151
+
152
+ # Specifies the storage type associated with DB snapshot.
153
+ # @return [String]
154
+ def storage_type
155
+ data.storage_type
156
+ end
157
+
158
+ # The ARN from the key store with which to associate the instance for
159
+ # TDE encryption.
160
+ # @return [String]
161
+ def tde_credential_arn
162
+ data.tde_credential_arn
163
+ end
164
+
165
+ # Specifies whether the DB snapshot is encrypted.
166
+ # @return [Boolean]
167
+ def encrypted
168
+ data.encrypted
169
+ end
170
+
171
+ # If `Encrypted` is true, the KMS key identifier for the encrypted DB
172
+ # snapshot.
173
+ # @return [String]
174
+ def kms_key_id
175
+ data.kms_key_id
176
+ end
177
+
178
+ # The Amazon Resource Name (ARN) for the DB snapshot.
179
+ # @return [String]
180
+ def db_snapshot_arn
181
+ data.db_snapshot_arn
182
+ end
183
+
184
+ # The time zone of the DB snapshot. In most cases, the `Timezone`
185
+ # element is empty. `Timezone` content appears only for snapshots taken
186
+ # from Microsoft SQL Server DB instances that were created with a time
187
+ # zone specified.
188
+ # @return [String]
189
+ def timezone
190
+ data.timezone
191
+ end
192
+
193
+ # @!endgroup
194
+
195
+ # @return [Client]
196
+ def client
197
+ @client
198
+ end
199
+
200
+ # Loads, or reloads {#data} for the current {DBSnapshot}.
201
+ # Returns `self` making it possible to chain methods.
202
+ #
203
+ # db_snapshot.reload.data
204
+ #
205
+ # @return [self]
206
+ def load
207
+ resp = @client.describe_db_snapshots(db_snapshot_identifier: @snapshot_id)
208
+ @data = resp.dbsnapshots[0]
209
+ self
210
+ end
211
+ alias :reload :load
212
+
213
+ # @return [Types::DBSnapshot]
214
+ # Returns the data for this {DBSnapshot}. Calls
215
+ # {Client#describe_db_snapshots} if {#data_loaded?} is `false`.
216
+ def data
217
+ load unless @data
218
+ @data
219
+ end
220
+
221
+ # @return [Boolean]
222
+ # Returns `true` if this resource is loaded. Accessing attributes or
223
+ # {#data} on an unloaded resource will trigger a call to {#load}.
224
+ def data_loaded?
225
+ !!@data
226
+ end
227
+
228
+ # @!group Actions
229
+
230
+ # @example Request syntax with placeholder values
231
+ #
232
+ # dbsnapshot = db_snapshot.create({
233
+ # tags: [
234
+ # {
235
+ # key: "String",
236
+ # value: "String",
237
+ # },
238
+ # ],
239
+ # })
240
+ # @param [Hash] options ({})
241
+ # @option options [Array<Types::Tag>] :tags
242
+ # A list of tags.
243
+ # @return [DBSnapshot]
244
+ def create(options = {})
245
+ options = options.merge(
246
+ db_instance_identifier: @instance_id,
247
+ db_snapshot_identifier: @snapshot_id
248
+ )
249
+ resp = @client.create_db_snapshot(options)
250
+ DBSnapshot.new(
251
+ instance_id: resp.data.db_snapshot.db_instance_identifier,
252
+ snapshot_id: resp.data.db_snapshot.db_snapshot_identifier,
253
+ data: resp.data.db_snapshot,
254
+ client: @client
255
+ )
256
+ end
257
+
258
+ # @example Request syntax with placeholder values
259
+ #
260
+ # dbsnapshot = db_snapshot.copy({
261
+ # target_db_snapshot_identifier: "String", # required
262
+ # kms_key_id: "String",
263
+ # tags: [
264
+ # {
265
+ # key: "String",
266
+ # value: "String",
267
+ # },
268
+ # ],
269
+ # copy_tags: false,
270
+ # })
271
+ # @param [Hash] options ({})
272
+ # @option options [required, String] :target_db_snapshot_identifier
273
+ # The identifier for the copied snapshot.
274
+ #
275
+ # Constraints:
276
+ #
277
+ # * Cannot be null, empty, or blank
278
+ #
279
+ # * Must contain from 1 to 255 alphanumeric characters or hyphens
280
+ #
281
+ # * First character must be a letter
282
+ #
283
+ # * Cannot end with a hyphen or contain two consecutive hyphens
284
+ #
285
+ # Example: `my-db-snapshot`
286
+ # @option options [String] :kms_key_id
287
+ # The AWS Key Management Service (AWS KMS) key identifier for an
288
+ # encrypted DB snapshot. The KMS key identifier is the Amazon Resource
289
+ # Name (ARN) or the KMS key alias for the KMS encryption key.
290
+ #
291
+ # If you copy an unencrypted DB snapshot and specify a value for the
292
+ # `KmsKeyId` parameter, Amazon RDS encrypts the target DB snapshot using
293
+ # the specified KMS encryption key.
294
+ #
295
+ # If you copy an encrypted DB snapshot from your AWS account, you can
296
+ # specify a value for `KmsKeyId` to encrypt the copy with a new KMS
297
+ # encryption key. If you don't specify a value for `KmsKeyId` then the
298
+ # copy of the DB snapshot is encrypted with the same KMS key as the
299
+ # source DB snapshot.
300
+ #
301
+ # If you copy an encrypted DB snapshot that is shared from another AWS
302
+ # account, then you must specify a value for `KmsKeyId`.
303
+ # @option options [Array<Types::Tag>] :tags
304
+ # A list of tags.
305
+ # @option options [Boolean] :copy_tags
306
+ # True to copy all tags from the source DB snapshot to the target DB
307
+ # snapshot; otherwise false. The default is false.
308
+ # @return [DBSnapshot]
309
+ def copy(options = {})
310
+ options = options.merge(source_db_snapshot_identifier: @snapshot_id)
311
+ resp = @client.copy_db_snapshot(options)
312
+ DBSnapshot.new(
313
+ instance_id: resp.data.db_snapshot.db_instance_identifier,
314
+ snapshot_id: resp.data.db_snapshot.db_snapshot_identifier,
315
+ data: resp.data.db_snapshot,
316
+ client: @client
317
+ )
318
+ end
319
+
320
+ # @example Request syntax with placeholder values
321
+ #
322
+ # dbsnapshot = db_snapshot.delete()
323
+ # @param [Hash] options ({})
324
+ # @return [DBSnapshot]
325
+ def delete(options = {})
326
+ options = options.merge(db_snapshot_identifier: @snapshot_id)
327
+ resp = @client.delete_db_snapshot(options)
328
+ DBSnapshot.new(
329
+ instance_id: resp.data.db_snapshot.db_instance_identifier,
330
+ snapshot_id: resp.data.db_snapshot.db_snapshot_identifier,
331
+ data: resp.data.db_snapshot,
332
+ client: @client
333
+ )
334
+ end
335
+
336
+ # @example Request syntax with placeholder values
337
+ #
338
+ # dbinstance = db_snapshot.restore({
339
+ # db_instance_identifier: "String", # required
340
+ # db_instance_class: "String",
341
+ # port: 1,
342
+ # availability_zone: "String",
343
+ # db_subnet_group_name: "String",
344
+ # multi_az: false,
345
+ # publicly_accessible: false,
346
+ # auto_minor_version_upgrade: false,
347
+ # license_model: "String",
348
+ # db_name: "String",
349
+ # engine: "String",
350
+ # iops: 1,
351
+ # option_group_name: "String",
352
+ # tags: [
353
+ # {
354
+ # key: "String",
355
+ # value: "String",
356
+ # },
357
+ # ],
358
+ # storage_type: "String",
359
+ # tde_credential_arn: "String",
360
+ # tde_credential_password: "String",
361
+ # domain: "String",
362
+ # copy_tags_to_snapshot: false,
363
+ # domain_iam_role_name: "String",
364
+ # })
365
+ # @param [Hash] options ({})
366
+ # @option options [required, String] :db_instance_identifier
367
+ # Name of the DB instance to create from the DB snapshot. This parameter
368
+ # isn't case-sensitive.
369
+ #
370
+ # Constraints:
371
+ #
372
+ # * Must contain from 1 to 63 alphanumeric characters or hyphens (1 to
373
+ # 15 for SQL Server)
374
+ #
375
+ # * First character must be a letter
376
+ #
377
+ # * Cannot end with a hyphen or contain two consecutive hyphens
378
+ #
379
+ # Example: `my-snapshot-id`
380
+ # @option options [String] :db_instance_class
381
+ # The compute and memory capacity of the Amazon RDS DB instance.
382
+ #
383
+ # Valid Values: `db.t1.micro | db.m1.small | db.m1.medium | db.m1.large
384
+ # | db.m1.xlarge | db.m2.2xlarge | db.m2.4xlarge | db.m3.medium |
385
+ # db.m3.large | db.m3.xlarge | db.m3.2xlarge | db.m4.large |
386
+ # db.m4.xlarge | db.m4.2xlarge | db.m4.4xlarge | db.m4.10xlarge |
387
+ # db.r3.large | db.r3.xlarge | db.r3.2xlarge | db.r3.4xlarge |
388
+ # db.r3.8xlarge | db.t2.micro | db.t2.small | db.t2.medium |
389
+ # db.t2.large`
390
+ # @option options [Integer] :port
391
+ # The port number on which the database accepts connections.
392
+ #
393
+ # Default: The same port as the original DB instance
394
+ #
395
+ # Constraints: Value must be `1150-65535`
396
+ # @option options [String] :availability_zone
397
+ # The EC2 Availability Zone that the database instance will be created
398
+ # in.
399
+ #
400
+ # Default: A random, system-chosen Availability Zone.
401
+ #
402
+ # Constraint: You cannot specify the AvailabilityZone parameter if the
403
+ # MultiAZ parameter is set to `true`.
404
+ #
405
+ # Example: `us-east-1a`
406
+ # @option options [String] :db_subnet_group_name
407
+ # The DB subnet group name to use for the new instance.
408
+ #
409
+ # Constraints: Must contain no more than 255 alphanumeric characters,
410
+ # periods, underscores, spaces, or hyphens. Must not be default.
411
+ #
412
+ # Example: `mySubnetgroup`
413
+ # @option options [Boolean] :multi_az
414
+ # Specifies if the DB instance is a Multi-AZ deployment.
415
+ #
416
+ # Constraint: You cannot specify the AvailabilityZone parameter if the
417
+ # MultiAZ parameter is set to `true`.
418
+ # @option options [Boolean] :publicly_accessible
419
+ # Specifies the accessibility options for the DB instance. A value of
420
+ # true specifies an Internet-facing instance with a publicly resolvable
421
+ # DNS name, which resolves to a public IP address. A value of false
422
+ # specifies an internal instance with a DNS name that resolves to a
423
+ # private IP address.
424
+ #
425
+ # Default: The default behavior varies depending on whether a VPC has
426
+ # been requested or not. The following list shows the default behavior
427
+ # in each case.
428
+ #
429
+ # * **Default VPC:** true
430
+ #
431
+ # * **VPC:** false
432
+ #
433
+ # If no DB subnet group has been specified as part of the request and
434
+ # the PubliclyAccessible value has not been set, the DB instance will be
435
+ # publicly accessible. If a specific DB subnet group has been specified
436
+ # as part of the request and the PubliclyAccessible value has not been
437
+ # set, the DB instance will be private.
438
+ # @option options [Boolean] :auto_minor_version_upgrade
439
+ # Indicates that minor version upgrades will be applied automatically to
440
+ # the DB instance during the maintenance window.
441
+ # @option options [String] :license_model
442
+ # License model information for the restored DB instance.
443
+ #
444
+ # Default: Same as source.
445
+ #
446
+ # Valid values: `license-included` \| `bring-your-own-license` \|
447
+ # `general-public-license`
448
+ # @option options [String] :db_name
449
+ # The database name for the restored DB instance.
450
+ #
451
+ # <note markdown="1"> This parameter doesn't apply to the MySQL, PostgreSQL, or MariaDB
452
+ # engines.
453
+ #
454
+ # </note>
455
+ # @option options [String] :engine
456
+ # The database engine to use for the new instance.
457
+ #
458
+ # Default: The same as source
459
+ #
460
+ # Constraint: Must be compatible with the engine of the source
461
+ #
462
+ # Valid Values: `MySQL` \| `mariadb` \| `oracle-se1` \| `oracle-se` \|
463
+ # `oracle-ee` \| `sqlserver-ee` \| `sqlserver-se` \| `sqlserver-ex` \|
464
+ # `sqlserver-web` \| `postgres` \| `aurora`
465
+ # @option options [Integer] :iops
466
+ # Specifies the amount of provisioned IOPS for the DB instance,
467
+ # expressed in I/O operations per second. If this parameter is not
468
+ # specified, the IOPS value will be taken from the backup. If this
469
+ # parameter is set to 0, the new instance will be converted to a
470
+ # non-PIOPS instance, which will take additional time, though your DB
471
+ # instance will be available for connections before the conversion
472
+ # starts.
473
+ #
474
+ # Constraints: Must be an integer greater than 1000.
475
+ #
476
+ # **SQL Server**
477
+ #
478
+ # Setting the IOPS value for the SQL Server database engine is not
479
+ # supported.
480
+ # @option options [String] :option_group_name
481
+ # The name of the option group to be used for the restored DB instance.
482
+ #
483
+ # Permanent options, such as the TDE option for Oracle Advanced Security
484
+ # TDE, cannot be removed from an option group, and that option group
485
+ # cannot be removed from a DB instance once it is associated with a DB
486
+ # instance
487
+ # @option options [Array<Types::Tag>] :tags
488
+ # A list of tags.
489
+ # @option options [String] :storage_type
490
+ # Specifies the storage type to be associated with the DB instance.
491
+ #
492
+ # Valid values: `standard | gp2 | io1`
493
+ #
494
+ # If you specify `io1`, you must also include a value for the `Iops`
495
+ # parameter.
496
+ #
497
+ # Default: `io1` if the `Iops` parameter is specified; otherwise
498
+ # `standard`
499
+ # @option options [String] :tde_credential_arn
500
+ # The ARN from the Key Store with which to associate the instance for
501
+ # TDE encryption.
502
+ # @option options [String] :tde_credential_password
503
+ # The password for the given ARN from the Key Store in order to access
504
+ # the device.
505
+ # @option options [String] :domain
506
+ # Specify the Active Directory Domain to restore the instance in.
507
+ # @option options [Boolean] :copy_tags_to_snapshot
508
+ # True to copy all tags from the restored DB instance to snapshots of
509
+ # the DB instance; otherwise false. The default is false.
510
+ # @option options [String] :domain_iam_role_name
511
+ # Specify the name of the IAM role to be used when making API calls to
512
+ # the Directory Service.
513
+ # @return [DBInstance]
514
+ def restore(options = {})
515
+ options = options.merge(db_snapshot_identifier: @snapshot_id)
516
+ resp = @client.restore_db_instance_from_db_snapshot(options)
517
+ DBInstance.new(
518
+ id: resp.data.db_instance.db_instance_identifier,
519
+ data: resp.data.db_instance,
520
+ client: @client
521
+ )
522
+ end
523
+
524
+ # @example Request syntax with placeholder values
525
+ #
526
+ # eventsubscription = db_snapshot.subscribe_to({
527
+ # subscription_name: "String", # required
528
+ # })
529
+ # @param [Hash] options ({})
530
+ # @option options [required, String] :subscription_name
531
+ # The name of the RDS event notification subscription you want to add a
532
+ # source identifier to.
533
+ # @return [EventSubscription]
534
+ def subscribe_to(options = {})
535
+ options = options.merge(source_identifier: @snapshot_id)
536
+ resp = @client.add_source_identifier_to_subscription(options)
537
+ EventSubscription.new(
538
+ name: resp.data.event_subscription.cust_subscription_id,
539
+ data: resp.data.event_subscription,
540
+ client: @client
541
+ )
542
+ end
543
+
544
+ # @example Request syntax with placeholder values
545
+ #
546
+ # eventsubscription = db_snapshot.unsubscribe_from({
547
+ # subscription_name: "String", # required
548
+ # })
549
+ # @param [Hash] options ({})
550
+ # @option options [required, String] :subscription_name
551
+ # The name of the RDS event notification subscription you want to remove
552
+ # a source identifier from.
553
+ # @return [EventSubscription]
554
+ def unsubscribe_from(options = {})
555
+ options = options.merge(source_identifier: @snapshot_id)
556
+ resp = @client.remove_source_identifier_from_subscription(options)
557
+ EventSubscription.new(
558
+ name: resp.data.event_subscription.cust_subscription_id,
559
+ data: resp.data.event_subscription,
560
+ client: @client
561
+ )
562
+ end
563
+
564
+ # @!group Associations
565
+
566
+ # @example Request syntax with placeholder values
567
+ #
568
+ # attributes = db_snapshot.attributes()
569
+ # @param [Hash] options ({})
570
+ # @return [DBSnapshotAttribute::Collection]
571
+ def attributes(options = {})
572
+ batches = Enumerator.new do |y|
573
+ batch = []
574
+ options = options.merge(db_snapshot_identifier: @snapshot_id)
575
+ resp = @client.describe_db_snapshot_attributes(options)
576
+ resp.data.db_snapshot_attributes_result.db_snapshot_attributes.each do |d|
577
+ batch << DBSnapshotAttribute.new(
578
+ snapshot_id: @snapshot_id,
579
+ name: d.attribute_name,
580
+ data: d,
581
+ client: @client
582
+ )
583
+ end
584
+ y.yield(batch)
585
+ end
586
+ DBSnapshotAttribute::Collection.new(batches)
587
+ end
588
+
589
+ # @example Request syntax with placeholder values
590
+ #
591
+ # events = db_snapshot.events({
592
+ # start_time: Time.now,
593
+ # end_time: Time.now,
594
+ # duration: 1,
595
+ # event_categories: ["String"],
596
+ # filters: [
597
+ # {
598
+ # name: "String", # required
599
+ # values: ["String"], # required
600
+ # },
601
+ # ],
602
+ # })
603
+ # @param [Hash] options ({})
604
+ # @option options [Time,DateTime,Date,Integer,String] :start_time
605
+ # The beginning of the time interval to retrieve events for, specified
606
+ # in ISO 8601 format. For more information about ISO 8601, go to the
607
+ # [ISO8601 Wikipedia page.][1]
608
+ #
609
+ # Example: 2009-07-08T18:00Z
610
+ #
611
+ #
612
+ #
613
+ # [1]: http://en.wikipedia.org/wiki/ISO_8601
614
+ # @option options [Time,DateTime,Date,Integer,String] :end_time
615
+ # The end of the time interval for which to retrieve events, specified
616
+ # in ISO 8601 format. For more information about ISO 8601, go to the
617
+ # [ISO8601 Wikipedia page.][1]
618
+ #
619
+ # Example: 2009-07-08T18:00Z
620
+ #
621
+ #
622
+ #
623
+ # [1]: http://en.wikipedia.org/wiki/ISO_8601
624
+ # @option options [Integer] :duration
625
+ # The number of minutes to retrieve events for.
626
+ #
627
+ # Default: 60
628
+ # @option options [Array<String>] :event_categories
629
+ # A list of event categories that trigger notifications for a event
630
+ # notification subscription.
631
+ # @option options [Array<Types::Filter>] :filters
632
+ # This parameter is not currently supported.
633
+ # @return [Event::Collection]
634
+ def events(options = {})
635
+ batches = Enumerator.new do |y|
636
+ options = options.merge(
637
+ source_type: "db-snapshot",
638
+ source_identifier: @snapshot_id
639
+ )
640
+ resp = @client.describe_events(options)
641
+ resp.each_page do |page|
642
+ batch = []
643
+ page.data.events.each do |e|
644
+ batch << Event.new(
645
+ source_id: e.source_identifier,
646
+ date: e.date,
647
+ data: e,
648
+ client: @client
649
+ )
650
+ end
651
+ y.yield(batch)
652
+ end
653
+ end
654
+ Event::Collection.new(batches)
655
+ end
656
+
657
+ # @return [DBInstance]
658
+ def instance
659
+ DBInstance.new(
660
+ id: @instance_id,
661
+ client: @client
662
+ )
663
+ end
664
+
665
+ # @return [OptionGroup, nil]
666
+ def option_group
667
+ if data.db_snapshot.option_group_name
668
+ OptionGroup.new(
669
+ name: data.db_snapshot.option_group_name,
670
+ client: @client
671
+ )
672
+ else
673
+ nil
674
+ end
675
+ end
676
+
677
+ # @deprecated
678
+ # @api private
679
+ def identifiers
680
+ {
681
+ instance_id: @instance_id,
682
+ snapshot_id: @snapshot_id
683
+ }
684
+ end
685
+ deprecated(:identifiers)
686
+
687
+ private
688
+
689
+ def extract_instance_id(args, options)
690
+ value = args[0] || options.delete(:instance_id)
691
+ case value
692
+ when String then value
693
+ when nil then raise ArgumentError, "missing required option :instance_id"
694
+ else
695
+ msg = "expected :instance_id to be a String, got #{value.class}"
696
+ raise ArgumentError, msg
697
+ end
698
+ end
699
+
700
+ def extract_snapshot_id(args, options)
701
+ value = args[1] || options.delete(:snapshot_id)
702
+ case value
703
+ when String then value
704
+ when nil then raise ArgumentError, "missing required option :snapshot_id"
705
+ else
706
+ msg = "expected :snapshot_id to be a String, got #{value.class}"
707
+ raise ArgumentError, msg
708
+ end
709
+ end
710
+
711
+ class Collection < Aws::Resources::Collection; end
712
+ end
713
+ end
714
+ end