Fn
Resource Orchestration Service intrinsic functions.
https://help.aliyun.com/zh/ros/user-guide/functions
Static Functions
Name | Description |
---|---|
add |
No description. |
any |
Returns whether a value in the specified array is true or false. |
avg |
No description. |
base64Decode |
No description. |
base64Encode |
The intrinsic function Fn::Base64 returns the Base64 representation of the input string. |
calculate |
No description. |
cidr |
Returns a list of CIDR addresses. |
conditionAnd |
Returns true if all the specified conditions evaluate to true, or returns false if any one of the conditions evaluates to false. |
conditionEquals |
Compares if two values are equal. |
conditionIf |
Returns one value if the specified condition evaluates to true and another value if the specified condition evaluates to false. |
conditionNot |
Returns true for a condition that evaluates to false or returns false for a condition that evaluates to true. |
conditionOr |
Returns true if any one of the specified conditions evaluate to true, or returns false if all of the conditions evaluates to false. |
contains |
Returns true if at least one member of the list matches the specified value and false otherwise. |
eachMemberIn |
Returns true if every member of the first list is equal to at least one value in the second list, and false otherwise. |
findInMap |
The intrinsic function Fn::FindInMap returns the value corresponding to keys in a two-level map that is declared in the Mappings section. |
formatTime |
Returns the formatted time of the object. |
getAtt |
The Fn::GetAtt intrinsic function returns the value of an attribute from a resource in the template. |
getAzs |
The intrinsic function Fn::GetAZs returns an array that lists Availability Zones for a specified region. |
getJsonValue |
No description. |
getStackOutput |
The intrinsic function Fn::GetStackOutput returns the value of an output exported by another stack. |
indent |
The intrinsic function Fn::Indent adjust the indentation of the string. |
index |
Returns the index of the item in the list. |
join |
The intrinsic function Fn::Join appends a set of values into a single value, separated by the specified delimiter. |
jq |
No description. |
lengthOf |
Returns the length of the object. |
listMerge |
No description. |
marketplaceImage |
The intrinsic function Fn::MarketplaceImage returns the default image ID of the specified cloud marketplace image product Code. |
matchPattern |
Returns true if a specified string matches a specified pattern. |
max |
No description. |
mergeMapToList |
No description. |
min |
No description. |
ref |
The Ref intrinsic function returns the value of the specified parameter or resource. |
replace |
No description. |
select |
The intrinsic function Fn::Select returns a single object from a list of objects by index. |
selectMapList |
No description. |
split |
To split a string into a list of string values so that you can select an element from the resulting string list, use the Fn::Split intrinsic function. |
str |
No description. |
sub |
The intrinsic function Fn::Sub substitutes variables in an input string with values that you specify. |
add
import { Fn } from '@alicloud/ros-cdk-core'
Fn.add(values: number | any[] | {[ key: string ]: any})
- Type: number | any[] | {[ key: string ]: any}
any
import { Fn } from '@alicloud/ros-cdk-core'
Fn.any(values: any[] | IResolvable)
Returns whether a value in the specified array is true or false.
Returns true if any item in the array is true, and false otherwise.
- Type: any[] | IResolvable
An array of values.
avg
import { Fn } from '@alicloud/ros-cdk-core'
Fn.avg(ndigits: number, values: number[])
- Type: number
- Type: number[]
base64Decode
import { Fn } from '@alicloud/ros-cdk-core'
Fn.base64Decode(data: string)
- Type: string
base64Encode
import { Fn } from '@alicloud/ros-cdk-core'
Fn.base64Encode(data: string)
The intrinsic function Fn::Base64
returns the Base64 representation of the input string.
- Type: string
The string value you want to convert to Base64.
calculate
import { Fn } from '@alicloud/ros-cdk-core'
Fn.calculate(values: string, ndigits: number, para: number[])
- Type: string
- Type: number
- Type: number[]
cidr
import { Fn } from '@alicloud/ros-cdk-core'
Fn.cidr(ipBlock: string | IResolvable, count: number | IResolvable, cidrBits: number | IResolvable)
Returns a list of CIDR addresses.
- Type: string | IResolvable
The IP address block from which you want to allocate the CIDR.
The block must be expressed in CIDR notation.
- Type: number | IResolvable
The number of IPv4 CIDRs to generate.
Valid input values range from 1 to 256 and are used to decide the total number of final subnets.
- Type: number | IResolvable
The number of subnet bits of the new CIDR.
For example, if the value "8" is specified for this parameter, a CIDR with a "/24" mask will be created.
conditionAnd
import { Fn } from '@alicloud/ros-cdk-core'
Fn.conditionAnd(conditions: string | IRosConditionExpression)
Returns true if all the specified conditions evaluate to true, or returns false if any one of the conditions evaluates to false.
Fn::And
acts as
an AND operator. The minimum number of conditions that you can include is
2, and the maximum is 10.
- Type: string | IRosConditionExpression
conditions to AND.
conditionEquals
import { Fn } from '@alicloud/ros-cdk-core'
Fn.conditionEquals(lhs: any, rhs: any)
Compares if two values are equal.
Returns true if the two values are equal or false if they aren't.
- Type: any
A value of any type that you want to compare.
- Type: any
A value of any type that you want to compare.
conditionIf
import { Fn } from '@alicloud/ros-cdk-core'
Fn.conditionIf(conditionId: string | IRosConditionExpression, valueIfTrue: any, valueIfFalse: any)
Returns one value if the specified condition evaluates to true and another value if the specified condition evaluates to false.
- Type: string | IRosConditionExpression
A reference to a condition in the Conditions section.
Use the condition's name to reference it.
- Type: any
A value to be returned if the specified condition evaluates to true.
- Type: any
A value to be returned if the specified condition evaluates to false.
conditionNot
import { Fn } from '@alicloud/ros-cdk-core'
Fn.conditionNot(condition: string | IRosConditionExpression)
Returns true for a condition that evaluates to false or returns false for a condition that evaluates to true.
Fn::Not
acts as a NOT operator.
- Type: string | IRosConditionExpression
A condition such as Fn::Equals
that evaluates to true or false.
conditionOr
import { Fn } from '@alicloud/ros-cdk-core'
Fn.conditionOr(conditions: string | IRosConditionExpression)
Returns true if any one of the specified conditions evaluate to true, or returns false if all of the conditions evaluates to false.
Fn::Or
acts
as an OR operator. The minimum number of conditions that you can include is
2, and the maximum is 10.
- Type: string | IRosConditionExpression
conditions that evaluates to true or false.
contains
import { Fn } from '@alicloud/ros-cdk-core'
Fn.contains(values: any[] | IResolvable, value: any)
Returns true if at least one member of the list matches the specified value and false otherwise.
- Type: any[] | IResolvable
An array of values.
- Type: any
A value.
eachMemberIn
import { Fn } from '@alicloud/ros-cdk-core'
Fn.eachMemberIn(values1: any[] | IResolvable, values2: any[] | IResolvable)
Returns true if every member of the first list is equal to at least one value in the second list, and false otherwise.
- Type: any[] | IResolvable
An array of values.
- Type: any[] | IResolvable
An array of values.
findInMap
import { Fn } from '@alicloud/ros-cdk-core'
Fn.findInMap(mapName: string, topLevelKey: string, secondLevelKey: string)
The intrinsic function Fn::FindInMap
returns the value corresponding to keys in a two-level map that is declared in the Mappings section.
- Type: string
- Type: string
- Type: string
formatTime
import { Fn } from '@alicloud/ros-cdk-core'
Fn.formatTime(format: string | IResolvable, timeZone: string | IResolvable)
Returns the formatted time of the object.
- Type: string | IResolvable
The format of the time.
- Type: string | IResolvable
The time zone.
getAtt
import { Fn } from '@alicloud/ros-cdk-core'
Fn.getAtt(logicalNameOfResource: string, attributeName: string)
The Fn::GetAtt
intrinsic function returns the value of an attribute from a resource in the template.
- Type: string
The logical name (also called logical ID) of the resource that contains the attribute that you want.
- Type: string
The name of the resource-specific attribute whose value you want.
See the resource's reference page for details about the attributes available for that resource type.
getAzs
import { Fn } from '@alicloud/ros-cdk-core'
Fn.getAzs(region: string)
The intrinsic function Fn::GetAZs
returns an array that lists Availability Zones for a specified region.
Because customers have access to
different Availability Zones, the intrinsic function Fn::GetAZs
enables
template authors to write templates that adapt to the calling user's
access. That way you don't have to hard-code a full list of Availability
Zones for a specified region.
- Type: string
The name of the region for which you want to get the Availability Zones.
You can use the ROS::Region pseudo parameter to specify the region in which the stack is created. Specifying an empty string is equivalent to specifying ROS::Region.
getJsonValue
import { Fn } from '@alicloud/ros-cdk-core'
Fn.getJsonValue(key: string, jsonData: any)
- Type: string
- Type: any
getStackOutput
import { Fn } from '@alicloud/ros-cdk-core'
Fn.getStackOutput(stackID: string, outputKey: string, stackRegion?: string)
The intrinsic function Fn::GetStackOutput
returns the value of an output exported by another stack.
- Type: string
- Type: string
- Type: string
indent
import { Fn } from '@alicloud/ros-cdk-core'
Fn.indent(str: string | IResolvable, level: number | IResolvable, indent?: number | IResolvable)
The intrinsic function Fn::Indent adjust the indentation of the string.
- Type: string | IResolvable
Strings that need to be indented.
- Type: number | IResolvable
Indentation level.
The range is [0,20].
- Type: number | IResolvable
Optional, defaults to 2 for two Spaces per level, in the range [0,4].
index
import { Fn } from '@alicloud/ros-cdk-core'
Fn.index(itemToFindIndex: any, itemList: any[] | IResolvable)
Returns the index of the item in the list.
- Type: any
The item to find in the list.
- Type: any[] | IResolvable
The list to find the item in.
join
import { Fn } from '@alicloud/ros-cdk-core'
Fn.join(delimiter: string, listOfValues: string | IResolvable[])
The intrinsic function Fn::Join
appends a set of values into a single value, separated by the specified delimiter.
If a delimiter is the empty string, the set of values are concatenated with no delimiter.
- Type: string
The value you want to occur between fragments.
The delimiter will occur between fragments only. It will not terminate the final value.
- Type: string | IResolvable[]
The list of values you want combined.
jq
import { Fn } from '@alicloud/ros-cdk-core'
Fn.jq(method: string, script: string, inputString: string | {[ key: string ]: any})
- Type: string
- Type: string
- Type: string | {[ key: string ]: any}
lengthOf
import { Fn } from '@alicloud/ros-cdk-core'
Fn.lengthOf(obj: any)
Returns the length of the object.
- Type: any
An object whose length needs to be computed.
Three types are supported: strings, lists, and dictionaries.
listMerge
import { Fn } from '@alicloud/ros-cdk-core'
Fn.listMerge(valueList: any[] | IResolvable[])
- Type: any[] | IResolvable[]
marketplaceImage
import { Fn } from '@alicloud/ros-cdk-core'
Fn.marketplaceImage(imageProductCode: string | IResolvable)
The intrinsic function Fn::MarketplaceImage returns the default image ID of the specified cloud marketplace image product Code.
- Type: string | IResolvable
The product code of the cloud marketplace image.
matchPattern
import { Fn } from '@alicloud/ros-cdk-core'
Fn.matchPattern(pattern: string | IResolvable, value: string | IResolvable)
Returns true if a specified string matches a specified pattern.
- Type: string | IResolvable
A regular expression in string form.
- Type: string | IResolvable
The string to match.
max
import { Fn } from '@alicloud/ros-cdk-core'
Fn.max(values: number[])
- Type: number[]
mergeMapToList
import { Fn } from '@alicloud/ros-cdk-core'
Fn.mergeMapToList(mapList: {[ key: string ]: any[]}[])
- Type: {[ key: string ]: any[]}[]
min
import { Fn } from '@alicloud/ros-cdk-core'
Fn.min(values: number[])
- Type: number[]
ref
import { Fn } from '@alicloud/ros-cdk-core'
Fn.ref(logicalName: string)
The Ref
intrinsic function returns the value of the specified parameter or resource.
Note that it doesn't validate the logicalName, it mainly serves paremeter/resource reference defined in a RosInclude
template.
- Type: string
The logical name of a parameter/resource for which you want to retrieve its value.
replace
import { Fn } from '@alicloud/ros-cdk-core'
Fn.replace(replaceData: {[ key: string ]: any}, content: string)
- Type: {[ key: string ]: any}
- Type: string
select
import { Fn } from '@alicloud/ros-cdk-core'
Fn.select(index: string | number, array: any)
The intrinsic function Fn::Select
returns a single object from a list of objects by index.
- Type: string | number
The index of the object to retrieve.
This must be a value from zero to N-1, where N represents the number of elements in the array.
- Type: any
The list of objects to select from.
This list must not be null, nor can it have null entries.
selectMapList
import { Fn } from '@alicloud/ros-cdk-core'
Fn.selectMapList(key: string, mapList: {[ key: string ]: any}[])
- Type: string
- Type: {[ key: string ]: any}[]
split
import { Fn } from '@alicloud/ros-cdk-core'
Fn.split(delimiter: string, source: string)
To split a string into a list of string values so that you can select an element from the resulting string list, use the Fn::Split
intrinsic function.
Specify the location of splits
with a delimiter, such as , (a comma). After you split a string, use the Fn::Select
function
to pick a specific element.
- Type: string
A string value that determines where the source string is divided.
- Type: string
The string value that you want to split.
str
import { Fn } from '@alicloud/ros-cdk-core'
Fn.str(value: any)
- Type: any
sub
import { Fn } from '@alicloud/ros-cdk-core'
Fn.sub(body: string, variables?: {[ key: string ]: any})
The intrinsic function Fn::Sub
substitutes variables in an input string with values that you specify.
In your templates, you can use this function to construct commands or outputs that include values that aren't available until you create or update a stack.
- Type: string
A string with variables that Ros Template substitutes with their associated values at runtime.
Write variables as ${MyVarName}. Variables can be template parameter names, resource logical IDs, resource attributes, or a variable in a key-value map. If you specify only template parameter names, resource logical IDs, and resource attributes, don't specify a key-value map.
- Type: {[ key: string ]: any}
The name of a variable that you included in the String parameter.
The value that Ros Template substitutes for the associated variable name at runtime.