Functions

confirm-subscription alias of ::aws::sns::subscriptions/confirm-subscription

fn (topic_arn: Str, token: Str): SubscribeResponse | ::aws::core/AwsError

Confirm a pending subscription using the token from the confirmation message.

Required for HTTP/HTTPS and email subscriptions.

Example

result ::aws::sns::subscriptions/confirm-subscription(topic-arn, confirmation-token)
result.subscription_arn  // => "arn:aws:sns:us-east-1:123456:my-topic:abc-123..."

create-topic alias of ::aws::sns::topics/create-topic

fn (name: Str, attributes: Map, tags: Vec): CreateTopicResponse | ::aws::core/AwsError
fn (name: Str, attributes: Map): CreateTopicResponse | ::aws::core/AwsError
fn (name: Str): CreateTopicResponse | ::aws::core/AwsError

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 alias of ::aws::sns::topics/delete-topic

fn (topic_arn: Str): Map | ::aws::core/AwsError

Delete an SNS topic by its ARN.

Example

::aws::sns::topics/delete-topic("arn:aws:sns:us-east-1:123456:my-topic")

get-subscription-attributes alias of ::aws::sns::subscriptions/get-subscription-attributes

fn (subscription_arn: Str): GetSubscriptionAttributesResponse | ::aws::core/AwsError

Get attributes of an SNS subscription.

Example

result ::aws::sns::subscriptions/get-subscription-attributes(subscription-arn)
result.attributes  // => {Protocol: "sqs", Endpoint: "arn:aws:sqs:...", ...}

get-topic-attributes alias of ::aws::sns::topics/get-topic-attributes

fn (topic_arn: Str): GetTopicAttributesResponse | ::aws::core/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-subscriptions alias of ::aws::sns::subscriptions/list-subscriptions

fn (next_token: Str): ListSubscriptionsResponse | ::aws::core/AwsError
fn (): ListSubscriptionsResponse | ::aws::core/AwsError

List all subscriptions across all topics. Supports pagination via next_token.

Example

result ::aws::sns::subscriptions/list-subscriptions()
result.subscriptions
// => [{subscription_arn: "arn:...", protocol: "sqs", endpoint: "arn:aws:sqs:...", ...}]

list-subscriptions-by-topic alias of ::aws::sns::subscriptions/list-subscriptions-by-topic

fn (topic_arn: Str, next_token: Str): ListSubscriptionsResponse | ::aws::core/AwsError
fn (topic_arn: Str): ListSubscriptionsResponse | ::aws::core/AwsError

List all subscriptions for a specific topic. Supports pagination via next_token.

Example

result ::aws::sns::subscriptions/list-subscriptions-by-topic(topic-arn)
length(result.subscriptions)  // => 3

list-tags-for-resource alias of ::aws::sns::topics/list-tags-for-resource

fn (resource_arn: Str): Map | ::aws::core/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 alias of ::aws::sns::topics/list-topics

fn (next_token: Str): ListTopicsResponse | ::aws::core/AwsError
fn (): ListTopicsResponse | ::aws::core/AwsError

List all SNS topics. Supports pagination via next_token.

Example

result ::aws::sns::topics/list-topics()
topic-arns map(result.topics, %.topic_arn)
// => ["arn:aws:sns:us-east-1:123456:topic-1", "arn:aws:sns:us-east-1:123456:topic-2"]

publish alias of ::aws::sns::publish/publish

fn (topic_arn: Str, message: Str, options: Map): PublishResponse | ::aws::core/AwsError
fn (topic_arn: Str, message: Str): PublishResponse | ::aws::core/AwsError

Publish a message to an SNS topic or directly to an endpoint.

Example

// Simple publish
result ::aws::sns::publish/publish(topic-arn, "Hello from Hot!")
result.message_id  // => "abc123-def456..."

// Publish with subject (for email subscriptions)
result ::aws::sns::publish/publish(topic-arn, "Message body", {subject: "Alert"})

publish-batch alias of ::aws::sns::publish/publish-batch

fn (topic_arn: Str, entries: Vec): PublishBatchResponse | ::aws::core/AwsError

Publish multiple messages to a topic in a single request (up to 10).

Each entry should have id (unique) and message (content).

Example

entries [
    {id: "msg1", message: "First message"},
    {id: "msg2", message: "Second message"},
    {id: "msg3", message: "Third message"}
]
result ::aws::sns::publish/publish-batch(topic-arn, entries)
length(result.successful)  // => 3
length(result.failed)      // => 0

publish-json alias of ::aws::sns::publish/publish-json

fn (topic_arn: Str, message: Map): PublishResponse | ::aws::core/AwsError

Publish a message with protocol-specific payloads.

The message map must include a "default" key. Other keys are protocol names (email, sqs, lambda, http, https) with protocol-specific content.

Example

result ::aws::sns::publish/publish-json(topic-arn, {
    default: "Default notification",
    sqs: to-json({type: "notification", data: {order_id: "12345"}})
})
result.message_id  // => "abc123..."

publish-with-attributes alias of ::aws::sns::publish/publish-with-attributes

fn (topic_arn: Str, message: Str, attributes: Map): PublishResponse | ::aws::core/AwsError

Publish a message with message attributes for subscription filtering.

Each attribute should have DataType ("String", "Number", or "Binary") and StringValue.

Example

result ::aws::sns::publish/publish-with-attributes(topic-arn, "Order placed", {
    event_type: {DataType: "String", StringValue: "order"},
    priority: {DataType: "Number", StringValue: "1"}
})
result.message_id  // => "abc123..."

send-sms alias of ::aws::sns::publish/send-sms

fn (phone_number: Str, message: Str, options: Map): PublishResponse | ::aws::core/AwsError
fn (phone_number: Str, message: Str): PublishResponse | ::aws::core/AwsError

Send an SMS message directly to a phone number (E.164 format).

Example

// Simple SMS
result ::aws::sns::publish/send-sms("+14155551234", "Your code is 123456")
result.message_id  // => "abc123..."

// SMS with options
result ::aws::sns::publish/send-sms("+14155551234", "Your code is 123456", {
    message_type: "Transactional"
})

set-subscription-attributes alias of ::aws::sns::subscriptions/set-subscription-attributes

fn (subscription_arn: Str, attribute_name: Str, attribute_value: Str): Map | ::aws::core/AwsError

Set a single attribute of an SNS subscription.

Common attribute names: FilterPolicy, FilterPolicyScope, RawMessageDelivery, RedrivePolicy.

Example

// Enable raw message delivery for SQS
::aws::sns::subscriptions/set-subscription-attributes(subscription-arn, "RawMessageDelivery", "true")

// Set a filter policy
::aws::sns::subscriptions/set-subscription-attributes(
    subscription-arn,
    "FilterPolicy",
    to-json({event_type: ["order"]})
)

set-topic-attributes alias of ::aws::sns::topics/set-topic-attributes

fn (topic_arn: Str, attribute_name: Str, attribute_value: Str): Map | ::aws::core/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")

subscribe alias of ::aws::sns::subscriptions/subscribe

fn (topic_arn: Str, protocol: Str, endpoint: Str, attributes: Map): SubscribeResponse | ::aws::core/AwsError
fn (topic_arn: Str, protocol: Str, endpoint: Str): SubscribeResponse | ::aws::core/AwsError

Subscribe an endpoint to an SNS topic.

Supported protocols: "http", "https", "email", "email-json", "sms", "sqs", "lambda", "application", "firehose".

Example

// Subscribe an SQS queue
result ::aws::sns::subscriptions/subscribe(topic-arn, "sqs", queue-arn)
result.subscription_arn  // => "arn:aws:sns:us-east-1:123456:my-topic:abc-123..."

// Subscribe a Lambda function
::aws::sns::subscriptions/subscribe(topic-arn, "lambda", lambda-arn)

// Subscribe with filter policy
::aws::sns::subscriptions/subscribe(topic-arn, "sqs", queue-arn, {
    FilterPolicy: to-json({event_type: ["order", "payment"]})
})

tag-resource alias of ::aws::sns::topics/tag-resource

fn (resource_arn: Str, tags: Vec): Map | ::aws::core/AwsError

Add tags to an SNS topic.

Example

::aws::sns::topics/tag-resource(topic-arn, [
    {Key: "Environment", Value: "production"},
    {Key: "Application", Value: "my-app"}
])

unsubscribe alias of ::aws::sns::subscriptions/unsubscribe

fn (subscription_arn: Str): Map | ::aws::core/AwsError

Unsubscribe from an SNS topic.

Example

::aws::sns::subscriptions/unsubscribe(subscription-arn)

untag-resource alias of ::aws::sns::topics/untag-resource

fn (resource_arn: Str, tag_keys: Vec): Map | ::aws::core/AwsError

Remove tags from an SNS topic by tag key names.

Example

::aws::sns::topics/untag-resource(topic-arn, ["Environment", "Application"])

Types

AwsError alias of ::aws::core/AwsError

CreateTopicResponse alias of ::aws::sns::topics/CreateTopicResponse

CreateTopicResponse type {
    topic_arn: Str?
}

Credentials alias of ::aws::core/Credentials

GetSubscriptionAttributesResponse alias of ::aws::sns::subscriptions/GetSubscriptionAttributesResponse

GetSubscriptionAttributesResponse type {
    attributes: Map
}

GetTopicAttributesResponse alias of ::aws::sns::topics/GetTopicAttributesResponse

GetTopicAttributesResponse type {
    attributes: Map
}

ListSubscriptionsResponse alias of ::aws::sns::subscriptions/ListSubscriptionsResponse

ListSubscriptionsResponse type {
    subscriptions: Vec,
    next_token: Str?
}

ListTopicsResponse alias of ::aws::sns::topics/ListTopicsResponse

ListTopicsResponse type {
    topics: Vec,
    next_token: Str?
}

PublishBatchFailureEntry alias of ::aws::sns::publish/PublishBatchFailureEntry

PublishBatchFailureEntry type {
    id: Str?,
    code: Str?,
    message: Str?,
    sender_fault: Bool?
}

PublishBatchResponse alias of ::aws::sns::publish/PublishBatchResponse

PublishBatchResponse type {
    successful: Vec,
    failed: Vec
}

PublishBatchResultEntry alias of ::aws::sns::publish/PublishBatchResultEntry

PublishBatchResultEntry type {
    id: Str?,
    message_id: Str?,
    sequence_number: Str?
}

PublishResponse alias of ::aws::sns::publish/PublishResponse

PublishResponse type {
    message_id: Str?,
    sequence_number: Str?
}

SubscribeResponse alias of ::aws::sns::subscriptions/SubscribeResponse

SubscribeResponse type {
    subscription_arn: Str?
}

Subscription alias of ::aws::sns::subscriptions/Subscription

Subscription type {
    subscription_arn: Str?,
    owner: Str?,
    protocol: Str?,
    endpoint: Str?,
    topic_arn: Str?
}

Topic alias of ::aws::sns::topics/Topic

Topic type {
    topic_arn: Str
}