Amazon::SNS - Amazon Simple Notification Service made simpler
use Amazon::SNS; my $sns = Amazon::SNS->new({ 'key' => '...', 'secret' => '...' }); # create a new topic and publish my $topic = $sns->CreateTopic('MyTopic') or die $sns->error; $topic->Publish('My test message'); # delete it! $topic->DeleteTopic; # publish to a known ARN my $topic = $sns->GetTopic('arn:aws:sns:eu-west-1:123456789099:MyTopic'); $topic->Publish('My test message', 'My Subject'); # get all topics my @topics = $sns->ListTopics; print $_->arn, "\n" for @topics; # change region $sns->service('http://sns.us-east-1.amazonaws.com');
Sorry for not providing a better documentation, patches are always accepted. ;)
Creates an Amazon::SNS object with given key and secret.
Gives you an Amazon::SNS::Topic object using an existing ARN.
Gives you an Amazon::SNS::Target object using an existing ARN. Sending Notification to TargetArn instead of TopicArn.
When used with Amazon::SNS::Target object (see GetTarget), additional parameter $attributes is used to pass MessageAttributes.entry.N attributes with message. An example of MobilePush TTL: $attributes = {"AWS.SNS.MOBILE.APNS.TTL" => {"Type" => "String", "Value" => 3600}}; More information can be found on Amazon web site: http://docs.aws.amazon.com/sns/latest/dg/sns-ttl.html
Gives you an Amazon::SNS::Topic object with the given name, creating it if it does not already exist in your Amazon SNS account.
Deletes a topic using its ARN.
The result is a list of all the topics in your account, as an array of Amazon::SNS::Topic objects.
Description of the last error, or undef if none.
The status code of the last HTTP response.
Get/set SNS service url, something like 'http://sns.us-east-1.amazonaws.com'.
Get/set auth key.
Get/set secret.
Get/set debug level. When set to 1 you'll get some debug output on STDERR.
Be sure to use ARNs in the same region as you have set the service to.
The module defaults to the EU (Ireland) region.
Alessandro Zummo, <a.zummo@towertech.it>
Copyright (C) 2011-15 Alessandro Zummo
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
To install Amazon::SNS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Amazon::SNS
CPAN shell
perl -MCPAN -e shell install Amazon::SNS
For more information on module installation, please visit the detailed CPAN module installation guide.