UNPKG

1.73 kBTypeScriptView Raw
1import { Construct } from 'constructs';
2import { Reference } from './reference';
3import { IResolvable, IResolveContext } from './resolvable';
4import { Construct as CoreConstruct } from './construct-compat';
5export interface CfnJsonProps {
6 /**
7 * The value to resolve. Can be any JavaScript object, including tokens and
8 * references in keys or values.
9 */
10 readonly value: any;
11}
12/**
13 * Captures a synthesis-time JSON object a CloudFormation reference which
14 * resolves during deployment to the resolved values of the JSON object.
15 *
16 * The main use case for this is to overcome a limitation in CloudFormation that
17 * does not allow using intrinsic functions as dictionary keys (because
18 * dictionary keys in JSON must be strings). Specifically this is common in IAM
19 * conditions such as `StringEquals: { lhs: "rhs" }` where you want "lhs" to be
20 * a reference.
21 *
22 * This object is resolvable, so it can be used as a value.
23 *
24 * This construct is backed by a custom resource.
25 */
26export declare class CfnJson extends CoreConstruct implements IResolvable {
27 readonly creationStack: string[];
28 /**
29 * An Fn::GetAtt to the JSON object passed through `value` and resolved during
30 * synthesis.
31 *
32 * Normally there is no need to use this property since `CfnJson` is an
33 * IResolvable, so it can be simply used as a value.
34 */
35 readonly value: Reference;
36 private readonly jsonString;
37 constructor(scope: Construct, id: string, props: CfnJsonProps);
38 /**
39 * This is required in case someone JSON.stringifys an object which refrences
40 * this object. Otherwise, we'll get a cyclic JSON reference.
41 */
42 toJSON(): string;
43 resolve(_: IResolveContext): any;
44}