DependableTrait

class aws_cdk.core.DependableTrait

Bases: object

Trait for IDependable.

Traits are interfaces that are privately implemented by objects. Instead of showing up in the public interface of a class, they need to be queried explicitly. This is used to implement certain framework features that are not intended to be used by Construct consumers, and so should be hidden from accidental use.

Example:

# Usage
roots = DependableTrait.get(construct).dependency_roots

# Definition
class TraitImplementation(DependableTrait):
    def __init__(self):
        self.dependency_roots = [construct_a, construct_b, construct_c]
DependableTrait.implement(construct, TraitImplementation())

Attributes

dependency_roots

The set of constructs that form the root of this dependable.

All resources under all returned constructs are included in the ordering dependency.

Static Methods

classmethod get(instance)

Return the matching DependableTrait for the given class instance.

Parameters:

instance (IDependable) –

Return type:

DependableTrait

classmethod implement(instance, trait)

Register instance to have the given DependableTrait.

Should be called in the class constructor.

Parameters:
Return type:

None