AWS-Lambda-Quick

 view release on metacpan or  search on metacpan

CONTRIBUTING.md  view on Meta::CPAN

    $ perl -Mblib t/some_test_file.t

You may need to satisfy some dependencies. The easiest way to satisfy
dependencies is to install the last release. This is available at
https://metacpan.org/release/AWS-Lambda-Quick

If you use cpanminus, you can do it without downloading the tarball first:

    $ cpanm --reinstall --installdeps --with-recommends AWS::Lambda::Quick

Dist::Zilla is a very powerful authoring tool, but requires a number of
author-specific plugins. If you would like to use it for contributing, install
it from CPAN, then run one of the following commands, depending on your CPAN
client:

    $ cpan `dzil authordeps --missing`

or

    $ dzil authordeps --missing | cpanm

There may also be additional requirements not needed by the dzil build which
are needed for tests or other development:

    $ cpan `dzil listdeps --author --missing`

or

    $ dzil listdeps --author --missing | cpanm

Or, you can use the 'dzil stale' command to install all requirements at once:

    $ cpan Dist::Zilla::App::Command::stale
    $ cpan `dzil stale --all`

or

    $ cpanm Dist::Zilla::App::Command::stale
    $ dzil stale --all | cpanm

CONTRIBUTING.md  view on Meta::CPAN

If you have found a bug, but do not have an accompanying patch to fix it, you
can submit an issue report [via the web](https://github.com/2shortplanks/aws-lambda-quick/issues)
.
This is a good place to send your questions about the usage of this distribution.


## Tidyall

This distribution uses
[Code::TidyAll](https://metacpan.org/release/Code-TidyAll) to enforce a
uniform coding style. This is tested as part of the author testing suite. You
can install and run tidyall by running the following commands:

    $ cpanm Code::TidyAll
    $ tidyall -a

Please run this before committing your changes and address any issues it
brings up.

## Contributor Names

LICENSE  view on Meta::CPAN

 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The license agreements of most software companies try to keep users
at the mercy of those companies.  By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid

LICENSE  view on Meta::CPAN


  For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must tell them their rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  The precise terms and conditions for copying, distribution and
modification follow.

                    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License.  The

LICENSE  view on Meta::CPAN


Each version is given a distinguishing version number.  If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.

  8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

                            NO WARRANTY

  9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN

LICENSE  view on Meta::CPAN

possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.

  To do so, attach the following notices to the program.  It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) 19yy  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 1, or (at your option)
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

LICENSE  view on Meta::CPAN

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA  02110-1301 USA


Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) 19xx name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License.  Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.

MANIFEST  view on Meta::CPAN

lib/AWS/Lambda/Quick/Processor.pm
lib/AWS/Lambda/Quick/Upload.pm
perlcriticrc
perltidyrc
t/00-report-prereqs.dd
t/00-report-prereqs.t
t/02zip.t
t/03process.t
t/lib/TestHelper/CreateTestFiles.pm
tidyall.ini
xt/author/00-compile.t
xt/author/eol.t
xt/author/mojibake.t
xt/author/no-tabs.t
xt/author/pod-spell.t
xt/author/pod-syntax.t
xt/author/portability.t
xt/author/test-version.t
xt/author/tidyall.t
xt/release/cpan-changes.t
xt/release/meta-json.t

META.json  view on Meta::CPAN

{
   "abstract" : "quickly create a REST accesible AWS Lambda function",
   "author" : [
      "Mark Fowler <mark@twoshortplanks.com>"
   ],
   "dynamic_config" : 0,
   "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
      "version" : 2

META.json  view on Meta::CPAN

         },
         {
            "class" : "Dist::Zilla::Plugin::Test::CPAN::Meta::JSON",
            "name" : "@MAXMIND/Test::CPAN::Meta::JSON",
            "version" : "0.004"
         },
         {
            "class" : "Dist::Zilla::Plugin::Test::EOL",
            "config" : {
               "Dist::Zilla::Plugin::Test::EOL" : {
                  "filename" : "xt/author/eol.t",
                  "finder" : [
                     ":ExecFiles",
                     ":InstallModules",
                     ":TestFiles"
                  ],
                  "trailing_whitespace" : 1
               }
            },
            "name" : "@MAXMIND/Test::EOL",
            "version" : "0.19"
         },
         {
            "class" : "Dist::Zilla::Plugin::Test::NoTabs",
            "config" : {
               "Dist::Zilla::Plugin::Test::NoTabs" : {
                  "filename" : "xt/author/no-tabs.t",
                  "finder" : [
                     ":InstallModules",
                     ":ExecFiles",
                     ":TestFiles"
                  ]
               }
            },
            "name" : "@MAXMIND/Test::NoTabs",
            "version" : "0.15"
         },

META.json  view on Meta::CPAN

         {
            "class" : "Dist::Zilla::Plugin::Test::TidyAll",
            "name" : "@MAXMIND/Test::TidyAll",
            "version" : "0.04"
         },
         {
            "class" : "Dist::Zilla::Plugin::Test::Compile",
            "config" : {
               "Dist::Zilla::Plugin::Test::Compile" : {
                  "bail_out_on_fail" : 0,
                  "fail_on_warning" : "author",
                  "fake_home" : 0,
                  "filename" : "xt/author/00-compile.t",
                  "module_finder" : [
                     ":InstallModules"
                  ],
                  "needs_display" : 0,
                  "phase" : "develop",
                  "script_finder" : [
                     ":PerlExecFiles"
                  ],
                  "skips" : [],
                  "switch" : []

META.json  view on Meta::CPAN

         {
            "class" : "Dist::Zilla::Plugin::Test::Version",
            "name" : "@MAXMIND/Test::Version",
            "version" : "1.09"
         },
         {
            "class" : "Dist::Zilla::Plugin::Git::Contributors",
            "config" : {
               "Dist::Zilla::Plugin::Git::Contributors" : {
                  "git_version" : "2.21.0 (Apple Git-122.2)",
                  "include_authors" : 0,
                  "include_releaser" : 1,
                  "order_by" : "name",
                  "paths" : []
               }
            },
            "name" : "@MAXMIND/Git::Contributors",
            "version" : "0.035"
         },
         {
            "class" : "Dist::Zilla::Plugin::SurgicalPodWeaver",

META.json  view on Meta::CPAN

         }
      ],
      "zilla" : {
         "class" : "Dist::Zilla::Dist::Builder",
         "config" : {
            "is_trial" : 0
         },
         "version" : "6.012"
      }
   },
   "x_authority" : "cpan:MAXMIND",
   "x_generated_by_perl" : "v5.28.1",
   "x_serialization_backend" : "Cpanel::JSON::XS version 4.08"
}

META.yml  view on Meta::CPAN

---
abstract: 'quickly create a REST accesible AWS Lambda function'
author:
  - 'Mark Fowler <mark@twoshortplanks.com>'
build_requires:
  Exporter: '0'
  ExtUtils::MakeMaker: '0'
  File::Spec: '0'
  FindBin: '0'
  HTTP::Tiny: '0'
  Test2::V0: '0'
  Test::More: '1.302015'
  Test::TempDir::Tiny: '0'

META.yml  view on Meta::CPAN

      name: '@MAXMIND/Test::CPAN::Changes'
      version: '0.012'
    -
      class: Dist::Zilla::Plugin::Test::CPAN::Meta::JSON
      name: '@MAXMIND/Test::CPAN::Meta::JSON'
      version: '0.004'
    -
      class: Dist::Zilla::Plugin::Test::EOL
      config:
        Dist::Zilla::Plugin::Test::EOL:
          filename: xt/author/eol.t
          finder:
            - ':ExecFiles'
            - ':InstallModules'
            - ':TestFiles'
          trailing_whitespace: 1
      name: '@MAXMIND/Test::EOL'
      version: '0.19'
    -
      class: Dist::Zilla::Plugin::Test::NoTabs
      config:
        Dist::Zilla::Plugin::Test::NoTabs:
          filename: xt/author/no-tabs.t
          finder:
            - ':InstallModules'
            - ':ExecFiles'
            - ':TestFiles'
      name: '@MAXMIND/Test::NoTabs'
      version: '0.15'
    -
      class: Dist::Zilla::Plugin::Test::Portability
      config:
        Dist::Zilla::Plugin::Test::Portability:

META.yml  view on Meta::CPAN

      version: '2.001000'
    -
      class: Dist::Zilla::Plugin::Test::TidyAll
      name: '@MAXMIND/Test::TidyAll'
      version: '0.04'
    -
      class: Dist::Zilla::Plugin::Test::Compile
      config:
        Dist::Zilla::Plugin::Test::Compile:
          bail_out_on_fail: '0'
          fail_on_warning: author
          fake_home: 0
          filename: xt/author/00-compile.t
          module_finder:
            - ':InstallModules'
          needs_display: 0
          phase: develop
          script_finder:
            - ':PerlExecFiles'
          skips: []
          switch: []
      name: '@MAXMIND/Test::Compile'
      version: '2.058'

META.yml  view on Meta::CPAN

      version: '0.027'
    -
      class: Dist::Zilla::Plugin::Test::Version
      name: '@MAXMIND/Test::Version'
      version: '1.09'
    -
      class: Dist::Zilla::Plugin::Git::Contributors
      config:
        Dist::Zilla::Plugin::Git::Contributors:
          git_version: '2.21.0 (Apple Git-122.2)'
          include_authors: 0
          include_releaser: 1
          order_by: name
          paths: []
      name: '@MAXMIND/Git::Contributors'
      version: '0.035'
    -
      class: Dist::Zilla::Plugin::SurgicalPodWeaver
      config:
        Dist::Zilla::Plugin::PodWeaver:
          config_plugins:

META.yml  view on Meta::CPAN

      version: '6.012'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: '@MAXMIND/MetaProvides::Package/AUTOVIV/:InstallModulesPM'
      version: '6.012'
  zilla:
    class: Dist::Zilla::Dist::Builder
    config:
      is_trial: '0'
    version: '6.012'
x_authority: cpan:MAXMIND
x_generated_by_perl: v5.28.1
x_serialization_backend: 'YAML::Tiny version 1.73'

README.md  view on Meta::CPAN

### Create a new method

Each Lambda function we create gets its own method, which is where
AWS specifies what HTTP method it accepts (`GET`,`POST`,`PUT`,
etc.) and how it decides who can access it.

This module always sets the type of method to `ANY` (i.e. we always
call the lambda function and let it figure out what it wants to accept
or not.)

We setup the `NONE` authentication, meaning anyone can call the API
over the internet - i.e. it's configured as a public API.

### Create a new integration

Integrations are how AWS decides both where a request is routed to
and what extracted from that HTTP request is passed on and how.

We configure an AWS\_PROXY integration routing to our new Lambda
function.  This essentially means everything is passed "as is"
through to our handler as the first argument.

README.md  view on Meta::CPAN


By default this is to the `quick`, though you can reconfigure that
with the `stage_name` parameter.

## Parameters

This is a full list of parameters you can currently configure.  Only
one parameter - `name` - is required and all other parameters are
optional and will have hopefully sensible defaults.

It is not the intent of the author to provide a complete and exhaustive
list of all possibilities - you have the power of the AWS Management
console and AWS API to make any further tweaks you may desire.

- name

    The name of the Lambda function.  Required.

    This will become part of the URL that can be used to call this
    function so you are strongly encouraged not to use any non-url
    safe characters (including `/`, `?`, etc) in the name.

README.md  view on Meta::CPAN

    function.

        use AWS::Lambda::Quick (
            name => 'email sender',
            extra_layers => [ 'paws' ],
        );

## Installing the CLI tools

This module requires you to have the version 1 AWS CLI tools installed
on your system and configured with your authentication credentials.
Installing the tools are covered in many AWS guides, but can be
quickly summarized as:

    shell$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
    shell$ unzip awscli-bundle.zip
    shell$ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

You'll need to configure awscli with your own personal AWS Access
Key ID and AWS Secret Access Key.  You can create these from the AWS
Management console by following the guide on

dist.ini  view on Meta::CPAN

name   = AWS-Lambda-Quick
author = Mark Fowler <mark@twoshortplanks.com>
copyright_holder = Mark Fowler
 
[@MAXMIND]
dist = AWS-Lambda-Quick
-remove = MAXMIND::Contributors
-remove = Test::CleanNamespaces
-remove = Test::Synopsis
-remove = UploadToCPAN
-remove = Test::Pod::Coverage::Configurable
stopwords = AWS

lib/AWS/Lambda/Quick.pm  view on Meta::CPAN

=head3 Create a new method

Each Lambda function we create gets its own method, which is where
AWS specifies what HTTP method it accepts (C<GET>,C<POST>,C<PUT>,
etc.) and how it decides who can access it.

This module always sets the type of method to C<ANY> (i.e. we always
call the lambda function and let it figure out what it wants to accept
or not.)

We setup the C<NONE> authentication, meaning anyone can call the API
over the internet - i.e. it's configured as a public API.

=head3 Create a new integration

Integrations are how AWS decides both where a request is routed to
and what extracted from that HTTP request is passed on and how.

We configure an AWS_PROXY integration routing to our new Lambda
function.  This essentially means everything is passed "as is"
through to our handler as the first argument.

lib/AWS/Lambda/Quick.pm  view on Meta::CPAN


By default this is to the C<quick>, though you can reconfigure that
with the C<stage_name> parameter.

=head2 Parameters

This is a full list of parameters you can currently configure.  Only
one parameter - C<name> - is required and all other parameters are
optional and will have hopefully sensible defaults.

It is not the intent of the author to provide a complete and exhaustive
list of all possibilities - you have the power of the AWS Management
console and AWS API to make any further tweaks you may desire.

=over

=item name

The name of the Lambda function.  Required.

This will become part of the URL that can be used to call this

lib/AWS/Lambda/Quick.pm  view on Meta::CPAN

    use AWS::Lambda::Quick (
        name => 'email sender',
        extra_layers => [ 'paws' ],
    );

=back

=head2 Installing the CLI tools

This module requires you to have the version 1 AWS CLI tools installed
on your system and configured with your authentication credentials.
Installing the tools are covered in many AWS guides, but can be
quickly summarized as:

    shell$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
    shell$ unzip awscli-bundle.zip
    shell$ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

You'll need to configure awscli with your own personal AWS Access
Key ID and AWS Secret Access Key.  You can create these from the AWS
Management console by following the guide on

lib/AWS/Lambda/Quick/Upload.pm  view on Meta::CPAN

        $self->debug('found existing method');
        return ();
    }

    $self->debug('putting new method');
    $self->aws_do(
        'apigateway',
        'put-method',
        {
            @identifiers,
            'authorization-type' => 'NONE',
        },
    );
    $self->debug('new method put');

    return ();
}

sub _create_method_response {
    my $self        = shift;
    my $resource_id = shift;

tidyall.ini  view on Meta::CPAN

[PerlCritic]
select = **/*.{pl,pm,t,psgi}
ignore = .build/**/*
ignore = AWS-Lambda-Quick-*/**/*
ignore = blib/**/*
ignore = t/00-*
ignore = t/author-*
ignore = t/release-*
ignore = t/zzz-*
ignore = xt/**/*
argv = --profile=$ROOT/perlcriticrc

[PerlTidy]
select = **/*.{pl,pm,t,psgi}
ignore = .build/**/*
ignore = AWS-Lambda-Quick-*/**/*
ignore = blib/**/*
ignore = t/00-*
ignore = t/author-*
ignore = t/release-*
ignore = t/zzz-*
ignore = xt/**/*
argv = --profile=$ROOT/perltidyrc

[Test::Vars]
select = **/*.pm
ignore = .build/**/*
ignore = AWS-Lambda-Quick-*/**/*
ignore = blib/**/*
ignore = t/00-*
ignore = t/author-*
ignore = t/release-*
ignore = t/zzz-*
ignore = xt/**/*



( run in 2.421 seconds using v1.01-cache-2.11-cpan-5c0b1e786e0 )