Skip to content

Commit

Permalink
Intrinsic functions (refs #1):
Browse files Browse the repository at this point in the history
- get_file
- list_join
- digest
- repeat
- resource_facade
- str_replace
- str_replace_strict
- str_replace_vstrict
  • Loading branch information
vojtechhabarta committed Sep 19, 2017
1 parent c3c1dff commit 530d7bb
Show file tree
Hide file tree
Showing 2 changed files with 402 additions and 0 deletions.
201 changes: 201 additions & 0 deletions fragment/fragment-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,16 @@
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"get_file": {
"description": "The `get_file` function returns the content of a file into the template. It is generally used as a file inclusion mechanism for files containing scripts or configuration files.\nhttps://docs.openstack.org/heat/latest/template_guide/hot_spec.html#get-file",
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
Expand Down Expand Up @@ -427,9 +437,160 @@
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"list_join": {
"description": "The `list_join` function joins a list of strings with the given delimiter.\nhttps://docs.openstack.org/heat/latest/template_guide/hot_spec.html#list-join",
"type": "array",
"items": [
{
"type": "string"
}
],
"minItems": 2,
"additionalItems": {
"$ref": "#/definitions/array-with-intrinsic-functions"
}
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"digest": {
"description": "The `digest` function allows for performing digest operations on a given value.\nhttps://docs.openstack.org/heat/latest/template_guide/hot_spec.html#digest",
"type": "array",
"items": [
{
"type": "string",
"enum": [
"md5",
"sha1",
"sha224",
"sha256",
"sha384",
"sha512"
]
},
{
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/intrinsic-function"
}
]
}
],
"minItems": 2,
"maxItems": 2
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"repeat": {
"description": "The `repeat` function allows for dynamically transforming lists by iterating over the contents of one or more source lists and replacing the list elements into a template. The result of this function is a new list, where the elements are set to the template, rendered for each list item.\nhttps://docs.openstack.org/heat/latest/template_guide/hot_spec.html#repeat",
"type": "object",
"properties": {
"template": {
"$ref": "#/definitions/value-with-intrinsic-function"
},
"for_each": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"$ref": "#/definitions/array-with-intrinsic-functions"
},
{
"$ref": "#/definitions/intrinsic-function"
}
]
}
}
},
"required": [
"template",
"for_each"
],
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"resource_facade": {
"description": "The `resource_facade` function retrieves data in a parent provider template.\nhttps://docs.openstack.org/heat/latest/template_guide/hot_spec.html#resource-facade",
"type": "string",
"enum": [
"metadata",
"deletion_policy",
"update_policy"
]
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"str_replace": {
"description": "The `str_replace` function dynamically constructs strings by providing a template string with placeholders and a list of mappings to assign values to those placeholders at runtime. The placeholders are replaced with mapping values wherever a mapping key exactly matches a placeholder.\nhttps://docs.openstack.org/heat/latest/template_guide/hot_spec.html#str-replace",
"$ref": "#/definitions/str_replace-functions"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"str_replace_strict": {
"description": "`str_replace_strict` behaves identically to the `str_replace` function, only an error is raised if any of the params are not present in the template. This may help catch typo’s or other issues sooner rather than later when processing a template.\nhttps://docs.openstack.org/heat/latest/template_guide/hot_spec.html#str-replace-strict",
"$ref": "#/definitions/str_replace-functions"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"str_replace_vstrict": {
"description": "`str_replace_vstrict` behaves identically to the `str_replace_strict` function, only an error is raised if any of the params are empty. This may help catch issues (i.e., prevent resources from being created with bogus values) sooner rather than later if it is known that all the params should be non-empty.\nhttps://docs.openstack.org/heat/latest/template_guide/hot_spec.html#str-replace-vstrict",
"$ref": "#/definitions/str_replace-functions"
}
},
"additionalProperties": false
}
]
},
"str_replace-functions": {
"type": "object",
"properties": {
"template": {
"type": "string"
},
"params": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/value-with-intrinsic-function"
}
}
},
"required": [
"template",
"params"
],
"additionalProperties": false
},
"value-with-intrinsic-function": {
"oneOf": [
{
Expand Down Expand Up @@ -461,6 +622,11 @@
"get_attr"
]
},
{
"required": [
"get_file"
]
},
{
"required": [
"get_param"
Expand All @@ -470,6 +636,41 @@
"required": [
"get_resource"
]
},
{
"required": [
"list_join"
]
},
{
"required": [
"digest"
]
},
{
"required": [
"repeat"
]
},
{
"required": [
"resource_facade"
]
},
{
"required": [
"str_replace"
]
},
{
"required": [
"str_replace_strict"
]
},
{
"required": [
"str_replace_vstrict"
]
}
]
},
Expand Down
Loading

0 comments on commit 530d7bb

Please sign in to comment.