Skip to content

Instantly share code, notes, and snippets.

@csquared
Created November 29, 2011 02:20
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save csquared/079c98529d399bb08c7a to your computer and use it in GitHub Desktop.
Save csquared/079c98529d399bb08c7a to your computer and use it in GitHub Desktop.
Provisioning V2

** this document is intended to be a proposal for the final interface between the Add-ons Engine and a Platform. We can make these changes while maintaining the same interface to our providers and intend to do so. This will allow us to change provisioning without providers ever knowing and allow us to treat changing that API as another project. **

#Platform API

Provisioning

this is the API the Heroku Platform will use to provision an add-on instance.

POST /resources from a Platform (ie, Heroku)

{           
   "addon"        : "memcache",
   "plan"         : "1GB",
   "consumer_id"  : "app123@heroku.com",
   "options" : {
      "backups" : "false",   
      "logplex_token" : null,
      "callback_url"  : "https://foo.heroku.com/vendor/apps/app123@heroku.com",
   } 
} 

201 Response to Heroku

{ 
  "resource_id" : "ALKFSDHFO-AKSFJH-ASFDLGKAJHS",
  "config"      : {"MYADDON_URL": "http://foo.com"},
  "message"     : "OMG i Love add-ons",
  "provider_id" : "ASFD"       
}
  • Resource ID is the UUID that the Add-Ons Engine has assigned to the resource. The provider id is the id that the provider assigned to the resource during provisioning which, although we (add ons and core) want to deprecate, needs to be provided for backwards compatibility in the /vendor/apps interface. *

Response Codes 201 - Resource Created 503 - unavailable - could not deprovision with provider

Deprovisioning

DELETE /resources/<resource_id> No body

Response Codes 202 - accepted deprovision request 503 - unavailable - could not deprovision with provider 404 - resource not found

Plan Change

PUT /resources/<resource_id>

{ "plan": "5GB" } 

200 Response

{ 
  "config": { "MEMCACHE_URL": "http://addon.com/106410987" },
  "message" : "Nice job!" 
}

Response Codes:

200 - OK! Plan changed 503 - unavailable - could not change plan with provider 404 - resource not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment