ConstructSelector

class aws_cdk.mixins_preview.core.ConstructSelector

Bases: object

(experimental) Selects constructs from a construct tree based on various criteria.

Stability:

experimental

ExampleMetadata:

infused

Example:

# Apply to all constructs in a scope
Mixins.of(scope).apply(EncryptionAtRest())

# Apply to specific resource types
Mixins.of(scope, ConstructSelector.resources_of_type(s3.CfnBucket)).apply(EncryptionAtRest())

# Apply to constructs matching a pattern
Mixins.of(scope, ConstructSelector.by_id(/.*-prod-.*/)).apply(ProductionSecurityMixin())
Stability:

experimental

Methods

abstractmethod select(scope)

(experimental) Selects constructs from the given scope based on the selector’s criteria.

Parameters:

scope (IConstruct)

Stability:

experimental

Return type:

List[IConstruct]

Static Methods

classmethod all()

(experimental) Selects all constructs in the tree.

Stability:

experimental

Return type:

ConstructSelector

classmethod by_id(pattern)

(experimental) Selects constructs whose IDs match a pattern.

Parameters:

pattern (Any)

Stability:

experimental

Return type:

ConstructSelector

classmethod cfn_resource()

(experimental) Selects CfnResource constructs or the default CfnResource child.

Stability:

experimental

Return type:

ConstructSelector

classmethod only_itself()

(experimental) Selects only the provided construct.

Stability:

experimental

Return type:

ConstructSelector

classmethod resources_of_type(type)

(experimental) Selects constructs of a specific type.

Parameters:

type (Any)

Stability:

experimental

Return type:

ConstructSelector