Blueprint Support

Support for Blueprints is provided via the following collection:

/api/blueprints

Querying Blueprints

Fetching all blueprints as follows:

GET /api/blueprints?expand=resources
{
  "name": "blueprints",
  "count": 1,
  "subcount": 1,
  "resources": [
    {
      "href": "http://localhost:3000/api/blueprints/10000000000003",
      "id": 10000000000003,
      "name": "RHEL7 and Postgres",
      "ui_properties": {
        "num_items": 2,
        "visibility": {
          "id": 800,
          "name": "Private"
        },
        "service_dialog": {
          "id": 10000000000007
        },
        "chart_data_model": {
          "nodes": [
            {
              "x": 96,
              "y": 63,
              "id": 10000000000018,
              "name": "RHEL7 on Amazon AWS",
              "tags": [
                {
                  "id": 10000000000171,
                  "category": {
                    "id": 10000000000136
                  },
                  "categorization": {
                    "displayName": "Service Catalog: clouddemo"
                  }
                }
              ],
              "image": "http://localhost:8001/pictures/10r14.png",
              "width": 150,
              "invalid": false,
              "backgroundColor": "#fff",
              "outputConnectors": []
            },
            {
              "x": 369,
              "y": 134,
              "id": 10000000000004,
              "icon": "pf pficon-bundle",
              "name": "Deploy RHEL7 with PostgreSQL",
              "tags": [],
              "image": "http://localhost:8001/pictures/10r4.jpg",
              "width": 150,
              "bundle": true,
              "invalid": false,
              "fontFamily": "PatternFlyIcons-webfont",
              "fontContent": "",
              "backgroundColor": "#fff"
            }
          ]
        },
        "automate_entrypoints": {
          "Provision": "ManageIQ/VM/Provisioning/StateMachines/Methods/Provision",
          "Retirement": "ManageIQ/VM/Retirement/StateMachines/Methods/StartRetirement",
          "Reconfigure": "ManageIQ/VM/Provisioning/StateMachines/Methods/CustomizeRequest"
        }
      },
      "created_at": "2016-11-04T11:26:37Z",
      "updated_at": "2016-11-04T11:49:54Z",
      "content": {},
      "actions": [
        {
          "name": "edit",
          "method": "post",
          "href": "http://localhost:3000/api/blueprints/10000000000003"
        },
        {
          "name": "delete",
          "method": "post",
          "href": "http://localhost:3000/api/blueprints/10000000000003"
        },
        {
          "name": "publish",
          "method": "post",
          "href": "http://localhost:3000/api/blueprints/10000000000003"
        },
        {
          "name": "delete",
          "method": "delete",
          "href": "http://localhost:3000/api/blueprints/10000000000003"
        }
      ]
    },
  ],
  "actions": [
    {
      "name": "query",
      "method": "post",
      "href": "http://localhost:3000/api/blueprints"
    },
    {
      "name": "create",
      "method": "post",
      "href": "http://localhost:3000/api/blueprints"
    },
    {
      "name": "edit",
      "method": "post",
      "href": "http://localhost:3000/api/blueprints"
    },
    {
      "name": "delete",
      "method": "post",
      "href": "http://localhost:3000/api/blueprints"
    },
    {
      "name": "publish",
      "method": "post",
      "href": "http://localhost:3000/api/blueprints"
    }
  ]
}

Creating Blueprints

Creating a new blueprint can be done via the create action signature or simply a POST of the new blueprint as follows:

POST /api/blueprints
{
  "action" : "create",
  "resource" : {
    "name" : "test_blueprint",
    "description" : "Test Blueprint",
    "ui_properties" : {
      "service_catalog"      : {},
      "service_dialog"       : {},
      "automate_entrypoints" : {},
      "chart_data_model"     : {}
    }
  }
}

Response:

{
  "results": [
    {
      "id": 1,
      "name": "test_blueprint",
      "description": "Test Blueprint",
      "ui_properties": {
        "service_dialog": {
        },
        "service_catalog": {
        },
        "chart_data_model": {
        },
        "automate_entrypoints": {
        }
      },
      "created_at": "2016-11-03T20:18:06Z",
      "updated_at": "2016-11-03T20:18:06Z"
    }
  ]
}

Please refer to the Resource Attributes page for a list of available attributes when creating Blueprints.

Editing a Blueprint

Blueprints can be updated using the edit action as follows:

POST /api/blueprints/:id
{
  "action" : "edit",
  "resource" : {
    "name" : "updated test_blueprint",
    "description" : "Updated Test Blueprint"
  }
}

Response:

{
  "href": "http://localhost:3000/api/blueprints/1",
  "id": 1,
  "name": "updated test_blueprint",
  "description": "Updated Test Blueprint",
  "ui_properties": {
    "service_dialog": {
    },
    "service_catalog": {
    },
    "chart_data_model": {
    },
    "automate_entrypoints": {
    }
  },
  "created_at": "2016-11-03T20:18:06Z",
  "updated_at": "2016-11-03T20:30:01Z"
}

Publishing Blueprints

Blueprints can be published using the publish action as follows:

POST /api/blueprints/:id
{
  "action" : "publish"
}

Response:

{
  "href": "http://localhost:3000/api/blueprints/1",
  "id": 1,
  "status": "published",
  "description": "Updated Test Blueprint",
  "created_at": "2016-08-02T15:44:03Z",
  "updated_at": "2016-11-03T20:34:56Z"
}

Deleting Blueprints

Deleting blueprints is available via the delete action or DELETE on the individual blueprint as follows:

POST /api/blueprints/:id
{
  "action" : "delete"
}

Or simply:

DELETE /api/blueprints/:id

Also, deleting multiple blueprints is available via the delete action on the collection passing in references to the different blueprints:

POST /api/blueprints
{
  "action" : "delete",
  "resources" : [
    { "href" : "http://localhost:3000/api/blueprints/1001" },
    { "href" : "http://localhost:3000/api/blueprints/1002" },
    ...
  ]
}