heroku / platform-api

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

How to specify an addon's version? #80

Closed andhapp closed 7 years ago

andhapp commented 7 years ago

Hey,

I am using the API to create add-ons and that works fine. However, I'd like to specify a version for the addon to be installed on my account. For example: Heroku PostgreSql, I'd like to install postgres 9.4.9 as opposed to the latest.

How can I achieve that in the API?

I couldn't see any examples or anything in the code related to this. May be it's not possible but would like to know before I start exploring other options.

Thanks.

geemus commented 7 years ago

Hey, for add-ons, we pass the body's config blob on to the partner, which is how in this case version is passed. So I believe you would want an invocation like:

heroku.addon.create('heroku-postgresql:standard-0', { config: { version: "9.4.9" } })

Hope that clarifies for you, it probably should be better and more clearly documented.

andhapp commented 7 years ago

Thanks. I've been using the following command to create addons:

heroku.addon.create(APP_NAME, { plan: 'heroku-postgresql:standard-0' })

Is that right? Looks different from what you've suggested.

geemus commented 7 years ago

Oops, just my faulty memory, let me try again:

heroku.addon.create(APP_NAME, {
  config: { version: "9.4.9" },
  plan: 'heroku-postgresql:standard-0'
})

I think that should be accurate, sorry for the confusion.

andhapp commented 7 years ago

No worries. Thanks. That works!

Can I raise a PR to update README with an example of the same?

geemus commented 7 years ago

Yeah, a PR to add that to the README sounds great, thanks!