diff --git a/src/resty/aws/init.lua b/src/resty/aws/init.lua index 8422a52..95e80e8 100644 --- a/src/resty/aws/init.lua +++ b/src/resty/aws/init.lua @@ -9,7 +9,6 @@ local split = require("pl.utils").split local tablex = require("pl.tablex") - -- case-insensitive lookup help. -- always throws an error! local lookup_helper = function(self, key) -- signature to match __index meta-method @@ -298,6 +297,11 @@ local function generate_service_methods(service) -- decapitalize first character of method names to mimic JS sdk local method_name = operation.name:sub(1,1):lower() .. operation.name:sub(2,-1) + -- add hostPrefix for the methods that needs hostPrefix + -- issue: https://github.com/Kong/lua-resty-aws/issues/57 + local hostPrefix = operation.endpoint and operation.endpoint.hostPrefix or "" + service.config.endpoint = hostPrefix .. service.config.endpoint + local operation_prefix = ("%s:%s()"):format( service.api.metadata.serviceId:gsub(" ",""), method_name)