azion
Version:
Azion Packages for Edge Computing.
1,648 lines (1,647 loc) • 192 kB
JavaScript
import { create as X, all as Z } from "mathjs";
import j from "ajv";
import x from "ajv-errors";
import L from "ajv-keywords";
const A = [
"args",
"device_group",
"domain",
"geoip_city",
"geoip_city_continent_code",
"geoip_city_country_code",
"geoip_city_country_name",
"geoip_continent_code",
"geoip_country_code",
"geoip_country_name",
"geoip_region",
"geoip_region_name",
"host",
"remote_addr",
"remote_port",
"remote_user",
"request",
"request_body",
"request_method",
"request_uri",
"scheme",
"uri"
], J = ["server_addr", "server_port"], ee = [
"ssl_client_fingerprint",
"ssl_client_escaped_cert",
"ssl_client_s_dn",
"ssl_client_s_dn_parsed",
"ssl_client_cert",
"ssl_client_i_dn",
"ssl_client_serial",
"ssl_client_v_end",
"ssl_client_v_remain",
"ssl_client_v_start",
"ssl_client_verify"
], te = [
"sent_http_name",
"status",
"tcpinfo_rtt",
"upstream_addr",
"upstream_status"
], re = ["cookie_time_offset", "encode_base64"], S = [...A, ...J, ...ee], C = [...A, ...te], c = [
"is_equal",
"is_not_equal",
"starts_with",
"does_not_start_with",
"matches",
"does_not_match"
], m = ["exists", "does_not_exist"], _ = ["if", "and", "or"], ae = [.../* @__PURE__ */ new Set([...S, ...C])], ie = [
"deny",
"drop",
"set_rate_limit",
"set_waf_ruleset",
"run_function",
"set_custom_response"
], T = ["second", "minute"], v = ["clientIp", "global"], h = ["learning", "blocking"], u = [
"header_accept",
"header_accept_encoding",
"header_accept_language",
"header_cookie",
"header_origin",
"header_referer",
"header_user_agent",
"host",
"network",
"request_args",
"request_method",
"request_uri",
"scheme",
"client_certificate_validation",
"ssl_verification_status"
], w = ["if", "and", "or"], E = ["ip_cidr", "asn", "countries"], se = ["2021-Q3"], M = [
"is_equal",
"is_not_equal",
"starts_with",
"does_not_start_with",
"matches",
"does_not_match",
"exists",
"does_not_exist",
"is_in_list",
"is_not_in_list"
], oe = ["if", "and", "or"], ne = ["http,https", "http"], le = ["", "tls_1_0", "tls_1_1", "tls_1_2", "tls_1_3"], de = [
"all",
"TLSv1.2_2018",
"TLSv1.2_2019",
"TLSv1.2_2021",
"TLSv1.3_2022"
], pe = [80, 8008, 8080], ue = [443, 8443, 9440, 9441, 9442, 9443], ce = ["honor", "override", "no-cache"], me = ["honor", "override"], ge = ["ignore", "all", "allowlist", "denylist"], he = ["ignore", "all", "allowlist", "denylist"], fe = ["ignore", "allowlist"], be = ["options", "post"], ye = ["nearest-region", "us-east-1", "br-east-1"], _e = ["webpack", "esbuild"], Te = ["read_only", "read_write", "restricted"], k = [
"deny",
"no_content",
"deliver",
"finish_request_phase",
"forward_cookies",
"optimize_images",
"bypass_cache",
"enable_gzip",
"redirect_http_to_https"
], R = ["redirect_to_301", "redirect_to_302", "rewrite_request"], I = ["run_function", "set_cache_policy", "set_connector", "set_origin"], O = [
"add_request_header",
"add_response_header",
"filter_request_header",
"filter_response_header"
], N = [
"add_request_cookie",
"filter_request_cookie",
"set_cookie",
"filter_response_cookie"
], $ = ["", "tls_1_0", "tls_1_1", "tls_1_2", "tls_1_3"], B = ["enforce", "permissive"], V = ["http1", "http2", "http3"], F = ["http", "storage", "live_ingest"], D = ["both", "force_ipv4"], H = ["preserve", "force_https", "force_http"], W = ["http1_1"], z = ["round_robin", "least_conn", "ip_hash"], U = ["aws4_hmac_sha256"], G = [
"default",
"400",
"401",
"403",
"404",
"405",
"406",
"408",
"409",
"410",
"411",
"414",
"415",
"416",
"426",
"429",
"431",
"500",
"501",
"502",
"503",
"504",
"505"
], ve = ["page_connector"], Me = {
type: "object",
properties: {
name: {
type: "string",
minLength: 1,
maxLength: 250,
pattern: ".*",
errorMessage: "The 'name' field must be a string between 1 and 250 characters."
},
type: {
type: "string",
enum: E,
errorMessage: "The 'type' field must be a string. Accepted values are 'asn', 'countries' or 'ip_cidr'."
},
items: {
type: "array",
minItems: 1,
maxItems: 2e4,
items: {
type: "string",
pattern: ".*",
errorMessage: "Each item in 'items' must be a string."
},
errorMessage: "The 'items' field must be an array of strings with 1-20000 items."
},
active: {
type: "boolean",
default: !0,
errorMessage: "The 'active' field must be a boolean."
}
},
required: ["name", "type", "items"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in network list items.",
required: "The 'name', 'type' and 'items' fields are required in each network list item."
}
}, we = {
type: "object",
properties: {
name: {
type: "string",
minLength: 1,
maxLength: 250,
pattern: ".*",
errorMessage: "The 'name' field must be a string (1-250 characters)."
},
product_version: {
type: ["string", "null"],
minLength: 3,
maxLength: 50,
pattern: "\\d+\\.\\d+",
default: "1.0",
errorMessage: "The 'product_version' field must be a string matching pattern \\d+\\.\\d+ (e.g., '1.0')."
},
engine_settings: {
type: "object",
properties: {
engine_version: {
type: "string",
enum: se,
default: "2021-Q3",
errorMessage: "The 'engine_version' field must be '2021-Q3'."
},
type: {
type: "string",
enum: ["score"],
default: "score",
errorMessage: "The 'type' field must be 'score'."
},
attributes: {
type: "object",
properties: {
rulesets: {
type: "array",
items: {
type: "integer",
enum: [1]
},
default: [1],
errorMessage: "The 'rulesets' field must be an array containing [1]."
},
thresholds: {
type: "array",
items: {
type: "object",
properties: {
threat: {
type: "string",
enum: [
"cross_site_scripting",
"directory_traversal",
"evading_tricks",
"file_upload",
"identified_attack",
"remote_file_inclusion",
"sql_injection",
"unwanted_access"
],
errorMessage: "The 'threat' field must be a valid threat type."
},
sensitivity: {
type: "string",
enum: ["highest", "high", "medium", "low", "lowest"],
default: "medium",
errorMessage: "The 'sensitivity' field must be one of: highest, high, medium, low, lowest."
}
},
required: ["threat", "sensitivity"],
additionalProperties: !1
},
maxItems: 8,
default: [
{ threat: "cross_site_scripting", sensitivity: "medium" },
{ threat: "directory_traversal", sensitivity: "medium" },
{ threat: "evading_tricks", sensitivity: "medium" },
{ threat: "file_upload", sensitivity: "medium" },
{ threat: "identified_attack", sensitivity: "medium" },
{ threat: "remote_file_inclusion", sensitivity: "medium" },
{ threat: "sql_injection", sensitivity: "medium" },
{ threat: "unwanted_access", sensitivity: "medium" }
],
errorMessage: "The 'thresholds' field must be an array of threat configurations (max 8 items)."
}
},
required: ["rulesets", "thresholds"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in the attributes object.",
required: "The 'rulesets' and 'thresholds' fields are required in the attributes object."
}
}
},
required: ["engine_version", "type", "attributes"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in the engine_settings object.",
required: "The 'engine_version', 'type', and 'attributes' fields are required in the engine_settings object."
}
}
},
required: ["name", "engine_settings"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in waf items.",
required: "The 'name, mode, active, sql_injection, sql_injection_sensitivity, remote_file_inclusion, remote_file_inclusion_sensitivity, directory_traversal, directory_traversal_sensitivity, cross_site_scripting, cross_site_scripting_sensitivity, evading_tricks, evading_tricks_sensitivity, file_upload, file_upload_sensitivity, unwanted_access, unwanted_access_sensitivity, identified_attack, identified_attack_sensitivity and bypass_addresses' fields are required in each waf item."
}
}, qe = {
type: "object",
properties: {
variable: {
type: "string",
enum: u,
errorMessage: "The 'variable' field must be a valid firewall variable."
},
operator: {
type: "string",
enum: M,
errorMessage: "The 'operator' field must be a valid operator."
},
conditional: {
type: "string",
enum: oe,
errorMessage: "The 'conditional' field must be one of: if, and, or"
},
argument: {
type: "string",
errorMessage: "The 'argument' field must be a string."
}
},
required: ["variable", "operator", "conditional"],
additionalProperties: !1,
errorMessage: {
required: "The 'variable', 'operator' and 'conditional' fields are required in criteria.",
additionalProperties: "No additional properties are allowed in criteria."
}
}, Pe = {
type: "object",
properties: {
name: {
type: "string",
minLength: 6,
maxLength: 63,
pattern: "^.{6,63}$",
errorMessage: "The 'name' field must be a string between 6 and 63 characters."
},
dir: {
type: "string",
errorMessage: "The 'dir' field must be a string."
},
workloads_access: {
type: "string",
enum: ["read_only", "read_write", "restricted"],
errorMessage: "The 'workloads_access' field must be one of: read_only, read_write, restricted."
},
prefix: {
type: "string",
errorMessage: "The 'prefix' field must be a string."
}
},
required: ["name", "dir", "prefix"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in storage items.",
required: "The 'name', 'dir' and 'prefix' fields are required."
}
}, je = {
type: "object",
properties: {
name: {
type: "string",
minLength: 6,
maxLength: 63,
pattern: "^.{6,63}$",
errorMessage: "The 'name' field must be a string between 6 and 63 characters."
}
},
required: ["name"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in kv items.",
required: "The 'name' field is required."
}
}, y = {
set_rate_limit: {
type: "object",
properties: {
type: {
type: "string",
enum: T,
errorMessage: "The rate limit 'type' must be either 'second' or 'minute'."
},
limit_by: {
type: "string",
enum: v,
errorMessage: "The 'limit_by' field must be either 'client_ip' or 'global'."
},
average_rate_limit: {
type: "string",
pattern: "^[0-9]+$",
errorMessage: "The 'average_rate_limit' must be a string containing a number."
},
maximum_burst_size: {
type: "string",
pattern: "^[0-9]+$",
errorMessage: "The 'maximum_burst_size' must be a string containing a number."
}
},
required: ["type", "limit_by", "average_rate_limit"],
additionalProperties: !1
},
set_waf_ruleset: {
type: "object",
properties: {
waf_id: {
type: "integer",
errorMessage: "The waf_id must be an integer"
},
mode: {
type: "string",
enum: h,
errorMessage: `The mode must be one of: ${h.join(", ")}`
}
},
required: ["waf_id", "mode"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in the set_waf_ruleset object",
required: "Both 'waf_id' and 'mode' fields are required in set_waf_ruleset"
}
},
set_custom_response: {
type: "object",
properties: {
status_code: {
oneOf: [
{
type: "integer",
minimum: 200,
maximum: 499,
errorMessage: "The status_code must be an integer between 200 and 499"
},
{
type: "string",
pattern: "^[2-4][0-9]{2}$",
errorMessage: "The status_code as string must be a valid HTTP status code (200-499)"
}
],
errorMessage: "The status_code must be either an integer or string between 200 and 499"
},
content_body: {
type: "string",
maxLength: 500,
errorMessage: "The content_body must be a string with maximum 500 characters"
},
content_type: {
type: "string",
errorMessage: "The content_type must be a string"
}
},
required: ["status_code", "content_body", "content_type"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in the set_custom_response object",
required: "All fields ('status_code', 'content_body', 'content_type') are required in set_custom_response"
}
}
}, xe = {
type: "object",
properties: {
name: {
type: "string",
enum: ie,
errorMessage: "The behavior 'name' must be a valid firewall behavior."
},
target: {
oneOf: [
{ type: "null" },
{ type: "string" },
y.set_rate_limit,
y.set_waf_ruleset,
y.set_custom_response
],
errorMessage: "The 'target' must be a string, object, or null depending on the behavior."
}
},
required: ["name"],
additionalProperties: !1,
errorMessage: {
required: "The 'name' field is required in firewall behaviors.",
additionalProperties: "No additional properties are allowed in firewall behaviors."
}
}, Le = {
type: "object",
properties: {
id: {
type: "integer",
errorMessage: "The 'id' field must be an integer."
},
name: {
type: "string",
errorMessage: "The 'name' field must be a string."
},
criteria: {
type: "array",
items: {
type: "array",
items: qe,
errorMessage: "The 'criteria' field must be an array of criteria objects."
},
errorMessage: "The 'criteria' field must be an array of criteria objects."
},
behaviors: {
type: "array",
items: xe,
errorMessage: "The 'behaviors' field must be an array of behavior objects."
},
description: {
type: "string",
maxLength: 1e3,
pattern: "^[\\u0000-\\uFFFF]*$",
errorMessage: "The 'description' must not exceed 1000 characters and must not contain 4-byte unicode characters."
},
active: {
type: "boolean",
default: !0,
errorMessage: "The 'active' field must be a boolean."
}
},
required: ["name", "criteria", "behaviors"],
additionalProperties: !1,
errorMessage: {
type: "The 'firewall' field must be an object",
required: "The 'name', 'criteria' and 'behaviors' fields are required in firewall rules.",
additionalProperties: "No additional properties are allowed in firewall rules."
}
}, Ae = {
type: "object",
properties: {
name: {
type: "string",
minLength: 1,
maxLength: 250,
pattern: ".*",
errorMessage: "The 'name' field must be a string between 1 and 250 characters"
},
runtime: {
type: "string",
enum: ["azion_js"],
default: "azion_js",
errorMessage: "The 'runtime' field must be 'azion_js'"
},
code: {
type: "string",
minLength: 1,
maxLength: 20971520,
pattern: ".*",
errorMessage: "The 'code' field must be a string between 1 and 20971520 characters (20MB max)"
},
default_args: {
type: "object",
default: {},
errorMessage: "The 'default_args' field must be an object"
},
execution_environment: {
type: "string",
enum: ["application", "firewall"],
default: "application",
errorMessage: "The 'execution_environment' field must be 'application' or 'firewall'"
},
active: {
type: "boolean",
default: !0,
errorMessage: "The 'active' field must be a boolean"
},
path: {
type: "string",
errorMessage: "The 'path' field must be a string"
},
bindings: {
type: "object",
properties: {
storage: {
type: "object",
properties: {
bucket: {
type: "string",
errorMessage: "The 'bucket' field must be a string"
},
prefix: {
type: "string",
errorMessage: "The 'prefix' field must be a string"
}
},
additionalProperties: !1
}
},
additionalProperties: !1,
errorMessage: "The 'bindings' field must be an object"
}
},
required: ["name"],
additionalProperties: !1
}, Se = {
type: ["object", "null"],
properties: {
main_settings: {
type: "object",
properties: {
name: {
type: "string",
errorMessage: "The 'name' field must be a string."
},
domains: {
type: "array",
items: {
type: "string",
errorMessage: "Each domain in the firewall's domains list must be a string"
}
},
is_active: {
type: "boolean",
errorMessage: "The 'is_active' field must be a boolean."
},
functions_enabled: {
type: "boolean",
errorMessage: "The 'functions_enabled' field must be a boolean."
},
network_protection_enabled: {
type: "boolean",
errorMessage: "The 'network_protection_enabled' field must be a boolean."
},
waf_enabled: {
type: "boolean",
errorMessage: "The 'waf_enabled' field must be a boolean."
},
debug_rules: {
type: "boolean",
errorMessage: "The 'debug_rules' field must be a boolean."
}
},
required: ["name"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in firewall main settings.",
required: "The 'name' field is required in firewall main settings."
}
},
rules_engine: {
type: "array",
items: Le,
errorMessage: {
type: "The 'rules_engine' field must be an array",
required: "The 'rules_engine' field must be an array of firewall rules.",
additionalProperties: "No additional properties are allowed in firewall rules."
}
}
},
required: ["main_settings"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in firewall object.",
required: "The 'main_settings' field is required in firewall object."
}
}, Ce = {
type: "object",
properties: {
name: {
type: "string",
minLength: 1,
maxLength: 250,
pattern: "^[a-zA-Z0-9 \\-.',|]+$",
errorMessage: "The 'name' field must be a string between 1-250 characters with valid pattern."
},
browser_cache: {
type: "object",
properties: {
behavior: {
type: "string",
enum: ce,
default: "honor",
errorMessage: "The 'behavior' must be one of: honor, override, no-cache."
},
max_age: {
type: "integer",
minimum: 0,
maximum: 31536e3,
default: 0,
errorMessage: "The 'max_age' must be between 0 and 31536000 seconds."
}
},
required: ["behavior", "max_age"],
additionalProperties: !1,
errorMessage: {
required: "Both 'behavior' and 'max_age' are required in browser_cache.",
additionalProperties: "No additional properties are allowed in browser_cache."
}
},
modules: {
type: "object",
properties: {
cache: {
type: "object",
properties: {
behavior: {
type: "string",
enum: me,
default: "honor",
errorMessage: "The 'behavior' must be either 'honor' or 'override'."
},
max_age: {
type: "integer",
minimum: 0,
maximum: 31536e3,
default: 60,
errorMessage: "The 'max_age' must be between 0 and 31536000 seconds."
},
stale_cache: {
type: "object",
properties: {
enabled: {
type: "boolean",
errorMessage: "The 'enabled' field must be a boolean."
}
},
required: ["enabled"],
additionalProperties: !1
},
large_file_cache: {
type: "object",
properties: {
enabled: {
type: "boolean",
errorMessage: "The 'enabled' field must be a boolean."
},
offset: {
type: "integer",
minimum: 0,
errorMessage: "The 'offset' must be a non-negative integer."
}
},
required: ["enabled", "offset"],
additionalProperties: !1
},
tiered_cache: {
type: ["object", "null"],
properties: {
enabled: {
type: "boolean",
errorMessage: "The 'enabled' field must be a boolean."
},
topology: {
type: ["string", "null"],
enum: [...ye, null],
errorMessage: "The 'topology' must be one of: nearest-region, us-east-1, br-east-1 or null."
}
},
required: ["enabled"],
if: {
properties: { enabled: { const: !0 } }
},
then: {
required: ["enabled", "topology"],
errorMessage: {
required: "When 'enabled' is true, 'topology' is required in the 'tiered_cache' object."
}
},
additionalProperties: !1
}
},
required: ["behavior", "max_age"],
additionalProperties: !1
},
application_accelerator: {
type: "object",
properties: {
cache_vary_by_method: {
type: "array",
items: {
type: "string",
enum: be
},
maxItems: 2,
errorMessage: "The 'cache_vary_by_method' must be an array of max 2 valid HTTP methods (options, post)."
},
cache_vary_by_querystring: {
type: "object",
properties: {
behavior: {
type: "string",
enum: ge,
default: "ignore",
errorMessage: "The 'behavior' must be one of: ignore, all, allowlist, denylist."
},
fields: {
type: "array",
items: { type: "string" },
errorMessage: "The 'fields' must be an array of strings."
},
sort_enabled: {
type: "boolean",
default: !0,
errorMessage: "The 'sort_enabled' field must be a boolean."
}
},
required: ["behavior", "fields", "sort_enabled"],
additionalProperties: !1
},
cache_vary_by_cookies: {
type: "object",
properties: {
behavior: {
type: "string",
enum: he,
default: "ignore",
errorMessage: "The 'behavior' must be one of: ignore, all, allowlist, denylist."
},
cookie_names: {
type: "array",
items: { type: "string" },
errorMessage: "The 'cookie_names' must be an array of strings."
}
},
required: ["behavior", "cookie_names"],
additionalProperties: !1
},
cache_vary_by_devices: {
type: "object",
properties: {
behavior: {
type: "string",
enum: fe,
default: "ignore",
errorMessage: "The 'behavior' must be either 'ignore' or 'allowlist'."
},
device_group: {
type: "array",
items: { type: "integer" },
errorMessage: "The 'device_group' must be an array of integers."
}
},
required: ["behavior", "device_group"],
additionalProperties: !1
}
},
required: [
"cache_vary_by_method",
"cache_vary_by_querystring",
"cache_vary_by_cookies",
"cache_vary_by_devices"
],
additionalProperties: !1
}
},
required: ["cache", "application_accelerator"],
additionalProperties: !1
}
},
required: ["name", "browser_cache", "modules"],
additionalProperties: !1
}, Ee = {
oneOf: [
{
type: "object",
properties: {
type: {
type: "string",
enum: k
}
},
required: ["type"],
additionalProperties: !1
},
{
type: "object",
properties: {
type: {
type: "string",
enum: R
},
attributes: {
type: "object",
properties: {
value: {
type: "string",
minLength: 1,
maxLength: 255
}
},
required: ["value"],
additionalProperties: !1
}
},
required: ["type", "attributes"],
additionalProperties: !1
},
{
type: "object",
properties: {
type: {
type: "string",
enum: I
},
attributes: {
type: "object",
properties: {
value: {
oneOf: [
{
type: "string",
minLength: 1,
maxLength: 255
},
{
type: "integer",
minimum: 1
}
]
}
},
required: ["value"],
additionalProperties: !1
}
},
required: ["type", "attributes"],
additionalProperties: !1
},
{
type: "object",
properties: {
type: {
type: "string",
enum: O
},
attributes: {
type: "object",
properties: {
value: {
type: "string",
minLength: 1,
maxLength: 255,
pattern: ".*"
}
},
required: ["value"],
additionalProperties: !1
}
},
required: ["type", "attributes"],
additionalProperties: !1
},
{
type: "object",
properties: {
type: {
type: "string",
enum: N
},
attributes: {
type: "object",
properties: {
value: {
type: "string",
minLength: 1,
maxLength: 255,
pattern: ".*"
}
},
required: ["value"],
additionalProperties: !1
}
},
required: ["type", "attributes"],
additionalProperties: !1
},
{
type: "object",
properties: {
type: {
type: "string",
enum: ["capture_match_groups"]
},
attributes: {
type: "object",
properties: {
regex: {
type: "string",
minLength: 1,
maxLength: 255
},
subject: {
type: "string",
minLength: 4,
maxLength: 50
},
captured_array: {
type: "string",
minLength: 1,
maxLength: 10
}
},
required: ["regex", "subject", "captured_array"],
additionalProperties: !1
}
},
required: ["type", "attributes"],
additionalProperties: !1
}
]
}, ke = {
type: "object",
properties: {
variable: {
type: "string",
pattern: `^\\$\\{(${Array.from(new Set(ae)).join("|")})\\}$`,
errorMessage: "The 'variable' field must be a valid variable name wrapped in ${}."
},
operator: {
type: "string",
enum: [...c, ...m],
errorMessage: "The 'operator' field must be a valid operator."
},
conditional: {
type: "string",
enum: _,
errorMessage: "The 'conditional' field must be one of: if, and, or."
},
argument: {
type: "string",
errorMessage: "The 'argument' field must be a string."
}
},
required: ["variable", "operator", "conditional"],
allOf: [
{
if: {
properties: {
operator: { enum: c }
}
},
then: {
required: ["argument"]
}
},
{
if: {
properties: {
operator: { enum: m }
}
},
then: {
not: {
required: ["argument"]
}
}
}
],
additionalProperties: !1
}, Re = {
type: "object",
properties: {
phase: {
type: "string",
enum: ["request", "response"],
errorMessage: "The 'phase' field must be either 'request' or 'response'."
},
rule: {
type: "object",
properties: {
name: {
type: "string",
minLength: 1,
maxLength: 250,
errorMessage: "The 'name' field must be a string between 1 and 250 characters."
},
description: {
type: "string",
maxLength: 1e3,
errorMessage: "The 'description' field must be a string with maximum 1000 characters."
},
active: {
type: "boolean",
default: !0,
errorMessage: "The 'active' field must be a boolean."
},
criteria: {
type: "array",
items: {
type: "array",
items: ke,
minItems: 1,
maxItems: 10
},
minItems: 1,
maxItems: 5,
errorMessage: "The criteria must be an array of arrays with 1-5 groups."
},
behaviors: {
type: "array",
items: Ee,
minItems: 1,
maxItems: 10,
errorMessage: "The behaviors must be an array with 1-10 items."
}
},
required: ["name", "criteria", "behaviors"],
additionalProperties: !1
}
},
required: ["phase", "rule"],
additionalProperties: !1
}, Ie = Re, Oe = {
type: "object",
properties: {
name: {
type: "string",
minLength: 1,
maxLength: 100,
pattern: ".*",
errorMessage: "The 'name' field must be a string between 1 and 100 characters."
},
delivery_protocol: {
type: "string",
enum: ne,
default: "http",
errorMessage: "The 'delivery_protocol' field must be either 'http,https' or 'http'."
},
http3: {
type: "boolean",
errorMessage: "The 'http3' field must be a boolean."
},
http_port: {
type: "array",
items: {
type: "integer",
enum: pe
},
errorMessage: {
enum: "The 'http_port' field must be an array of valid HTTP ports.",
type: "The 'http_port' field must be an array"
}
},
https_port: {
type: "array",
items: {
type: "integer",
enum: ue
},
default: [443],
errorMessage: "The 'https_port' field must be an array of valid HTTPS ports."
},
minimum_tls_version: {
type: "string",
enum: le,
default: "",
errorMessage: "The 'minimum_tls_version' field must be a valid TLS version."
},
supported_ciphers: {
type: "string",
enum: de,
default: "all",
errorMessage: "The 'supported_ciphers' field must be a valid cipher suite."
},
active: {
type: "boolean",
default: !0,
errorMessage: "The 'active' field must be a boolean."
},
debug: {
type: "boolean",
default: !1,
errorMessage: "The 'debug' field must be a boolean."
},
modules: {
type: "object",
properties: {
cache: {
type: "object",
properties: {
enabled: {
type: "boolean",
default: !0,
errorMessage: "The 'enabled' field must be a boolean."
}
},
required: ["enabled"],
additionalProperties: !1
},
functions: {
type: "object",
properties: {
enabled: {
type: "boolean",
default: !1,
errorMessage: "The 'enabled' field must be a boolean."
}
},
required: ["enabled"],
additionalProperties: !1
},
application_accelerator: {
type: "object",
properties: {
enabled: {
type: "boolean",
default: !1,
errorMessage: "The 'enabled' field must be a boolean."
}
},
required: ["enabled"],
additionalProperties: !1
},
image_processor: {
type: "object",
properties: {
enabled: {
type: "boolean",
default: !1,
errorMessage: "The 'enabled' field must be a boolean."
}
},
required: ["enabled"],
additionalProperties: !1
}
},
required: [],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in modules object."
}
},
cache_settings: {
type: "array",
items: Ce,
errorMessage: "The 'cache_settings' field must be an array of cache setting items."
},
rules: {
type: "array",
items: Ie,
errorMessage: "The 'rules' field must be an array of application rule items."
},
device_groups: {
type: "array",
items: {
type: "object",
properties: {
name: {
type: "string",
minLength: 1,
maxLength: 250,
pattern: ".*",
errorMessage: "The 'name' field must be a string between 1 and 250 characters."
},
user_agent: {
type: "string",
minLength: 1,
maxLength: 512,
pattern: ".*",
errorMessage: "The 'user_agent' field must be a valid regex pattern between 1 and 512 characters."
}
},
required: ["name", "user_agent"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in device group objects.",
required: "The 'name' and 'user_agent' fields are required in each device group."
}
},
errorMessage: "The 'device_groups' field must be an array of device group objects."
},
functions_instances: {
type: "array",
items: {
type: "object",
properties: {
name: {
type: "string",
minLength: 1,
maxLength: 100,
pattern: ".*",
errorMessage: "The 'name' field must be a string between 1 and 100 characters."
},
function: {
oneOf: [
{
type: "string",
minLength: 1,
maxLength: 250,
errorMessage: "The 'function' field must be a string between 1 and 250 characters."
},
{
type: "integer",
minimum: 1,
errorMessage: "The 'function' field must be an integer >= 1."
}
],
errorMessage: "The 'function' field must be either a string (function name) or integer (function ID)."
},
args: {
type: "object",
default: {},
errorMessage: "The 'args' field must be an object."
},
active: {
type: "boolean",
default: !0,
errorMessage: "The 'active' field must be a boolean."
}
},
required: ["name", "function"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in function instance objects.",
required: "The 'name' and 'function' fields are required in each function instance."
}
},
errorMessage: "The 'functions_instances' field must be an array of function instance objects."
}
},
required: ["name"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in application items.",
required: "The 'name field are required."
}
}, Ne = {
type: "object",
properties: {
name: {
type: "string",
minLength: 1,
maxLength: 100,
pattern: ".*",
errorMessage: "The 'name' field must be a string between 1 and 100 characters"
},
active: {
type: "boolean",
default: !0,
errorMessage: "The 'active' field must be a boolean"
},
infrastructure: {
type: "integer",
enum: [1, 2],
default: 1,
errorMessage: "The 'infrastructure' must be either 1 or 2"
},
workload_domain_allow_access: {
type: "boolean",
default: !0,
errorMessage: "The 'workload_domain_allow_access' field must be a boolean"
},
domains: {
type: "array",
items: {
type: "string",
minLength: 1,
maxLength: 250,
errorMessage: "Each domain must be a string between 1 and 250 characters"
},
errorMessage: "The 'domains' field must be an array of domain strings"
},
tls: {
type: "object",
properties: {
certificate: {
type: ["integer", "null"],
minimum: 1,
errorMessage: "The 'certificate' must be an integer >= 1 or null"
},
ciphers: {
type: ["integer", "null"],
enum: [1, 2, 3, 4, 5, 6, 7, 8, null],
errorMessage: "The 'ciphers' must be an integer between 1-8 or null"
},
minimum_version: {
type: ["string", "null"],
enum: [...$, null],
default: "tls_1_3",
errorMessage: "The 'minimum_version' must be a valid TLS version or null"
}
},
default: { certificate: null, ciphers: null, minimum_version: "tls_1_3" },
additionalProperties: !1
},
protocols: {
type: "object",
properties: {
http: {
type: "object",
properties: {
versions: {
type: "array",
items: {
type: "string",
enum: V
},
default: ["http1", "http2"]
},
http_ports: {
type: "array",
items: { type: "integer" },
default: [80]
},
https_ports: {
type: "array",
items: { type: "integer" },
default: [443]
},
quic_ports: {
type: ["array", "null"],
items: { type: "integer" }
}
},
required: ["versions", "http_ports", "https_ports"],
additionalProperties: !1
}
},
default: {
http: {
versions: ["http1", "http2"],
http_ports: [80],
https_ports: [443],
quic_ports: null
}
},
additionalProperties: !1
},
mtls: {
type: "object",
properties: {
enabled: {
type: "boolean",
default: !1
},
config: {
type: "object",
properties: {
verification: {
type: "string",
enum: B,
default: "enforce"
},
certificate: {
type: ["integer", "null"],
minimum: 1
},
crl: {
type: ["array", "null"],
items: { type: "integer" },
maxItems: 100
}
},
additionalProperties: !1
}
},
additionalProperties: !1
}
},
required: ["name", "domains"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in workload items",
required: "The 'name' and 'domains' fields are required in workload items"
}
}, $e = {
type: ["object", "null"],
properties: {
name: {
type: "string",
minLength: 1,
maxLength: 255,
pattern: ".*",
errorMessage: "The 'name' field must be a string between 1 and 255 characters"
},
active: {
type: "boolean",
default: !0,
errorMessage: "The 'active' field must be a boolean"
},
type: {
type: "string",
enum: F,
errorMessage: "The 'type' must be one of: http, storage, live_ingest"
},
attributes: {
oneOf: [
{
type: "object",
properties: {
bucket: {
type: "string",
minLength: 1,
maxLength: 255,
pattern: ".*",
errorMessage: "The 'bucket' field must be a string between 1 and 255 characters"
},
prefix: {
type: "string",
minLength: 1,
maxLength: 255,
pattern: ".*",
errorMessage: "The 'prefix' field must be a string between 1 and 255 characters"
}
},
required: ["bucket"],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in storage attributes.",
required: "The 'bucket' field is required in storage attributes."
}
},
{
type: "object",
properties: {
addresses: {
type: "array",
minItems: 1,
items: {
type: "object",
properties: {
active: {
type: "boolean",
default: !0,
errorMessage: "The 'active' field must be a boolean"
},
address: {
type: "string",
minLength: 1,
maxLength: 255,
pattern: ".*",
errorMessage: "The 'address' field must be a string between 1 and 255 characters"
},
http_port: {
type: "integer",
minimum: 1,
maximum: 65535,
default: 80,
errorMessage: "The 'http_port' must be between 1 and 65535"
},
https_port: {
type: "integer",
minimum: 1,
maximum: 65535,
default: 443,
errorMessage: "The 'https_port' must be between 1 and 65535"
},
modules: {
type: ["object", "null"],
errorMessage: "The 'modules' field must be an object or null"
}
},
required: ["address"],
additionalProperties: !1
},
errorMessage: "The 'addresses' field must be an array of address objects"
},
connection_options: {
type: "object",
properties: {
dns_resolution: {
type: "string",
enum: D,
default: "preserve",
errorMessage: "The 'dns_resolution' must be one of: both, force_ipv4"
},
transport_policy: {
type: "string",
enum: H,
default: "preserve",
errorMessage: "The 'transport_policy' must be one of: preserve, force_https, force_http"
},
http_version_policy: {
type: "string",
enum: W,
default: "http1_1",
errorMessage: "The 'http_version_policy' must be http1_1"
},
host: {
type: "string",
minLength: 1,
maxLength: 255,
pattern: ".*",
default: "${host}",
errorMessage: "The 'host' field must be a string between 1 and 255 characters"
},
path_prefix: {
type: "string",
minLength: 0,
maxLength: 255,
pattern: ".*",
default: "",
errorMessage: "The 'path_prefix' field must be a string between 0 and 255 characters"
},
following_redirect: {
type: "boolean",
default: !1,
errorMessage: "The 'following_redirect' field must be a boolean"
},
real_ip_header: {
type: "string",
minLength: 1,
maxLength: 255,
pattern: ".*",
default: "X-Real-IP",
errorMessage: "The 'real_ip_header' field must be a string between 1 and 255 characters"
},
real_port_header: {
type: "string",
minLength: 1,
maxLength: 255,
pattern: ".*",
default: "X-Real-PORT",
errorMessage: "The 'real_port_header' field must be a string between 1 and 255 characters"
}
},
required: [
"dns_resolution",
"transport_policy",
"http_version_policy",
"host",
"path_prefix",
"following_redirect",
"real_ip_header",
"real_port_header"
],
additionalProperties: !1,
errorMessage: {
additionalProperties: "No additional properties are allowed in connection options.",
required: "All connection options fields are required."
}
},
modules: {
type: "object",
properties: {
load_balancer: {
type: "object",
properties: {
enabled: {
type: "boolean",
errorMessage: "The 'enabled' field must be a boolean"
},
config: {
type: ["object", "null"],
properties: {
method: {
type: "string",
enum: z,
errorMessage: "The 'method' must be one of: round_robin, least_conn, ip_hash"
},
max_retries: {
type: "integer",
minimum: 0,
maximum: 10,
errorMessage: "The 'max_retries' must be between 0 and 10"
},
connection_timeout: {
type: "integer",
minimum: 1,
maximum: 300,
errorMessage: "The 'connection_timeout' must be between 1 and 300"
},
read_write_timeout: {
type: "integer",
minimum: 1,
maximum: 300,
errorMessage: "The 'read_write_timeout' must be between 1 and 300"
}
},
additionalProperties: !1,
errorMessage: {