AWS-Lambda-Quick

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

         },
         {
            "class" : "Dist::Zilla::Plugin::MojibakeTests",
            "name" : "@MAXMIND/MojibakeTests",
            "version" : "0.8"
         },
         {
            "class" : "Dist::Zilla::Plugin::Test::CPAN::Changes",
            "config" : {
               "Dist::Zilla::Plugin::Test::CPAN::Changes" : {
                  "changelog" : "Changes"
               }
            },
            "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"
         },

META.json  view on Meta::CPAN

                  "allow_dirty" : [
                     "CONTRIBUTING.md",
                     "Changes",
                     "LICENSE",
                     "Makefile.PL",
                     "README.md",
                     "cpanfile",
                     "tidyall.ini"
                  ],
                  "allow_dirty_match" : [],
                  "changelog" : "Changes"
               },
               "Dist::Zilla::Role::Git::Repo" : {
                  "git_version" : "2.21.0 (Apple Git-122.2)",
                  "repo_root" : "."
               }
            },
            "name" : "@MAXMIND/Git::Check",
            "version" : "2.046"
         },
         {

META.json  view on Meta::CPAN

                  "allow_dirty" : [
                     "CONTRIBUTING.md",
                     "Changes",
                     "LICENSE",
                     "Makefile.PL",
                     "README.md",
                     "cpanfile",
                     "tidyall.ini"
                  ],
                  "allow_dirty_match" : [],
                  "changelog" : "Changes"
               },
               "Dist::Zilla::Role::Git::Repo" : {
                  "git_version" : "2.21.0 (Apple Git-122.2)",
                  "repo_root" : "."
               },
               "Dist::Zilla::Role::Git::StringFormatter" : {
                  "time_zone" : "local"
               }
            },
            "name" : "@MAXMIND/Commit generated files",
            "version" : "2.046"
         },
         {
            "class" : "Dist::Zilla::Plugin::Git::Tag",
            "config" : {
               "Dist::Zilla::Plugin::Git::Tag" : {
                  "branch" : null,
                  "changelog" : "Changes",
                  "signed" : 0,
                  "tag" : "v1.0002",
                  "tag_format" : "v%V",
                  "tag_message" : "v%V"
               },
               "Dist::Zilla::Role::Git::Repo" : {
                  "git_version" : "2.21.0 (Apple Git-122.2)",
                  "repo_root" : "."
               },
               "Dist::Zilla::Role::Git::StringFormatter" : {

META.json  view on Meta::CPAN

                  "commit_msg" : "Bump version after release"
               },
               "Dist::Zilla::Role::Git::DirtyFiles" : {
                  "allow_dirty" : [
                     "Changes",
                     "dist.ini"
                  ],
                  "allow_dirty_match" : [
                     "(?^:.+)"
                  ],
                  "changelog" : "Changes"
               },
               "Dist::Zilla::Role::Git::Repo" : {
                  "git_version" : "2.21.0 (Apple Git-122.2)",
                  "repo_root" : "."
               },
               "Dist::Zilla::Role::Git::StringFormatter" : {
                  "time_zone" : "local"
               }
            },
            "name" : "@MAXMIND/Commit version bump",

META.yml  view on Meta::CPAN

      name: '@MAXMIND/RunExtraTests'
      version: '0.029'
    -
      class: Dist::Zilla::Plugin::MojibakeTests
      name: '@MAXMIND/MojibakeTests'
      version: '0.8'
    -
      class: Dist::Zilla::Plugin::Test::CPAN::Changes
      config:
        Dist::Zilla::Plugin::Test::CPAN::Changes:
          changelog: Changes
      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:

META.yml  view on Meta::CPAN

        Dist::Zilla::Role::Git::DirtyFiles:
          allow_dirty:
            - CONTRIBUTING.md
            - Changes
            - LICENSE
            - Makefile.PL
            - README.md
            - cpanfile
            - tidyall.ini
          allow_dirty_match: []
          changelog: Changes
        Dist::Zilla::Role::Git::Repo:
          git_version: '2.21.0 (Apple Git-122.2)'
          repo_root: .
      name: '@MAXMIND/Git::Check'
      version: '2.046'
    -
      class: Dist::Zilla::Plugin::Git::Commit
      config:
        Dist::Zilla::Plugin::Git::Commit:
          add_files_in: []

META.yml  view on Meta::CPAN

        Dist::Zilla::Role::Git::DirtyFiles:
          allow_dirty:
            - CONTRIBUTING.md
            - Changes
            - LICENSE
            - Makefile.PL
            - README.md
            - cpanfile
            - tidyall.ini
          allow_dirty_match: []
          changelog: Changes
        Dist::Zilla::Role::Git::Repo:
          git_version: '2.21.0 (Apple Git-122.2)'
          repo_root: .
        Dist::Zilla::Role::Git::StringFormatter:
          time_zone: local
      name: '@MAXMIND/Commit generated files'
      version: '2.046'
    -
      class: Dist::Zilla::Plugin::Git::Tag
      config:
        Dist::Zilla::Plugin::Git::Tag:
          branch: ~
          changelog: Changes
          signed: 0
          tag: v1.0002
          tag_format: v%V
          tag_message: v%V
        Dist::Zilla::Role::Git::Repo:
          git_version: '2.21.0 (Apple Git-122.2)'
          repo_root: .
        Dist::Zilla::Role::Git::StringFormatter:
          time_zone: local
      name: '@MAXMIND/Git::Tag'

META.yml  view on Meta::CPAN

      config:
        Dist::Zilla::Plugin::Git::Commit:
          add_files_in: []
          commit_msg: 'Bump version after release'
        Dist::Zilla::Role::Git::DirtyFiles:
          allow_dirty:
            - Changes
            - dist.ini
          allow_dirty_match:
            - (?^:.+)
          changelog: Changes
        Dist::Zilla::Role::Git::Repo:
          git_version: '2.21.0 (Apple Git-122.2)'
          repo_root: .
        Dist::Zilla::Role::Git::StringFormatter:
          time_zone: local
      name: '@MAXMIND/Commit version bump'
      version: '2.046'
    -
      class: Dist::Zilla::Plugin::Git::Push
      config:

README.md  view on Meta::CPAN


By default, unless you specify extra parameters when you import
AWS::Lambda::Quick, AWS will be configured as described below

### Create A New Role For Use With AWS::Lambda::Quick

Execution creates a new role called `perl-aws-lambda-quick` that can
be assumed by both the API Gateway (`apigateway.amazonaws.com`) and
Lambda (`lambda.amazonaws.com`) services.  The role will have
`AWSLambdaRole` and `CloudWatchLogsFullAccess`  policies permissioned
(so it execute the lambda function and write logs.)

You can modify this role as you see fit.  For example, to give your
lambda functions the ability to access S3:

    shell$ aws iam attach-role-policy \
             --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess \
             --role-name perl-aws-lambda-quick

If you really want your lambda functions to use a different role then
you can control this with the `role` parameter described below.

README.md  view on Meta::CPAN

                'Content-Type' => 'application/json',
            },
            body => encode_json($data),
        };
    }

    1;

### Create a new integration-response and method-response

The integration response and method response are analogous to the
integration and method - but instead of getting data from HTTP to
Lambda, they get Lambda data back to HTTP.

Because we want our handler to have complete control over the output
we don't do anything special with what we create.

### Deploying the Code.

Once all the above is done the module finally deploys the code
so it's web accessible.

README.md  view on Meta::CPAN

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
[How to quickly find and update your access keys, password, and MFA setting using the AWS Management Console](https://aws.amazon.com/blogs/security/how-to-find-update-access-keys-password-mfa-aws-management-console/)

Once you have your keys you can then use the `configure` command
to update the aws command line utility.

    shell$ aws configure
    AWS Access Key ID [********************]:
    AWS Secret Access Key [********************]:
    Default region name [us-east-1]:
    Default output format [None]:

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


By default, unless you specify extra parameters when you import
AWS::Lambda::Quick, AWS will be configured as described below

=head3 Create A New Role For Use With AWS::Lambda::Quick

Execution creates a new role called C<perl-aws-lambda-quick> that can
be assumed by both the API Gateway (C<apigateway.amazonaws.com>) and
Lambda (C<lambda.amazonaws.com>) services.  The role will have
C<AWSLambdaRole> and C<CloudWatchLogsFullAccess>  policies permissioned
(so it execute the lambda function and write logs.)

You can modify this role as you see fit.  For example, to give your
lambda functions the ability to access S3:

    shell$ aws iam attach-role-policy \
             --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess \
             --role-name perl-aws-lambda-quick

If you really want your lambda functions to use a different role then
you can control this with the C<role> parameter described below.

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

                'Content-Type' => 'application/json',
            },
            body => encode_json($data),
        };
    }

    1;

=head3 Create a new integration-response and method-response

The integration response and method response are analogous to the
integration and method - but instead of getting data from HTTP to
Lambda, they get Lambda data back to HTTP.

Because we want our handler to have complete control over the output
we don't do anything special with what we create.

=head3 Deploying the Code.

Once all the above is done the module finally deploys the code
so it's web accessible.

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

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
L<How to quickly find and update your access keys, password, and MFA setting using the AWS Management Console|https://aws.amazon.com/blogs/security/how-to-find-update-access-keys-password-mfa-aws-management-console/>

Once you have your keys you can then use the C<configure> command
to update the aws command line utility.

    shell$ aws configure
    AWS Access Key ID [********************]:
    AWS Secret Access Key [********************]:
    Default region name [us-east-1]:
    Default output format [None]:

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


sub _write_zip {
    my $self = shift;
    unless ( $self->_zip->writeToFileNamed( $self->zip_filename->stringify )
        == AZ_OK ) {
        die 'write error';
    }
    return ();
}

### logic for building the zip file contents ###

sub _build_zip {
    my $self = shift;
    $self->_add_string( $self->_converted_src, 'handler.pl' );
    $self->_add_path($_) for @{ $self->extra_files };
    return ();
}

sub create_zip {
    my $self = shift;



( run in 1.069 second using v1.01-cache-2.11-cpan-49f99fa48dc )