Class: AWS::SNS::SubscriptionCollection
- Inherits:
-
Object
- Object
- AWS::SNS::SubscriptionCollection
- Includes:
- Enumerable
- Defined in:
- lib/aws/sns/subscription_collection.rb
Overview
Represents the collection of all subscriptions for the AWS account. For example:
# get the ARNs of all SQS queues with subscriptions to topics
# owned by this account
topic.subscriptions.
select { |s| s.protocol == :sqs }.
collect(&:endpoint)
Direct Known Subclasses
Instance Method Summary collapse
-
#[](arn) ⇒ Subscription
Retrieves a subscription object by ARN.
-
#each {|subscription| ... } ⇒ nil
Yield each subscription belonging to this account.
Instance Method Details
#[](arn) ⇒ Subscription
Retrieves a subscription object by ARN. This method does not make any requests to the service.
65 66 67 |
# File 'lib/aws/sns/subscription_collection.rb', line 65 def [] arn Subscription.new(arn, :config => config) end |
#each {|subscription| ... } ⇒ nil
Yield each subscription belonging to this account.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/aws/sns/subscription_collection.rb', line 39 def each next_token = nil begin opts = request_opts opts[:next_token] = next_token if next_token resp = client.send(list_request, opts) resp.subscriptions.each do |sub| subscription = Subscription.new(sub.subscription_arn, :endpoint => sub.endpoint, :protocol => sub.protocol.tr('-','_').to_sym, :owner_id => sub.owner, :topic => Topic.new(sub.topic_arn, :config => config), :config => config ) yield(subscription) end next_token = resp.next_token end until resp && next_token.nil? nil end |