@Generated(value="jsii-pacmak/1.58.0 (build f8ba112)",
date="2022-05-20T22:19:52.880Z")
public class Aspects
extends software.amazon.jsii.JsiiObject
Example:
import software.amazon.awscdk.core.*; import software.constructs.Construct; import software.constructs.IConstruct; public class MyAspect implements IAspect { public void visit(IConstruct node) { if (node instanceof CfnResource && node.getCfnResourceType() == "Foo::Bar") { this.error(node, "we do not want a Foo::Bar resource"); } } public void error(IConstruct node, String message) { Annotations.of(node).addError(message); } } public class MyStack extends Stack { public MyStack(Construct scope, String id) { super(scope, id); Stack stack = new Stack(); CfnResource.Builder.create(stack, "Foo") .type("Foo::Bar") .properties(Map.of( "Fred", "Thud")) .build(); Aspects.of(stack).add(new MyAspect()); } }
Modifier | Constructor and Description |
---|---|
protected |
Aspects(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Aspects(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
void |
add(IAspect aspect)
Adds an aspect to apply this scope before synthesis.
|
java.util.List<IAspect> |
getAspects()
The list of aspects which were directly applied on this scope.
|
static Aspects |
of(IConstruct scope)
Returns the `Aspects` object associated with a construct scope.
|
protected Aspects(software.amazon.jsii.JsiiObjectRef objRef)
protected Aspects(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public static Aspects of(IConstruct scope)
scope
- The scope for which these aspects will apply. This parameter is required.public void add(IAspect aspect)
aspect
- The aspect to add. This parameter is required.public java.util.List<IAspect> getAspects()