Add apply_endpoint_url_override helper parsing canonical AWS_ENDPOINT_URL env#9
Add apply_endpoint_url_override helper parsing canonical AWS_ENDPOINT_URL env#9vulkoingim wants to merge 2 commits into
apply_endpoint_url_override helper parsing canonical AWS_ENDPOINT_URL env#9Conversation
…v vars Matching Go SDKs ResolveServiceBaseEndpoint implementation https://github.com/aws/aws-sdk-go-v2/blob/790446eef174929d0796cbd608c43cdea0bba443/internal/configsources/endpoints.go#L41-L57
There was a problem hiding this comment.
What problem are you trying to solve here that cannot be solved with make_local_client?
The reason for approving is mostly since I'm having to do something quite similar to this for: aws-beam/aws-erlang#175 so this kinda comes at "the right time" 😄
I'm fine accepting this anyway due to this but it feels like you're simply using the wrong function here 😓
We have many small services that make use of Glad to hear that it is going to be useful for your other work 😄 |
Thanks for the explanation and its a reasonable thought process! 👍😄 Will deal with the merge dance tonight (CEST time) 👍 |
Adds helper to parse
AWS_ENDPOINT_URL_<SERVICE>/AWS_ENDPOINT_URLenv vars matching Go SDKs ResolveServiceBaseEndpoint implementation.aws-codegen PR
As a disclosure I have used a LLM to generate the code, but I have tested and verified that the generated erlang lib compiles and works against:
AWS_ENDPOINT_URL_DYNAMODBAWS_ENDPOINT_URL_S3Generates
do_requestin the form:do_request(Client, Action, Input0, Options) -> Client1 = Client#{service => <<"dynamodb">>}, - Host = build_host(<<"dynamodb">>, Client1), - URL = build_url(Host, Client1), + DefaultHost = build_host(<<"dynamodb">>, Client1), + {URL, Host} = aws_util:apply_endpoint_url_override( + build_url(DefaultHost, Client1), DefaultHost, <<"/">>, + <<"AWS_ENDPOINT_URL_DYNAMODB">>), Headers = [ {<<"Host">>, Host}, {<<"Content-Type">>, <<"application/x-amz-json-1.0">>},Tested after generating the code, and patching the
aws_utilin aws-erlang.