Creates a programmable script.
Operation description
Before you begin
Create a Standard Edition or WAF-enhanced ALB instance. For more information, see CreateLoadBalancer.
Usage notes
CreateAScripts is an asynchronous operation. After a request is sent, the system returns a request ID, but the programmable script is not yet created. The creation task continues in the background. Call ListAScripts to query the creation status of the programmable script:
-
If the programmable script is in the Creating state, the script is being created.
-
If the programmable script is in the Available state, the script is created successfully.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
alb:CreateAScripts |
create |
*LoadBalancer
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ClientToken |
string |
No |
The client token used to ensure the idempotence of the request. Generate a unique value from your client for each request. ClientToken supports only ASCII characters. |
5A2CFF0E-5718-45B5-9D4D-70B****** |
| DryRun |
boolean |
No |
Specifies whether to perform a dry run. Valid values:
|
false |
| ListenerId |
string |
Yes |
The listener ID. |
lsn-6hfq3zs0x04ibn**** |
| AScripts |
array<object> |
No |
The list of programmable script information. |
|
|
array<object> |
No |
The programmable script information. |
||
| AScriptName |
string |
Yes |
The name of the programmable script. The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), hyphens (-), and spaces. It must start with a letter, Chinese character, or digit. |
test |
| Position |
string |
No |
The execution position of the programmable script. Valid values:
|
RequestFoot |
| Enabled |
boolean |
No |
Specifies whether to enable the programmable script. Valid values:
|
false |
| ScriptContent |
string |
Yes |
The content of the programmable script. |
if and(match_re($uri, '^/1.txt$'), $arg_type) { rewrite(concat('/1.', $arg_type), 'break') } |
| ExtAttributes |
array<object> |
No |
The extended attributes. |
|
|
object |
No |
The extended attribute information of the programmable script. |
||
| AttributeKey |
string |
No |
The attribute key of the AScript script. Valid values: EsDebug only. When a request carries the _es_dbg parameter and its value matches the key configured here, the corresponding debug response headers are enabled to output rule execution records. |
EsDebug |
| AttributeValue |
string |
No |
The attribute value. The value can contain uppercase and lowercase letters and digits, and must be 1 to 128 characters in length. |
test123 |
| ExtAttributeEnabled |
boolean |
No |
Specifies whether to enable the extended attributes of the programmable script. Valid values:
|
true |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response for creating a programmable script. |
||
| JobId |
string |
The asynchronous task ID. |
5c607642-535e-4e06-9d77-df53049b**** |
| RequestId |
string |
The request ID. |
BF0FE763-9603-558F-A55B-0F4****** |
| AScriptIds |
array<object> |
The list of programmable script IDs. |
|
|
object |
The programmable script ID. |
||
| AScriptId |
string |
The programmable script ID. |
as-xvq5igaa7uv6vr**** |
Examples
Success response
JSON format
{
"JobId": "5c607642-535e-4e06-9d77-df53049b****",
"RequestId": "BF0FE763-9603-558F-A55B-0F4******",
"AScriptIds": [
{
"AScriptId": "as-xvq5igaa7uv6vr****"
}
]
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | IncorrectStatus.Listener | The status of %s [%s] is incorrect. | This operation is not supported in the listener's current state. |
| 400 | ResourceQuotaExceeded.AScriptsNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The quota %s has been exceeded. The current usage is %s, and the quota is %s. |
| 400 | ResourceQuotaExceeded.AScriptsTotalLinesNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The quota %s has been exceeded. The current usage is %s, and the quota is %s. |
| 400 | ResourceQuotaExceeded.AScriptLinesNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The quota %s has been exceeded. The current usage is %s, and the quota is %s. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.