Class: AWS::SNS::SubscriptionCollection
- Inherits:
-
Object
- Object
- AWS::SNS::SubscriptionCollection
- Includes:
- Core::Model, 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 Attribute Summary
Attributes included from Core::Model
Instance Method Summary collapse
-
#[](arn) ⇒ Subscription
Retrieves a subscription object by ARN.
-
#each {|subscription| ... } ⇒ nil
Yield each subscription belonging to this account.
Methods included from Core::Model
#client, #config_prefix, #initialize, #inspect
Instance Method Details
#[](arn) ⇒ Subscription
Retrieves a subscription object by ARN. This method does not make any requests to the service.
61 62 63 |
# File 'lib/aws/sns/subscription_collection.rb', line 61 def [] arn Subscription.new(arn, :config => config) end |
#each {|subscription| ... } ⇒ nil
Yield each subscription belonging to this account.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/aws/sns/subscription_collection.rb', line 35 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_arn => sub.topic_arn, :config => config ) yield(subscription) end next_token = resp.data[:next_token] end until next_token.nil? nil end |