Constructor
# new SNSService(snsClient)
Creates an instance of SNSService.
Parameters:
| Name | Type | Description |
|---|---|---|
snsClient |
AWS.SNS
|
An instance of AWS.SNS |
Methods
# async getTopicAttributes(topicArn) → {Promise.<Object>}
Get attributes for the specified SNS topic to verify it exists.
Parameters:
| Name | Type | Description |
|---|---|---|
topicArn |
string
|
The ARN of the SNS topic. |
- The topic attributes.
Promise.<Object>
# async publishMessage(topicArn, messageBody) → {Promise.<Object>}
Publish a message to the specified SNS topic.
Parameters:
| Name | Type | Description |
|---|---|---|
topicArn |
string
|
The ARN of the SNS topic. |
messageBody |
Object
|
The message body to publish. |
- The result from SNS.
Promise.<Object>
# async subscribe(topicArn, protocol, endpoint) → {Promise.<Object>}
Subscribe an endpoint to the specified SNS topic.
Parameters:
| Name | Type | Description |
|---|---|---|
topicArn |
string
|
The ARN of the SNS topic. |
protocol |
string
|
The protocol of the endpoint (e.g., 'email', 'sms', 'lambda', etc.). |
endpoint |
string
|
The endpoint to subscribe (e.g., email address, phone number, Lambda ARN, etc.). |
- The result from SNS.
Promise.<Object>
# async unsubscribe(subscriptionArn) → {Promise.<Object>}
Unsubscribe an endpoint from the specified SNS topic.
Parameters:
| Name | Type | Description |
|---|---|---|
subscriptionArn |
string
|
The ARN of the subscription to unsubscribe. |
- The result from SNS.
Promise.<Object>