ballerinax/aws.sns Ballerina library

1.2.0

Overview

The Ballerina AWS SNS provides the capability to manage topics and subscriptions in AWS SNS.

This module supports Amazon SNS REST API 2010-03-31 version.

Prerequisites

Before using this connector in your Ballerina application, complete the following:

  1. Create an AWS account
  2. Obtain tokens

Quickstart

To use the AWS SNS connector in your Ballerina application, update the .bal file as follows:

Step 1: Import connector

Import the ballerinax/aws.sns module into the Ballerina project.

Copy
import ballerinax/aws.sns;

Step 2: Create a new connector instance

You can now enter the credentials in the SNS client configuration and create the SNS client by passing the configuration as follows.

Copy
sns:LongTermCredentials longTermCredentials = {
    accessKey: "<ACCESS_KEY_ID>",
    secretKey: "<SECRET_ACCESS_KEY>"
};

sns:ConnectionConfig config = {
    credentials:longTermCredentials,
    region: <REGION>
};

sns:Client snsClient = check new (configuration);

Step 3: Invoke connector operation

  1. You can create a topic in SNS as follows with createTopic method for a preferred topic name and the required set of attributes.

    Copy
    sns:TopicAttribute attributes = {
        displayName : "Test"
    };
    sns:CreateTopicResponse|error response = amazonSNSClient->createTopic(testTopic, attributes);
    if (response is sns:CreateTopicResponse) {
        log:printInfo("Created topic: " + response.toString());
    }
  2. Use bal run command to compile and run the Ballerina program.

You can find more samples here

Import

import ballerinax/aws.sns;Copy

Metadata

Released date: about 2 years ago

Version: 1.2.0

License: Apache-2.0


Compatibility

Platform: java11

Ballerina version: 2201.0.0


Pull count

Total: 10

Current verison: 2


Weekly downloads


Source repository


Keywords

Communication/Notifications

Cost/Freemium

Vendor/Amazon


Contributors

Other versions