From 47202789ebe0294ba8ee769a590078a23e0e3bd0 Mon Sep 17 00:00:00 2001 From: Brendan Melville Date: Wed, 4 Nov 2015 15:37:23 -0800 Subject: [PATCH 1/2] Adding information about external templates in design.md --- docs/design/design.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/design/design.md b/docs/design/design.md index 0590aeb51..1f2dcdc34 100644 --- a/docs/design/design.md +++ b/docs/design/design.md @@ -155,7 +155,12 @@ passing configuration to Deployment Manager. ### Instantiating Templates Templates can be instantiated in the same way that a configurable resource is -used, but must be imported and included as part of the configuration. +used. They can be used in two different ways, either passed to the API as an +imported file, or used from a public HTTP endpoint. + +#### Imported Templates +Templates may be imported as part of the target configuration and used +directly, for example: ``` imports: @@ -172,6 +177,30 @@ The _imports_ list is not understood by the Deployment Manager service, but is a directive to client-side tooling to specify what additional files should be included when passing a configuration to the API. +Using the Deployment Manager API, these templates can be included in the +imports section of the _targetConfig_. + +#### External Templates +Templates may also be used from a public HTTP endpoint, for example: + +``` +resources: +- name: example + type: https://raw.githubusercontent.com/example/example.py + properties: + prop1: prop-value +``` + +The service will process external templates as follows: + +1. fetch the external template as an import +1. attempt to fetch the schema for the template, using + _.schema_ as the schema path +1. repeat for any sub-imports found in the schema file + +When fetching schema files and sub-imports, the base path of the external +template is used for relative paths. + ## API Model Deployment Manager exposes a set of RESTful collections over HTTP/JSON. From 77a6d477a6b459a6ec0f2f060420eeda395e428b Mon Sep 17 00:00:00 2001 From: Brendan Melville Date: Wed, 4 Nov 2015 15:37:42 -0800 Subject: [PATCH 2/2] Adding information about imports in schemas to design.md --- docs/design/design.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/design/design.md b/docs/design/design.md index 1f2dcdc34..ed0f99b98 100644 --- a/docs/design/design.md +++ b/docs/design/design.md @@ -127,6 +127,7 @@ more details, including: * info: more information about the template, including long description and title +* imports: any sub-imports used by this template (may be relative path or URL) * required: properties which are required when instantiating the template * properties: JSON Schema descriptions of each property the template accepts @@ -137,6 +138,9 @@ info: title: The Example description: A template being used as an example to illustrate concepts. +imports: +- path: helper.py + required: - prop1