Package software.amazon.awscdk
Class Aspects
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.Aspects
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.104.0 (build e79254c)",
date="2024-11-21T06:34:02.040Z")
@Stability(Stable)
public class Aspects
extends software.amazon.jsii.JsiiObject
Aspects can be applied to CDK tree scopes and can operate on the tree before synthesis.
Example:
import software.amazon.awscdk.*; 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()); } }
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
-
Constructor Summary
-
Method Summary
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
Aspects
protected Aspects(software.amazon.jsii.JsiiObjectRef objRef) -
Aspects
protected Aspects(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
-
-
Method Details
-
of
Returns theAspects
object associated with a construct scope.- Parameters:
scope
- The scope for which these aspects will apply. This parameter is required.
-
add
Adds an aspect to apply this scope before synthesis.- Parameters:
aspect
- The aspect to add. This parameter is required.
-
getAll
The list of aspects which were directly applied on this scope.
-