Class: AWS::SNS::Subscription
- Inherits:
-
Object
- Object
- AWS::SNS::Subscription
- Defined in:
- lib/aws/sns/subscription.rb
Overview
Represents a subscription of a single endpoint to an SNS topic. To create a subscription, use the Topic#subscribe method. Depending on the endpoint type, you may also need to use Topic#confirm_subscription.
Instance Attribute Summary collapse
-
#arn ⇒ String
readonly
The ARN of the subscription.
-
#endpoint ⇒ String
readonly
URL, an e-mail address, or a queue ARN.
-
#owner_id ⇒ String
readonly
The AWS account ID of the subscription owner.
-
#protocol ⇒ String
readonly
The protocol.
-
#topic ⇒ Topic
readonly
The topic to which the endpoint is subscribed.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Returns true if the subscriptions have the same resource ARN.
-
#exists? ⇒ Boolean
Returns true if the subscription exists.
-
#unsubscribe ⇒ nil
Deletes this subscription.
Instance Attribute Details
#arn ⇒ String (readonly)
Returns The ARN of the subscription.
40 41 42 |
# File 'lib/aws/sns/subscription.rb', line 40 def arn @arn end |
#endpoint ⇒ String (readonly)
URL, an e-mail address, or a queue ARN.
47 48 49 |
# File 'lib/aws/sns/subscription.rb', line 47 def endpoint @endpoint end |
#owner_id ⇒ String (readonly)
Returns The AWS account ID of the subscription owner.
59 60 61 |
# File 'lib/aws/sns/subscription.rb', line 59 def owner_id @owner_id end |
#protocol ⇒ String (readonly)
Returns The protocol. Possible values:
-
:http
-
:https
-
:email
-
:email_json
-
:sqs
.
56 57 58 |
# File 'lib/aws/sns/subscription.rb', line 56 def protocol @protocol end |
#topic ⇒ Topic (readonly)
Returns The topic to which the endpoint is subscribed.
43 44 45 |
# File 'lib/aws/sns/subscription.rb', line 43 def topic @topic end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Returns true if the subscriptions have the same resource ARN.
92 93 94 |
# File 'lib/aws/sns/subscription.rb', line 92 def ==(other) other.kind_of?(Subscription) and other.arn == arn end |
#exists? ⇒ Boolean
This method requests the entire list of subscriptions for the topic (if known) or the account (if the topic is not known). It can be expensive if the number of subscriptions is high.
Returns true if the subscription exists.
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/aws/sns/subscription.rb', line 74 def exists? collection = if topic TopicSubscriptionCollection.new(topic, :config => config) else SubscriptionCollection.new(:config => config) end collection.include?(self) end |
#unsubscribe ⇒ nil
Deletes this subscription.
63 64 65 66 |
# File 'lib/aws/sns/subscription.rb', line 63 def unsubscribe client.unsubscribe(:subscription_arn => arn) nil end |