Functions
create-topic
fn (name: Str, attributes: Map, tags: Vec
Create a new SNS topic.
Attributes can include DisplayName, Policy, DeliveryPolicy, FifoTopic, and ContentBasedDeduplication.
Example
// Simple topic
result ::aws::sns::topics/create-topic("my-notifications")
result.topic_arn // => "arn:aws:sns:us-east-1:123456:my-notifications"
// Topic with display name
result ::aws::sns::topics/create-topic("alerts", {DisplayName: "My Alerts"})
delete-topic
fn (topic_arn: Str): Map | AwsError
Delete an SNS topic by its ARN.
Example
::aws::sns::topics/delete-topic("arn:aws:sns:us-east-1:123456:my-topic")
get-topic-attributes
fn (topic_arn: Str): GetTopicAttributesResponse | AwsError
Get attributes of an SNS topic.
Example
result ::aws::sns::topics/get-topic-attributes(topic-arn)
result.attributes.DisplayName // => "My Alerts"
result.attributes.TopicArn // => "arn:aws:sns:us-east-1:123456:my-topic"
list-tags-for-resource
fn (resource_arn: Str): Map | AwsError
List tags for an SNS topic.
Example
result ::aws::sns::topics/list-tags-for-resource(topic-arn)
result.tags
// => [{Key: "Environment", Value: "production"}, {Key: "Application", Value: "my-app"}]
list-topics
fn (next_token: Str): ListTopicsResponse | AwsError
fn (): ListTopicsResponse | AwsError
List all SNS topics. Supports pagination via next_token.
Example
result ::aws::sns::topics/list-topics()
topic-arns map(result.topics, (t) { t.topic_arn })
// => ["arn:aws:sns:us-east-1:123456:topic-1", "arn:aws:sns:us-east-1:123456:topic-2"]
set-topic-attributes
fn (topic_arn: Str, attribute_name: Str, attribute_value: Str): Map | AwsError
Set a single attribute of an SNS topic.
Common attribute names: DisplayName, Policy, DeliveryPolicy.
Example
::aws::sns::topics/set-topic-attributes(topic-arn, "DisplayName", "Updated Name")
tag-resource
fn (resource_arn: Str, tags: Vec
Add tags to an SNS topic.
Example
::aws::sns::topics/tag-resource(topic-arn, [
{Key: "Environment", Value: "production"},
{Key: "Application", Value: "my-app"}
])
untag-resource
fn (resource_arn: Str, tag_keys: Vec): Map | AwsError
Remove tags from an SNS topic by tag key names.
Example
::aws::sns::topics/untag-resource(topic-arn, ["Environment", "Application"])
Types
CreateTopicResponse
CreateTopicResponse type {
topic_arn: Str?
}
GetTopicAttributesResponse
GetTopicAttributesResponse type {
attributes: Map
}
ListTopicsResponse
ListTopicsResponse type {
topics: Vec,
next_token: Str?
}
Topic
Topic type {
topic_arn: Str
}