Functions
confirm-subscription
fn (topic_arn: Str, token: Str): SubscribeResponse | 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..."
get-subscription-attributes
fn (subscription_arn: Str): GetSubscriptionAttributesResponse | 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:...", ...}
list-subscriptions
fn (next_token: Str): ListSubscriptionsResponse | AwsError
fn (): ListSubscriptionsResponse | 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
fn (topic_arn: Str, next_token: Str): ListSubscriptionsResponse | AwsError
fn (topic_arn: Str): ListSubscriptionsResponse | 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
set-subscription-attributes
fn (subscription_arn: Str, attribute_name: Str, attribute_value: Str): Map | 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"]})
)
subscribe
fn (topic_arn: Str, protocol: Str, endpoint: Str, attributes: Map): SubscribeResponse | AwsError
fn (topic_arn: Str, protocol: Str, endpoint: Str): SubscribeResponse | 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"]})
})
unsubscribe
fn (subscription_arn: Str): Map | AwsError
Unsubscribe from an SNS topic.
Example
::aws::sns::subscriptions/unsubscribe(subscription-arn)
Types
GetSubscriptionAttributesResponse
GetSubscriptionAttributesResponse type {
attributes: Map
}
ListSubscriptionsResponse
ListSubscriptionsResponse type {
subscriptions: Vec,
next_token: Str?
}
SubscribeResponse
SubscribeResponse type {
subscription_arn: Str?
}
Subscription
Subscription type {
subscription_arn: Str?,
owner: Str?,
protocol: Str?,
endpoint: Str?,
topic_arn: Str?
}