Class: Aws::RDS::EventSubscription
- Inherits:
-
Object
- Object
- Aws::RDS::EventSubscription
- Defined in:
- gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#customer_aws_id ⇒ String
The Amazon Web Services customer account associated with the RDS event notification subscription.
-
#enabled ⇒ Boolean
A Boolean value indicating if the subscription is enabled.
-
#event_categories_list ⇒ Array<String>
A list of event categories for the RDS event notification subscription.
-
#event_subscription_arn ⇒ String
The Amazon Resource Name (ARN) for the event subscription.
-
#name ⇒ String
(also: #cust_subscription_id)
-
#sns_topic_arn ⇒ String
The topic ARN of the RDS event notification subscription.
-
#source_ids_list ⇒ Array<String>
A list of source IDs for the RDS event notification subscription.
-
#source_type ⇒ String
The source type for the RDS event notification subscription.
-
#status ⇒ String
The status of the RDS event notification subscription.
-
#subscription_creation_time ⇒ String
The time the RDS event notification subscription was created.
Actions collapse
-
#add_subscriber(options = {}) ⇒ EventSubscription
-
#create(options = {}) ⇒ EventSubscription
-
#delete(options = {}) ⇒ EventSubscription
-
#modify(options = {}) ⇒ EventSubscription
-
#remove_subscriber(options = {}) ⇒ EventSubscription
Instance Method Summary collapse
-
#client ⇒ Client
-
#data ⇒ Types::EventSubscription
Returns the data for this EventSubscription.
-
#data_loaded? ⇒ Boolean
Returns
true
if this resource is loaded. -
#initialize(*args) ⇒ EventSubscription
constructor
A new instance of EventSubscription.
-
#load ⇒ self
(also: #reload)
Loads, or reloads #data for the current EventSubscription.
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::RDS::Client] #wait_until instead
Constructor Details
#initialize(name, options = {}) ⇒ EventSubscription #initialize(options = {}) ⇒ EventSubscription
Returns a new instance of EventSubscription.
22 23 24 25 26 27 28 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 22 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @name = extract_name(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() @waiter_block_warned = false end |
Instance Method Details
#add_subscriber(options = {}) ⇒ EventSubscription
271 272 273 274 275 276 277 278 279 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 271 def add_subscriber( = {}) = .merge(subscription_name: @name) resp = @client.add_source_identifier_to_subscription() EventSubscription.new( name: resp.data.event_subscription.cust_subscription_id, data: resp.data.event_subscription, client: @client ) end |
#client ⇒ Client
108 109 110 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 108 def client @client end |
#create(options = {}) ⇒ EventSubscription
365 366 367 368 369 370 371 372 373 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 365 def create( = {}) = .merge(subscription_name: @name) resp = @client.create_event_subscription() EventSubscription.new( name: resp.data.event_subscription.cust_subscription_id, data: resp.data.event_subscription, client: @client ) end |
#customer_aws_id ⇒ String
The Amazon Web Services customer account associated with the RDS event notification subscription.
41 42 43 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 41 def customer_aws_id data[:customer_aws_id] end |
#data ⇒ Types::EventSubscription
Returns the data for this Aws::RDS::EventSubscription. Calls
Client#describe_event_subscriptions if #data_loaded? is false
.
128 129 130 131 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 128 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
136 137 138 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 136 def data_loaded? !!@data end |
#delete(options = {}) ⇒ EventSubscription
380 381 382 383 384 385 386 387 388 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 380 def delete( = {}) = .merge(subscription_name: @name) resp = @client.delete_event_subscription() EventSubscription.new( name: resp.data.event_subscription.cust_subscription_id, data: resp.data.event_subscription, client: @client ) end |
#enabled ⇒ Boolean
A Boolean value indicating if the subscription is enabled. True indicates the subscription is enabled.
95 96 97 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 95 def enabled data[:enabled] end |
#event_categories_list ⇒ Array<String>
A list of event categories for the RDS event notification subscription.
88 89 90 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 88 def event_categories_list data[:event_categories_list] end |
#event_subscription_arn ⇒ String
The Amazon Resource Name (ARN) for the event subscription.
101 102 103 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 101 def event_subscription_arn data[:event_subscription_arn] end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::RDS::EventSubscription.
Returns self
making it possible to chain methods.
event_subscription.reload.data
118 119 120 121 122 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 118 def load resp = @client.describe_event_subscriptions(subscription_name: @name) @data = resp.event_subscriptions_list[0] self end |
#modify(options = {}) ⇒ EventSubscription
424 425 426 427 428 429 430 431 432 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 424 def modify( = {}) = .merge(subscription_name: @name) resp = @client.modify_event_subscription() EventSubscription.new( name: resp.data.event_subscription.cust_subscription_id, data: resp.data.event_subscription, client: @client ) end |
#name ⇒ String Also known as: cust_subscription_id
33 34 35 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 33 def name @name end |
#remove_subscriber(options = {}) ⇒ EventSubscription
445 446 447 448 449 450 451 452 453 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 445 def remove_subscriber( = {}) = .merge(subscription_name: @name) resp = @client.remove_source_identifier_from_subscription() EventSubscription.new( name: resp.data.event_subscription.cust_subscription_id, data: resp.data.event_subscription, client: @client ) end |
#sns_topic_arn ⇒ String
The topic ARN of the RDS event notification subscription.
47 48 49 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 47 def sns_topic_arn data[:sns_topic_arn] end |
#source_ids_list ⇒ Array<String>
A list of source IDs for the RDS event notification subscription.
81 82 83 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 81 def source_ids_list data[:source_ids_list] end |
#source_type ⇒ String
The source type for the RDS event notification subscription.
75 76 77 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 75 def source_type data[:source_type] end |
#status ⇒ String
The status of the RDS event notification subscription.
Constraints:
Can be one of the following: creating | modifying | deleting | active | no-permission | topic-not-exist
The status "no-permission" indicates that RDS no longer has permission to post to the SNS topic. The status "topic-not-exist" indicates that the topic was deleted after the subscription was created.
63 64 65 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 63 def status data[:status] end |
#subscription_creation_time ⇒ String
The time the RDS event notification subscription was created.
69 70 71 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 69 def subscription_creation_time data[:subscription_creation_time] end |
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::RDS::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success
or :failure
from these callbacks,
it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'gems/aws-sdk-rds/lib/aws-sdk-rds/event_subscription.rb', line 220 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Waiters::Waiter.new().wait({}) end |