Amazon-SNS-V4

 view release on metacpan or  search on metacpan

lib/Amazon/SNS/V4.pm  view on Meta::CPAN

package Amazon::SNS::V4;

use strict;
use warnings;

use base qw/ Class::Accessor::Fast /;

__PACKAGE__->mk_accessors(qw/ key secret error status_code service debug signer error_response/);

use LWP::UserAgent;
use XML::Simple;
use URI::Escape;
use AWS::Signature4;
use HTTP::Request::Common;
use Amazon::SNS::V4::Target;
use Amazon::SNS::V4::Topic;
use Amazon::SNS::V4::FifoTopic;

our $VERSION = '2.0';


sub CreateTopic
{
	my ($self, $name) = @_;

	my $r = $self->dispatch({
		'Action'	=> 'CreateTopic',
		'Name'		=> $name,
	});

	my $arn = eval { $r->{'CreateTopicResult'}{'TopicArn'} };

	return defined $arn ? $self->GetTopic($arn) : undef;
}

sub GetTopic
{
	my ($self, $arn) = @_;
	if ($arn =~ m{\.fifo$}) {
		return GetFifoTopic( @_ );
	}

	return Amazon::SNS::V4::Topic->new({
		'sns' => $self,
		'arn' => $arn,
	});
}

sub GetFifoTopic
{
	my ($self, $arn) = @_;

	return Amazon::SNS::V4::FifoTopic->new({
		'sns' => $self,
		'arn' => $arn,
	});
}

sub GetTarget
{
	my ($self, $arn) = @_;

	return Amazon::SNS::V4::Target->new({
		'sns' => $self,
		'arn' => $arn,
	});
}

sub DeleteTopic
{
	my ($self, $arn) = @_;

	return $self->dispatch({
		'Action'	=> 'DeleteTopic',



( run in 0.440 second using v1.01-cache-2.11-cpan-97f6503c9c8 )