heroku / platform-api

Ruby HTTP client for the Heroku API
MIT License
213 stars 86 forks source link

Access to sni-endpoints API #49

Closed maxehmookau closed 7 years ago

maxehmookau commented 8 years ago

The new sni-endpoints API appears to be available (albeit in beta) and is being used by the production dashboard at heroku.com.

Is there a general policy against including beta endpoints in the ruby gem? If not, I'll happily put together a PR to add this functionality.

jalada commented 8 years ago

I've forked the code and re-ran the build against the beta schema: https://github.com/jalada/platform-api

geemus commented 8 years ago

Historically we have left out non-GA stuff from the gem (as it isn't in the core schema yet). I wouldn't go so far to say that this was a policy, so much as coincidence of tooling. I don't think we could really automate this reasonably, since some variants actually change behavior of existing endpoints it would be weird trying to merge them. That said, this may be reflective of it just being about time for us to bring this out of variant and into the main schema. Does that help/make sense?

maxehmookau commented 8 years ago

@geemus Seems fair. Yep, it makes sense. I'm also an idiot because I didn't realise you could pass custom headers using this gem.

Thanks!

geemus commented 8 years ago

@maxehmookau hey, there are many parts of this gem that are (unfortunately) less than obvious right now. Definitely appreciate your understanding and definitely let us know (or PR) if there are some good fixes to docs or other things to improve the clarity. Thanks!

chriso0710 commented 8 years ago

If I understand correctly: As long as the new features "http-sni" and "sni-endpoints" are in beta, they won't be implemented in the api?

So to use the new features I would do something like letsencrypt-heroku does kind of "manually" with httparty: https://github.com/substrakt/letsencrypt-heroku/blob/master/lib/certificate_generation.rb#L78

Thanks!

maxehmookau commented 8 years ago

@chriso0710, letsencrypt-heroku uses HTTParty although it probably shouldn't since you can set those manual headers using this gem anyway.

https://github.com/heroku/platform-api#passing-custom-headers

jalada commented 8 years ago

@maxehmookau yes, but that's not enough to access endpoints that aren't in the schema generated when packaging up this gem, because the method isn't defined, right?

maxehmookau commented 8 years ago

Ah yeah, you are right.

Then letsencrypt-heroku will have to remain using HTTParty for now then.

chriso0710 commented 8 years ago

Thanks, guys!

IMHO the new SNI/SSL feature is really huge and could be worth implementing it as beta into the api. For now I will use the same method which letsenrypt-heroku uses. If the new features will become GA and supported by the platform-api, then I will (and should) probably switch.

geemus commented 8 years ago

For now, yes, you need in some capacity to explicitly set the headers. The method described should work, as would other http-libraries used directly (I'm partial to excon/excon), but unfortunately it lacks some of the convenience and syntactic sugar provided by platform-api.

jalada commented 8 years ago

Now that SNI-based SSL is out of beta will this be supported?

dmathieu commented 8 years ago

Yes. You can find it here: https://devcenter.heroku.com/articles/platform-api-reference#sni-endpoint

timurvafin commented 7 years ago

What is the status of implementation of sni endpoints in this gem?

ukasiu commented 7 years ago

+1

chriso0710 commented 7 years ago

Take a look at https://github.com/jalada/platform-api which has updated the schema, regenerated the API and seems to support the new SNI features.

This issue should be reopened IMHO. @geemus What about pulling in the changes from @jalada's repo?

geemus commented 7 years ago

@chriso0710 good call. There are a couple open pull requests relating to regenerating schema and releasing also. Lots of stuff going on, but hoping to get to it pretty soon.

jalada commented 7 years ago

I would really like to stop telling people to use my fork, as it looks like it might be causing further issues as it falls behind now 😞 https://github.com/pixielabs/letsencrypt-rails-heroku/issues/35

geemus commented 7 years ago

@mathias perhaps you can speak to where we are in this process?

alexssung commented 7 years ago

Is this going to be fixed?

And why is this ticket closed? This is still an open issue.

geemus commented 7 years ago

It will be fixed, though I'm not sure of exact timing.

I'm not actually certain why it was closed (that was some time ago), I've re-opened.

david-a-wheeler commented 7 years ago

This appears to be related to pull request 56. Any timeline? Soon? We can't use the new Heroku support for Let's Encrypt, because we use a CDN - so this functionality is important to us.

mathias commented 7 years ago

Hello,

These methods should be present in the 1.0.1 release of this gem.

# in pry:
require 'platform-api'
#=> true
client = PlatformAPI.connect_oauth(ENV['TOKEN'])
#=> #<PlatformAPI::Client:... @client=#<Heroics::Client url="https://api.heroku.com">>
ls -m client.sni_endpoint
#=> PlatformAPI::SniEndpoint#methods: create  delete  info  list  update
client.sni_endpoint.list('young-garden-2012')
#=> []

Hope this helps!

I'm going to close this for now. Feel free to comment+re-open if something is amiss.