Skip to main content

Policy logic reference

Look up logic operations, input and output types, relationship traversal, and null handling.

Operations by Task​

Use Operations to find the operation reference organized by task. This page covers shared logic concepts, including types, relationships, null handling, and extracts.

Operations form nested expressions: an operation's result becomes another operation's input. A condition's check must produce a Boolean. Use the repository's current YAML schema and IDE completion to check supported arguments.

Inputs, Outputs, and Conversions​

Choose types according to the comparison you need:

TypeBehavior
TextCase-insensitive; trims and collapses whitespace.
BytesPreserves case and whitespace; contains text, not binary data.
BooleanRepresents true, false, or null.
NumberSupports integers and decimals.
DateTimeRepresents an instant; comparisons normalize timezones to UTC.
DurationRepresents a positive time span.
SetUnique, unordered Text or Bytes items.
ListOrdered Text or Bytes items; retains duplicates and empty strings.
JsonStructured objects, arrays, and primitives; supports JMESPath queries.

IS_EQUAL compares values of the same type. Convert serialized values before evaluating them:

InputOperationOutput
Boolean textBOOLEAN_FROMBoolean
Timestamp textDATE_TIME_FROMDateTime
Duration textDURATION_FROMDuration
Delimited textLIST_FROM / SET_FROMList / Set
JSON textJSON_FROMJson

Relationship Traversal​

Use dotted paths to access related objects. For an EC2 instance, CA10__vpcId__c identifies the VPC in AWS, CA10__vpc__c identifies its CMDB record, and CA10__vpc__r.Name reads that record's name.

FIELD and EXTRACT can return null when the target field is empty, a lookup ID is missing, the CMDB relationship is unresolved, or a related object has disappeared. A null result alone therefore cannot identify the cause.

For collections of related objects, define relatedLists with relationshipName, conditions, and a fallback. Use RELATED_LIST_HAS, RELATED_LIST_HAS_NO, or RELATED_LIST_COUNT to consume their evaluated statuses in parent logic. See Write policy logic.

Null Handling and Undetermined Outcomes​

Empty-value behavior depends on type:

  • Text treats null and empty text as equivalent.
  • Boolean null differs from both true and false; false is not empty.
  • Number zero is not empty; null is empty. Numeric ordering comparisons with null generally return false.
  • Null DateTime and Duration values are empty.
  • Null Sets and Lists compare equal to empty collections. Text Sets discard normalized empty items; Bytes Sets discard empty strings but retain whitespace-only items.

Use IS_EMPTY or NOT_EMPTY for values and IS_EMPTY_LOOKUP or NOT_EMPTY_LOOKUP for relationship completeness. When missing collection data prevents a reliable conclusion, handle it as UNDETERMINED. When relationship absence itself proves the requirement's outcome, assign the appropriate compliant or violation status. See Policy statuses.

Reusable Extracts​

Extracts centralize field access, validation, and derived values shared across policies. Store definitions in types/{type}/{name}.extracts.yaml, import them with importExtracts, and retrieve a named value through EXTRACT.

Production logic should use extracts; keep direct FIELD access inside extract definitions or development logic. Field wrappers conventionally live in object.extracts.yaml and use the field API name as the extract name. Equivalent values across object types can share extract names; related JSON extractions can share a dedicated file.

For file syntax and an empty-value diagnostic, see Extract Definitions.

Operation Examples​

These expression fragments illustrate comparison behavior; they are not complete policy files.

A Text comparison ignores case and normalized whitespace, so this expression returns true:

IS_EQUAL:
left:
TEXT: " Production "
right:
TEXT: "production"

Using BYTES for both operands preserves the differences and returns false.

After importing the IAM policy type's extracts, compare its ARN with a required managed policy:

IS_EQUAL:
left:
EXTRACT: CA10__arn__c
right:
TEXT: "arn:aws:iam::aws:policy/AWSSupportAccess"

The expression returns a Boolean; the surrounding condition supplies the status and messages. Validate complete logic against the repository schema and follow Test and debug policies, including missing values and unresolved relationships in fixtures.