line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SNS::Notification; |
2
|
1
|
|
|
1
|
|
898
|
use Moose; |
|
1
|
|
|
|
|
377336
|
|
|
1
|
|
|
|
|
6
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has Timestamp => (is => 'ro', isa => 'Str', required => 1); |
7
|
|
|
|
|
|
|
has TopicArn => (is => 'ro', isa => 'Str', required => 1); |
8
|
|
|
|
|
|
|
has Type => (is => 'ro', isa => 'Str', required => 1); |
9
|
|
|
|
|
|
|
has MessageId => (is => 'ro', isa => 'Str', required => 1); |
10
|
|
|
|
|
|
|
has Message => (is => 'ro', isa => 'Str', required => 1); |
11
|
|
|
|
|
|
|
has UnsubscribeURL => (is => 'ro', isa => 'Str', required => 1); |
12
|
|
|
|
|
|
|
has Signature => (is => 'ro', isa => 'Str', required => 1); |
13
|
|
|
|
|
|
|
has SignatureVersion => (is => 'ro', isa => 'Str', required => 1); |
14
|
|
|
|
|
|
|
has Subject => (is => 'ro', isa => 'Str'); |
15
|
|
|
|
|
|
|
has SigningCertURL => (is => 'ro', isa => 'Str', required => 1); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
1; |
21
|
|
|
|
|
|
|
### main pod documentation begin ### |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=encoding UTF-8 |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
SNS::Notification - An object for representing SNS Notifications |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use SNS::Notification; |
32
|
|
|
|
|
|
|
my $not = SNS::Notification->new( |
33
|
|
|
|
|
|
|
Timestamp => ... |
34
|
|
|
|
|
|
|
... required attributes ... |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
#do something with $obj |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $body = decode_json($sns_message); |
39
|
|
|
|
|
|
|
my $sns = eval { SNS::Notification->new($body) }; |
40
|
|
|
|
|
|
|
if ($@) { |
41
|
|
|
|
|
|
|
die "Doesn't look like an SNS::Message to me"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
print $sns->Message; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 DESCRIPTION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This module holds an object for representing an SNS messsage. It tries |
48
|
|
|
|
|
|
|
to validate that all appropiate fields are present. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This is really just a module for other modules that work with SNS to |
51
|
|
|
|
|
|
|
depend on (and not reimplement it constantly). |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SEE ALSO |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
L<http://docs.aws.amazon.com/sns/latest/dg/json-formats.html> |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
L<http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
L<http://docs.aws.amazon.com/sns/latest/dg/SendMessageToSQS.html> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 COPYRIGHT and LICENSE |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Copyright (c) 2016 by CAPSiDE |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This code is distributed under the Apache 2 License. The full text of the license can be found in the LICENSE file included with this module. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |