ALIYUN::ROS::Assert は、アサーションを作成するために使用されます。アサーションは条件を評価するために使用され、さまざまな操作タイプをサポートします。アサーション結果は false の場合、アサーションは作成を終了してエラーメッセージを返すかどうかを決定します。
構文
{
"Type": "ALIYUN::ROS::Assert",
"Properties": {
"Values": List,
"AbortCreation": Boolean,
"ErrorMessage": String,
"Operation": String
}
}プロパティ
プロパティ | タイプ | 必須 | 編集可能 | 説明 | 制約 |
Values | リスト | はい | いいえ | 評価されるアサーション。 | アサーションは順番に評価されます。最大 3 つの Assertion を指定できます。 説明 Operation が Equal または NotEqual に設定されている場合のみ、3 つの Assertion を指定できます。 Operation が Not に設定されている場合のみ、1 つの Assertion を指定できます。 |
AbortCreation | ブール値 | いいえ | いいえ | アサーション結果が false の場合に作成を終了するかどうかを指定します。 | デフォルト値:True。 |
ErrorMessage | 文字列 | いいえ | いいえ | アサーション結果が false の場合に返されるエラーメッセージ。 | なし。 |
Operation | 文字列 | いいえ | いいえ | アサーションの操作タイプ。 | 有効値:
|
戻り値
Fn::GetAtt
Result: アサーションの結果。
FailureCause: アサーション結果が false である理由。
例
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
Values:
Type: Json
Description:
en: |-
A list of values to assert. The items in the list are compared in order. The range of length is one to three.
- Three values are supported only if the operation is Equal or NotEqual.
- One value is supported only if the operation is Not.
Required: true
MinLength: 1
MaxLength: 3
Resources:
Assert:
Type: ALIYUN::ROS::Assert
Properties:
Values:
Ref: Values
Outputs:
Result:
Description: The result of the assert.
Value:
Fn::GetAtt:
- Assert
- Result
FailureCause:
Description: The reason the assertion failed
Value:
Fn::GetAtt:
- Assert
- FailureCause
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"Values": {
"Type": "Json",
"Description": {
"en": "A list of values to assert. The items in the list are compared in order. The range of length is one to three. \n- Three values are supported only if the operation is Equal or NotEqual.\n- One value is supported only if the operation is Not."
},
"Required": true,
"MinLength": 1,
"MaxLength": 3
}
},
"Resources": {
"Assert": {
"Type": "ALIYUN::ROS::Assert",
"Properties": {
"Values": {
"Ref": "Values"
}
}
}
},
"Outputs": {
"Result": {
"Description": "アサーションの結果。",
"Value": {
"Fn::GetAtt": [
"Assert",
"Result"
]
}
},
"FailureCause": {
"Description": "アサーションが失敗した理由",
"Value": {
"Fn::GetAtt": [
"Assert",
"FailureCause"
]
}
}
}
}