Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

Assumes domain has public access? #23

Open
rmpugh opened this issue Jan 15, 2016 · 2 comments
Open

Assumes domain has public access? #23

rmpugh opened this issue Jan 15, 2016 · 2 comments

Comments

@rmpugh
Copy link

rmpugh commented Jan 15, 2016

If I add a policy to a domain which restricts access (to an IAM user or AWS account), adding/updating/searching all fail with:

"User: anonymous is not authorized to perform: cloudsearch:search on resource: arn:aws:cloudsearch:my-domain"

I believe this is because the gem is going through HTTP and not passing through any credentials. For example, in cloud_search.rb:

 def self.post_sdf_list endpoint, sdf_list
    uri = URI.parse("http://#{endpoint}/#{API_VERSION}/documents/batch")

    req = Net::HTTP::Post.new(uri.path)
    req.body = JSON.generate sdf_list
    req["Content-Type"] = "application/json"

    response = Net::HTTP.start(uri.host, uri.port){|http| http.request(req)}

    if response.is_a? Net::HTTPSuccess
      JSON.parse response.body
    else
      # Raise an exception based on the response see http://ruby-doc.org/stdlib-1.9.2/libdoc/net/http/rdoc/Net/HTTP.html
      response.error!
    end

  end

or is this expected behavior (the gem only supports public domains)?

Thanks,
Rob

@philipmw
Copy link
Contributor

Yeah you're right, that's a problem.

@piyushchauhan2011
Copy link

Is this library abandoned ?

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

No branches or pull requests

3 participants