@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:35.812Z") @Stability(value=Stable) public class CfnJson extends software.constructs.Construct implements IResolvable
The main use case for this is to overcome a limitation in CloudFormation that
does not allow using intrinsic functions as dictionary keys (because
dictionary keys in JSON must be strings). Specifically this is common in IAM
conditions such as StringEquals: { lhs: "rhs" } where you want "lhs" to be
a reference.
This object is resolvable, so it can be used as a value.
This construct is backed by a custom resource.
Example:
// Example automatically generated from non-compiling source. May contain errors.
CfnParameter tagParam = new CfnParameter(this, "TagName");
CfnJson stringEquals = CfnJson.Builder.create(this, "ConditionJson")
.value(Map.of(
String.format("aws:PrincipalTag/%s", tagParam.getValueAsString()), true))
.build();
PrincipalBase principal = new AccountRootPrincipal().withConditions(Map.of(
"StringEquals", stringEquals));
Role.Builder.create(this, "MyRole").assumedBy(principal).build();
| Modifier and Type | Class and Description |
|---|---|
static class |
CfnJson.Builder
A fluent builder for
CfnJson. |
software.amazon.jsii.JsiiObject.InitializationModeIResolvable.Jsii$Default, IResolvable.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
|
CfnJson(software.constructs.Construct scope,
String id,
CfnJsonProps props) |
protected |
CfnJson(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnJson(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getCreationStack()
The creation stack of this resolvable which will be appended to errors thrown during resolution.
|
Reference |
getValue()
An Fn::GetAtt to the JSON object passed through `value` and resolved during synthesis.
|
Object |
resolve(IResolveContext _)
Produce the Token's value at resolution time.
|
String |
toJSON()
This is required in case someone JSON.stringifys an object which refrences this object.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waittoStringprotected CfnJson(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnJson(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnJson(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
CfnJsonProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public Object resolve(@NotNull IResolveContext _)
resolve in interface IResolvable_ - This parameter is required.@Stability(value=Stable) @NotNull public String toJSON()
@Stability(value=Stable) @NotNull public List<String> getCreationStack()
This may return an array with a single informational element indicating how to get this property populated, if it was skipped for performance reasons.
getCreationStack in interface IResolvable@Stability(value=Stable) @NotNull public Reference getValue()
Normally there is no need to use this property since CfnJson is an
IResolvable, so it can be simply used as a value.
Copyright © 2022. All rights reserved.