set-variable
set-variable ポリシーを使用して、ランタイム変数をストリング値に設定したり、ランタイム変数の追加やクリアを行ったりします。
set-variable ポリシーの形式は次のとおりです。
- set-variable:
title: title
description: description
actions:
- action_type: variable_name
value: value
プロパティー | 必須 | 説明 | データ型 |
---|---|---|---|
title | いいえ | ポリシーのタイトル。 | ストリング |
description | いいえ | ポリシーの説明。 | ストリング |
action_type | はい | ランタイム変数に関して適用するアクションを定義します。 有効は値は以下のとおりです。
|
ストリング |
variable_name | はい | ストリング値に設定する変数の名前か、追加またはクリアする変数の名前を指定します。 | ストリング |
value | はい* | この値を指定した変数に割り振ります。リテラル値か、別の変数を指定できます。 * 変数値が必要となるのは、set または add がアクションとして指定されている場合のみです。 |
ストリング |
例 1
# clear a variable
set-variable:
title: clear_region
actions:
- clear: message.headers.region
例 2
# set a variable to the value of an API Gateway context variable
set-variable:
title: set content type
actions:
- set: message.headers.contenttype
value: $(message.headers.content-type)