Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add hostPrefix #90

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/resty/aws/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -298,6 +297,14 @@ 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 = ""
if operation.endpoint then
hostPrefix = operation.endpoint.hostPrefix
service.config.endpoint = hostPrefix .. service.config.endpoint
end

local operation_prefix = ("%s:%s()"):format(
service.api.metadata.serviceId:gsub(" ",""),
method_name)
Expand Down