Jump to: navigation, search

Heat/Blueprints/lifecycle-callbacks

< Heat
Revision as of 19:10, 23 April 2014 by Randall Burt (talk | contribs) (Created page with "For this feature, Heat would provide a mechanism by which template authors can specify web hooks that would be called during various stages of a stack and/or resource's lifecy...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

For this feature, Heat would provide a mechanism by which template authors can specify web hooks that would be called during various stages of a stack and/or resource's lifecycle. The user would be required to specify one or more hooks per lifecycle as well as optionally associated headers and body. Heat would parse nothing nor read responses from these calls, only react based on response code. A first pass at HOT syntax for this could be:

heat_template_version: 2013-05-23

description: |
  My first Heat template

parameters:

  foo_param:
    type: String

resources:

  my_server:
    type: OS::Nova::Server
    lifecycle_callbacks:
    - url
      create:
         # this isn't prescriptive, all, urls, headers, and bodies are user-defined 
         pre: # fires right before the resource is to be created
         - url: https://example.com/create_hook/pre
           headers:
             X-Foo: { get_param: foo_param }
             X-Stack-Name: { get_param: OS::stack_name }
             X-Stack-Id: { get_param: OS::stack_id }
           fail_on_error: false # Fail the stack operation if the hook returns an HTTP error code; default would be true
         success: # fires when the resource create succeeds
         - url: https://example.com/create_hook/success
           headers:
             X-Foo: { get_param: foo_param }
             X-User-Header: create_success
           body: |
              stack: { get_param: OS::stack_name }
              resource: my_server
         post:
         - 
    properties:
      name: my-server
      image: Ubuntu 14.04 LTS (Trusty Tahr)
      flavor: 2 GB Performance
            
outputs:

  "Server ID":
    value: { get_resource: my_server }
    description: The server id