Skip to content
v2.275.0

Experimental

@aws-cdk/aws-bedrock-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

Guardrail L1 construct ​

Class to create a Guardrail with CDK.

Example ​

ts
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
  guardrailName: 'my-BedrockGuardrails',
});
// Add regex filter with input/output actions
guardrail.addRegexFilter({
  name: 'TestRegexFilter',
  pattern: 'test-pattern',
  action: bedrock.GuardrailAction.ANONYMIZE,
  // below props are optional
  description: 'This is a test regex filter',
  inputAction: bedrock.GuardrailAction.BLOCK,
  inputEnabled: true,
  outputAction: bedrock.GuardrailAction.ANONYMIZE,
  outputEnabled: true,
});
python
guardrail = bedrock.Guardrail(self, "bedrockGuardrails",
    guardrail_name="my-BedrockGuardrails"
)
# Add regex filter with input/output actions
guardrail.add_regex_filter(
    name="TestRegexFilter",
    pattern="test-pattern",
    action=bedrock.GuardrailAction.ANONYMIZE,
    # below props are optional
    description="This is a test regex filter",
    input_action=bedrock.GuardrailAction.BLOCK,
    input_enabled=True,
    output_action=bedrock.GuardrailAction.ANONYMIZE,
    output_enabled=True
)
java
Guardrail guardrail = Guardrail.Builder.create(this, "bedrockGuardrails")
        .guardrailName("my-BedrockGuardrails")
        .build();
// Add regex filter with input/output actions
guardrail.addRegexFilter(RegexFilter.builder()
        .name("TestRegexFilter")
        .pattern("test-pattern")
        .action(GuardrailAction.ANONYMIZE)
        // below props are optional
        .description("This is a test regex filter")
        .inputAction(GuardrailAction.BLOCK)
        .inputEnabled(true)
        .outputAction(GuardrailAction.ANONYMIZE)
        .outputEnabled(true)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Alpha
var guardrail = new Guardrail(this, "bedrockGuardrails", new GuardrailProps {
    GuardrailName = "my-BedrockGuardrails"
});
// Add regex filter with input/output actions
guardrail.AddRegexFilter(new RegexFilter {
    Name = "TestRegexFilter",
    Pattern = "test-pattern",
    Action = GuardrailAction.ANONYMIZE,
    // below props are optional
    Description = "This is a test regex filter",
    InputAction = GuardrailAction.BLOCK,
    InputEnabled = true,
    OutputAction = GuardrailAction.ANONYMIZE,
    OutputEnabled = true
});
go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockalpha/v2
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
	GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add regex filter with input/output actions
guardrail.AddRegexFilter(&RegexFilter{
	Name: jsii.String("TestRegexFilter"),
	Pattern: jsii.String("test-pattern"),
	Action: bedrock.GuardrailAction_ANONYMIZE,
	// below props are optional
	Description: jsii.String("This is a test regex filter"),
	InputAction: bedrock.GuardrailAction_BLOCK,
	InputEnabled: jsii.Boolean(true),
	OutputAction: bedrock.GuardrailAction_ANONYMIZE,
	OutputEnabled: jsii.Boolean(true),
})

Initializer ​

ts
new Guardrail(scope: Construct, id: string, props: GuardrailProps)
python
Guardrail(scope: Construct, id: str, props: GuardrailProps)
java
new Guardrail(Construct scope, String id, GuardrailProps props)
csharp
new Guardrail(Construct scope, string id, GuardrailProps props)
go
NewGuardrail(Scope Construct, Id *string, Props GuardrailProps)

Construct Props ​

blockedInputMessagingoptionalstringblocked_input_messagingoptionalstrblockedInputMessagingoptionalStringBlockedInputMessagingoptionalstringBlockedInputMessagingoptional*string#
The message to return when the guardrail blocks a prompt.

Default: "Sorry, your query violates our usage policy."

Must be between 1 and 500 characters.

blockedOutputsMessagingoptionalstringblocked_outputs_messagingoptionalstrblockedOutputsMessagingoptionalStringBlockedOutputsMessagingoptionalstringBlockedOutputsMessagingoptional*string#
The message to return when the guardrail blocks a model response.

Default: "Sorry, I am unable to answer your question because of our usage policy."

Must be between 1 and 500 characters.

contentFiltersoptionalContentFilter[]content_filtersoptionaltyping.List[ContentFilter]contentFiltersoptionalList<ContentFilter>ContentFiltersoptionalContentFilter[]ContentFiltersoptional*[]ContentFilter= []#
The content filters to apply to the guardrail.
contentFiltersTierConfigoptionalTierConfigcontent_filters_tier_configoptionalTierConfigcontentFiltersTierConfigoptionalTierConfigContentFiltersTierConfigoptionalTierConfigContentFiltersTierConfigoptionalTierConfig= filters.TierConfig.CLASSIC#
The tier configuration to apply to the guardrail.
contextualGroundingFiltersoptionalContextualGroundingFilter[]contextual_grounding_filtersoptionaltyping.List[ContextualGroundingFilter]contextualGroundingFiltersoptionalList<ContextualGroundingFilter>ContextualGroundingFiltersoptionalContextualGroundingFilter[]ContextualGroundingFiltersoptional*[]ContextualGroundingFilter= []#
The contextual grounding filters to apply to the guardrail.
crossRegionConfigoptionalGuardrailCrossRegionConfigPropertycross_region_configoptionalGuardrailCrossRegionConfigPropertycrossRegionConfigoptionalGuardrailCrossRegionConfigPropertyCrossRegionConfigoptionalGuardrailCrossRegionConfigPropertyCrossRegionConfigoptionalGuardrailCrossRegionConfigProperty#
The cross-region configuration for the guardrail.

Default: No cross-region configuration

This is optional and when provided, it should be of type GuardrailCrossRegionConfigProperty.

deniedTopicsoptionalTopic[]denied_topicsoptionaltyping.List[Topic]deniedTopicsoptionalList<Topic>DeniedTopicsoptionalTopic[]DeniedTopicsoptional*[]Topic= []#
A list of policies related to topics that the guardrail should deny.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#
The description of the guardrail.

Default: No description

guardrailNamestringguardrail_namestrguardrailNameStringGuardrailNamestringGuardrailName*stringrequired#
The name of the guardrail.

This will be used as the physical name of the guardrail.

kmsKeyoptionalIKeykms_keyoptionalIKeykmsKeyoptionalIKeyKmsKeyoptionalIKeyKmsKeyoptionalIKey#
A custom KMS key to use for encrypting data.

Default: Data is encrypted by default with a key that AWS owns and manages for you

managedWordListFiltersoptionalManagedWordFilter[]managed_word_list_filtersoptionaltyping.List[ManagedWordFilter]managedWordListFiltersoptionalList<ManagedWordFilter>ManagedWordListFiltersoptionalManagedWordFilter[]ManagedWordListFiltersoptional*[]ManagedWordFilter= []#
The managed word filters to apply to the guardrail.
piiFiltersoptionalPIIFilter[]pii_filtersoptionaltyping.List[PIIFilter]piiFiltersoptionalList<PIIFilter>PiiFiltersoptionalPIIFilter[]PiiFiltersoptional*[]PIIFilter= []#
The PII filters to apply to the guardrail.
regexFiltersoptionalRegexFilter[]regex_filtersoptionaltyping.List[RegexFilter]regexFiltersoptionalList<RegexFilter>RegexFiltersoptionalRegexFilter[]RegexFiltersoptional*[]RegexFilter= []#
The regular expression (regex) filters to apply to the guardrail.
topicsTierConfigoptionalTierConfigtopics_tier_configoptionalTierConfigtopicsTierConfigoptionalTierConfigTopicsTierConfigoptionalTierConfigTopicsTierConfigoptionalTierConfig= filters.TierConfig.CLASSIC#
The tier configuration to apply to the guardrail.
wordFiltersoptionalWordFilter[]word_filtersoptionaltyping.List[WordFilter]wordFiltersoptionalList<WordFilter>WordFiltersoptionalWordFilter[]WordFiltersoptional*[]WordFilter= []#
The word filters to apply to the guardrail.

Properties ​

blockedInputMessagingstringblocked_input_messagingstrblockedInputMessagingStringBlockedInputMessagingstringBlockedInputMessaging*string#
The message to return when the guardrail blocks a prompt.

Default: "Sorry, your query violates our usage policy."

blockedOutputsMessagingstringblocked_outputs_messagingstrblockedOutputsMessagingStringBlockedOutputsMessagingstringBlockedOutputsMessaging*string#
The message to return when the guardrail blocks a model response.

Default: "Sorry, I am unable to answer your question because of our usage policy."

contentFiltersContentFilter[]content_filterstyping.List[ContentFilter]contentFiltersList<ContentFilter>ContentFiltersContentFilter[]ContentFilters*[]ContentFilter#
The content filters applied by the guardrail.
contentFiltersTierConfigTierConfigcontent_filters_tier_configTierConfigcontentFiltersTierConfigTierConfigContentFiltersTierConfigTierConfigContentFiltersTierConfigTierConfig= filters.TierConfig.CLASSIC#
The tier that your guardrail uses for content filters.

Consider using a tier that balances performance, accuracy, and compatibility with your existing generative AI workflows.

contextualGroundingFiltersContextualGroundingFilter[]contextual_grounding_filterstyping.List[ContextualGroundingFilter]contextualGroundingFiltersList<ContextualGroundingFilter>ContextualGroundingFiltersContextualGroundingFilter[]ContextualGroundingFilters*[]ContextualGroundingFilter#
The contextual grounding filters applied by the guardrail.
crossRegionConfigmay be undefinedGuardrailCrossRegionConfigPropertycross_region_configmay be undefinedGuardrailCrossRegionConfigPropertycrossRegionConfigmay be undefinedGuardrailCrossRegionConfigPropertyCrossRegionConfigmay be undefinedGuardrailCrossRegionConfigPropertyCrossRegionConfigmay be undefinedGuardrailCrossRegionConfigProperty#
The cross-region configuration for the guardrail.
deniedTopicsTopic[]denied_topicstyping.List[Topic]deniedTopicsList<Topic>DeniedTopicsTopic[]DeniedTopics*[]Topic#
The denied topic filters applied by the guardrail.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

guardrailArnstringguardrail_arnstrguardrailArnStringGuardrailArnstringGuardrailArn*string#
The ARN of the guardrail.
guardrailIdstringguardrail_idstrguardrailIdStringGuardrailIdstringGuardrailId*string#
The ID of the guardrail.
guardrailVersionstringguardrail_versionstrguardrailVersionStringGuardrailVersionstringGuardrailVersion*string#
The version of the guardrail.
hashstringhashstrhashStringHashstringHash*string#
The computed hash of the guardrail properties.
kmsKeymay be undefinedIKeykms_keymay be undefinedIKeykmsKeymay be undefinedIKeyKmsKeymay be undefinedIKeyKmsKeymay be undefinedIKey#
The KMS key used to encrypt data.

Default: undefined - "Data is encrypted by default with a key that AWS owns and manages for you"

lastUpdatedmay be undefinedstringlast_updatedmay be undefinedstrlastUpdatedmay be undefinedStringLastUpdatedmay be undefinedstringLastUpdatedmay be undefined*string#
When this guardrail was last updated.
managedWordListFiltersManagedWordFilter[]managed_word_list_filterstyping.List[ManagedWordFilter]managedWordListFiltersList<ManagedWordFilter>ManagedWordListFiltersManagedWordFilter[]ManagedWordListFilters*[]ManagedWordFilter#
The managed word list filters applied by the guardrail.
namestringnamestrnameStringNamestringName*string#
The name of the guardrail.
nodeNodenodeNodenodeNodeNodeNodeNodeNode#
The tree node.
piiFiltersPIIFilter[]pii_filterstyping.List[PIIFilter]piiFiltersList<PIIFilter>PiiFiltersPIIFilter[]PiiFilters*[]PIIFilter#
The PII filters applied by the guardrail.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringstatic#
Uniquely identifies this class.
regexFiltersRegexFilter[]regex_filterstyping.List[RegexFilter]regexFiltersList<RegexFilter>RegexFiltersRegexFilter[]RegexFilters*[]RegexFilter#
The regex filters applied by the guardrail.
stackStackstackStackstackStackStackStackStackStack#
The stack in which this resource is defined.
topicsTierConfigTierConfigtopics_tier_configTierConfigtopicsTierConfigTierConfigTopicsTierConfigTierConfigTopicsTierConfigTierConfig= filters.TierConfig.CLASSIC#
The tier that your guardrail uses for denied topic filters.
wordFiltersWordFilter[]word_filterstyping.List[WordFilter]wordFiltersList<WordFilter>WordFiltersWordFilter[]WordFilters*[]WordFilter#
The word filters applied by the guardrail.

Methods ​

addContentFilter(filter: ContentFilter): voiddef add_content_filter(self, filter: ContentFilter) -> Nonepublic void addContentFilter(ContentFilter filter)public void AddContentFilter(ContentFilter filter)func AddContentFilter(Filter ContentFilter)#
Adds a content filter to the guardrail.
1 parameter

Parameters

  • filterfilterfilterfilterFilter — The content filter to add.
addContextualGroundingFilter(filter: ContextualGroundingFilter): voiddef add_contextual_grounding_filter(self, filter: ContextualGroundingFilter) -> Nonepublic void addContextualGroundingFilter(ContextualGroundingFilter filter)public void AddContextualGroundingFilter(ContextualGroundingFilter filter)func AddContextualGroundingFilter(Filter ContextualGroundingFilter)#
Adds a contextual grounding filter to the guardrail.
1 parameter

Parameters

  • filterfilterfilterfilterFilter — The contextual grounding filter to add.
addDeniedTopicFilter(filter: Topic): voiddef add_denied_topic_filter(self, filter: Topic) -> Nonepublic void addDeniedTopicFilter(Topic filter)public void AddDeniedTopicFilter(Topic filter)func AddDeniedTopicFilter(Filter Topic)#
Adds a denied topic filter to the guardrail.
1 parameter

Parameters

  • filterfilterfilterfilterFilter — The denied topic filter to add.
addManagedWordListFilter(filter: ManagedWordFilter): voiddef add_managed_word_list_filter(self, filter: ManagedWordFilter) -> Nonepublic void addManagedWordListFilter(ManagedWordFilter filter)public void AddManagedWordListFilter(ManagedWordFilter filter)func AddManagedWordListFilter(Filter ManagedWordFilter)#
Adds a managed word list filter to the guardrail.
1 parameter

Parameters

  • filterfilterfilterfilterFilter — The managed word list filter to add.
addPIIFilter(filter: PIIFilter): voiddef add_pii_filter(self, filter: PIIFilter) -> Nonepublic void addPIIFilter(PIIFilter filter)public void AddPIIFilter(PIIFilter filter)func AddPIIFilter(Filter PIIFilter)#
Adds a PII filter to the guardrail.
1 parameter

Parameters

  • filterfilterfilterfilterFilter — The PII filter to add.
addRegexFilter(filter: RegexFilter): voiddef add_regex_filter(self, filter: RegexFilter) -> Nonepublic void addRegexFilter(RegexFilter filter)public void AddRegexFilter(RegexFilter filter)func AddRegexFilter(Filter RegexFilter)#
Adds a regex filter to the guardrail.
1 parameter

Parameters

  • filterfilterfilterfilterFilter — The regex filter to add.
addWordFilter(filter: WordFilter): voiddef add_word_filter(self, filter: WordFilter) -> Nonepublic void addWordFilter(WordFilter filter)public void AddWordFilter(WordFilter filter)func AddWordFilter(Filter WordFilter)#
Adds a word filter to the guardrail.
1 parameter

Parameters

  • filterfilterfilterfilterFilter — The word filter to add.
addWordFilterFromFile(filePath: string, inputAction?: GuardrailAction, outputAction?: GuardrailAction, inputEnabled?: boolean, outputEnabled?: boolean): voiddef add_word_filter_from_file(self, file_path: str, input_action: typing.Optional[GuardrailAction] = None, output_action: typing.Optional[GuardrailAction] = None, input_enabled: typing.Optional[bool] = None, output_enabled: typing.Optional[bool] = None) -> Nonepublic void addWordFilterFromFile(String filePath, GuardrailAction inputAction, GuardrailAction outputAction, Boolean inputEnabled, Boolean outputEnabled)public void AddWordFilterFromFile(string filePath, GuardrailAction? inputAction = null, GuardrailAction? outputAction = null, bool? inputEnabled = null, bool? outputEnabled = null)func AddWordFilterFromFile(FilePath *string, InputAction GuardrailAction, OutputAction GuardrailAction, InputEnabled *bool, OutputEnabled *bool)#
Adds a word filter to the guardrail.
1 parameter

Parameters

  • filePathfile_pathfilePathfilePathFilePath — The location of the word filter file.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

createVersion(description?: string): stringdef create_version(self, description: typing.Optional[str] = None) -> strpublic String createVersion(String description)public string CreateVersion(string? description = null)func CreateVersion(Description *string) *string#
Create a version for the guardrail.
1 parameter · returns

Parameters

  • descriptiondescriptiondescriptiondescriptionDescription — The description of the version.

Returns: The guardrail version.

fromCfnGuardrail(cfnGuardrail: CfnGuardrail): IGuardrail@staticmethod def from_cfn_guardrail(cfn_guardrail: CfnGuardrail) -> IGuardrailpublic static IGuardrail fromCfnGuardrail(CfnGuardrail cfnGuardrail)public static IGuardrail FromCfnGuardrail(CfnGuardrail cfnGuardrail)func FromCfnGuardrail(CfnGuardrail CfnGuardrail) IGuardrailstatic#
Import a low-level L1 Cfn Guardrail.
fromGuardrailAttributes(scope: Construct, id: string, attrs: GuardrailAttributes): IGuardrail@staticmethod def from_guardrail_attributes(scope: Construct, id: str, attrs: GuardrailAttributes) -> IGuardrailpublic static IGuardrail fromGuardrailAttributes(Construct scope, String id, GuardrailAttributes attrs)public static IGuardrail FromGuardrailAttributes(Construct scope, string id, GuardrailAttributes attrs)func FromGuardrailAttributes(Scope Construct, Id *string, Attrs GuardrailAttributes) IGuardrailstatic#
Import a guardrail given its attributes.
grant(grantee: IGrantable, ...actions: string[]): Grantdef grant(self, grantee: IGrantable, actions: str) -> Grantpublic Grant grant(IGrantable grantee, String actions)public Grant Grant(IGrantable grantee, string actions)func Grant(Grantee IGrantable, Actions *string) Grant#
Grant the given principal identity permissions to perform actions on this guardrail.

[disable-awslint:no-grants]

grantApply(grantee: IGrantable): Grantdef grant_apply(self, grantee: IGrantable) -> Grantpublic Grant grantApply(IGrantable grantee)public Grant GrantApply(IGrantable grantee)func GrantApply(Grantee IGrantable) Grant#
Grant the given identity permissions to apply the guardrail.

[disable-awslint:no-grants]

isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
metric(metricName: string, props?: MetricOptions): Metricdef metric(self, metric_name: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metric(String metricName, MetricOptions props)public Metric Metric(string metricName, MetricOptions? props = null)func Metric(MetricName *string, Props MetricOptions) Metric#
Return the given named metric for this guardrail.

By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

metricAll(metricName: string, props?: MetricOptions): Metric@staticmethod def metric_all(metric_name: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic static Metric metricAll(String metricName, MetricOptions props)public static Metric MetricAll(string metricName, MetricOptions? props = null)func MetricAll(MetricName *string, Props MetricOptions) Metricstatic#
Return the given named metric for all guardrails.

By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

metricAllInvocationLatency(props?: MetricOptions): Metric@staticmethod def metric_all_invocation_latency(props: typing.Optional[MetricOptions] = None) -> Metricpublic static Metric metricAllInvocationLatency(MetricOptions props)public static Metric MetricAllInvocationLatency(MetricOptions? props = null)func MetricAllInvocationLatency(Props MetricOptions) Metricstatic#
Return the invocation latency metric for all guardrails.
metricAllInvocations(props?: MetricOptions): Metric@staticmethod def metric_all_invocations(props: typing.Optional[MetricOptions] = None) -> Metricpublic static Metric metricAllInvocations(MetricOptions props)public static Metric MetricAllInvocations(MetricOptions? props = null)func MetricAllInvocations(Props MetricOptions) Metricstatic#
Return the invocations metric for all guardrails.
metricAllInvocationsIntervened(props?: MetricOptions): Metric@staticmethod def metric_all_invocations_intervened(props: typing.Optional[MetricOptions] = None) -> Metricpublic static Metric metricAllInvocationsIntervened(MetricOptions props)public static Metric MetricAllInvocationsIntervened(MetricOptions? props = null)func MetricAllInvocationsIntervened(Props MetricOptions) Metricstatic#
Return the invocations intervened metric for all guardrails.
metricAllTextUnitCount(props?: MetricOptions): Metric@staticmethod def metric_all_text_unit_count(props: typing.Optional[MetricOptions] = None) -> Metricpublic static Metric metricAllTextUnitCount(MetricOptions props)public static Metric MetricAllTextUnitCount(MetricOptions? props = null)func MetricAllTextUnitCount(Props MetricOptions) Metricstatic#
Return the text unit count metric for all guardrails.
metricInvocationClientErrors(props?: MetricOptions): Metricdef metric_invocation_client_errors(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricInvocationClientErrors(MetricOptions props)public Metric MetricInvocationClientErrors(MetricOptions? props = null)func MetricInvocationClientErrors(Props MetricOptions) Metric#
Return the invocation client errors metric for this guardrail.
metricInvocationLatency(props?: MetricOptions): Metricdef metric_invocation_latency(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricInvocationLatency(MetricOptions props)public Metric MetricInvocationLatency(MetricOptions? props = null)func MetricInvocationLatency(Props MetricOptions) Metric#
Return the invocation latency metric for this guardrail.
metricInvocations(props?: MetricOptions): Metricdef metric_invocations(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricInvocations(MetricOptions props)public Metric MetricInvocations(MetricOptions? props = null)func MetricInvocations(Props MetricOptions) Metric#
Return the invocations metric for this guardrail.
metricInvocationServerErrors(props?: MetricOptions): Metricdef metric_invocation_server_errors(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricInvocationServerErrors(MetricOptions props)public Metric MetricInvocationServerErrors(MetricOptions? props = null)func MetricInvocationServerErrors(Props MetricOptions) Metric#
Return the invocation server errors metric for this guardrail.
metricInvocationsIntervened(props?: MetricOptions): Metricdef metric_invocations_intervened(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricInvocationsIntervened(MetricOptions props)public Metric MetricInvocationsIntervened(MetricOptions? props = null)func MetricInvocationsIntervened(Props MetricOptions) Metric#
Return the invocations intervened metric for this guardrail.
metricInvocationThrottles(props?: MetricOptions): Metricdef metric_invocation_throttles(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricInvocationThrottles(MetricOptions props)public Metric MetricInvocationThrottles(MetricOptions? props = null)func MetricInvocationThrottles(Props MetricOptions) Metric#
Return the invocation throttles metric for this guardrail.
metricTextUnitCount(props?: MetricOptions): Metricdef metric_text_unit_count(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricTextUnitCount(MetricOptions props)public Metric MetricTextUnitCount(MetricOptions? props = null)func MetricTextUnitCount(Props MetricOptions) Metric#
Return the text unit count metric for this guardrail.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.