Adds Parameter Label to HOT spec and parameter schema

This change will add the ability to put a human readable label
in a HOT Template for each parameter. This label will be used
to provide a better form label in any user interface when
available.

Change-Id: I8d815d1cfceb71c1ea0a9907f2afeb06dc4fca09
Implements: blueprint add-parameter-label-to-template
This commit is contained in:
Tim Schnell 2014-01-07 16:50:12 +00:00
parent ba0f1afd8b
commit 9914a5b293
4 changed files with 28 additions and 8 deletions

View File

@ -105,12 +105,15 @@ follows:
parameters:
key_name:
type: string
label: Key Name
description: Name of key-pair to be used for compute instance
image_id:
type: string
label: Image ID
description: Image to be used for compute instance
instance_type:
type: string
label: Instance Type
description: Type of instance (flavor) to be used
resources:
@ -137,6 +140,7 @@ the 'm1.small' flavor unless specified otherwise be the user.
parameters:
instance_type:
type: string
label: Instance Type
description: Type of instance (flavor) to be used
default: m1.small
@ -150,6 +154,7 @@ passwords as user input:
parameters:
database_password:
type: string
label: Database Password
description: Password to be used for database
hidden: true
@ -170,6 +175,7 @@ for the *instance_type* parameter:
parameters:
instance_type:
type: string
label: Instance Type
description: Type of instance (flavor) to be used
constraints:
- allow_values: [ m1.medium, m1.large, m1.xlarge ]
@ -185,6 +191,7 @@ provided by users:
parameters:
database_password:
type: string
label: Database Password
description: Password to be used for database
hidden: true
constraints:

View File

@ -146,6 +146,7 @@ default value defined as nested elements.
parameters:
<param name>:
type: <string | number | json | comma_delimited_list>
label: <human-readable name of the parameter>
description: <description of the parameter>
default: <default value for parameter>
hidden: <true | false>
@ -159,6 +160,10 @@ type
This attribute specifies the type of parameter. Currently supported types
are *string*, *number*, *comma_delimited_list* or *json*.
label
This *optional* attribute allows for giving a human readable name of the
parameter.
description
This *optional* attribute allows for giving a human readable description of
the parameter.
@ -179,17 +184,19 @@ constraints
parameter, such as minimum or maximum values for numeric parameters.
The following example shows a minimalistic definition of two parameters. Note
that the description is actually optional, but is good practice to provide a
useful description for each parameter.
that the description and label are actually optional, but is good practice to
provide a useful description and label for each parameter.
::
parameters:
user_name:
type: string
label: User Name
description: User name to be configured for the application
port_number:
type: number
label: Port Number
description: Port number to be configured for the web server
@ -238,6 +245,7 @@ presented to the user at deployment time.
parameters:
user_name:
type: string
label: User Name
description: User name to be configured for the application
constraints:
- length: { min: 6, max: 8 }
@ -309,6 +317,7 @@ For example:
parameters:
instance_type:
type: string
label: Instance Type
description: Instance type for compute instances
constraints:
allowed_values:
@ -334,6 +343,7 @@ For example:
parameters:
user_name:
type: string
label: User Name
description: User name to be configured for the application
constraints:
- allowed_pattern: "[A-Z]+[a-zA-Z0-9]*"
@ -461,6 +471,7 @@ resource definition is shown below.
parameters:
instance_type:
type: string
label: Instance Type
description: Instance type to be used.
resources:
@ -589,6 +600,7 @@ like scripts for initializing compute instances as shown in the example below:
parameters:
DBRootPassword:
type: string
label: Database Password
description: Root password for MySQL
hidden: true

View File

@ -268,10 +268,10 @@ class HOTParamSchema(parameters.Schema):
KEYS = (
TYPE, DESCRIPTION, DEFAULT, SCHEMA, CONSTRAINTS,
HIDDEN
HIDDEN, LABEL
) = (
'type', 'description', 'default', 'schema', 'constraints',
'hidden'
'hidden', 'label'
)
# For Parameters the type name for Schema.LIST is comma_delimited_list

View File

@ -24,11 +24,11 @@ from heat.common import exception
PARAMETER_KEYS = (
TYPE, DEFAULT, NO_ECHO, ALLOWED_VALUES, ALLOWED_PATTERN,
MAX_LENGTH, MIN_LENGTH, MAX_VALUE, MIN_VALUE,
DESCRIPTION, CONSTRAINT_DESCRIPTION
DESCRIPTION, CONSTRAINT_DESCRIPTION, LABEL
) = (
'Type', 'Default', 'NoEcho', 'AllowedValues', 'AllowedPattern',
'MaxLength', 'MinLength', 'MaxValue', 'MinValue',
'Description', 'ConstraintDescription'
'Description', 'ConstraintDescription', 'Label'
)
@ -36,9 +36,10 @@ class Schema(constr.Schema):
'''Parameter schema.'''
KEYS = (
TYPE, DESCRIPTION, DEFAULT, SCHEMA, CONSTRAINTS, HIDDEN
TYPE, DESCRIPTION, DEFAULT, SCHEMA, CONSTRAINTS, HIDDEN, LABEL
) = (
'Type', 'Description', 'Default', 'Schema', 'Constraints', 'NoEcho'
'Type', 'Description', 'Default', 'Schema', 'Constraints', 'NoEcho',
'Label'
)
# For Parameters the type name for Schema.LIST is CommaDelimitedList