set_variable
Version: v2025-01-13 | Includes use: Yes |
---|
Behavior name: Set Variable
Modify a variable to insert into subsequent fields within the rule tree. Use this behavior to specify the pre-declared variable_name
and determine from where to derive its new value.
Based on the value_source
, you can either generate the value; extract it from some part of the incoming request; assign it from another variable, including a set of built-in system variables; or directly specify its text. Optionally, choose a transform
function to modify the value once.
For more information, see Support for variables.
Default behavior
These samples reflect the behavior's default settings. You can use these as is in your configurations or make adjustments based on the behavior's available options.
data "akamai_property_rules_builder" "set_variable" {
rules_v2025_02_18 {
name = "Set Variable"
comments = "Modify a variable to insert into subsequent fields within the rule tree."
behavior {
set_variable {
variable_name = ""
value_source = "EXPRESSION"
variable_value = ""
transform = "NONE"
}
}
}
}
"behaviors": [
{
"name": "setVariable",
"options": {
"variablename": "",
"valueSource": "EXPRESSION",
"variableValue": "",
"transform": "NONE"
}
}
]
Options
Option | Description |
---|---|
variable_name |
Specifies the pre-declared root name of the variable to modify. When you declare a variable name such as
VAR its name is preprended with PMUSER_ and accessible in a user namespace, so that you invoke it in subsequent text fields within the rule tree as {{user.PMUSER_VAR}} . In deployed XML metadata, it appears as %(PMUSER_VAR) .
|
value_source |
Determines how you want to set the value. Value is one of:
|
variable_value |
This directly specifies the value to assign to the variable. The expression may include a mix of static text and other variables, such as
new_filename.{{builtin.AK_EXTENSION}} to embed a system variable.
|
extract_location |
This specifies from where to get the value. Value is one of:
|
certificate_field_name |
Specifies the certificate's content. Value is one of:
|
header_name |
Specifies the case-insensitive name of the HTTP header to extract.
|
response_header_name |
Specifies the case-insensitive name of the HTTP header to extract.
|
set_cookie_name |
Specifies the name of the origin's
Set-Cookie response header.
|
cookie_name |
Specifies the name of the cookie to extract.
|
location_id |
Specifies the
X-Akamai-Edgescape header's field name. Possible values specify basic geolocation, various geographic standards, and information about the client's network. For details on EdgeScape header fields, see the EdgeScape User Guide. Value is one of:
|
path_component_offset |
This specifies a portion of the path. The indexing starts from
1 so a value of /path/to/nested/filename.html and an offset of 1 yields path and 3 yields nested / Negative indexes offset from the right, so -2 also yields nested .
|
query_parameter_name |
Specifies the name of the query parameter from which to extract the value.
|
generator |
This specifies the type of value to generate. Value is one of:
|
number_of_bytes |
Specifies the number of random hex bytes to generate. Value range is
1 -16 .
|
min_random_number |
Specifies the lower bound of the random number.
|
max_random_number |
Specifies the upper bound of the random number.
|
transform |
Specifies a function to transform the value. For more details on each transform function, see Set Variable: Operations. Value is one of:
|
operand_one |
Specifies an additional operand.
|
algorithm |
Specifies the algorithm to apply. Value is one of:
|
encryption_key |
Specifies the encryption hex key.
|
initialization_vector |
Specifies a one-time number as an initialization vector.
|
encryption_mode |
Specifies the encryption mode. Value is one of:
|
nonce |
Specifies the one-time number used for encryption.
|
prepend_bytes |
Specifies a number of random bytes to prepend to the key.
|
format_string |
Specifies an optional format string for the conversion, using format codes such as
%m/%d/%y as specified by strftime . A blank value defaults to RFC-2616 format.
|
param_name |
Extracts the value for the specified parameter name from a string that contains key/value pairs. Use
separator below to parse them.
|
separator |
Specifies the character that separates pairs of values within the string.
|
min |
Specifies a minimum value for the generated integer.
|
max |
Specifies a maximum value for the generated integer.
|
hmac_key |
Specifies the secret to use in generating the base64-encoded digest.
|
hmac_algorithm |
Specifies the algorithm to use to generate the base64-encoded digest. Value is one of:
|
ip_version |
Specifies which IP version a subnet mask generates. Value is one of:
|
ipv6Prefix |
Specifies the prefix of the IPV6 address. Value range is
0 -128 .
|
ipv4Prefix |
Specifies the prefix of the IPV4 address. Value range is
0 -32 .
|
sub_string |
Specifies a substring for which the returned value represents a zero-based offset of where it appears in the original string, or
-1 if there's no match.
|
regex |
Specifies the regular expression pattern (PCRE) to match the value.
|
replacement |
Specifies the replacement string. Reinsert grouped items from the match into the replacement using a $ followed by a number. For example, $1
|
case_sensitive |
Enabling this makes all matches case sensitive.
|
global_substitution |
Replaces all matches in the string, not just the first.
|
start_index |
Specifies the zero-based character offset at the start of the substring. Negative indexes specify the offset from the end of the string.
|
end_index |
Specifies the zero-based character offset at the end of the substring, without including the character at that index position. Negative indexes specify the offset from the end of the string.
|
except_chars |
Specifies characters not to encode, possibly overriding the default set.
|
force_chars |
Specifies characters to encode, possibly overriding the default set.
|
device_profile |
Specifies the client device attribute. Possible values specify information about the client device, including device type, size and browser. Value is one of:
|
Updated 7 minutes ago