NAME

APIExample - Class for exercising various AWS APIs

SYNOPSIS

package Amazon::EC2;

use parent qw( Amazon::API::EC2 APIExample );

our $DESCRIPTIONS = {
  DescribeSecurityGroups =>
    'Executes the EC2 API "DescribeSubnets": run DescribeSubnets',
};

caller or __PACKAGE__->main;

########################################################################
sub _DescribeSecurityGroups {
########################################################################
  my ( $package, $options, @args ) = @_;

  my $ec2 = $package->new( url => $options->{'endpoint-url'} );

  my @filter = param_n(
    { Filter => [
        { Name  => 'group-name',
          Value => ['tb*']
        }
      ]
    }
  );

  return print {*STDOUT} Dumper( $ec2->DescribeSecurityGroups( \@filter ) );
}

...

DESCRIPTION

This class acts as a wrapper for various classes that exercise a subset of AWS API calls using the Amazon::API framework.

The API class are usually named for the service (e.g. ec2.pm). Each of those classes will use this class a parent class and provide wrapper methods that correspond to the actual API method called by the Amazon::API::{service} class. These wrapper classes should begin with an underscore ('_') and essentially provide (or pass along the command line arguments) the parameters to the method being tested.

The wrapper class usually looks something like:

sub _SomeMethod {
  my ($package, $options, @args) = @_;
  
  my $service = $package->new;

  my $parameters =  { SomeParmeter => 'some value' };

  return print {*STDOUT} Dumper($service->SomeMethod($parameters));
}

METHODS AND SUBROUTINES

AUTHOR

Rob Lauer - <rlauer6@comcast.net>

SEE ALSO

Amazon::API