aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
45 lines (44 loc) • 1.88 kB
TypeScript
import type { CfnResource } from '../cfn-resource';
/**
* Token-aware property inspection for a nested property path.
*
* Use `PropertyReflection.of()` to traverse a dot-separated path on an object,
* then query the result with `.value`, `.exists()`, `.equals()`, or `.get()`.
*
* Array indexing is supported using numeric path segments (e.g. `'rules.0.name'`).
*/
export declare class PropertyReflection {
private readonly result;
/**
* Traverse a dot-separated property path on an object.
* If `obj` is `undefined` or `null`, the result is treated as 'missing' (not 'unknown').`
* @param obj - The root object to traverse.
* @param path - Dot-separated property path.
*/
static of(obj: CfnResource | undefined, path: string): PropertyReflection;
private constructor();
/**
* Whether the property exists.
*
* - Returns `true` if the full path is reachable and the leaf is not `undefined`.
* - Returns `false` if a segment along the path is `null` or `undefined`.
* - Returns `undefined` if any segment (or the leaf) is an unresolved token.
*/
exists(): boolean | undefined;
/**
* Whether the property strictly equals an expected value.
*
* - Returns `true` if the full path is reachable and the leaf `=== expected`.
* - Returns `false` if the path is missing or the leaf differs.
* - Returns `undefined` if any segment (or the leaf) is an unresolved token.
*/
equals(expected: any): boolean | undefined;
/**
* The property value, with an optional fallback for unresolved tokens.
*
* - Returns the resolved value if the full path is reachable.
* - Returns `undefined` if a segment along the path is missing.
* - Returns `fallback` if any segment (or the leaf) is an unresolved token.
*/
get(fallback?: any): any;
}