import * as cdk from '@aws-cdk/core';
import { Construct, IConstruct } from 'constructs';
class MyAspect implements cdk.IAspect {
public visit(node: IConstruct): void {
if (node instanceof cdk.CfnResource && node.cfnResourceType === 'Foo::Bar') {
this.error(node, 'we do not want a Foo::Bar resource');
}
}
protected error(node: IConstruct, message: string): void {
cdk.Annotations.of(node).addError(message);
}
}
class MyStack extends cdk.Stack {
constructor(scope: Construct, id: string) {
super(scope, id);
const stack = new cdk.Stack();
new cdk.CfnResource(stack, 'Foo', {
type: 'Foo::Bar',
properties: {
Fred: 'Thud',
},
});
cdk.Aspects.of(stack).add(new MyAspect());
}
}
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as greengrass from '@aws-cdk/aws-greengrass';
const cfnCoreDefinitionVersion = new greengrass.CfnCoreDefinitionVersion(this, 'MyCfnCoreDefinitionVersion', {
coreDefinitionId: 'coreDefinitionId',
cores: [{
certificateArn: 'certificateArn',
id: 'id',
thingArn: 'thingArn',
// the properties below are optional
syncShadow: false,
}],
});
// 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/core';
const cfnWaitCondition = new cdk.CfnWaitCondition(this, 'MyCfnWaitCondition', /* all optional props */ {
count: 123,
handle: 'handle',
timeout: 'timeout',
});
// 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/core';
import * as pipelines from '@aws-cdk/pipelines';
declare const cfnOutput: cdk.CfnOutput;
const stackOutputReference = pipelines.StackOutputReference.fromCfnOutput(cfnOutput);
// 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/core';
const cfnModuleVersion = new cdk.CfnModuleVersion(this, 'MyCfnModuleVersion', {
moduleName: 'moduleName',
modulePackage: 'modulePackage',
});