Skip to content
v2.274.0

ConstructSelector Class ​

Selects constructs from a construct tree based on various criteria.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const constructSelector = new cdk.ConstructSelector();
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk

construct_selector = cdk.ConstructSelector()
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;

ConstructSelector constructSelector = new ConstructSelector();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;

var constructSelector = new ConstructSelector();
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"

constructSelector := cdk.NewConstructSelector()

Initializer ​

ts
new ConstructSelector()
python
ConstructSelector()
java
new ConstructSelector()
csharp
new ConstructSelector()
go
NewConstructSelector()

Methods ​

all(): IConstructSelector@staticmethod def all() -> IConstructSelectorpublic static IConstructSelector all()public static IConstructSelector All()func All() IConstructSelectorstatic#
Selects all constructs in the tree.
byId(pattern: string): IConstructSelector@staticmethod def by_id(pattern: str) -> IConstructSelectorpublic static IConstructSelector byId(String pattern)public static IConstructSelector ById(string pattern)func ById(Pattern *string) IConstructSelectorstatic#
Selects constructs whose construct IDs match a pattern.

Uses glob like matching.

byPath(pattern: string): IConstructSelector@staticmethod def by_path(pattern: str) -> IConstructSelectorpublic static IConstructSelector byPath(String pattern)public static IConstructSelector ByPath(string pattern)func ByPath(Pattern *string) IConstructSelectorstatic#
Selects constructs whose construct paths match a pattern.

Uses glob like matching.

cfnResource(): IConstructSelector@staticmethod def cfn_resource() -> IConstructSelectorpublic static IConstructSelector cfnResource()public static IConstructSelector CfnResource()func CfnResource() IConstructSelectorstatic#
Selects CfnResource constructs or the default CfnResource child.
onlyItself(): IConstructSelector@staticmethod def only_itself() -> IConstructSelectorpublic static IConstructSelector onlyItself()public static IConstructSelector OnlyItself()func OnlyItself() IConstructSelectorstatic#
Selects only the provided construct.
resourcesOfType(...types: string[]): IConstructSelector@staticmethod def resources_of_type(types: str) -> IConstructSelectorpublic static IConstructSelector resourcesOfType(String types)public static IConstructSelector ResourcesOfType(string types)func ResourcesOfType(Types *string) IConstructSelectorstatic#
Selects constructs of a specific type.