Example of Creating an SNS Topic using the AWS SDK for Swift
Here is an example of creating an SNS topic using the AWS SDK for Swift:
import AWSSDK
let sns = SNSClient(region: .usWest2)
let params = SNSCreateTopicInput(name: "Events")
sns.createTopic(params) { (result, error) in
if let error = error {
print("Error: \(error)")
} else {
print("Topic ARN: \(result?.topicArn ?? "")")
}
}
Example of Creating an SNS Topic using the AWS SDK for Rust
Here is an example of creating an SNS topic using the AWS SDK for Rust:
use aws_sdk_sns::{Client, CreateTopicRequest};
async fn main() -> Result<(), Box> {
let sns = Client::new().await?;
let params = CreateTopicRequest {
name: Some("Events".to_string()),
..Default::default()
};
let result = sns.create_topic(params).await?;
println!("Topic ARN: {}", result.topic_arn);
Ok(())
}
Example of Creating an SNS Topic using the AWS SDK for Kotlin
Here is an example of creating an SNS topic using the AWS SDK for Kotlin:
import software.amazon.awssdk.services.sns.SnsClient
import software.amazon.awssdk.services.sns.model.CreateTopicRequest
import software.amazon.awssdk.services.sns.model.CreateTopicResponse
fun main() {
val sns = SnsClient.create()
val request = CreateTopicRequest.builder()
.name("Events")
.build()
val response = sns.createTopic(request)
println("Topic ARN: ${response.topicArn()}")
}
Example of Creating an SNS Topic using the AWS SDK for Scala
Here is an example of creating an SNS topic using the AWS SDK for Scala:
import software.amazon.awssdk.services.sns.SnsClient
import software.amazon.awssdk.services.sns.model.CreateTopicRequest
import software.amazon.awssdk.services.sns.model.CreateTopicResponse
object CreateSnsTopic {
def main(args: Array[String]): Unit = {
val sns = SnsClient.create()
val request = CreateTopicRequest.builder()
.name("Events")
.build()
val response = sns.createTopic(request)
println(s"Topic ARN: ${response.topicArn()}")
}
}
Example of Creating an SNS Topic using the AWS SDK for TypeScript
Here is an example of creating an SNS topic using the AWS SDK for TypeScript:
import * as AWS from 'aws-sdk';
import * as sns from 'aws-sdk/clients/sns';
const snsClient = new sns({ region: 'us-west-2' });
const params = {
Name: 'Events',
};
snsClient.createTopic(params, (err, data) => {
if (err) {
console.log(err);
} else {
console.log(`Topic ARN: ${data.TopicArn}`);
}
});
Example of Creating an SNS Topic using the AWS SDK for Dart
Here is an example of creating an SNS topic using the AWS SDK for Dart:
import 'package:aws_sdk_sns/sns.dart';
void main() async {
final sns = SnsClient(region: 'us-west-2');
final params = CreateTopicRequest(name: 'Events');
final response = await sns.createTopic(params);
print('Topic ARN: ${response.topicArn}');
}
Share this blog on:
Written by:
Sanjeev Kumar
Engineering, SuprSend
ABOUT THE AUTHOR
What’s a Rich Text element?
The rich text element allows you to create and format headings, paragraphs, blockquotes, images, and video all in one place instead of having to add and format them individually. Just double-click and easily create content.
Static and dynamic content editing
A rich text element can be used with static or dynamic content. For static content, just drop it into any page and begin editing. For dynamic content, add a rich text field to any collection and then connect a rich text element to that field in the settings panel. Voila!
How to customize formatting for each rich text
Headings, paragraphs, blockquotes, figures, images, and figure captions can all be styled after a class is added to the rich text element using the "When inside of" nested selector system.
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.