ballerinax/aws.sns Ballerina library

2.1.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:AwsCredentials longTermCredentials = {
    accessKeyId: "<ACCESS_KEY_ID>",
    secretAccessKey: "<SECRET_ACCESS_KEY>"
};

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

sns:Client snsClient = check new (config);

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 response = check amazonSNSClient->createTopic("testTopic", attributes);
    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: 9 months ago

Version: 2.1.0

License: Apache-2.0


Compatibility

Platform: java11

Ballerina version: 2201.4.1


Pull count

Total: 

Current verison: 2


Weekly downloads


Source repository


Keywords

Communication/Notifications
Cost/Freemium
Vendor/Amazon

Contributors

Other versions