@@ -5,6 +5,8 @@ import { Metric, MetricOptions, MetricProps } from 'aws-cdk-lib/aws-cloudwatch';
55import * as iam from 'aws-cdk-lib/aws-iam' ;
66import { IKey , Key } from 'aws-cdk-lib/aws-kms' ;
77import { md5hash } from 'aws-cdk-lib/core/lib/helpers-internal' ;
8+ import { addConstructMetadata , MethodMetadata } from 'aws-cdk-lib/core/lib/metadata-resource' ;
9+ import { propertyInjectable } from 'aws-cdk-lib/core/lib/prop-injectable' ;
810import { Construct } from 'constructs' ;
911// Internal Libs
1012import * as filters from './guardrail-filters' ;
@@ -408,7 +410,11 @@ export interface GuardrailAttributes {
408410 * Class to create a Guardrail with CDK.
409411 * @cloudformationResource AWS::Bedrock::Guardrail
410412 */
413+ @propertyInjectable
411414export class Guardrail extends GuardrailBase {
415+ /** Uniquely identifies this class. */
416+ public static readonly PROPERTY_INJECTION_ID : string = '@aws-cdk.aws-bedrock-alpha.Guardrail' ;
417+
412418 /**
413419 * Import a guardrail given its attributes
414420 */
@@ -541,6 +547,8 @@ export class Guardrail extends GuardrailBase {
541547 super ( scope , id , {
542548 physicalName : props . guardrailName ,
543549 } ) ;
550+ // Enhanced CDK Analytics Telemetry
551+ addConstructMetadata ( this , props ) ;
544552
545553 // ------------------------------------------------------
546554 // Set properties or defaults
@@ -620,6 +628,7 @@ export class Guardrail extends GuardrailBase {
620628 * Adds a content filter to the guardrail.
621629 * @param filter The content filter to add.
622630 */
631+ @MethodMetadata ( )
623632 public addContentFilter ( filter : filters . ContentFilter ) : void {
624633 this . validateSingleContentFilter ( filter ) ;
625634 this . contentFilters . push ( filter ) ;
@@ -629,6 +638,7 @@ export class Guardrail extends GuardrailBase {
629638 * Adds a PII filter to the guardrail.
630639 * @param filter The PII filter to add.
631640 */
641+ @MethodMetadata ( )
632642 public addPIIFilter ( filter : filters . PIIFilter ) : void {
633643 this . validateSinglePiiFilter ( filter ) ;
634644 this . piiFilters . push ( filter ) ;
@@ -638,6 +648,7 @@ export class Guardrail extends GuardrailBase {
638648 * Adds a regex filter to the guardrail.
639649 * @param filter The regex filter to add.
640650 */
651+ @MethodMetadata ( )
641652 public addRegexFilter ( filter : filters . RegexFilter ) : void {
642653 this . validateSingleRegexFilter ( filter ) ;
643654 this . regexFilters . push ( filter ) ;
@@ -647,6 +658,7 @@ export class Guardrail extends GuardrailBase {
647658 * Adds a denied topic filter to the guardrail.
648659 * @param filter The denied topic filter to add.
649660 */
661+ @MethodMetadata ( )
650662 public addDeniedTopicFilter ( filter : filters . Topic ) : void {
651663 this . validateSingleDeniedTopic ( filter ) ;
652664 this . deniedTopics . push ( filter ) ;
@@ -656,6 +668,7 @@ export class Guardrail extends GuardrailBase {
656668 * Adds a contextual grounding filter to the guardrail.
657669 * @param filter The contextual grounding filter to add.
658670 */
671+ @MethodMetadata ( )
659672 public addContextualGroundingFilter ( filter : filters . ContextualGroundingFilter ) : void {
660673 this . validateSingleContextualGroundingFilter ( filter ) ;
661674 this . contextualGroundingFilters . push ( filter ) ;
@@ -665,6 +678,7 @@ export class Guardrail extends GuardrailBase {
665678 * Adds a word filter to the guardrail.
666679 * @param filter The word filter to add.
667680 */
681+ @MethodMetadata ( )
668682 public addWordFilter ( filter : filters . WordFilter ) : void {
669683 this . validateSingleWordFilter ( filter ) ;
670684 this . wordFilters . push ( filter ) ;
@@ -674,6 +688,7 @@ export class Guardrail extends GuardrailBase {
674688 * Adds a word filter to the guardrail.
675689 * @param filePath The location of the word filter file.
676690 */
691+ @MethodMetadata ( )
677692 public addWordFilterFromFile ( filePath : string ,
678693 inputAction ?: filters . GuardrailAction ,
679694 outputAction ?: filters . GuardrailAction ,
@@ -688,6 +703,7 @@ export class Guardrail extends GuardrailBase {
688703 * Adds a managed word list filter to the guardrail.
689704 * @param filter The managed word list filter to add.
690705 */
706+ @MethodMetadata ( )
691707 public addManagedWordListFilter ( filter : filters . ManagedWordFilter ) : void {
692708 this . validateSingleManagedWordListFilter ( filter ) ;
693709 this . managedWordListFilters . push ( filter ) ;
@@ -698,6 +714,7 @@ export class Guardrail extends GuardrailBase {
698714 * @param description The description of the version.
699715 * @returns The guardrail version.
700716 */
717+ @MethodMetadata ( )
701718 public createVersion ( description ?: string ) : string {
702719 const cfnVersion = new GuardrailVersion ( this , `GuardrailVersion-${ this . hash . slice ( 0 , 16 ) } ` , {
703720 description : description ,
0 commit comments