Skip to content

Policy

Policy declares a name, rule, and first-match evaluation semantic for an expression graph.

new Policy(sourceValue, sourceInfoValue): Policy

constructor configures the policy’s source and source information.

Source

SourceInfo

Policy

addImport(value): void

addImport adds an import to the policy.

Import

void


clearMetadata(name): void

clearMetadata removes a named metadata key.

string

void


description(): ValueString

description returns the description of the policy.

ValueString


explanationOutputPolicy(): Policy

explanationOutputPolicy returns a copy whose match outputs use explanation expressions.

Policy


imports(): Import[]

imports returns the list of imports associated with the policy.

Import[]


metadata(name): [unknown, boolean]

metadata returns a named metadata object when it exists.

string

[unknown, boolean]


metadataKeys(): string[]

metadataKeys returns the metadata keys set on the policy.

string[]


name(): ValueString

name returns the name of the policy.

ValueString


rule(): Rule | undefined

rule returns the rule entry point of the policy.

Rule | undefined


setDescription(value): void

setDescription configures the policy description.

ValueString

void


setMetadata(name, value): void

setMetadata updates a named metadata key.

string

unknown

void


setName(value): void

setName configures the policy name.

ValueString

void


setRule(value): void

setRule configures the policy rule entry point.

Rule

void


source(): Source

source returns the policy file contents as a CEL source object.

Source


sourceInfo(): SourceInfo

sourceInfo returns metadata about expression positions in the policy file.

SourceInfo