heroku / platform-api

Ruby HTTP client for the Heroku API
MIT License
214 stars 85 forks source link

Provide Automated Certificate Management (ACM) endpoints #69

Closed prem-prakash closed 7 years ago

prem-prakash commented 7 years ago

It would be very nice if we could ask for ACM using this gem. Today the only way I found is to make a custom call

ronin commented 7 years ago

Hey @prem-prakash, can you share your custom call for setting up automated certificate?

ransombriggs commented 7 years ago

@ronin @prem-prakash the API endpoints are now part of the public API and I will work on updating the gem next Tuesday. In the meantime here is the API (the platform API reference in devcenter has not been updated yet)

App Enable ACM

Enable ACM flag for an app

POST /apps/{app_id_or_name}/acm

Curl Example

$ curl -n -X POST https://api.heroku.com/apps/$APP_ID_OR_NAME/acm \
  -H "Content-Type: application/json" \
  -H "Accept: application/vnd.heroku+json; version=3"

Response Example

HTTP/1.1 200 OK
ETag: "0123456789abcdef0123456789abcdef"
Last-Modified: Sun, 01 Jan 2012 12:00:00 GMT
RateLimit-Remaining: 2400
{
  "acm": false,
  "archived_at": "2012-01-01T12:00:00Z",
  "buildpack_provided_description": "Ruby/Rack",
  "build_stack": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "cedar-14"
  },
  "created_at": "2012-01-01T12:00:00Z",
  "git_url": "https://git.heroku.com/example.git",
  "id": "01234567-89ab-cdef-0123-456789abcdef",
  "maintenance": false,
  "name": "example",
  "owner": {
    "email": "username@example.com",
    "id": "01234567-89ab-cdef-0123-456789abcdef"
  },
  "organization": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "example"
  },
  "team": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "example"
  },
  "region": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "us"
  },
  "released_at": "2012-01-01T12:00:00Z",
  "repo_size": 0,
  "slug_size": 0,
  "space": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "nasa",
    "shield": true
  },
  "stack": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "cedar-14"
  },
  "updated_at": "2012-01-01T12:00:00Z",
  "web_url": "https://example.herokuapp.com/"
}

App Disable ACM

Disable ACM flag for an app

DELETE /apps/{app_id_or_name}/acm

Curl Example

$ curl -n -X DELETE https://api.heroku.com/apps/$APP_ID_OR_NAME/acm \
  -H "Content-Type: application/json" \
  -H "Accept: application/vnd.heroku+json; version=3"

Response Example

HTTP/1.1 200 OK
ETag: "0123456789abcdef0123456789abcdef"
Last-Modified: Sun, 01 Jan 2012 12:00:00 GMT
RateLimit-Remaining: 2400
{
  "acm": false,
  "archived_at": "2012-01-01T12:00:00Z",
  "buildpack_provided_description": "Ruby/Rack",
  "build_stack": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "cedar-14"
  },
  "created_at": "2012-01-01T12:00:00Z",
  "git_url": "https://git.heroku.com/example.git",
  "id": "01234567-89ab-cdef-0123-456789abcdef",
  "maintenance": false,
  "name": "example",
  "owner": {
    "email": "username@example.com",
    "id": "01234567-89ab-cdef-0123-456789abcdef"
  },
  "organization": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "example"
  },
  "team": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "example"
  },
  "region": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "us"
  },
  "released_at": "2012-01-01T12:00:00Z",
  "repo_size": 0,
  "slug_size": 0,
  "space": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "nasa",
    "shield": true
  },
  "stack": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "cedar-14"
  },
  "updated_at": "2012-01-01T12:00:00Z",
  "web_url": "https://example.herokuapp.com/"
}

App Refresh ACM

Refresh ACM for an app

PATCH /apps/{app_id_or_name}/acm

Curl Example

$ curl -n -X PATCH https://api.heroku.com/apps/$APP_ID_OR_NAME/acm \
  -H "Content-Type: application/json" \
  -H "Accept: application/vnd.heroku+json; version=3"

Response Example

HTTP/1.1 200 OK
ETag: "0123456789abcdef0123456789abcdef"
Last-Modified: Sun, 01 Jan 2012 12:00:00 GMT
RateLimit-Remaining: 2400
{
  "acm": false,
  "archived_at": "2012-01-01T12:00:00Z",
  "buildpack_provided_description": "Ruby/Rack",
  "build_stack": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "cedar-14"
  },
  "created_at": "2012-01-01T12:00:00Z",
  "git_url": "https://git.heroku.com/example.git",
  "id": "01234567-89ab-cdef-0123-456789abcdef",
  "maintenance": false,
  "name": "example",
  "owner": {
    "email": "username@example.com",
    "id": "01234567-89ab-cdef-0123-456789abcdef"
  },
  "organization": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "example"
  },
  "team": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "example"
  },
  "region": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "us"
  },
  "released_at": "2012-01-01T12:00:00Z",
  "repo_size": 0,
  "slug_size": 0,
  "space": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "nasa",
    "shield": true
  },
  "stack": {
    "id": "01234567-89ab-cdef-0123-456789abcdef",
    "name": "cedar-14"
  },
  "updated_at": "2012-01-01T12:00:00Z",
  "web_url": "https://example.herokuapp.com/"
}
olivierbuffon commented 7 years ago

@ransombriggs Any update on the availability of ACM through the gem? 21 days ago you're talking about "next Tuesday" but I can't find anything regarding this feature. Am I missing something or the release has been postponed? Thanks.

ransombriggs commented 7 years ago

@olivierbuffon sorry for dropping the ball, but I was preempted by other work. I went ahead and shipped a new release 2.1.0 which includes enable_acm / disable_acm / refresh_acm, see https://github.com/heroku/platform-api/pull/75

mikehale commented 7 years ago

👏