AWS-CLIWrapper

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.08  2013-07-05
  * Potential 'nofork' option to allow calling IPC::Cmd::run vs. run_forked (issue #1, thanks @mschrader)

0.07  2013-06-19
  * Add "output_file" key name of parameter for aws s3 get-object
  * Enable to specify timeout before aborting "aws" command

0.06  2013-06-12
  * Add some methods for aws-cli/0.12.0
  * Fix died when failed to parse result as JSON (aws s3)

0.05  2013-05-01
  * Add some methods for latest awscli (0.9.2)

0.04  2013-04-30
  * Adjust $Error for incompatible changes of aws-cli/botocore

0.03  2013-03-11
  * Add $AWS::CLIWrapper::true and $AWS::CLIWrapper::false for boolean parameter

MANIFEST  view on Meta::CPAN

xt/11_struct-in-list.t
xt/12_nested-boolean.t
xt/19_error.t
xt/20_s3-sync.t
xt/30_compat.t
xt/90_dependencies.t
xt/91_usedmodules.t
xt/92_usedfunctions.t
xt/perlcriticrc
META.yml                                 Module YAML meta-data (added by MakeMaker)
META.json                                Module JSON meta-data (added by MakeMaker)

META.json  view on Meta::CPAN

         "requires" : {}
      },
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "6.30"
         }
      },
      "runtime" : {
         "requires" : {
            "IPC::Cmd" : "0",
            "JSON" : "2",
            "String::ShellQuote" : "0",
            "perl" : "5.008001",
            "version" : "0.77"
         }
      },
      "test" : {
         "requires" : {
            "Test::More" : "0"
         }
      }
   },
   "release_status" : "stable",
   "resources" : {
      "repository" : {
         "type" : "git",
         "url" : "https://github.com/hirose31/AWS-CLIWrapper.git",
         "web" : "https://github.com/hirose31/AWS-CLIWrapper"
      }
   },
   "version" : "1.27",
   "x_serialization_backend" : "JSON::PP version 2.27400_02"
}

META.yml  view on Meta::CPAN

meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: AWS-CLIWrapper
no_index:
  directory:
    - t
    - inc
requires:
  IPC::Cmd: '0'
  JSON: '2'
  String::ShellQuote: '0'
  perl: '5.008001'
  version: '0.77'
resources:
  repository: https://github.com/hirose31/AWS-CLIWrapper.git
version: '1.27'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

Makefile.PL  view on Meta::CPAN

    "BUILD_REQUIRES" => {},
    "CONFIGURE_REQUIRES" => {
        "ExtUtils::MakeMaker" => "6.30"
    },
    "DISTNAME" => "AWS-CLIWrapper",
    "LICENSE" => "perl",
    "NAME" => "AWS::CLIWrapper",
    "PREREQ_PM" => {
        "IPC::Cmd"   => 0,
        "String::ShellQuote" => 0,
        "JSON"       => "2",
        "version"    => "0.77",
    },
    "TEST_REQUIRES" => {
        "Test::More" => 0
    },
    "VERSION_FROM" => "lib/AWS/CLIWrapper.pm",
    "MIN_PERL_VERSION" => 5.008001,
    "META_MERGE" => {
        'meta-spec' => { version => 2 },
        resources => {

cpanfile  view on Meta::CPAN

# -*- mode: cperl -*-

requires 'IPC::Cmd';
requires 'JSON', '2';
requires 'String::ShellQuote';
requires 'perl', '5.005';
requires 'version';
requires 'perl', '5.008001';

on configure => sub {
    requires 'ExtUtils::MakeMaker', '6.30';
};

on test => sub {

lib/AWS/CLIWrapper.pm  view on Meta::CPAN

package AWS::CLIWrapper;

use 5.008001;
use strict;
use warnings;

our $VERSION = '1.27';

use version;
use JSON 2;
use IPC::Cmd;
use String::ShellQuote;
use Carp;

our $Error = { Message => '', Code => '' };

our $true  = do { bless \(my $dummy = 1), "AWS::CLIWrapper::Boolean" };
our $false = do { bless \(my $dummy = 0), "AWS::CLIWrapper::Boolean" };

my $AWSCLI_VERSION = undef;

lib/AWS/CLIWrapper.pm  view on Meta::CPAN

    my @opt = ();
    for my $k (qw(region profile endpoint_url)) {
        if (my $v = delete $param{$k}) {
            push @opt, param2opt($k, $v);
        }
    }

    my $self = bless {
        region => $region,
        opt  => \@opt,
        json => JSON->new,
        param => \%param,
        awscli_path => $param{awscli_path} || 'aws',
        croak_on_error => !!$param{croak_on_error},
        timeout => (defined $ENV{AWS_CLIWRAPPER_TIMEOUT}) ? $ENV{AWS_CLIWRAPPER_TIMEOUT} : 30,
    }, $class;

    return $self;
}

sub region { shift->{region} }

lib/AWS/CLIWrapper.pm  view on Meta::CPAN

sub _handle {
    my ($self, $service, $operation, $ret) = @_;

    if ($ret->{exit_code} == 0 && $ret->{timeout} == 0) {
        my $json = $ret->{stdout};
        warn sprintf("%s.%s[%s]: %s\n",
                     $service, $operation, 'OK', $json,
                    ) if $ENV{AWSCLI_DEBUG};
        local $@;
        my($ret) = eval {
            # aws s3 returns null HTTP body, so failed to parse as JSON

            # Temporary disable __DIE__ handler to prevent the
            # exception from decode() from catching by outer
            # __DIE__ handler.
            local $SIG{__DIE__} = sub {};

            $self->json->decode($json);
        };
        if ($@) {
            if ($ENV{AWSCLI_DEBUG}) {

xt/12_nested-boolean.t  view on Meta::CPAN

    count              => 1,
    image_id           => $AMI_ID,
    instance_type      => 't2.micro',
    key_name           => 'hirose31-aws-tokyo',
    network_interfaces => [
        {
            DeviceIndex              => 0,
            SubnetId                 => 'subnet-00c69dad8729ad024',
            PrivateIpAddress         => "10.0.0.240",
            Groups                   => [ 'sg-0ec4572b2c015784c' ],
            AssociatePublicIpAddress => JSON::true, # not $AWS::CLIWrapper::true,
        },
    ],
})
    or die sprintf("Code : %s\nMessage: %s",
                    $AWS::CLIWrapper::Error->{Code},
                    $AWS::CLIWrapper::Error->{Message},
                );
ok($res, 'run-instances');
my $instance_id = $res->{Instances}[0]{InstanceId};
ok($instance_id, 'getting instance id');



( run in 1.252 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )