diff --git a/.luacheckrc b/.luacheckrc
index bd065421295..097df0c3b7b 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -6,6 +6,7 @@ max_line_length = false
globals = {
"_KONG",
+ "kong",
"ngx.IS_CLI",
}
diff --git a/.travis.yml b/.travis.yml
index d74043e39e4..f6cabc02a52 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
-dist: xenial
-sudo: false
+dist: trusty
+sudo: required
-language: generic
+language: java
jdk:
- oraclejdk8
@@ -16,43 +16,40 @@ addons:
- net-tools
- libpcre3-dev
- build-essential
- hosts:
- - grpcs_1.test
- - grpcs_2.test
services:
- docker
env:
global:
- - TEST_SUITE=integration
+ - CASSANDRA_BASE=2.2.12
+ - CASSANDRA_LATEST=3.9
+ - KONG_REPOSITORY=kong
+ - KONG_TAG=master
+ - DOWNLOAD_CACHE=$HOME/download-cache
- INSTALL_CACHE=$HOME/install-cache
- DOWNLOAD_ROOT=$HOME/download-root
- - PLUGIN_NAME=liamp
+ - BUSTED_ARGS="-o gtest -v --exclude-tags=flaky,ipv6"
+ - PLUGIN_NAME=aws-lambda
- KONG_PLUGINS=bundled,$PLUGIN_NAME
- KONG_TEST_PLUGINS=$KONG_PLUGINS
- TEST_FILE_PATH=$TRAVIS_BUILD_DIR/spec
- - JOBS=2
matrix:
- - KONG_TEST_DATABASE=cassandra CASSANDRA=2.2.12 KONG=master BUSTED_ARGS="-o gtest -v --exclude-tags=flaky,ipv6,postgres,off"
- - KONG_TEST_DATABASE=cassandra CASSANDRA=3.9 KONG=master BUSTED_ARGS="-o gtest -v --exclude-tags=flaky,ipv6,postgres,off"
- - KONG_TEST_DATABASE=postgres POSTGRES=9.5 KONG=master BUSTED_ARGS="-o gtest -v --exclude-tags=flaky,ipv6,cassandra,off"
-matrix:
- allow_failures:
- - env: KONG_TEST_DATABASE=postgres POSTGRES=9.5 KONG=master BUSTED_ARGS="-o gtest -v --exclude-tags=flaky,ipv6,cassandra,off"
+ # This one runs both postgres and cassandra_base
+ - CASSANDRA=$CASSANDRA_BASE
+ - CASSANDRA=$CASSANDRA_LATEST
install:
- - make setup-ci
- - pushd kong-source && source .ci/setup_env.sh && popd
- - pushd kong-source && make dev && popd
- - cp -r kong-source/spec/fixtures spec
- - luarocks make
+ - git clone --single-branch --branch master https://$GITHUB_TOKEN:@github.com/Kong/kong-ci.git ../kong-ci
+ - source ../kong-ci/setup_plugin_env.sh
script:
- - pushd kong-source && bin/busted $BUSTED_ARGS ../spec && popd
+ - eval $LUACHECK_CMD
+ - eval $BUSTED_CMD
cache:
apt: true
+ pip: true
directories:
- $DOWNLOAD_CACHE
- $INSTALL_CACHE
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 00b20fb5f3f..7a4f13ec200 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 3.0.0
+
+- supersede the `aws-lambda` plugin from Kong core
+
## 0.2.0
### Changed
diff --git a/README.md b/README.md
index 4c75f2654d6..5ad928bef81 100644
--- a/README.md
+++ b/README.md
@@ -115,11 +115,12 @@ Here's a list of all the parameters which can be used in this plugin's configura
|`config.aws_secret`
*semi-optional* ||The AWS secret credential to be used when invoking the function. This value is required if `aws_key` is defined.
|`config.aws_region` || The AWS region where the Lambda function is located. Regions supported are: `ap-northeast-1`, `ap-northeast-2`, `ap-south-1`, `ap-southeast-1`, `ap-southeast-2`, `ca-central-1`, `cn-north-1`, `cn-northwest-1`, `eu-central-1`, `eu-west-1`, `eu-west-2`, `sa-east-1`, `us-east-1`, `us-east-2`, `us-gov-west-1`, `us-west-1`, `us-west-2`.
|`config.function_name` || The AWS Lambda function name to invoke.
+|`config.timeout`| `60000` | Timeout protection in milliseconds when invoking the function.
+|`config.keepalive`| `60000` | Max idle timeout in milliseconds when invoking the function.
|`config.qualifier`
*optional* || The [`Qualifier`](http://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_RequestSyntax) to use when invoking the function.
|`config.invocation_type`
*optional*| `RequestResponse` | The [`InvocationType`](http://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_RequestSyntax) to use when invoking the function. Available types are `RequestResponse`, `Event`, `DryRun`.
|`config.log_type`
*optional* | `Tail`| The [`LogType`](http://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_RequestSyntax) to use when invoking the function. By default `None` and `Tail` are supported.
-|`config.port`
*optional* | `Tail`| The [`LogType`](http://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_RequestSyntax) to use when invoking the function. By default `None` and `Tail` are supported.
-|`config.timeout`| `60000` | An optional timeout in milliseconds when invoking the function.
+|`config.port`
*optional* | `443` | The TCP port that this plugin will use to connect to the server.
|`config.unhandled_status`
*optional* | `200`, `202` or `204` | The response status code to use (instead of the default `200`, `202`, or `204`) in the case of an [`Unhandled` Function Error](https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_ResponseSyntax)
|`config.forward_request_body`
*optional* | `false` | An optional value that defines whether the request body is to be sent in the `request_body` field of the JSON-encoded request. If the body arguments can be parsed, they will be sent in the separate `request_body_args` field of the request. The body arguments can be parsed for `application/json`, `application/x-www-form-urlencoded`, and `multipart/form-data` content types.
|`config.forward_request_headers`
*optional* | `false` | An optional value that defines whether the original HTTP request headers are to be sent as a map in the `request_headers` field of the JSON-encoded request.
diff --git a/kong-plugin-aws-lambda-3.0.0-1.rockspec b/kong-plugin-aws-lambda-3.0.0-1.rockspec
new file mode 100644
index 00000000000..13923491a4f
--- /dev/null
+++ b/kong-plugin-aws-lambda-3.0.0-1.rockspec
@@ -0,0 +1,29 @@
+package = "kong-plugin-aws-lambda"
+version = "3.0.0-1"
+
+supported_platforms = {"linux", "macosx"}
+source = {
+ url = "https://github.com/Kong/kong-plugin-aws-lambda/archive/3.0.0.tar.gz",
+ dir = "kong-plugin-aws-lambda-3.0.0"
+}
+
+description = {
+ summary = "Kong plugin to invoke AWS Lambda functions",
+ homepage = "http://konghq.com",
+ license = "Apache 2.0"
+}
+
+dependencies = {
+}
+
+build = {
+ type = "builtin",
+ modules = {
+ ["kong.plugins.aws-lambda.aws-serializer"] = "kong/plugins/aws-lambda/aws-serializer.lua",
+ ["kong.plugins.aws-lambda.handler"] = "kong/plugins/aws-lambda/handler.lua",
+ ["kong.plugins.aws-lambda.iam-ec2-credentials"] = "kong/plugins/aws-lambda/iam-ec2-credentials.lua",
+ ["kong.plugins.aws-lambda.iam-ecs-credentials"] = "kong/plugins/aws-lambda/iam-ecs-credentials.lua",
+ ["kong.plugins.aws-lambda.schema"] = "kong/plugins/aws-lambda/schema.lua",
+ ["kong.plugins.aws-lambda.v4"] = "kong/plugins/aws-lambda/v4.lua",
+ }
+}
diff --git a/kong-plugin-liamp-0.2.0-1.rockspec b/kong-plugin-liamp-0.2.0-1.rockspec
deleted file mode 100644
index a9aa52da49c..00000000000
--- a/kong-plugin-liamp-0.2.0-1.rockspec
+++ /dev/null
@@ -1,38 +0,0 @@
-package = "kong-plugin-liamp" -- TODO: rename, must match the info in the filename of this rockspec!
- -- as a convention; stick to the prefix: `kong-plugin-`
-version = "0.2.0-1" -- TODO: renumber, must match the info in the filename of this rockspec!
--- The version '0.2.0' is the source code version, the trailing '1' is the version of this rockspec.
--- whenever the source version changes, the rockspec should be reset to 1. The rockspec version is only
--- updated (incremented) when this file changes, but the source remains the same.
-
--- TODO: This is the name to set in the Kong configuration `plugins` setting.
--- Here we extract it from the package name.
-local pluginName = package:match("^kong%-plugin%-(.+)$") -- "myPlugin"
-
-supported_platforms = {"linux", "macosx"}
-source = {
- url = "http://github.com/Tieske/kong-plugin-liamp.git",
- tag = "0.2.0"
-}
-
-description = {
- summary = "Kong is a scalable and customizable API Management Layer built on top of Nginx.",
- homepage = "http://getkong.org",
- license = "Apache 2.0"
-}
-
-dependencies = {
-}
-
-build = {
- type = "builtin",
- modules = {
- -- TODO: add any additional files that the plugin consists of
- ["kong.plugins."..pluginName..".aws-serializer"] = "kong/plugins/"..pluginName.."/aws-serializer.lua",
- ["kong.plugins."..pluginName..".handler"] = "kong/plugins/"..pluginName.."/handler.lua",
- ["kong.plugins."..pluginName..".iam-ec2-credentials"] = "kong/plugins/"..pluginName.."/iam-ec2-credentials.lua",
- ["kong.plugins."..pluginName..".iam-ecs-credentials"] = "kong/plugins/"..pluginName.."/iam-ecs-credentials.lua",
- ["kong.plugins."..pluginName..".schema"] = "kong/plugins/"..pluginName.."/schema.lua",
- ["kong.plugins."..pluginName..".v4"] = "kong/plugins/"..pluginName.."/v4.lua",
- }
-}
diff --git a/kong/plugins/liamp/aws-serializer.lua b/kong/plugins/aws-lambda/aws-serializer.lua
similarity index 96%
rename from kong/plugins/liamp/aws-serializer.lua
rename to kong/plugins/aws-lambda/aws-serializer.lua
index 1d896bc1cce..9b3b0ffb8d3 100644
--- a/kong/plugins/liamp/aws-serializer.lua
+++ b/kong/plugins/aws-lambda/aws-serializer.lua
@@ -99,8 +99,5 @@ return function(ctx, config)
isBase64Encoded = isBase64Encoded,
}
- --print(require("pl.pretty").write(request))
- --print(require("pl.pretty").write(ctx.router_matches))
-
return request
-end
\ No newline at end of file
+end
diff --git a/kong/plugins/liamp/handler.lua b/kong/plugins/aws-lambda/handler.lua
similarity index 87%
rename from kong/plugins/liamp/handler.lua
rename to kong/plugins/aws-lambda/handler.lua
index 440e663c39f..79c17fafb52 100644
--- a/kong/plugins/liamp/handler.lua
+++ b/kong/plugins/aws-lambda/handler.lua
@@ -1,19 +1,25 @@
-- Copyright (C) Kong Inc.
-local aws_v4 = require "kong.plugins.liamp.v4"
-local aws_serializer = require "kong.plugins.liamp.aws-serializer"
+local aws_v4 = require "kong.plugins.aws-lambda.v4"
+local aws_serializer = require "kong.plugins.aws-lambda.aws-serializer"
local http = require "resty.http"
local cjson = require "cjson.safe"
local meta = require "kong.meta"
local constants = require "kong.constants"
+local VIA_HEADER = constants.HEADERS.VIA
+local VIA_HEADER_VALUE = meta._NAME .. "/" .. meta._VERSION
+local IAM_CREDENTIALS_CACHE_KEY = "plugin.aws-lambda.iam_role_temp_creds"
+local AWS_PORT = 443
+
+
local fetch_credentials
do
local credential_sources = {
- require "kong.plugins.liamp.iam-ecs-credentials",
+ require "kong.plugins.aws-lambda.iam-ecs-credentials",
-- The EC2 one will always return `configured == true`, so must be the last!
- require "kong.plugins.liamp.iam-ec2-credentials",
+ require "kong.plugins.aws-lambda.iam-ec2-credentials",
}
for _, credential_source in ipairs(credential_sources) do
@@ -32,13 +38,7 @@ local fmt = string.format
local ngx_encode_base64 = ngx.encode_base64
local ngx_update_time = ngx.update_time
local ngx_now = ngx.now
-
-local IAM_CREDENTIALS_CACHE_KEY = "plugin.liamp.iam_role_temp_creds"
-
-
-local server_header_value
-local server_header_name
-local AWS_PORT = 443
+local kong = kong
local raw_content_types = {
@@ -107,28 +107,6 @@ end
local AWSLambdaHandler = {}
-local function send(status, content, headers)
- headers = kong.table.merge(headers) -- create a copy of headers
-
- if server_header_value then
- headers[server_header_name] = server_header_value
- end
-
- return kong.response.exit(status, content, headers)
-end
-
-
-function AWSLambdaHandler:init_worker()
- if kong.configuration.enabled_headers[constants.HEADERS.VIA] then
- server_header_value = meta._SERVER_TOKENS
- server_header_name = constants.HEADERS.VIA
- else
- server_header_value = nil
- server_header_name = nil
- end
-end
-
-
function AWSLambdaHandler:access(conf)
local upstream_body = kong.table.new(0, 6)
local var = ngx.var
@@ -151,13 +129,7 @@ function AWSLambdaHandler:access(conf)
end
if conf.forward_request_uri then
- local path = kong.request.get_path()
- local query = kong.request.get_raw_query()
- if query ~= "" then
- upstream_body.request_uri = path .. "?" .. query
- else
- upstream_body.request_uri = path
- end
+ upstream_body.request_uri = kong.request.get_path_with_query()
upstream_body.request_uri_args = kong.request.get_query()
end
@@ -216,7 +188,7 @@ function AWSLambdaHandler:access(conf)
if not conf.aws_key then
-- no credentials provided, so try the IAM metadata service
- local iam_role_credentials, err = kong.cache:get(
+ local iam_role_credentials = kong.cache:get(
IAM_CREDENTIALS_CACHE_KEY,
nil,
fetch_credentials
@@ -267,8 +239,7 @@ function AWSLambdaHandler:access(conf)
return kong.response.exit(500, { message = "An unexpected error occurred" })
end
- local res
- res, err = client:request {
+ local res, err = client:request {
method = "POST",
path = request.url,
body = request.body,
@@ -331,11 +302,16 @@ function AWSLambdaHandler:access(conf)
end
end
+ headers = kong.table.merge(headers) -- create a copy of headers
+
+ if kong.configuration.enabled_headers[VIA_HEADER] then
+ headers[VIA_HEADER] = VIA_HEADER_VALUE
+ end
- return send(status, content, headers)
+ return kong.response.exit(status, content, headers)
end
AWSLambdaHandler.PRIORITY = 750
-AWSLambdaHandler.VERSION = "0.2.0"
+AWSLambdaHandler.VERSION = "3.0.0"
return AWSLambdaHandler
diff --git a/kong/plugins/liamp/iam-ec2-credentials.lua b/kong/plugins/aws-lambda/iam-ec2-credentials.lua
similarity index 90%
rename from kong/plugins/liamp/iam-ec2-credentials.lua
rename to kong/plugins/aws-lambda/iam-ec2-credentials.lua
index 474837e95d8..3c4c602b98d 100644
--- a/kong/plugins/liamp/iam-ec2-credentials.lua
+++ b/kong/plugins/aws-lambda/iam-ec2-credentials.lua
@@ -4,10 +4,7 @@ local parse_date = require("luatz").parse.rfc_3339
local ngx_now = ngx.now
-local plugin_name = ({...})[1]:match("^kong%.plugins%.([^%.]+)")
-
-
-local LOG_PREFIX = "[" .. plugin_name .. " ec2] "
+local kong = kong
local METADATA_SERVICE_PORT = 80
local METADATA_SERVICE_REQUEST_TIMEOUT = 5000
local METADATA_SERVICE_HOST = "169.254.169.254"
@@ -40,7 +37,7 @@ local function fetch_ec2_credentials()
local iam_role_name = role_name_request_res:read_body()
- ngx.log(ngx.DEBUG, LOG_PREFIX, "Found IAM role on instance with name: ", iam_role_name)
+ kong.log.debug("Found IAM role on instance with name: ", iam_role_name)
local ok, err = client:connect(METADATA_SERVICE_HOST, METADATA_SERVICE_PORT)
@@ -71,7 +68,7 @@ local function fetch_ec2_credentials()
local iam_security_token_data = json.decode(iam_security_token_request:read_body())
- ngx.log(ngx.DEBUG, LOG_PREFIX, "Received temporary IAM credential from metadata service for role '",
+ kong.log.debug("Received temporary IAM credential from metadata service for role '",
iam_role_name, "' with session token: ", iam_security_token_data.Token)
local result = {
@@ -89,7 +86,7 @@ local function fetchCredentialsLogged()
if creds then
return creds, err, ttl
end
- ngx.log(ngx.ERR, LOG_PREFIX, err)
+ kong.log.err(err)
end
return {
diff --git a/kong/plugins/liamp/iam-ecs-credentials.lua b/kong/plugins/aws-lambda/iam-ecs-credentials.lua
similarity index 89%
rename from kong/plugins/liamp/iam-ecs-credentials.lua
rename to kong/plugins/aws-lambda/iam-ecs-credentials.lua
index 9efa67673c2..6d4761da18f 100644
--- a/kong/plugins/liamp/iam-ecs-credentials.lua
+++ b/kong/plugins/aws-lambda/iam-ecs-credentials.lua
@@ -9,9 +9,7 @@ local function makeset(t)
return t
end
-local plugin_name = ({...})[1]:match("^kong%.plugins%.([^%.]+)")
-
-local LOG_PREFIX = "[" .. plugin_name .. " ecs] "
+local kong = kong
local ENV_RELATIVE_URI = os.getenv 'AWS_CONTAINER_CREDENTIALS_RELATIVE_URI'
local ENV_FULL_URI = os.getenv 'AWS_CONTAINER_CREDENTIALS_FULL_URI'
local FULL_URI_UNRESTRICTED_PROTOCOLS = makeset { "https" }
@@ -23,14 +21,14 @@ local DEFAULT_SERVICE_REQUEST_TIMEOUT = 5000
local url = require "socket.url"
local http = require "resty.http"
local json = require "cjson"
-local parse_date = require("luatz").parse.rfc_3339
+local parse_date = require "luatz".parse.rfc_3339
local ngx_now = ngx.now
local ECSFullUri
do
if not (ENV_RELATIVE_URI or ENV_FULL_URI) then
-- No variables found, so we're not running on ECS containers
- ngx.log(ngx.NOTICE, LOG_PREFIX, "No ECS environment variables found for IAM")
+ kong.log.notice("No ECS environment variables found for IAM")
else
-- construct the URL
@@ -66,7 +64,7 @@ do
local err
ECSFullUri, err = getECSFullUri()
if not ECSFullUri then
- ngx.log(ngx.ERR, LOG_PREFIX, "Failed to construct IAM url: ", err)
+ kong.log.err("Failed to construct IAM url: ", err)
else
-- parse it and set a default port if omitted
ECSFullUri = url.parse(ECSFullUri)
@@ -104,7 +102,7 @@ local function fetchCredentials()
local credentials = json.decode(response:read_body())
- ngx.log(ngx.DEBUG, LOG_PREFIX, "Received temporary IAM credential from ECS metadata " ..
+ kong.log.debug("Received temporary IAM credential from ECS metadata " ..
"service with session token: ", credentials.Token)
local result = {
@@ -122,7 +120,7 @@ local function fetchCredentialsLogged()
if creds then
return creds, err, ttl
end
- ngx.log(ngx.ERR, LOG_PREFIX, err)
+ kong.log.err(err)
end
return {
diff --git a/kong/plugins/liamp/schema.lua b/kong/plugins/aws-lambda/schema.lua
similarity index 99%
rename from kong/plugins/liamp/schema.lua
rename to kong/plugins/aws-lambda/schema.lua
index 0c155ac2a72..d42ccfa53b3 100644
--- a/kong/plugins/liamp/schema.lua
+++ b/kong/plugins/aws-lambda/schema.lua
@@ -16,7 +16,7 @@ local REGIONS = {
}
return {
- name = "liamp",
+ name = "aws-lambda",
fields = {
{ run_on = typedefs.run_on_first },
{ protocols = typedefs.protocols_http },
diff --git a/kong/plugins/liamp/v4.lua b/kong/plugins/aws-lambda/v4.lua
similarity index 100%
rename from kong/plugins/liamp/v4.lua
rename to kong/plugins/aws-lambda/v4.lua
diff --git a/spec/plugins/liamp/02-schema_spec.lua b/spec/plugins/aws-lambda/02-schema_spec.lua
similarity index 97%
rename from spec/plugins/liamp/02-schema_spec.lua
rename to spec/plugins/aws-lambda/02-schema_spec.lua
index 312e4c55edf..d636452b984 100644
--- a/spec/plugins/liamp/02-schema_spec.lua
+++ b/spec/plugins/aws-lambda/02-schema_spec.lua
@@ -1,4 +1,4 @@
-local schema_def = require "kong.plugins.liamp.schema"
+local schema_def = require "kong.plugins.aws-lambda.schema"
local v = require("spec.helpers").validate_plugin_config_schema
diff --git a/spec/plugins/liamp/03-iam-ec2-credentials_spec.lua b/spec/plugins/aws-lambda/03-iam-ec2-credentials_spec.lua
similarity index 88%
rename from spec/plugins/liamp/03-iam-ec2-credentials_spec.lua
rename to spec/plugins/aws-lambda/03-iam-ec2-credentials_spec.lua
index 3cb4d0d7432..290c4a4a807 100644
--- a/spec/plugins/liamp/03-iam-ec2-credentials_spec.lua
+++ b/spec/plugins/aws-lambda/03-iam-ec2-credentials_spec.lua
@@ -1,10 +1,11 @@
+require "spec.helpers"
describe("[AWS Lambda] iam-ec2", function()
local fetch_ec2, http_responses
before_each(function()
- package.loaded["kong.plugins.liamp.iam-ec2-credentials"] = nil
+ package.loaded["kong.plugins.aws-lambda.iam-ec2-credentials"] = nil
package.loaded["resty.http"] = nil
local http = require "resty.http"
-- mock the http module
@@ -26,7 +27,7 @@ describe("[AWS Lambda] iam-ec2", function()
end,
}
end
- fetch_ec2 = require("kong.plugins.liamp.iam-ec2-credentials").fetchCredentials
+ fetch_ec2 = require("kong.plugins.aws-lambda.iam-ec2-credentials").fetchCredentials
end)
after_each(function()
diff --git a/spec/plugins/liamp/04-iam-ecs-credentials_spec.lua b/spec/plugins/aws-lambda/04-iam-ecs-credentials_spec.lua
similarity index 90%
rename from spec/plugins/liamp/04-iam-ecs-credentials_spec.lua
rename to spec/plugins/aws-lambda/04-iam-ecs-credentials_spec.lua
index 441125b9f02..c8a1d7e55e1 100644
--- a/spec/plugins/liamp/04-iam-ecs-credentials_spec.lua
+++ b/spec/plugins/aws-lambda/04-iam-ecs-credentials_spec.lua
@@ -1,3 +1,4 @@
+require "spec.helpers"
describe("[AWS Lambda] iam-ecs", function()
@@ -5,7 +6,7 @@ describe("[AWS Lambda] iam-ecs", function()
local old_getenv = os.getenv
before_each(function()
- package.loaded["kong.plugins.liamp.iam-ecs-credentials"] = nil
+ package.loaded["kong.plugins.aws-lambda.iam-ecs-credentials"] = nil
package.loaded["resty.http"] = nil
local http = require "resty.http"
-- mock the http module
@@ -56,7 +57,7 @@ describe("[AWS Lambda] iam-ecs", function()
]]
}
- fetch_ecs = require("kong.plugins.liamp.iam-ecs-credentials").fetchCredentials
+ fetch_ecs = require("kong.plugins.aws-lambda.iam-ecs-credentials").fetchCredentials
local iam_role_credentials, err = fetch_ecs()
diff --git a/spec/plugins/liamp/05-aws-serializer_spec.lua b/spec/plugins/aws-lambda/05-aws-serializer_spec.lua
similarity index 95%
rename from spec/plugins/liamp/05-aws-serializer_spec.lua
rename to spec/plugins/aws-lambda/05-aws-serializer_spec.lua
index c95159a71fd..72d19c94b77 100644
--- a/spec/plugins/liamp/05-aws-serializer_spec.lua
+++ b/spec/plugins/aws-lambda/05-aws-serializer_spec.lua
@@ -1,4 +1,4 @@
-local deepcopy = require("pl.tablex").deepcopy
+local deepcopy = require "pl.tablex".deepcopy
describe("[AWS Lambda] aws-gateway input", function()
@@ -27,13 +27,13 @@ describe("[AWS Lambda] aws-gateway input", function()
-- make sure to reload the module
- package.loaded["kong.plugins.liamp.aws-serializer"] = nil
- aws_serialize = require("kong.plugins.liamp.aws-serializer")
+ package.loaded["kong.plugins.aws-lambda.aws-serializer"] = nil
+ aws_serialize = require "kong.plugins.aws-lambda.aws-serializer"
end)
teardown(function()
-- make sure to drop the mocks
- package.loaded["kong.plugins.liamp.aws-serializer"] = nil
+ package.loaded["kong.plugins.aws-lambda.aws-serializer"] = nil
ngx = old_ngx -- luacheck: ignore
end)
diff --git a/spec/plugins/liamp/99-access_spec.lua b/spec/plugins/aws-lambda/99-access_spec.lua
similarity index 98%
rename from spec/plugins/liamp/99-access_spec.lua
rename to spec/plugins/aws-lambda/99-access_spec.lua
index b6738758f5b..106faa074eb 100644
--- a/spec/plugins/liamp/99-access_spec.lua
+++ b/spec/plugins/aws-lambda/99-access_spec.lua
@@ -89,7 +89,7 @@ for _, strategy in helpers.each_strategy() do
"routes",
"services",
"plugins",
- }, { "liamp" })
+ }, { "aws-lambda" })
local route1 = bp.routes:insert {
hosts = { "lambda.com" },
@@ -182,7 +182,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route1.id },
config = {
port = 10001,
@@ -194,7 +194,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route2.id },
config = {
port = 10001,
@@ -207,7 +207,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route3.id },
config = {
port = 10001,
@@ -220,7 +220,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route4.id },
config = {
port = 10001,
@@ -233,7 +233,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route5.id },
config = {
port = 10001,
@@ -245,7 +245,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route6.id },
config = {
port = 10001,
@@ -258,7 +258,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route7.id },
config = {
port = 10001,
@@ -271,7 +271,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route8.id },
config = {
port = 10001,
@@ -284,7 +284,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route9.id },
config = {
port = 10001,
@@ -300,7 +300,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route10.id },
config = {
port = 10001,
@@ -316,7 +316,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route11.id },
config = {
port = 10001,
@@ -329,7 +329,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route12.id },
config = {
port = 10001,
@@ -342,7 +342,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route13.id },
config = {
port = 10001,
@@ -355,7 +355,7 @@ for _, strategy in helpers.each_strategy() do
}
bp.plugins:insert {
- name = "liamp",
+ name = "aws-lambda",
route = { id = route14.id },
config = {
port = 10001,
@@ -368,7 +368,7 @@ for _, strategy in helpers.each_strategy() do
assert(helpers.start_kong({
database = strategy,
- plugins = "liamp",
+ plugins = "aws-lambda",
nginx_conf = "spec/fixtures/custom_nginx.template",
}, nil, nil, fixtures))
end)