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. |
base64_decode |
No description. |
base64_encode |
The intrinsic function Fn::Base64 returns the Base64 representation of the input string. |
calculate |
No description. |
cidr |
Returns a list of CIDR addresses. |
condition_and |
Returns true if all the specified conditions evaluate to true, or returns false if any one of the conditions evaluates to false. |
condition_equals |
Compares if two values are equal. |
condition_if |
Returns one value if the specified condition evaluates to true and another value if the specified condition evaluates to false. |
condition_not |
Returns true for a condition that evaluates to false or returns false for a condition that evaluates to true. |
condition_or |
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. |
each_member_in |
Returns true if every member of the first list is equal to at least one value in the second list, and false otherwise. |
find_in_map |
The intrinsic function Fn::FindInMap returns the value corresponding to keys in a two-level map that is declared in the Mappings section. |
format_time |
Returns the formatted time of the object. |
get_att |
The Fn::GetAtt intrinsic function returns the value of an attribute from a resource in the template. |
get_azs |
The intrinsic function Fn::GetAZs returns an array that lists Availability Zones for a specified region. |
get_json_value |
No description. |
get_stack_output |
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. |
length_of |
Returns the length of the object. |
list_merge |
No description. |
marketplace_image |
The intrinsic function Fn::MarketplaceImage returns the default image ID of the specified cloud marketplace image product Code. |
match_pattern |
Returns true if a specified string matches a specified pattern. |
max |
No description. |
merge_map_to_list |
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. |
select_map_list |
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 ros_cdk_core
ros_cdk_core.Fn.add(
values: typing.Union[typing.Union[int, float], typing.List[typing.Any], typing.Mapping[typing.Any]]
)
- Type: typing.Union[typing.Union[int, float], typing.List[typing.Any], typing.Mapping[typing.Any]]
any
import ros_cdk_core
ros_cdk_core.Fn.any(
values: typing.Union[typing.List[typing.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: typing.Union[typing.List[typing.Any], IResolvable]
An array of values.
avg
import ros_cdk_core
ros_cdk_core.Fn.avg(
ndigits: typing.Union[int, float],
values: typing.List[typing.Union[int, float]]
)
- Type: typing.Union[int, float]
- Type: typing.List[typing.Union[int, float]]
base64_decode
import ros_cdk_core
ros_cdk_core.Fn.base64_decode(
data: str
)
- Type: str
base64_encode
import ros_cdk_core
ros_cdk_core.Fn.base64_encode(
data: str
)
The intrinsic function Fn::Base64
returns the Base64 representation of the input string.
- Type: str
The string value you want to convert to Base64.
calculate
import ros_cdk_core
ros_cdk_core.Fn.calculate(
values: str,
ndigits: typing.Union[int, float],
para: typing.List[typing.Union[int, float]]
)
- Type: str
- Type: typing.Union[int, float]
- Type: typing.List[typing.Union[int, float]]
cidr
import ros_cdk_core
ros_cdk_core.Fn.cidr(
ip_block: typing.Union[str, IResolvable],
count: typing.Union[typing.Union[int, float], IResolvable],
cidr_bits: typing.Union[typing.Union[int, float], IResolvable]
)
Returns a list of CIDR addresses.
- Type: typing.Union[str, IResolvable]
The IP address block from which you want to allocate the CIDR.
The block must be expressed in CIDR notation.
- Type: typing.Union[typing.Union[int, float], 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: typing.Union[typing.Union[int, float], 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.
condition_and
import ros_cdk_core
ros_cdk_core.Fn.condition_and(
conditions: typing.Union[str, 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: typing.Union[str, IRosConditionExpression]
conditions to AND.
condition_equals
import ros_cdk_core
ros_cdk_core.Fn.condition_equals(
lhs: typing.Any,
rhs: typing.Any
)
Compares if two values are equal.
Returns true if the two values are equal or false if they aren't.
- Type: typing.Any
A value of any type that you want to compare.
- Type: typing.Any
A value of any type that you want to compare.
condition_if
import ros_cdk_core
ros_cdk_core.Fn.condition_if(
condition_id: typing.Union[str, IRosConditionExpression],
value_if_true: typing.Any,
value_if_false: typing.Any
)
Returns one value if the specified condition evaluates to true and another value if the specified condition evaluates to false.
- Type: typing.Union[str, IRosConditionExpression]
A reference to a condition in the Conditions section.
Use the condition's name to reference it.
- Type: typing.Any
A value to be returned if the specified condition evaluates to true.
- Type: typing.Any
A value to be returned if the specified condition evaluates to false.
condition_not
import ros_cdk_core
ros_cdk_core.Fn.condition_not(
condition: typing.Union[str, 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: typing.Union[str, IRosConditionExpression]
A condition such as Fn::Equals
that evaluates to true or false.
condition_or
import ros_cdk_core
ros_cdk_core.Fn.condition_or(
conditions: typing.Union[str, 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: typing.Union[str, IRosConditionExpression]
conditions that evaluates to true or false.
contains
import ros_cdk_core
ros_cdk_core.Fn.contains(
values: typing.Union[typing.List[typing.Any], IResolvable],
value: typing.Any
)
Returns true if at least one member of the list matches the specified value and false otherwise.
- Type: typing.Union[typing.List[typing.Any], IResolvable]
An array of values.
- Type: typing.Any
A value.
each_member_in
import ros_cdk_core
ros_cdk_core.Fn.each_member_in(
values1: typing.Union[typing.List[typing.Any], IResolvable],
values2: typing.Union[typing.List[typing.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: typing.Union[typing.List[typing.Any], IResolvable]
An array of values.
- Type: typing.Union[typing.List[typing.Any], IResolvable]
An array of values.
find_in_map
import ros_cdk_core
ros_cdk_core.Fn.find_in_map(
map_name: str,
top_level_key: str,
second_level_key: str
)
The intrinsic function Fn::FindInMap
returns the value corresponding to keys in a two-level map that is declared in the Mappings section.
- Type: str
- Type: str
- Type: str
format_time
import ros_cdk_core
ros_cdk_core.Fn.format_time(
format: typing.Union[str, IResolvable],
time_zone: typing.Union[str, IResolvable]
)
Returns the formatted time of the object.
- Type: typing.Union[str, IResolvable]
The format of the time.
- Type: typing.Union[str, IResolvable]
The time zone.
get_att
import ros_cdk_core
ros_cdk_core.Fn.get_att(
logical_name_of_resource: str,
attribute_name: str
)
The Fn::GetAtt
intrinsic function returns the value of an attribute from a resource in the template.
logical_name_of_resource
Required
- Type: str
The logical name (also called logical ID) of the resource that contains the attribute that you want.
- Type: str
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.
get_azs
import ros_cdk_core
ros_cdk_core.Fn.get_azs(
region: str
)
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: str
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.
get_json_value
import ros_cdk_core
ros_cdk_core.Fn.get_json_value(
key: str,
json_data: typing.Any
)
- Type: str
- Type: typing.Any
get_stack_output
import ros_cdk_core
ros_cdk_core.Fn.get_stack_output(
stack_i_d: str,
output_key: str,
stack_region: str = None
)
The intrinsic function Fn::GetStackOutput
returns the value of an output exported by another stack.
- Type: str
- Type: str
- Type: str
indent
import ros_cdk_core
ros_cdk_core.Fn.indent(
str: typing.Union[str, IResolvable],
level: typing.Union[typing.Union[int, float], IResolvable],
indent: typing.Union[typing.Union[int, float], IResolvable] = None
)
The intrinsic function Fn::Indent adjust the indentation of the string.
- Type: typing.Union[str, IResolvable]
Strings that need to be indented.
- Type: typing.Union[typing.Union[int, float], IResolvable]
Indentation level.
The range is [0,20].
- Type: typing.Union[typing.Union[int, float], IResolvable]
Optional, defaults to 2 for two Spaces per level, in the range [0,4].
index
import ros_cdk_core
ros_cdk_core.Fn.index(
item_to_find_index: typing.Any,
item_list: typing.Union[typing.List[typing.Any], IResolvable]
)
Returns the index of the item in the list.
- Type: typing.Any
The item to find in the list.
- Type: typing.Union[typing.List[typing.Any], IResolvable]
The list to find the item in.
join
import ros_cdk_core
ros_cdk_core.Fn.join(
delimiter: str,
list_of_values: typing.List[typing.Union[str, 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: str
The value you want to occur between fragments.
The delimiter will occur between fragments only. It will not terminate the final value.
- Type: typing.List[typing.Union[str, IResolvable]]
The list of values you want combined.
jq
import ros_cdk_core
ros_cdk_core.Fn.jq(
method: str,
script: str,
input_string: typing.Union[str, typing.Mapping[typing.Any]]
)
- Type: str
- Type: str
- Type: typing.Union[str, typing.Mapping[typing.Any]]
length_of
import ros_cdk_core
ros_cdk_core.Fn.length_of(
obj: typing.Any
)
Returns the length of the object.
- Type: typing.Any
An object whose length needs to be computed.
Three types are supported: strings, lists, and dictionaries.
list_merge
import ros_cdk_core
ros_cdk_core.Fn.list_merge(
value_list: typing.List[typing.Union[typing.List[typing.Any], IResolvable]]
)
- Type: typing.List[typing.Union[typing.List[typing.Any], IResolvable]]
marketplace_image
import ros_cdk_core
ros_cdk_core.Fn.marketplace_image(
image_product_code: typing.Union[str, IResolvable]
)
The intrinsic function Fn::MarketplaceImage returns the default image ID of the specified cloud marketplace image product Code.
- Type: typing.Union[str, IResolvable]
The product code of the cloud marketplace image.
match_pattern
import ros_cdk_core
ros_cdk_core.Fn.match_pattern(
pattern: typing.Union[str, IResolvable],
value: typing.Union[str, IResolvable]
)
Returns true if a specified string matches a specified pattern.
- Type: typing.Union[str, IResolvable]
A regular expression in string form.
- Type: typing.Union[str, IResolvable]
The string to match.
max
import ros_cdk_core
ros_cdk_core.Fn.max(
values: typing.List[typing.Union[int, float]]
)
- Type: typing.List[typing.Union[int, float]]
merge_map_to_list
import ros_cdk_core
ros_cdk_core.Fn.merge_map_to_list(
map_list: typing.List[typing.Mapping[typing.List[typing.Any]]]
)
- Type: typing.List[typing.Mapping[typing.List[typing.Any]]]
min
import ros_cdk_core
ros_cdk_core.Fn.min(
values: typing.List[typing.Union[int, float]]
)
- Type: typing.List[typing.Union[int, float]]
ref
import ros_cdk_core
ros_cdk_core.Fn.ref(
logical_name: str
)
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: str
The logical name of a parameter/resource for which you want to retrieve its value.
replace
import ros_cdk_core
ros_cdk_core.Fn.replace(
replace_data: typing.Mapping[typing.Any],
content: str
)
- Type: typing.Mapping[typing.Any]
- Type: str
select
import ros_cdk_core
ros_cdk_core.Fn.select(
index: typing.Union[str, typing.Union[int, float]],
array: typing.Any
)
The intrinsic function Fn::Select
returns a single object from a list of objects by index.
- Type: typing.Union[str, typing.Union[int, float]]
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: typing.Any
The list of objects to select from.
This list must not be null, nor can it have null entries.
select_map_list
import ros_cdk_core
ros_cdk_core.Fn.select_map_list(
key: str,
map_list: typing.List[typing.Mapping[typing.Any]]
)
- Type: str
- Type: typing.List[typing.Mapping[typing.Any]]
split
import ros_cdk_core
ros_cdk_core.Fn.split(
delimiter: str,
source: str
)
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: str
A string value that determines where the source string is divided.
- Type: str
The string value that you want to split.
str
import ros_cdk_core
ros_cdk_core.Fn.str(
value: typing.Any
)
- Type: typing.Any
sub
import ros_cdk_core
ros_cdk_core.Fn.sub(
body: str,
variables: typing.Mapping[typing.Any] = None
)
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: str
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: typing.Mapping[typing.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.