All Products
Search
Document Center

Server Load Balancer:CreateAScripts

Last Updated:Jun 10, 2026

Membuat skrip.

Deskripsi operasi

Prerequisites

  • You have created a standard edition or WAF-enhanced edition ALB instance. For more information, see CreateLoadBalancer.

Usage

CreateAScripts is an asynchronous operation. After you send a request, the system returns a request ID, but the programmable script is not created immediately because the creation task runs in the background. You can call ListAScripts to query the creation status of the programmable script:

  • If the programmable script is in the Creating state, it is being created.

  • If the programmable script is in the Available state, it has been created.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

alb:CreateAScripts

create

*LoadBalancer

acs:alb:{#regionId}:{#accountId}:loadbalancer/{#loadbalancerId}

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

ClientToken

string

No

Token klien yang digunakan untuk memastikan idempotensi permintaan.

Anda dapat menggunakan klien untuk menghasilkan nilai, tetapi Anda harus memastikan nilai tersebut unik di antara permintaan yang berbeda. Token hanya dapat berisi karakter ASCII.

5A2CFF0E-5718-45B5-9D4D-70B******

DryRun

boolean

No

Apakah akan menjalankan dry run. Nilai valid:

  • true: menjalankan dry run tanpa membuat AScript. Sistem memeriksa permintaan untuk parameter yang diperlukan, validitas format, dan batas layanan. Jika permintaan gagal pemeriksaan, Paket kesalahan akan dikembalikan. Jika permintaan lulus pemeriksaan, kode kesalahan DryRunOperation akan dikembalikan.

  • false (default): mengirim permintaan normal. Setelah permintaan lulus pemeriksaan, sistem mengembalikan kode status HTTP 2xx dan menjalankan operasi.

false

ListenerId

string

Yes

ID Pendengar daftar.

lsn-6hfq3zs0x04ibn****

AScripts

array<object>

No

AScripts yang akan dibuat.

array<object>

No

An AScript configuration.

AScriptName

string

Yes

The name of the AScript.

The name must be 2 to 128 characters long, and must start with a letter, a digit, or a Chinese character. It can contain digits, periods (.), underscores (_), hyphens (-), and spaces.

test

Position

string

No

Specifies when the AScript is executed. Valid values:

  • RequestHead (default): Executes before request rules.

  • RequestFoot: Executes after request rules.

  • ResponseHead: Executes before response rules.

RequestFoot

Enabled

boolean

No

Specifies whether the AScript is enabled. Valid values:

  • true: Enabled.

  • false (default): Disabled.

false

ScriptContent

string

Yes

The content of the AScript.

if and(match_re($uri, '^/1.txt$'), $arg_type) { rewrite(concat('/1.', $arg_type), 'break') }

ExtAttributes

array<object>

No

The extended attributes.

object

No

AttributeKey

string

No

The attribute key.

The only valid value is EsDebug. If a request contains the _es_dbg parameter and its value matches the secret key specified in AttributeValue, the system adds a debug header to the response, which contains rule execution logs.

EsDebug

AttributeValue

string

No

The attribute value, which is used as the secret key for the EsDebug attribute. The value must be 1 to 128 characters long and can contain uppercase letters, lowercase letters, and digits.

test123

ExtAttributeEnabled

boolean

No

Specifies whether to enable extended attributes for the AScript. Valid values:

  • true: Enabled.

  • false (default): Disabled.

true

Elemen respons

Element

Type

Description

Example

object

The response data.

JobId

string

The ID of the asynchronous task.

5c607642-535e-4e06-9d77-df53049b****

RequestId

string

The ID of the request.

BF0FE763-9603-558F-A55B-0F4******

AScriptIds

array<object>

A list of programmable script IDs.

object

The programmable script ID.

AScriptId

string

The ID of the programmable script.

as-xvq5igaa7uv6vr****

Contoh

Respons sukses

JSONformat

{
  "JobId": "5c607642-535e-4e06-9d77-df53049b****",
  "RequestId": "BF0FE763-9603-558F-A55B-0F4******",
  "AScriptIds": [
    {
      "AScriptId": "as-xvq5igaa7uv6vr****"
    }
  ]
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 IncorrectStatus.Listener The status of %s [%s] is incorrect.
400 ResourceQuotaExceeded.AScriptsNum The quota of %s is exceeded for resource %s, usage %s/%s.
400 ResourceQuotaExceeded.AScriptsTotalLinesNum The quota of %s is exceeded for resource %s, usage %s/%s.
400 ResourceQuotaExceeded.AScriptLinesNum The quota of %s is exceeded for resource %s, usage %s/%s.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.