Lifecycle of an object

Lifecycle delegate methods

Classes define delegate methods in template.yml file. When creating a new instance of a class these delegate methods are called:

  1. getInstanceId
  2. authorizer
  3. init
  4. destroy



(OPTIONAL) if defined, getInstanceId is called first. It should return a string which will be the id of the new instance. If not defined a random string is generated.


(OPTIONAL) It should return a status code. If 200 a new instance can be created. Authorizer can be cached if correct headers are returned. At the cache period it is not called again.

When creating a new instance, authorizer is called with data.context.methodName = 'INIT'. When getting an instance, authorizer is called with data.context.methodName = 'GET'.


It should initialize and make some configurations for the new instance. This method is called only once for the same instanceId. If you return same ID from getInstanceId then this method is not called the second time. Click for more details.


Upon deletion of an instance "destroy" delegate method is called. You can do final cleanup here. This method can prevent instance deletion by returning a status code other than 200. Click for more details.