Class: AWSCDK::Bedrock::CfnGuardrail::RegexConfigProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
bedrock/cfn_guardrail.rb

Overview

The regular expression to configure for the guardrail.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action:, name:, pattern:, description: nil, input_action: nil, input_enabled: nil, output_action: nil, output_enabled: nil) ⇒ RegexConfigProperty

Returns a new instance of RegexConfigProperty.

Parameters:

  • action (String)

    The guardrail action to configure when matching regular expression is detected.

  • name (String)

    The name of the regular expression to configure for the guardrail.

  • pattern (String)

    The regular expression pattern to configure for the guardrail.

  • description (String, nil) (defaults to: nil)

    The description of the regular expression to configure for the guardrail.

  • input_action (String, nil) (defaults to: nil)

    Specifies the action to take when harmful content is detected in the input. Supported values include:.

  • input_enabled (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether to enable guardrail evaluation on the input.

  • output_action (String, nil) (defaults to: nil)

    Specifies the action to take when harmful content is detected in the output. Supported values include:.

  • output_enabled (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether to enable guardrail evaluation on the output.



1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
# File 'bedrock/cfn_guardrail.rb', line 1484

def initialize(action:, name:, pattern:, description: nil, input_action: nil, input_enabled: nil, output_action: nil, output_enabled: nil)
  @action = action
  Jsii::Type.check_type(@action, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "action")
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  @pattern = pattern
  Jsii::Type.check_type(@pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "pattern")
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @input_action = input_action
  Jsii::Type.check_type(@input_action, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "inputAction") unless @input_action.nil?
  @input_enabled = input_enabled
  Jsii::Type.check_type(@input_enabled, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "inputEnabled") unless @input_enabled.nil?
  @output_action = output_action
  Jsii::Type.check_type(@output_action, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "outputAction") unless @output_action.nil?
  @output_enabled = output_enabled
  Jsii::Type.check_type(@output_enabled, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "outputEnabled") unless @output_enabled.nil?
end

Instance Attribute Details

#actionString (readonly)

The guardrail action to configure when matching regular expression is detected.



1507
1508
1509
# File 'bedrock/cfn_guardrail.rb', line 1507

def action
  @action
end

#descriptionString? (readonly)

The description of the regular expression to configure for the guardrail.



1522
1523
1524
# File 'bedrock/cfn_guardrail.rb', line 1522

def description
  @description
end

#input_actionString? (readonly)

Specifies the action to take when harmful content is detected in the input. Supported values include:.

  • BLOCK – Block the content and replace it with blocked messaging.
  • NONE – Take no action but return detection information in the trace response.


1530
1531
1532
# File 'bedrock/cfn_guardrail.rb', line 1530

def input_action
  @input_action
end

#input_enabledBoolean, ... (readonly)

Specifies whether to enable guardrail evaluation on the input.

When disabled, you aren't charged for the evaluation. The evaluation doesn't appear in the response.



1537
1538
1539
# File 'bedrock/cfn_guardrail.rb', line 1537

def input_enabled
  @input_enabled
end

#nameString (readonly)

The name of the regular expression to configure for the guardrail.



1512
1513
1514
# File 'bedrock/cfn_guardrail.rb', line 1512

def name
  @name
end

#output_actionString? (readonly)

Specifies the action to take when harmful content is detected in the output. Supported values include:.

  • BLOCK – Block the content and replace it with blocked messaging.
  • NONE – Take no action but return detection information in the trace response.


1545
1546
1547
# File 'bedrock/cfn_guardrail.rb', line 1545

def output_action
  @output_action
end

#output_enabledBoolean, ... (readonly)

Specifies whether to enable guardrail evaluation on the output.

When disabled, you aren't charged for the evaluation. The evaluation doesn't appear in the response.



1552
1553
1554
# File 'bedrock/cfn_guardrail.rb', line 1552

def output_enabled
  @output_enabled
end

#patternString (readonly)

The regular expression pattern to configure for the guardrail.



1517
1518
1519
# File 'bedrock/cfn_guardrail.rb', line 1517

def pattern
  @pattern
end

Class Method Details

.jsii_propertiesObject



1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
# File 'bedrock/cfn_guardrail.rb', line 1554

def self.jsii_properties
  {
    :action => "action",
    :name => "name",
    :pattern => "pattern",
    :description => "description",
    :input_action => "inputAction",
    :input_enabled => "inputEnabled",
    :output_action => "outputAction",
    :output_enabled => "outputEnabled",
  }
end

Instance Method Details

#to_jsiiObject



1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
# File 'bedrock/cfn_guardrail.rb', line 1567

def to_jsii
  result = {}
  result.merge!({
    "action" => @action,
    "name" => @name,
    "pattern" => @pattern,
    "description" => @description,
    "inputAction" => @input_action,
    "inputEnabled" => @input_enabled,
    "outputAction" => @output_action,
    "outputEnabled" => @output_enabled,
  })
  result.compact
end