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 com.aliyun.ros.cdk.core.Fn;
Fn.add(java.lang.Number OR java.util.List<java.lang.Object> OR java.util.Map<java.lang.String, java.lang.Object> values)
- Type: java.lang.Number OR java.util.List
OR java.util.Map
any
import com.aliyun.ros.cdk.core.Fn;
Fn.any(java.util.List<java.lang.Object> OR IResolvable values)
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: java.util.List
OR IResolvable
An array of values.
avg
import com.aliyun.ros.cdk.core.Fn;
Fn.avg(java.lang.Number ndigits, java.util.List<java.lang.Number> values)
- Type: java.lang.Number
- Type: java.util.List
base64Decode
import com.aliyun.ros.cdk.core.Fn;
Fn.base64Decode(java.lang.String data)
- Type: java.lang.String
base64Encode
import com.aliyun.ros.cdk.core.Fn;
Fn.base64Encode(java.lang.String data)
The intrinsic function Fn::Base64
returns the Base64 representation of the input string.
- Type: java.lang.String
The string value you want to convert to Base64.
calculate
import com.aliyun.ros.cdk.core.Fn;
Fn.calculate(java.lang.String values, java.lang.Number ndigits, java.util.List<java.lang.Number> para)
- Type: java.lang.String
- Type: java.lang.Number
- Type: java.util.List
cidr
import com.aliyun.ros.cdk.core.Fn;
Fn.cidr(java.lang.String OR IResolvable ipBlock, java.lang.Number OR IResolvable count, java.lang.Number OR IResolvable cidrBits)
Returns a list of CIDR addresses.
- Type: java.lang.String OR IResolvable
The IP address block from which you want to allocate the CIDR.
The block must be expressed in CIDR notation.
- Type: java.lang.Number OR 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: java.lang.Number OR 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 com.aliyun.ros.cdk.core.Fn;
Fn.conditionAnd(java.lang.String OR IRosConditionExpression conditions)
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: java.lang.String OR IRosConditionExpression
conditions to AND.
conditionEquals
import com.aliyun.ros.cdk.core.Fn;
Fn.conditionEquals(java.lang.Object lhs, java.lang.Object rhs)
Compares if two values are equal.
Returns true if the two values are equal or false if they aren't.
- Type: java.lang.Object
A value of any type that you want to compare.
- Type: java.lang.Object
A value of any type that you want to compare.
conditionIf
import com.aliyun.ros.cdk.core.Fn;
Fn.conditionIf(java.lang.String OR IRosConditionExpression conditionId, java.lang.Object valueIfTrue, java.lang.Object valueIfFalse)
Returns one value if the specified condition evaluates to true and another value if the specified condition evaluates to false.
- Type: java.lang.String OR IRosConditionExpression
A reference to a condition in the Conditions section.
Use the condition's name to reference it.
- Type: java.lang.Object
A value to be returned if the specified condition evaluates to true.
- Type: java.lang.Object
A value to be returned if the specified condition evaluates to false.
conditionNot
import com.aliyun.ros.cdk.core.Fn;
Fn.conditionNot(java.lang.String OR IRosConditionExpression condition)
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: java.lang.String OR IRosConditionExpression
A condition such as Fn::Equals
that evaluates to true or false.
conditionOr
import com.aliyun.ros.cdk.core.Fn;
Fn.conditionOr(java.lang.String OR IRosConditionExpression conditions)
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: java.lang.String OR IRosConditionExpression
conditions that evaluates to true or false.
contains
import com.aliyun.ros.cdk.core.Fn;
Fn.contains(java.util.List<java.lang.Object> OR IResolvable values, java.lang.Object value)
Returns true if at least one member of the list matches the specified value and false otherwise.
- Type: java.util.List
OR IResolvable
An array of values.
- Type: java.lang.Object
A value.
eachMemberIn
import com.aliyun.ros.cdk.core.Fn;
Fn.eachMemberIn(java.util.List<java.lang.Object> OR IResolvable values1, java.util.List<java.lang.Object> OR IResolvable values2)
Returns true if every member of the first list is equal to at least one value in the second list, and false otherwise.
- Type: java.util.List
OR IResolvable
An array of values.
- Type: java.util.List
OR IResolvable
An array of values.
findInMap
import com.aliyun.ros.cdk.core.Fn;
Fn.findInMap(java.lang.String mapName, java.lang.String topLevelKey, java.lang.String secondLevelKey)
The intrinsic function Fn::FindInMap
returns the value corresponding to keys in a two-level map that is declared in the Mappings section.
- Type: java.lang.String
- Type: java.lang.String
- Type: java.lang.String
formatTime
import com.aliyun.ros.cdk.core.Fn;
Fn.formatTime(java.lang.String OR IResolvable format, java.lang.String OR IResolvable timeZone)
Returns the formatted time of the object.
- Type: java.lang.String OR IResolvable
The format of the time.
- Type: java.lang.String OR IResolvable
The time zone.
getAtt
import com.aliyun.ros.cdk.core.Fn;
Fn.getAtt(java.lang.String logicalNameOfResource, java.lang.String attributeName)
The Fn::GetAtt
intrinsic function returns the value of an attribute from a resource in the template.
- Type: java.lang.String
The logical name (also called logical ID) of the resource that contains the attribute that you want.
- Type: java.lang.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 com.aliyun.ros.cdk.core.Fn;
Fn.getAzs(java.lang.String region)
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: java.lang.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 com.aliyun.ros.cdk.core.Fn;
Fn.getJsonValue(java.lang.String key, java.lang.Object jsonData)
- Type: java.lang.String
- Type: java.lang.Object
getStackOutput
import com.aliyun.ros.cdk.core.Fn;
Fn.getStackOutput(java.lang.String stackID, java.lang.String outputKey),Fn.getStackOutput(java.lang.String stackID, java.lang.String outputKey, java.lang.String stackRegion)
The intrinsic function Fn::GetStackOutput
returns the value of an output exported by another stack.
- Type: java.lang.String
- Type: java.lang.String
- Type: java.lang.String
indent
import com.aliyun.ros.cdk.core.Fn;
Fn.indent(java.lang.String OR IResolvable str, java.lang.Number OR IResolvable level),Fn.indent(java.lang.String OR IResolvable str, java.lang.Number OR IResolvable level, java.lang.Number OR IResolvable indent)
The intrinsic function Fn::Indent adjust the indentation of the string.
- Type: java.lang.String OR IResolvable
Strings that need to be indented.
- Type: java.lang.Number OR IResolvable
Indentation level.
The range is [0,20].
- Type: java.lang.Number OR IResolvable
Optional, defaults to 2 for two Spaces per level, in the range [0,4].
index
import com.aliyun.ros.cdk.core.Fn;
Fn.index(java.lang.Object itemToFindIndex, java.util.List<java.lang.Object> OR IResolvable itemList)
Returns the index of the item in the list.
- Type: java.lang.Object
The item to find in the list.
- Type: java.util.List
OR IResolvable
The list to find the item in.
join
import com.aliyun.ros.cdk.core.Fn;
Fn.join(java.lang.String delimiter, java.util.List<java.lang.String OR IResolvable> listOfValues)
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: java.lang.String
The value you want to occur between fragments.
The delimiter will occur between fragments only. It will not terminate the final value.
- Type: java.util.List
IResolvable\>
The list of values you want combined.
jq
import com.aliyun.ros.cdk.core.Fn;
Fn.jq(java.lang.String method, java.lang.String script, java.lang.String OR java.util.Map<java.lang.String, java.lang.Object> inputString)
- Type: java.lang.String
- Type: java.lang.String
- Type: java.lang.String OR java.util.Map
lengthOf
import com.aliyun.ros.cdk.core.Fn;
Fn.lengthOf(java.lang.Object obj)
Returns the length of the object.
- Type: java.lang.Object
An object whose length needs to be computed.
Three types are supported: strings, lists, and dictionaries.
listMerge
import com.aliyun.ros.cdk.core.Fn;
Fn.listMerge(java.util.List<java.util.List<java.lang.Object> OR IResolvable> valueList)
- Type: java.util.List
OR \IResolvable\>
marketplaceImage
import com.aliyun.ros.cdk.core.Fn;
Fn.marketplaceImage(java.lang.String OR IResolvable imageProductCode)
The intrinsic function Fn::MarketplaceImage returns the default image ID of the specified cloud marketplace image product Code.
- Type: java.lang.String OR IResolvable
The product code of the cloud marketplace image.
matchPattern
import com.aliyun.ros.cdk.core.Fn;
Fn.matchPattern(java.lang.String OR IResolvable pattern, java.lang.String OR IResolvable value)
Returns true if a specified string matches a specified pattern.
- Type: java.lang.String OR IResolvable
A regular expression in string form.
- Type: java.lang.String OR IResolvable
The string to match.
max
import com.aliyun.ros.cdk.core.Fn;
Fn.max(java.util.List<java.lang.Number> values)
- Type: java.util.List
mergeMapToList
import com.aliyun.ros.cdk.core.Fn;
Fn.mergeMapToList(java.util.List<java.util.Map<java.lang.String, java.util.List<java.lang.Object>>> mapList)
- Type: java.util.List
>>
min
import com.aliyun.ros.cdk.core.Fn;
Fn.min(java.util.List<java.lang.Number> values)
- Type: java.util.List
ref
import com.aliyun.ros.cdk.core.Fn;
Fn.ref(java.lang.String logicalName)
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: java.lang.String
The logical name of a parameter/resource for which you want to retrieve its value.
replace
import com.aliyun.ros.cdk.core.Fn;
Fn.replace(java.util.Map<java.lang.String, java.lang.Object> replaceData, java.lang.String content)
- Type: java.util.Map
- Type: java.lang.String
select
import com.aliyun.ros.cdk.core.Fn;
Fn.select(java.lang.String OR java.lang.Number index, java.lang.Object array)
The intrinsic function Fn::Select
returns a single object from a list of objects by index.
- Type: java.lang.String OR java.lang.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: java.lang.Object
The list of objects to select from.
This list must not be null, nor can it have null entries.
selectMapList
import com.aliyun.ros.cdk.core.Fn;
Fn.selectMapList(java.lang.String key, java.util.List<java.util.Map<java.lang.String, java.lang.Object>> mapList)
- Type: java.lang.String
- Type: java.util.List
>
split
import com.aliyun.ros.cdk.core.Fn;
Fn.split(java.lang.String delimiter, java.lang.String source)
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: java.lang.String
A string value that determines where the source string is divided.
- Type: java.lang.String
The string value that you want to split.
str
import com.aliyun.ros.cdk.core.Fn;
Fn.str(java.lang.Object value)
- Type: java.lang.Object
sub
import com.aliyun.ros.cdk.core.Fn;
Fn.sub(java.lang.String body),Fn.sub(java.lang.String body, java.util.Map<java.lang.String, java.lang.Object> variables)
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: java.lang.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: java.util.Map
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.