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

HostPrefix issue #57

Open
KamranBiglari opened this issue May 17, 2023 · 3 comments
Open

HostPrefix issue #57

KamranBiglari opened this issue May 17, 2023 · 3 comments

Comments

@KamranBiglari
Copy link

Some endpoints have hostPrefix and it's necessary to include it into host such as SFN:startSyncExecution.

"endpoint": {
        "hostPrefix": "sync-"
}
@KamranBiglari
Copy link
Author

This issue is already exists. There is no way to use functions that has HostPrefix such as startSyncExecution .
The prefix isn't attach to the URL for calling the API.
@Tieske @windmgc @mayocream @StarlightIbuki @saisatishkarra @kylekluever @flrgh

-- In your code
local AWS = require("resty.aws")
local cjson = require "cjson"
local AWS_global_config = require("resty.aws.config").global

local config = { region = AWS_global_config.region }

local aws = AWS(config)

local my_creds = aws:Credentials {
  accessKeyId = "xxxx",
  secretAccessKey = "xxxx",
}

aws.config.credentials = my_creds
-- instantiate a service (optionally overriding the aws-instance config)
local sf = aws:SFN {
  region = "eu-west-2",
}

-- Invoke a method.

local results, err = sf:startSyncExecution  {
    stateMachineArn = "arn:aws:states:eu-west-2:xxxx:stateMachine:optioncut",
    input = "{\"optioncutName\": \"Tokyo\",\"optioncutDate\": \"2023-05-14,2023-05-15,2023-05-16\"}",
}

ngx.say(cjson.encode(results))

The code it trying to call states.eu-west-2.amazonaws.com which is wrong since the StartSync method has hostPrefix which is sync- and it should call sync-states.eu-west-2.amazonaws.com instead

@windmgc
Copy link
Member

windmgc commented Jul 27, 2023

Thanks for the reporting! Let me take a look when I have free time

@KamranBiglari
Copy link
Author

@windmgc I add this feature: #90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants