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

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Add(object Values);

ValuesRequired

  • Type: object

Any

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Any(object 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.

ValuesRequired

  • Type: object

An array of values.


Avg

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Avg(double Ndigits, double[] Values);

NdigitsRequired

  • Type: double

ValuesRequired

  • Type: double[]

Base64Decode

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Base64Decode(string Data);

DataRequired

  • Type: string

Base64Encode

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Base64Encode(string Data);

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

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Calculate(string Values, double Ndigits, double[] Para);

ValuesRequired

  • Type: string

NdigitsRequired

  • Type: double

ParaRequired

  • Type: double[]

Cidr

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Cidr(object IpBlock, object Count, object CidrBits);

Returns a list of CIDR addresses.

IpBlockRequired

  • Type: object

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

The block must be expressed in CIDR notation.


CountRequired

  • Type: object

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: object

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

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.ConditionAnd(object 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.

ConditionsRequired

  • Type: object

conditions to AND.


ConditionEquals

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.ConditionEquals(object Lhs, object Rhs);

Compares if two values are equal.

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

LhsRequired

  • Type: object

A value of any type that you want to compare.


RhsRequired

  • Type: object

A value of any type that you want to compare.


ConditionIf

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.ConditionIf(object ConditionId, object ValueIfTrue, object ValueIfFalse);

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

ConditionIdRequired

  • Type: object

A reference to a condition in the Conditions section.

Use the condition's name to reference it.


ValueIfTrueRequired

  • Type: object

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


ValueIfFalseRequired

  • Type: object

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


ConditionNot

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.ConditionNot(object 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.

ConditionRequired

  • Type: object

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


ConditionOr

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.ConditionOr(object 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.

ConditionsRequired

  • Type: object

conditions that evaluates to true or false.


Contains

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Contains(object Values, object Value);

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

ValuesRequired

  • Type: object

An array of values.


ValueRequired

  • Type: object

A value.


EachMemberIn

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.EachMemberIn(object Values1, object Values2);

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: object

An array of values.


Values2Required

  • Type: object

An array of values.


FindInMap

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.FindInMap(string MapName, string TopLevelKey, 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.

MapNameRequired

  • Type: string

TopLevelKeyRequired

  • Type: string

SecondLevelKeyRequired

  • Type: string

FormatTime

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.FormatTime(object Format, object TimeZone);

Returns the formatted time of the object.

FormatRequired

  • Type: object

The format of the time.


TimeZoneRequired

  • Type: object

The time zone.


GetAtt

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.GetAtt(string LogicalNameOfResource, string AttributeName);

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

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.GetAzs(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.

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

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.GetJsonValue(string Key, object JsonData);

KeyRequired

  • Type: string

JsonDataRequired

  • Type: object

GetStackOutput

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.GetStackOutput(string StackID, string OutputKey, string StackRegion = null);

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

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Indent(object Str, object Level, object Indent = null);

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

StrRequired

  • Type: object

Strings that need to be indented.


LevelRequired

  • Type: object

Indentation level.

The range is [0,20].


IndentOptional

  • Type: object

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


Index

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Index(object ItemToFindIndex, object ItemList);

Returns the index of the item in the list.

ItemToFindIndexRequired

  • Type: object

The item to find in the list.


ItemListRequired

  • Type: object

The list to find the item in.


Join

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Join(string Delimiter, object[] 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.

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: object[]

The list of values you want combined.


Jq

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Jq(string Method, string Script, object InputString);

MethodRequired

  • Type: string

ScriptRequired

  • Type: string

InputStringRequired

  • Type: object

LengthOf

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.LengthOf(object Obj);

Returns the length of the object.

ObjRequired

  • Type: object

An object whose length needs to be computed.

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


ListMerge

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.ListMerge(object[] ValueList);

ValueListRequired

  • Type: object[]

MarketplaceImage

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.MarketplaceImage(object ImageProductCode);

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

ImageProductCodeRequired

  • Type: object

The product code of the cloud marketplace image.


MatchPattern

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.MatchPattern(object Pattern, object Value);

Returns true if a specified string matches a specified pattern.

PatternRequired

  • Type: object

A regular expression in string form.


ValueRequired

  • Type: object

The string to match.


Max

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Max(double[] Values);

ValuesRequired

  • Type: double[]

MergeMapToList

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.MergeMapToList(System.Collections.Generic.IDictionary<string, object[]>[] MapList);

MapListRequired

  • Type: System.Collections.Generic.IDictionary[]

Min

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Min(double[] Values);

ValuesRequired

  • Type: double[]

Ref

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Ref(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.

LogicalNameRequired

  • Type: string

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


Replace

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Replace(System.Collections.Generic.IDictionary<string, object> ReplaceData, string Content);

ReplaceDataRequired

  • Type: System.Collections.Generic.IDictionary

ContentRequired

  • Type: string

Select

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Select(object Index, object Array);

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

IndexRequired

  • Type: object

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: object

The list of objects to select from.

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


SelectMapList

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.SelectMapList(string Key, System.Collections.Generic.IDictionary<string, object>[] MapList);

KeyRequired

  • Type: string

MapListRequired

  • Type: System.Collections.Generic.IDictionary[]

Split

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Split(string Delimiter, 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.

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

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Str(object Value);

ValueRequired

  • Type: object

Sub

using AlibabaCloud.SDK.ROS.CDK.Core;
Fn.Sub(string Body, System.Collections.Generic.IDictionary<string, object> Variables = null);

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: System.Collections.Generic.IDictionary

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.