aws-beam / aws-codegen

Code generator for AWS clients in Erlang and Elixir.
Other
53 stars 49 forks source link

Add ability to skip endpoint url prefix #49

Open tfwright opened 4 years ago

tfwright commented 4 years ago

In the URL building logic for (I presume) all services, a prefix is currently being prepended to the endpoint host. I am using Digital Ocean and their Spaces API aims for AWS S3 parity, so I was hoping to use this lib to interface with it. However, their service does not use a prefix like s3 for obvious reasons. Since that is currently being hard coded into the url, I was getting a very cryptic error. I was able to work around the issue by adding an option to the client that instructs the service to skip the prefix in the host: https://github.com/tfwright/aws-elixir/commit/72b45d24a82d8b2a8d587f03b3bb22ec638bfdbe

If this is something you'd be open to adding, I can open a PR on this repo. There may be other solutions, like just requiring the user to specify the full url as the endpoint rather than composing it out of options, which might be a simpler and more flexible route to go.

jfacorro commented 4 years ago

The url is being built automatically since this the approach other AWS clients take, it reduces the amount of work for the users of the library. I think an option to explicitly set the endpoint will be welcome by other users as long as it also supports the implicit case.