Create the HOT reference book

The content of this book is mostly autogenerated from the heat source
code using the generate-reference.sh script and
openstack-doc-tools>=0.18.

Implements: blueprint heat-templates
Change-Id: Ia00ec6debdab3fe6038683aad01b025a9ff6702b
This commit is contained in:
Gauvain Pocentek 2014-08-07 20:50:12 +02:00
parent b878ba9ef1
commit 5de719a92a
10 changed files with 13607 additions and 0 deletions

View File

@ -0,0 +1,32 @@
HOT Reference
=============
This documentation is mostly generated from the heat source code, and files in
the ``generated/`` directory should not be edited manually. To make changes to
these files, modify the heat docstrings, then regenerate the files (see the
next section).
How to generate the content
===========================
* Clone the heat source code:
::
git clone git://git.openstack.org/openstack/heat
* Run the ``tools/generate-reference.sh`` script:
::
pip install 'openstack-doc-tools>=0.18'
tools/generate-reference.sh path/to/heat/clone
* Check the build:
::
mvn clean generate-sources
# or
tox

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="5.0"
xml:id="openstack-hot-reference">
<title>Heat Orchestration Template reference</title>
<?rax title.font.size="28px" subtitle.font.size="28px"?>
<titleabbrev>Heat Orchestration Template reference</titleabbrev>
<info>
<author>
<personname>
<firstname/>
<surname/>
</personname>
<affiliation>
<orgname>OpenStack Foundation</orgname>
</affiliation>
</author>
<copyright>
<year>2014</year>
<holder>OpenStack Foundation</holder>
</copyright>
<releaseinfo>current</releaseinfo>
<productname>OpenStack</productname>
<pubdate/>
<legalnotice role="cc-by">
<annotation>
<remark>Remaining licensing details are filled in by
the template.</remark>
</annotation>
</legalnotice>
<abstract>
<para>This guide documents the Heat Orchestration Template syntax.</para>
</abstract>
<revhistory>
<!-- ... continue adding more revisions here as you
change this document using the markup shown
below... -->
<revision>
<date>2014-08-03</date>
<revdescription>
<itemizedlist>
<listitem>
<para>Initial release.</para>
</listitem>
</itemizedlist>
</revdescription>
</revision>
</revhistory>
</info>
<xi:include href="ch_overview.xml"/>
<xi:include href="generated/openstack.xml"/>
<xi:include href="generated/cfn.xml"/>
<xi:include href="generated/functions.xml"/>
<xi:include href="../common/app_support.xml"/>
</book>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<preface xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="5.0"
xml:id="reference_overview">
<title>HOT reference overview</title>
<para>Heat Orchestration Template (HOT) is a new template format meant to
replace the Heat CloudFormation-compatible format (CFN) as the native
format supported by the Orchestration module over time.</para>
<para>This reference documents the syntax of:</para>
<itemizedlist>
<listitem>
<para>OpenStack native resources</para>
</listitem>
<listitem>
<para>CloudFormation-compatible resources</para>
</listitem>
<listitem>
<para>CloudFormation-compatible functions</para>
</listitem>
</itemizedlist>
<xi:include href="../common/section_conventions.xml"/>
</preface>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,370 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.-->
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="functions_cloudformation-compatible-functions">
<!--WARNING: This file is automatically generated. Do not edit it.-->
<title>CloudFormation Compatible Functions</title>
<para>There are a number of functions that you can use to help you write
CloudFormation compatible templates.</para>
<para>All of these functions (except <emphasis>Ref</emphasis>) start with <emphasis>Fn::</emphasis>.</para>
<section xml:id="functions_ref">
<?dbhtml stop-chunking?>
<title>Ref</title>
<para>Returns the value of the named parameter or resource.</para>
<section xml:id="functions_parameters">
<title>Parameters</title>
<variablelist role="definition_list">
<varlistentry>
<term role="String">name</term>
<listitem>
<para>The name of the resource or parameter.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="functions_usage">
<title>Usage</title>
<programlisting>{Ref: my_server}</programlisting>
<para>Returns the nova instance ID. For example, <literal>d8093de0-850f-4513-b202-7979de6c0d55</literal>.</para>
</section>
</section>
<section xml:id="functions_fn-base64">
<?dbhtml stop-chunking?>
<title>Fn::Base64</title>
<para>This returns the Base64 representation of the input string.</para>
<section xml:id="functions_id1">
<title>Parameters</title>
<variablelist role="definition_list">
<varlistentry>
<term role="String">value</term>
<listitem>
<para>The string to convert.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="functions_id2">
<title>Usage</title>
<programlisting>{Base64: "convert this string please."}</programlisting>
<para>Returns the Base64 of the input string.</para>
</section>
</section>
<section xml:id="functions_fn-findinmap">
<?dbhtml stop-chunking?>
<title>Fn::FindInMap</title>
<para>Returns the value corresponding to keys into a two-level map declared in the
Mappings section.</para>
<section xml:id="functions_id3">
<title>Parameters</title>
<variablelist role="definition_list">
<varlistentry>
<term role="String">map_name</term>
<listitem>
<para>The logical name of a mapping declared in the Mappings section that
contains the keys and values.</para>
</listitem>
</varlistentry>
<varlistentry>
<term role="String">top_level_key</term>
<listitem>
<para>The top-level key name. It's value is a list of key-value pairs.</para>
</listitem>
</varlistentry>
<varlistentry>
<term role="String">second_level_key</term>
<listitem>
<para>The second-level key name, which is set to one of the keys from the list
assigned to top_level_key.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="functions_id4">
<title>Usage</title>
<programlisting>Mapping:
MyContacts:
jone: {phone: 337, email: a@b.com}
jim: {phone: 908, email: g@b.com}
{"Fn::FindInMap": ["MyContacts", "jim", "phone" ] }</programlisting>
<para>Returns <literal>908</literal>.</para>
</section>
</section>
<section xml:id="functions_fn-getatt">
<?dbhtml stop-chunking?>
<title>Fn::GetAtt</title>
<para>Returns an attribute of a resource within the template.</para>
<section xml:id="functions_id5">
<title>Parameters</title>
<variablelist role="definition_list">
<varlistentry>
<term role="String">resource</term>
<listitem>
<para>The name of the resource.</para>
</listitem>
</varlistentry>
<varlistentry>
<term role="String">attribute</term>
<listitem>
<para>The name of the attribute.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="functions_id6">
<title>Usage</title>
<programlisting>{Fn::GetAtt: [my_server, PublicIp]}</programlisting>
<para>Returns an IP address such as <literal>10.0.0.2</literal>.</para>
</section>
</section>
<section xml:id="functions_fn-getazs">
<?dbhtml stop-chunking?>
<title>Fn::GetAZs</title>
<para>Returns the Availability Zones within the given region.</para>
<para>
<emphasis>Note: AZ's and regions are not fully implemented in Heat.</emphasis>
</para>
<section xml:id="functions_id7">
<title>Parameters</title>
<variablelist role="definition_list">
<varlistentry>
<term role="String">region</term>
<listitem>
<para>The name of the region.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="functions_id8">
<title>Usage</title>
<programlisting>{Fn::GetAZs: ""}</programlisting>
<para>Returns the list provided by <literal>nova availability-zone-list</literal>.</para>
</section>
</section>
<section xml:id="functions_fn-join">
<?dbhtml stop-chunking?>
<title>Fn::Join</title>
<para>Like python join, it joins a list of strings with the given delimiter.</para>
<section xml:id="functions_id9">
<title>Parameters</title>
<variablelist role="definition_list">
<varlistentry>
<term role="String">delimiter</term>
<listitem>
<para>The string to join the list with.</para>
</listitem>
</varlistentry>
<varlistentry>
<term role="list">list</term>
<listitem>
<para>The list to join.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="functions_id10">
<title>Usage</title>
<programlisting>{Fn::Join: [",", ["beer", "wine", "more beer"]]}</programlisting>
<para>Returns <literal>beer, wine, more beer</literal>.</para>
</section>
</section>
<section xml:id="functions_fn-select">
<?dbhtml stop-chunking?>
<title>Fn::Select</title>
<para>Select an item from a list.</para>
<para>
<emphasis>Heat extension: Select an item from a map</emphasis>
</para>
<section xml:id="functions_id11">
<title>Parameters</title>
<variablelist role="definition_list">
<varlistentry>
<term role="string or integer">selector</term>
<listitem>
<para>The number of item in the list or the name of the item in the map.</para>
</listitem>
</varlistentry>
<varlistentry>
<term role="map or list">collection</term>
<listitem>
<para>The collection to select the item from.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="functions_id12">
<title>Usage</title>
<para>For a list lookup:</para>
<programlisting>{ "Fn::Select" : [ "2", [ "apples", "grapes", "mangoes" ] ] }</programlisting>
<para>Returns <literal>mangoes</literal>.</para>
<para>For a map lookup:</para>
<programlisting>{ "Fn::Select" : [ "red", {"red": "a", "flu": "b"} ] }</programlisting>
<para>Returns <literal>a</literal>.</para>
</section>
</section>
<section xml:id="functions_fn-split">
<?dbhtml stop-chunking?>
<title>Fn::Split</title>
<para>This is the reverse of Join. Convert a string into a list based on the
delimiter.</para>
<section xml:id="functions_id13">
<title>Parameters</title>
<variablelist role="definition_list">
<varlistentry>
<term role="string">delimiter</term>
<listitem>
<para>Matching string to split on.</para>
</listitem>
</varlistentry>
<varlistentry>
<term role="String">string</term>
<listitem>
<para>The string to split.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="functions_id14">
<title>Usage</title>
<programlisting>{ "Fn::Split" : [ ",", "str1,str2,str3,str4"]}</programlisting>
<para>Returns <literal>{["str1", "str2", "str3", "str4"]}</literal>.</para>
</section>
</section>
<section xml:id="functions_fn-replace">
<?dbhtml stop-chunking?>
<title>Fn::Replace</title>
<para>Find and replace one string with another.</para>
<section xml:id="functions_id15">
<title>Parameters</title>
<variablelist role="definition_list">
<varlistentry>
<term role="map">substitutions</term>
<listitem>
<para>A map of substitutions.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>string: String</term>
<listitem>
<para>The string to do the substitutions in.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="functions_id16">
<title>Usage</title>
<programlisting>{"Fn::Replace": [
{'$var1': 'foo', '%var2%': 'bar'},
'$var1 is %var2%'
]}</programlisting>
<para>Returns <literal>"foo is bar"</literal>.</para>
</section>
</section>
<section xml:id="functions_fn-resourcefacade">
<?dbhtml stop-chunking?>
<title>Fn::ResourceFacade</title>
<variablelist role="definition_list">
<varlistentry>
<term>When writing a Template Resource:</term>
<listitem>
<itemizedlist>
<listitem>
<para>user writes a template that will fill in for a resource (the resource is the facade).</para>
</listitem>
<listitem>
<para>when they are writing their template they need to access the metadata from
the facade.</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
</variablelist>
<section xml:id="functions_id17">
<title>Parameters</title>
<variablelist role="definition_list">
<varlistentry>
<term role="String">attribute_name</term>
<listitem>
<para>One of <literal>Metadata</literal>, <literal>DeletionPolicy</literal> or <literal>UpdatePolicy</literal>.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="functions_id18">
<title>Usage</title>
<programlisting>{'Fn::ResourceFacade': 'Metadata'}
{'Fn::ResourceFacade': 'DeletionPolicy'}
{'Fn::ResourceFacade': 'UpdatePolicy'}</programlisting>
</section>
<section xml:id="functions_example">
<title>Example</title>
<para>Here is a top level template <literal>top.yaml</literal></para>
<programlisting>resources:
my_server:
type: OS::Nova::Server
metadata:
key: value
some: more stuff</programlisting>
<para>Here is a resource template <literal>my_actual_server.yaml</literal></para>
<programlisting>resources:
_actual_server_:
type: OS::Nova::Server
metadata: {'Fn::ResourceFacade': Metadata}</programlisting>
<para>The environment file <literal>env.yaml</literal></para>
<programlisting>resource_registry:
resources:
my_server:
"OS::Nova::Server": my_actual_server.yaml</programlisting>
<para>To use it</para>
<programlisting>$ heat stack-create -f top.yaml -e env.yaml</programlisting>
<para>What happened is the metadata in <literal>top.yaml</literal> (key: value, some: more
stuff) gets passed into the resource template via the <link linkend="functions_fn-resourcefacade">Fn::ResourceFacade</link>
function.</para>
</section>
</section>
<section xml:id="functions_fn-memberlisttomap">
<?dbhtml stop-chunking?>
<title>Fn::MemberListToMap</title>
<para>Convert an AWS style member list into a map.</para>
<section xml:id="functions_id19">
<title>Parameters</title>
<variablelist role="definition_list">
<varlistentry>
<term>key name: string</term>
<listitem>
<para>The name of the key (normally "Name" or "Key").</para>
</listitem>
</varlistentry>
<varlistentry>
<term>value name: string</term>
<listitem>
<para>The name of the value (normally "Value").</para>
</listitem>
</varlistentry>
<varlistentry>
<term>list: A list of strings</term>
<listitem>
<para>The string to convert.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="functions_id20">
<title>Usage</title>
<programlisting>{'Fn::MemberListToMap': ['Name', 'Value', ['.member.0.Name=key',
'.member.0.Value=door',
'.member.1.Name=colour',
'.member.1.Value=green']]}</programlisting>
<para>Returns <literal>{'key': 'door', 'colour': 'green'}</literal>.</para>
</section>
</section>
</chapter>

File diff suppressed because it is too large Load Diff

80
doc/hot-reference/pom.xml Normal file
View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.openstack.docs</groupId>
<artifactId>parent-pom</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack-hot-reference</artifactId>
<packaging>jar</packaging>
<name>Heat Orchestration Template Reference</name>
<properties>
<!-- This is set by Jenkins according to the branch. -->
<release.path.name>local</release.path.name>
<comments.enabled>0</comments.enabled>
</properties>
<!-- ################################################ -->
<!-- USE "mvn clean generate-sources" to run this POM -->
<!-- ################################################ -->
<build>
<plugins>
<plugin>
<groupId>com.rackspace.cloud.api</groupId>
<artifactId>clouddocs-maven-plugin</artifactId>
<!-- version is set in ../pom.xml file -->
<executions>
<execution>
<id>generate-webhelp</id>
<goals>
<goal>generate-webhelp</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<!-- These parameters only apply to webhelp -->
<enableDisqus>0</enableDisqus>
<disqusShortname>os-hot-reference</disqusShortname>
<enableGoogleAnalytics>1</enableGoogleAnalytics>
<googleAnalyticsId>UA-17511903-1</googleAnalyticsId>
<generateToc>
appendix toc,title
article/appendix nop
article toc,title
book toc,title,figure,table,example,equation
chapter toc
section toc
part toc
preface toc
qandadiv toc
qandaset toc
reference toc,title
set toc,title
</generateToc>
<!-- The following elements sets the autonumbering of sections in output for chapter numbers but no numbered sections-->
<sectionAutolabel>0</sectionAutolabel>
<formalProcedures>0</formalProcedures>
<tocSectionDepth>1</tocSectionDepth>
<tocChapterDepth>1</tocChapterDepth>
<sectionLabelIncludesComponentLabel>0</sectionLabelIncludesComponentLabel>
<webhelpDirname>hot-reference</webhelpDirname>
<pdfFilenameBase>hot-reference</pdfFilenameBase>
</configuration>
</execution>
</executions>
<configuration>
<!-- These parameters apply to pdf and webhelp -->
<xincludeSupported>true</xincludeSupported>
<sourceDirectory>.</sourceDirectory>
<includes>
bk-hot-reference.xml
</includes>
<branding>openstack</branding>
<canonicalUrlBase>http://docs.openstack.org/hot-reference/content</canonicalUrlBase>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -88,6 +88,11 @@
Configuration Reference Configuration Reference
</a> </a>
</dd> </dd>
<dd>
<a href="hot-reference/target/docbkx/webhelp/hot-reference/content/index.html">
HOT Reference
</a>
</dd>
<dd> <dd>
<a href="networking-guide/target/docbkx/webhelp/networking-guide/content/index.html"> <a href="networking-guide/target/docbkx/webhelp/networking-guide/content/index.html">
Networking Guide Networking Guide

View File

@ -15,6 +15,7 @@
<module>cli-reference</module> <module>cli-reference</module>
<module>config-reference</module> <module>config-reference</module>
<module>glossary</module> <module>glossary</module>
<module>hot-reference</module>
<module>image-guide</module> <module>image-guide</module>
<module>install-guide</module> <module>install-guide</module>
<module>networking-guide</module> <module>networking-guide</module>

30
tools/generate-hot-reference.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh -e
# Generates the HOT reference from the heat repository
usage() {
echo "$0 HEAT_DIR"
}
HEAT_DIR=$1
if [ -z "$1" ]; then
usage
exit 1
fi
# generate the doc in the heat directory
(
cd $HEAT_DIR
tox -edocs
. .tox/docs/bin/activate
make -C doc xml
)
SOURCES="cfn functions openstack"
TARGET=$(dirname $(readlink -f $0))/../doc/hot-reference/generated
for source in $SOURCES; do
openstack-dn2osdbk $HEAT_DIR/doc/build/xml/template_guide/$source.xml \
$TARGET/$source.xml
done