Coder Social home page Coder Social logo

Comments (4)

nickcanz avatar nickcanz commented on May 28, 2024 1

There is a "builder" function for the HTTP request here, I think this would be the most likely place to add that:

vulcanizer/es.go

Lines 389 to 425 in db3bbdb

func (c *Client) getAgent(method, path string) *gorequest.SuperAgent {
agent := gorequest.New().Set("Accept", "application/json").Set("Content-Type", "application/json")
agent.Method = method
var protocol string
if c.Secure {
protocol = "https"
} else {
protocol = "http"
}
if c.Path != "" {
path = fmt.Sprintf("%s/%s", c.Path, path)
}
if c.Port > 0 {
agent.Url = fmt.Sprintf("%s://%s:%v/%s", protocol, c.Host, c.Port, path)
} else {
agent.Url = fmt.Sprintf("%s://%s/%s", protocol, c.Host, path)
}
if c.Auth != nil {
agent.SetBasicAuth(c.Auth.User, c.Auth.Password)
}
if c.TLSConfig != nil {
agent.TLSClientConfig(c.TLSConfig)
}
if c.Timeout != 0 {
agent.Timeout(c.Timeout)
} else {
agent.Timeout(1 * time.Minute)
}
return agent
}

In terms of parsing the URL, instead I think it would make sense to just make it an explicit configuration option, similar to how basic HTTP auth is set, since it looks like you can set up custom domains for AWS Elasticsearch.

Regardless, feel free to open up a PR and we can work through it together 👍

from vulcanizer.

nickcanz avatar nickcanz commented on May 28, 2024

👋 Hi @maxmanders!

PRs would definitely be welcome! Right now the code isn't organized great, but I'd be happy to work with you on a PR to support AWS Elasticsearch Service in a reasonable way. The goal of the project is definitely to try to help with Elasticsearch anywhere it's running 😄

from vulcanizer.

maxmanders avatar maxmanders commented on May 28, 2024

Thanks for getting back to me, that's great to hear! I confess, I'm a novice with Go, but this might be just the sort of thing I need to improve. Conceptually, I think the approach would involve checking the input URL, and if it contains amazonaws.com assume it's AWS Elasticsearch Service. Given that condition, any HTTP requests sent should be sent along with the appropriate signed request header. Apples to oranges, and this isn't the Go way, but in an OOP context I'd see a base HTTP request interface, and two implementations: one for regular ElasticSearch and another for AWS Elasticsearch Service. If you think that sounds like an appropriate approach, I'll make a start at trying to implement something.

from vulcanizer.

maxmanders avatar maxmanders commented on May 28, 2024

On reflection, I'm going to close this. I must have misunderstood the AWS documentation. I'm able to use Vulcanizer to interact with AWS Elasticsearch Service without the need for signed requests.

from vulcanizer.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.