aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
63 lines (62 loc) • 1.65 kB
TypeScript
import type { IConstruct, IMixin } from 'constructs';
import { type IConstructSelector } from './selectors';
/**
* Represents a successful mixin application.
*/
export interface MixinApplication {
/**
* The construct the mixin was applied to.
*/
readonly construct: IConstruct;
/**
* The mixin that was applied.
*/
readonly mixin: IMixin;
}
/**
* Applies mixins to constructs.
*/
export declare class MixinApplicator {
private readonly scope;
private readonly selector;
private readonly applications;
private expectAll;
private expectAny;
/**
* The constructs that match the selector in the given scope.
*/
get selectedConstructs(): IConstruct[];
/**
* Returns the successful mixin applications.
*/
get report(): MixinApplication[];
constructor(scope: IConstruct, selector?: IConstructSelector);
/**
* Applies a mixin to selected constructs.
*/
apply(...mixins: IMixin[]): this;
/**
* Requires all selected constructs to support the applied mixins.
*
* Will only check for future call of `apply()`.
* Set this before calling `apply()` to take effect.
*
* @example
* Mixins.of(scope)
* .requireAll()
* .apply(new MyMixin());
*/
requireAll(): this;
/**
* Requires at least one mixin to be successfully applied.
*
* Will only check for future call of `apply()`.
* Set this before calling `apply()` to take effect.
*
* @example
* Mixins.of(scope)
* .requireAny()
* .apply(new MyMixin());
*/
requireAny(): this;
}