AWS-Lambda

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

         "xt",
         "inc",
         "share",
         "eg",
         "examples",
         "author",
         "builder"
      ]
   },
   "prereqs" : {
      "configure" : {
         "requires" : {
            "Module::Build::Tiny" : "0.035"
         }
      },
      "develop" : {
         "requires" : {
            "CPAN::Uploader" : "0",
            "Capture::Tiny" : "0",
            "Dancer2" : "0",
            "Minilla" : "0",

META.yml  view on Meta::CPAN

author:
  - 'ICHINOSE Shogo'
build_requires:
  File::Slurp: '9999.25'
  Starman: '0'
  Test::Deep: '1.128'
  Test::More: '0.98'
  Test::SharedFork: '0'
  Test::TCP: '2.19'
  Test::Warn: '0'
configure_requires:
  Module::Build::Tiny: '0.035'
dynamic_config: 0
generated_by: 'Minilla/v3.1.23, CPAN::Meta::Converter version 2.150010'
license: mit
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: AWS-Lambda
no_index:
  directory:

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

            # The name of the Lambda function.
            function_name => $context->function_name,

            # The version of the function.
            function_version => $context->function_version,
            
            # The Amazon Resource Name (ARN) used to invoke the function.
            # Indicates if the invoker specified a version number or alias.
            invoked_function_arn => $context->invoked_function_arn,

            # The amount of memory configured on the function.
            memory_limit_in_mb => $context->memory_limit_in_mb,

            # The identifier of the invocation request.
            aws_request_id => $context->aws_request_id,

            # The log group for the function.
            log_group_name => $context->log_group_name,

            # The log stream for the function instance.
            log_stream_name => $context->log_stream_name,

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

    1;

And then, L<Set up Lambda Proxy Integrations in API Gateway|https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html> or
L<Lambda Functions as ALB Targets|https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html>

=head1 DESCRIPTION

=head2 Streaming Response

L<AWS::Lambda::PSGI> supports L<response streaming|https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html>.
The function urls's invoke mode is configured as C<"RESPONSE_STREAM">, and Lambda environment variable "PERL5_LAMBDA_PSGI_INVOKE_MODE" is set to C<"RESPONSE_STREAM">.

    ExampleApi:
        Type: AWS::Serverless::Function
        Properties:
            FunctionUrlConfig:
                AuthType: NONE
                InvokeMode: RESPONSE_STREAM
            Environment:
                Variables:
                PERL5_LAMBDA_PSGI_INVOKE_MODE: RESPONSE_STREAM

t/20_psgi.t  view on Meta::CPAN

    ok !$req->env->{'psgi.streaming'}, 'psgi.streaming';
};

subtest "API Gateway Base64 encoded POST Request" => sub {
    my $input = slurp_json("testdata/apigateway-base64-request.json");
    my $output = $app->format_input($input);
    my $req = Plack::Request->new($output);
    is $req->method, 'POST', 'method';

    # You have to add 'application/octet-stream' to binary media types.
    # https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings-configure-with-console.html
    is $req->content_type, 'application/octet-stream', 'content-type';
    my $content;
    warning_is { $content = slurp_fh($req->input) } undef, 'no warning';
    is $content, '{"hello":"world"}', 'content';
    is $req->request_uri, '/', 'request uri';
    is $req->path_info, '/', 'path info';
    is $req->query_string, '', 'query string';
    ok !$req->env->{'psgi.streaming'}, 'psgi.streaming';
};



( run in 0.636 second using v1.01-cache-2.11-cpan-283623ac599 )