Amazon-API
view release on metacpan or search on metacpan
lib/Amazon/API.pm view on Meta::CPAN
PutRule
PutTargets
RemovePermission
RemoveTargets
TestEventPattern/;
sub new {
my $class = shift;
my $options = shift || {};
$class->SUPER::new({
%$options,
service_url_base => 'events',
version => undef,
api => 'AWSEvents',
api_methods => \@API_METHODS,
content_type => 'application/x-amz-json-1.1'
});
}
1;
lib/Amazon/API.pm view on Meta::CPAN
=item protocol
One of 'http' or 'https'. Some Amazon services do not support https (yet).
=back
=cut
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
unless ($self->get_user_agent) {
$self->set_user_agent(new LWP::UserAgent);
}
# some APIs are GET only (I'm talkin' to you IAM!)
$self->set_http_method('POST')
unless defined $self->get_http_method;
# note some APIs are global, hence an API may send '' to indicate global
lib/Amazon/API.pm view on Meta::CPAN
use parent qw/Amazon::API/;
sub new {
my $class = shift;
my $options = shift || {};
$options->{api} 'AWSEvents';
$options->{url} 'https://events.us-east-1.amazonaws.com';
$options->{api_methods} => [ 'ListRules' ];
return $class->SUPER::new($options);
}
1;
Then...
my $cwe = new Amazon::CloudWatchEvents();
$cwe->ListRules({});
Of course, creating a class for the service is optional. It may be
lib/Amazon/API.pm view on Meta::CPAN
=item * If the C<parameters> value to C<invoke_api()> is a reference, then the Content-Type is either the value of C<get_content_type> or C<application/x-amzn-json-1.1>.
=item * If the C<parameters> value to C<invoke_api()> is a scalar, then the Content-Type is C<application/x-www-form-urlencoded>.
=back
You can set the default Content-Type used for the calling service when
a reference is passed to the C<invoke_api()> method by passing the
C<content_type> option to the constructor.
$class->SUPER::new({%@_, content_type => 'application/x-amz-json-1.1', api => 'AWSEvents',
url => 'https://events.us-east-1.amazonaws.com'});
=head1 SEE OTHER
C<Amazon::Credentials>, C<Amazon::API::Error>
=head1 AUTHOR
Rob Lauer - <rlauer6@comcast.net>
lib/Amazon/API/Error.pm view on Meta::CPAN
An example response:
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>UnauthorizedOperation</Code><Message>You are not authorized to perform this operation.</Message></Error></Errors><RequestID>599b0f86-4668-4adb-b493-552d6039fcd1</RequestID></Response>
=cut
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
my $message = $self->get_message_raw;
if ( $message ) {
if ( $self->get_content_type =~/xml/ ) {
$message = eval {
XMLin($message);
};
}
( run in 1.006 second using v1.01-cache-2.11-cpan-49f99fa48dc )