Querying the Template of a Resource Type

Function

This API is used to query the template of a resource type.

Note

The output template parameters of this API are related to the input parameters that you have specified, but the parameters may be different.

URI

GET /v1/{project_id}/resource_types/{type_name}/template

For details about the parameters, see Table 1.

Table 1 Parameter description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Specifies the project ID.

type_name

String

Yes

Specifies the resource type.

Request Parameter

Parameter

In

Type

Mandatory

Description

template_type

query

String

No

Specifies the resource template type.

The valid types are cfn and hot.

Response Parameter

Parameter

In

Type

Description

outputs

body

Dict

Includes key-value pairs of the output data.

heat_template_version

body

String

Specifies the version of the HOT template.

HeatTemplateFormatVersion

body

String

Specifies the version of the CFN template.

description

body

String

Describes the stack template.

parameters

body

Dict

Specifies the key-value pairs of template parameters.

resources

body

Dict

Specifies the template resources.

Request Example

GET /v1/95d02433133a4c0a87ba6967474a2ad3/resource_types/OS%3A%3AHeat%3A%3ARandomString/template

Response Example

{
    "Outputs": {
        "value": {
            "Description": "The random string generated by this resource. This value is also available by referencing the resource.",
            "Value": "{"Fn::GetAtt": ["RandomString", "value"]}"
        },
        "show": {
            "Description": "Detailed information about resource.",
            "Value": "{"Fn::GetAtt": ["RandomString", "show"]}"
        }
    },
    "HeatTemplateFormatVersion": "2012-12-12",
    "Resources": {
        "RandomString": {
            "Type": "OS::Heat::RandomString",
            "Properties": {
                "length": {
                    "Ref": "length"
                },
                "salt": {
                    "Ref": "salt"
                },
                "character_sequences": {
                    "Fn::Split": [
                        ",",
                        {
                            "Ref": "character_sequences"
                        }
                    ]
                },
                "character_classes": {
                    "Fn::Split": [
                        ",",
                        {
                            "Ref": "character_classes"
                        }
                    ]
                },
                "sequence": {
                    "Ref": "sequence"
                }
            }
        }
    },
    "Description": "Initial template of RandomString",
    "Parameters": {
        "length": {
            "Default": 32,
            "Type": "Number",
            "Description": "Length of the string to generate.",
            "MaxValue": 512,
            "MinValue": 1
        },
        "salt": {
            "Type": "String",
            "Description": "Value which can be set or changed on stack update to trigger the resource for replacement with a new random string. The salt value itself is ignored by the random generator."
        },
        "character_sequences": {
            "Type": "CommaDelimitedList",
            "Description": "A list of character sequences and their constraints to generate the random string from."
        },
        "character_classes": {
            "Default": [
                {
                    "class": "lettersdigits",
                    "min": 1
                }
            ],
            "Type": "CommaDelimitedList",
            "Description": "A list of character class and their constraints to generate the random string from."
        },
        "sequence": {
            "Type": "String",
            "Description": "Sequence of characters to build the random string from.",
            "AllowedValues": [
                "lettersdigits",
                "letters",
                "lowercase",
                "uppercase",
                "digits",
                "hexdigits",
                "octdigits"
            ]
        }
    }
}

Return Code

Table 2 Normal return code

Return Code

Type

Description

200

OK

Request was successful.

Table 3 Error return code

Return Code

Type

Description

400

Bad Request

The server failed to process the request.

401

Unauthorized

Authorization failed.

404

Not found

The requested resources are not found.