You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::SNS::Topic
- Inherits:
-
Resources::Resource
- Object
- Resources::Resource
- Aws::SNS::Topic
- Defined in:
- (unknown)
Instance Attribute Summary collapse
-
#arn ⇒ String
readonly
-
#attributes ⇒ Hash<String,String>
readonly
A map of the topic\'s attributes.
Attributes inherited from Resources::Resource
Instance Method Summary collapse
-
#add_permission(options = {}) ⇒ Struct
Adds a statement to a topic's access control policy, granting access for the specified AWS accounts to the specified actions.
.
-
#confirm_subscription(options = {}) ⇒ Subscription
-
#delete ⇒ Struct
Deletes a topic and all its subscriptions.
-
#initialize ⇒ Object
constructor
-
#publish(options = {}) ⇒ Types::PublishResponse
Sends a message to an Amazon SNS topic, a text message (SMS message) directly to a phone number, or a message to a mobile platform endpoint (when you specify the
TargetArn
).If you send a message to a topic, Amazon SNS delivers the message to each endpoint that is subscribed to the topic.
-
#remove_permission(options = {}) ⇒ Struct
Removes a statement from a topic's access control policy.
.
-
#set_attributes(options = {}) ⇒ Struct
Allows a topic owner to set an attribute of the topic to a new value.
.
-
#subscribe(options = {}) ⇒ Subscription
-
#subscriptions(options = {}) ⇒ Collection<Subscription>
Returns a Collection of Subscription resources.
Methods inherited from Resources::Resource
add_data_attribute, add_identifier, #data, data_attributes, #data_loaded?, identifiers, #load, #wait_until
Methods included from Resources::OperationMethods
#add_batch_operation, #add_operation, #batch_operation, #batch_operation_names, #batch_operations, #operation, #operation_names, #operations
Constructor Details
#initialize(arn, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object
Instance Attribute Details
#arn ⇒ String (readonly)
#attributes ⇒ Hash<String,String> (readonly)
A map of the topic\'s attributes. Attributes in this map include the following:
DeliveryPolicy
– The JSON serialization of the topic\'s delivery policy.DisplayName
– The human-readable name used in theFrom
field for notifications toemail
andemail-json
endpoints.Owner
– The AWS account ID of the topic\'s owner.Policy
– The JSON serialization of the topic\'s access control policy.SubscriptionsConfirmed
– The number of confirmed subscriptions for the topic.SubscriptionsDeleted
– The number of deleted subscriptions for the topic.SubscriptionsPending
– The number of subscriptions pending confirmation for the topic.TopicArn
– The topic\'s ARN.EffectiveDeliveryPolicy
– The JSON serialization of the effective delivery policy, taking system defaults into account.
The following attribute applies only to server-side-encryption:
KmsMasterKeyId
- The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK. For more information, see Key Terms. For more examples, see KeyId in the AWS Key Management Service API Reference.
^
The following attributes apply only to FIFO topics:
FifoTopic
– When this is set totrue
, a FIFO topic is created.ContentBasedDeduplication
– Enables content-based deduplication for FIFO topics.By default,
ContentBasedDeduplication
is set tofalse
. If you create a FIFO topic and this attribute isfalse
, you must specify a value for theMessageDeduplicationId
parameter for the Publish action.When you set
ContentBasedDeduplication
totrue
, Amazon SNS uses a SHA-256 hash to generate theMessageDeduplicationId
using the body of the message (but not the attributes of the message).(Optional) To override the generated value, you can specify a value for the the
MessageDeduplicationId
parameter for thePublish
action.
Instance Method Details
#add_permission(options = {}) ⇒ Struct
Adds a statement to a topic's access control policy, granting access for the specified AWS accounts to the specified actions.
#confirm_subscription(options = {}) ⇒ Subscription
#delete ⇒ Struct
Deletes a topic and all its subscriptions. Deleting a topic might prevent some messages previously sent to the topic from being delivered to subscribers. This action is idempotent, so deleting a topic that does not exist does not result in an error.
#publish(options = {}) ⇒ Types::PublishResponse
Sends a message to an Amazon SNS topic, a text message (SMS message) directly to a phone number, or a message to a mobile platform endpoint (when you specify the TargetArn
).
If you send a message to a topic, Amazon SNS delivers the message to each endpoint that is subscribed to the topic. The format of the message depends on the notification protocol for each subscribed endpoint.
When a messageId
is returned, the message has been saved and Amazon SNS will attempt to deliver it shortly.
To use the Publish
action for sending a message to a mobile endpoint, such as an app on a Kindle device or mobile phone, you must specify the EndpointArn for the TargetArn parameter. The EndpointArn is returned when making a call with the CreatePlatformEndpoint
action.
For more information about formatting messages, see Send Custom Platform-Specific Payloads in Messages to Mobile Devices.
You can publish messages only to topics and endpoints in the same AWS Region.
#remove_permission(options = {}) ⇒ Struct
Removes a statement from a topic's access control policy.
#set_attributes(options = {}) ⇒ Struct
Allows a topic owner to set an attribute of the topic to a new value.
#subscribe(options = {}) ⇒ Subscription
#subscriptions(options = {}) ⇒ Collection<Subscription>
Returns a Collection of Subscription resources. No API requests are made until you call an enumerable method on the collection. Client#list_subscriptions_by_topic will be called multiple times until every Subscription has been yielded.