aws / aws-dax-go

AWS DAX SDK for the Go programming language. https://aws.amazon.com/dynamodb/dax
Apache License 2.0
47 stars 48 forks source link

Reusing aws session with a different endpoint. #19

Closed yogesh-anbalagan closed 4 years ago

yogesh-anbalagan commented 4 years ago

With github.com/aws/aws-sdk-go/service/dax you were able to just re-use the existing aws session and override the endpoint as follows,

// Create a DAX client with additional configuration
svc := dax.New(mySession, aws.NewConfig().WithEndpoint("http://localhost:4569"))

But,in aws/aws-dax-go we need to either create a new config or reuse the session completely. There's no way to provide just the session and an additional endpoint.

To be clear, I don't want to initialize the session with an endpoint explicitly as I would like to add the endpoint as an additional configuration while initializing the service clients. Is there a way this can be done?

VasilyFomin commented 4 years ago

Sounds like a reasonable constructor to have, and could probably help with #17 Actually DAX client doesn't take anything from the session object, except for the Config

lyaoxion commented 4 years ago

In order to preserve backward-compatibility, we choose not to add variable arguments to this method.

You can achieve the same thing through using the newly added method in v1.2.0 that creates a DAX Config from a Session. Then modify the endpoint in the Config and create a DAX client with it.