Skip to content

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 "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Add(values interface{}) IResolvable

valuesRequired

  • Type: interface{}

Any

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Any(values interface{}) *string

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.

valuesRequired

  • Type: interface{}

An array of values.


Avg

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Avg(ndigits *f64, values *[]*f64) *f64

ndigitsRequired

  • Type: *f64

valuesRequired

  • Type: []f64

Base64Decode

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Base64Decode(data *string) *string

dataRequired

  • Type: *string

Base64Encode

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Base64Encode(data *string) *string

The intrinsic function Fn::Base64 returns the Base64 representation of the input string.

dataRequired

  • Type: *string

The string value you want to convert to Base64.


Calculate

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Calculate(values *string, ndigits *f64, para *[]*f64) *f64

valuesRequired

  • Type: *string

ndigitsRequired

  • Type: *f64

paraRequired

  • Type: []f64

Cidr

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Cidr(ipBlock interface{}, count interface{}, cidrBits interface{}) *string

Returns a list of CIDR addresses.

ipBlockRequired

  • Type: interface{}

The IP address block from which you want to allocate the CIDR.

The block must be expressed in CIDR notation.


countRequired

  • Type: interface{}

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.


cidrBitsRequired

  • Type: interface{}

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 "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_ConditionAnd(conditions interface{}) 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.

conditionsRequired

  • Type: interface{}

conditions to AND.


ConditionEquals

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_ConditionEquals(lhs interface{}, rhs interface{}) IRosConditionExpression

Compares if two values are equal.

Returns true if the two values are equal or false if they aren't.

lhsRequired

  • Type: interface{}

A value of any type that you want to compare.


rhsRequired

  • Type: interface{}

A value of any type that you want to compare.


ConditionIf

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_ConditionIf(conditionId interface{}, valueIfTrue interface{}, valueIfFalse interface{}) interface{}

Returns one value if the specified condition evaluates to true and another value if the specified condition evaluates to false.

conditionIdRequired

  • Type: interface{}

A reference to a condition in the Conditions section.

Use the condition's name to reference it.


valueIfTrueRequired

  • Type: interface{}

A value to be returned if the specified condition evaluates to true.


valueIfFalseRequired

  • Type: interface{}

A value to be returned if the specified condition evaluates to false.


ConditionNot

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_ConditionNot(condition interface{}) 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.

conditionRequired

  • Type: interface{}

A condition such as Fn::Equals that evaluates to true or false.


ConditionOr

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_ConditionOr(conditions interface{}) 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.

conditionsRequired

  • Type: interface{}

conditions that evaluates to true or false.


Contains

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Contains(values interface{}, value interface{}) *string

Returns true if at least one member of the list matches the specified value and false otherwise.

valuesRequired

  • Type: interface{}

An array of values.


valueRequired

  • Type: interface{}

A value.


EachMemberIn

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_EachMemberIn(values1 interface{}, values2 interface{}) *string

Returns true if every member of the first list is equal to at least one value in the second list, and false otherwise.

values1Required

  • Type: interface{}

An array of values.


values2Required

  • Type: interface{}

An array of values.


FindInMap

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_FindInMap(mapName *string, topLevelKey *string, secondLevelKey *string) IResolvable

The intrinsic function Fn::FindInMap returns the value corresponding to keys in a two-level map that is declared in the Mappings section.

mapNameRequired

  • Type: *string

topLevelKeyRequired

  • Type: *string

secondLevelKeyRequired

  • Type: *string

FormatTime

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_FormatTime(format interface{}, timeZone interface{}) *string

Returns the formatted time of the object.

formatRequired

  • Type: interface{}

The format of the time.


timeZoneRequired

  • Type: interface{}

The time zone.


GetAtt

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_GetAtt(logicalNameOfResource *string, attributeName *string) IResolvable

The Fn::GetAtt intrinsic function returns the value of an attribute from a resource in the template.

logicalNameOfResourceRequired

  • Type: *string

The logical name (also called logical ID) of the resource that contains the attribute that you want.


attributeNameRequired

  • 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 "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_GetAzs(region *string) *[]*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.

regionRequired

  • 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 "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_GetJsonValue(key *string, jsonData interface{}) *string

keyRequired

  • Type: *string

jsonDataRequired

  • Type: interface{}

GetStackOutput

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_GetStackOutput(stackID *string, outputKey *string, stackRegion *string) IResolvable

The intrinsic function Fn::GetStackOutput returns the value of an output exported by another stack.

stackIDRequired

  • Type: *string

outputKeyRequired

  • Type: *string

stackRegionOptional

  • Type: *string

Indent

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Indent(str interface{}, level interface{}, indent interface{}) *string

The intrinsic function Fn::Indent adjust the indentation of the string.

strRequired

  • Type: interface{}

Strings that need to be indented.


levelRequired

  • Type: interface{}

Indentation level.

The range is [0,20].


indentOptional

  • Type: interface{}

Optional, defaults to 2 for two Spaces per level, in the range [0,4].


Index

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Index(itemToFindIndex interface{}, itemList interface{}) *string

Returns the index of the item in the list.

itemToFindIndexRequired

  • Type: interface{}

The item to find in the list.


itemListRequired

  • Type: interface{}

The list to find the item in.


Join

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Join(delimiter *string, listOfValues *[]interface{}) *string

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.

delimiterRequired

  • Type: *string

The value you want to occur between fragments.

The delimiter will occur between fragments only. It will not terminate the final value.


listOfValuesRequired

  • Type: *[]interface{}

The list of values you want combined.


Jq

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Jq(method *string, script *string, inputString interface{}) IResolvable

methodRequired

  • Type: *string

scriptRequired

  • Type: *string

inputStringRequired

  • Type: interface{}

LengthOf

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_LengthOf(obj interface{}) *string

Returns the length of the object.

objRequired

  • Type: interface{}

An object whose length needs to be computed.

Three types are supported: strings, lists, and dictionaries.


ListMerge

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_ListMerge(valueList *[]interface{}) IResolvable

valueListRequired

  • Type: *[]interface{}

MarketplaceImage

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_MarketplaceImage(imageProductCode interface{}) *string

The intrinsic function Fn::MarketplaceImage returns the default image ID of the specified cloud marketplace image product Code.

imageProductCodeRequired

  • Type: interface{}

The product code of the cloud marketplace image.


MatchPattern

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_MatchPattern(pattern interface{}, value interface{}) *string

Returns true if a specified string matches a specified pattern.

patternRequired

  • Type: interface{}

A regular expression in string form.


valueRequired

  • Type: interface{}

The string to match.


Max

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Max(values *[]*f64) *f64

valuesRequired

  • Type: []f64

MergeMapToList

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_MergeMapToList(mapList *[]*map[string]*[]interface{}) IResolvable

mapListRequired

  • Type: []map[string]*[]interface{}

Min

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Min(values *[]*f64) *f64

valuesRequired

  • Type: []f64

Ref

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Ref(logicalName *string) *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.

logicalNameRequired

  • Type: *string

The logical name of a parameter/resource for which you want to retrieve its value.


Replace

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Replace(replaceData *map[string]interface{}, content *string) *string

replaceDataRequired

  • Type: *map[string]interface{}

contentRequired

  • Type: *string

Select

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Select(index interface{}, array interface{}) IResolvable

The intrinsic function Fn::Select returns a single object from a list of objects by index.

indexRequired

  • Type: interface{}

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.


arrayRequired

  • Type: interface{}

The list of objects to select from.

This list must not be null, nor can it have null entries.


SelectMapList

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_SelectMapList(key *string, mapList *[]*map[string]interface{}) IResolvable

keyRequired

  • Type: *string

mapListRequired

  • Type: []map[string]interface{}

Split

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Split(delimiter *string, source *string) *[]*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.

delimiterRequired

  • Type: *string

A string value that determines where the source string is divided.


sourceRequired

  • Type: *string

The string value that you want to split.


Str

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Str(value interface{}) *string

valueRequired

  • Type: interface{}

Sub

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Fn_Sub(body *string, variables *map[string]interface{}) *string

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.

bodyRequired

  • 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.


variablesOptional

  • Type: *map[string]interface{}

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.