Application types
The types the azion/applications module exports, with the payloads each function takes and the list parameters each collection accepts.
The azion/applications module exports these types, except where a type says otherwise. Import them with import type.
AzionApplicationsClient
The client that createAzionApplicationClient returns. Each method takes one object.
| Method | Argument | Returns |
|---|---|---|
createApplication | { data: ApiCreateApplicationPayload; options?: AzionClientOptions } | Promise<AzionApplicationResponse<AzionApplication>> |
getApplication | { applicationId: number; options?: AzionClientOptions } | Promise<AzionApplicationResponse<AzionApplication>> |
getApplications | { params?: AzionApplicationCollectionOptions; options?: AzionClientOptions } | Promise<AzionApplicationCollectionResponse<AzionApplication>> |
putApplication | { applicationId: number; data: ApiUpdateApplicationPayload; options?: AzionClientOptions } | Promise<AzionApplicationResponse<AzionApplication>> |
patchApplication | { applicationId: number; data: Partial<ApiUpdateApplicationPayload>; options?: AzionClientOptions } | Promise<AzionApplicationResponse<AzionApplication>> |
deleteApplication | { applicationId: number; options?: AzionClientOptions } | Promise<AzionApplicationResponse<void>> |
CreateAzionApplicationClient
The type of createAzionApplicationClient.
AzionClientOptions
Request options that every function takes in options.
| Property | Type | Required | Description |
|---|---|---|---|
debug | boolean | No | Turns on debug mode. |
force | boolean | No | Declared by the type. No sample on this page uses it. |
AzionApplicationResponse
The envelope that every function except the list functions returns. For how to read it, refer to Response envelope.
| Property | Type | Required | Description |
|---|---|---|---|
data | T | No | The result of the call. |
error | { message: string; operation: string } | No | The error message and the operation that failed. A successful delete also fills it. |
AzionApplicationCollectionResponse
The envelope that the list functions return.
| Property | Type | Required | Description |
|---|---|---|---|
data | { count; total_pages; schema_version; links; results } | No | The page of results. |
data.count | number | Yes | The number of objects in the whole list, not on the page. |
data.total_pages | number | Yes | The number of pages. |
data.schema_version | number | Yes | The schema version of the API response. |
data.links | { previous: string | null; next: string | null } | Yes | The previous and next pages. |
data.results | T[] | Yes | The objects on the page. |
error | { message: string; operation: string } | No | The error message and the operation that failed. |
AzionApplication
An application: the fields of ApiBaseApplicationPayload, plus the ID and the application methods. AzionApplicationSettings is the same shape without the methods.
| Property | Type | Required | Description |
|---|---|---|---|
id | number | Yes | The ID of the application. |
origins | OriginOperations | Yes | The origin methods. |
cache | CacheOperations | Yes | The cache setting methods. |
devices | DeviceGroupOperations | Yes | The device group methods. |
functions | FunctionOperations | Yes | The function instance methods. |
rules | { request: RuleOperations; response: RuleOperations } | Yes | The rule methods, one set per phase. |
ApiBaseApplicationPayload
The settings of an application. name is required and every other field is optional. ApiCreateApplicationPayload, which the module does not export, has the same shape, and ApiUpdateApplicationPayload makes every field optional. API v3 refuses application_acceleration in a create request.
The enums of the application settings, which the module exports:
ApiListApplicationsParams
Pagination and ordering for getApplications. AzionApplicationCollectionOptions, which the client method takes, has the same keys.
| Property | Type | Required | Description |
|---|---|---|---|
page | number | No | The page number. |
page_size | number | No | The number of applications per page. |
sort | 'name' | 'id' | No | Declared by the type. No sample on this page uses it. |
order_by | string | No | Declared by the type. No sample on this page uses it. |
AzionOrigin
An origin, with its origin_key. ApiCreateOriginPayload takes every field below except id and method, all required, plus optional origin_path, hmac_authentication, hmac_region_name, hmac_access_key, hmac_secret_key, connection_timeout, and timeout_between_bytes. ApiUpdateOriginRequest makes every field optional and requires id.
The enums of an origin, which the module does not export:
AzionCacheSetting
A cache setting: the fields of ApiBaseCacheSettingPayload, plus its id (number).
ApiBaseCacheSettingPayload
The settings of a cache setting. name is required and every other field is optional. ApiUpdateCacheSettingPayload makes every field optional.
The enums of a cache setting, which the module does not export:
AzionDeviceGroup
A device group. ApiCreateDeviceGroupPayload and ApiUpdateDeviceGroupPayload, which the module does not export, take name and user_agent, both required on create and optional on update.
| Property | Type | Required | Description |
|---|---|---|---|
id | number | Yes | The ID of the device group. |
name | string | Yes | The name of the group, with no spaces and no hyphens. |
user_agent | string | Yes | The regular expression compared with the User-Agent request header. |
AzionFunctionInstance
A function instance. The API returns the four fields below, as the samples show.
| Property | Type | Description |
|---|---|---|
id | number | The ID of the function instance. |
edge_function_id | number | The ID of the function the instance runs. |
name | string | The name of the function instance. |
args | Record<string, unknown> | The arguments the function receives. |
The type declares other fields: id plus the fields of ApiBaseFunctionInstancePayload, which are name, code, language ('JavaScript'), initiator_type ('edge_application' \| 'edge_firewall'), active, and json_args. ApiUpdateFunctionInstancePayload makes those fields optional.
ApiCreateFunctionInstancePayload
The payload of createFunctionInstance. The module does not export this type.
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The name of the function instance. |
edge_function_id | number | Yes | The ID of the function the instance runs. |
args | Record<string, unknown> | Yes | The arguments the function receives. |
active | boolean | No | Declared by the type. No sample on this page uses it. |
AzionRule
A rule: the fields of ApiCreateRulePayload, plus id (number). AzionRule declares is_active and order as required, and every rule in the samples carries both.
ApiCreateRulePayload
The payload of createRule. ApiUpdateRulePayload makes every field optional.
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The name of the rule. |
phase | 'request' | 'response' | Yes | The phase of the rule. |
criteria | Criterion[][] | Yes | The condition groups. Each Criterion holds variable (string), operator (string), conditional ('if' | 'and' | 'or'), and input_value (string). |
behaviors | Behavior[] | Yes | The actions. Each Behavior holds name (string) and an optional target: a string, null, or { captured_array: string; subject: string; regex: string }. |
is_active | boolean | No | Whether the rule is active. A rule created without it is active. |
order | number | No | The position of the rule in its phase. |
description | string | No | The description of the rule. |
List parameters
The params object of each sub-resource list function declares these keys. The samples send only page and page_size. ApiListDeviceGroupsParams is not exported.
| Type | Declared keys |
|---|---|
ApiListOriginsParams | page, page_size, sort ('name' | 'id'), order ('asc' | 'desc'), filter |
ApiListCacheSettingsParams | page, page_size, sort ('name' | 'id'), order ('asc' | 'desc') |
ApiListDeviceGroupsParams | page, page_size, sort ('name' | 'id'), order ('asc' | 'desc') |
ApiListFunctionInstancesParams | page, page_size, sort ('name' | 'id'), order ('asc' | 'desc'), order_by, filter |
ApiListRulesParams | page, page_size, sort (string), order ('asc' | 'desc'), filter |