Class: AWSCDK::BedrockAgentCore::LambdaInterceptor
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::BedrockAgentCore::LambdaInterceptor
- Includes:
- IInterceptor
- Defined in:
- bedrock_agent_core/lambda_interceptor.rb
Overview
A Lambda-based interceptor for Gateway.
Interceptors allow you to run custom code during each invocation of your gateway:
- REQUEST interceptors execute before calling the target
- RESPONSE interceptors execute after the target responds
Class Method Summary collapse
-
.for_request(lambda_function, options = nil) ⇒ AWSCDK::BedrockAgentCore::LambdaInterceptor
Create a REQUEST interceptor that executes before the gateway calls the target.
-
.for_response(lambda_function, options = nil) ⇒ AWSCDK::BedrockAgentCore::LambdaInterceptor
Create a RESPONSE interceptor that executes after the target responds.
- .jsii_overridable_methods ⇒ Object
Instance Method Summary collapse
-
#bind(_scope, gateway) ⇒ AWSCDK::BedrockAgentCore::InterceptorBindConfig
Binds this Lambda interceptor to a Gateway.
-
#initialize(*args) ⇒ LambdaInterceptor
constructor
A new instance of LambdaInterceptor.
-
#interception_point ⇒ AWSCDK::BedrockAgentCore::InterceptionPoint
The interception point (REQUEST or RESPONSE).
Constructor Details
#initialize(*args) ⇒ LambdaInterceptor
Returns a new instance of LambdaInterceptor.
16 17 18 |
# File 'bedrock_agent_core/lambda_interceptor.rb', line 16 def initialize(*args) raise NoMethodError, "aws-cdk-lib.aws_bedrockagentcore.LambdaInterceptor does not have a visible constructor; use the provided factory methods" end |
Class Method Details
.for_request(lambda_function, options = nil) ⇒ AWSCDK::BedrockAgentCore::LambdaInterceptor
Create a REQUEST interceptor that executes before the gateway calls the target.
Important: When this interceptor is added to a gateway, the gateway's IAM role
will automatically be granted lambda:InvokeFunction permission on the specified
Lambda function.
36 37 38 39 40 41 |
# File 'bedrock_agent_core/lambda_interceptor.rb', line 36 def self.for_request(lambda_function, = nil) Jsii::Type.check_type(lambda_function, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklGdW5jdGlvbiJ9")), "lambdaFunction") = .is_a?(Hash) ? ::AWSCDK::BedrockAgentCore::InterceptorOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9ja2FnZW50Y29yZS5JbnRlcmNlcHRvck9wdGlvbnMifQ==")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_bedrockagentcore.LambdaInterceptor", "forRequest", [lambda_function, ]) end |
.for_response(lambda_function, options = nil) ⇒ AWSCDK::BedrockAgentCore::LambdaInterceptor
Create a RESPONSE interceptor that executes after the target responds.
Important: When this interceptor is added to a gateway, the gateway's IAM role
will automatically be granted lambda:InvokeFunction permission on the specified
Lambda function.
52 53 54 55 56 57 |
# File 'bedrock_agent_core/lambda_interceptor.rb', line 52 def self.for_response(lambda_function, = nil) Jsii::Type.check_type(lambda_function, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklGdW5jdGlvbiJ9")), "lambdaFunction") = .is_a?(Hash) ? ::AWSCDK::BedrockAgentCore::InterceptorOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9ja2FnZW50Y29yZS5JbnRlcmNlcHRvck9wdGlvbnMifQ==")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_bedrockagentcore.LambdaInterceptor", "forResponse", [lambda_function, ]) end |
.jsii_overridable_methods ⇒ Object
20 21 22 23 24 25 |
# File 'bedrock_agent_core/lambda_interceptor.rb', line 20 def self.jsii_overridable_methods { :interception_point => { kind: :property, name: "interceptionPoint", is_optional: false }, :bind => { kind: :method, name: "bind", is_optional: false }, } end |
Instance Method Details
#bind(_scope, gateway) ⇒ AWSCDK::BedrockAgentCore::InterceptorBindConfig
Binds this Lambda interceptor to a Gateway.
This method:
- Grants the Gateway's IAM role permission to invoke the Lambda function
- Returns the CloudFormation configuration for this interceptor
76 77 78 79 80 |
# File 'bedrock_agent_core/lambda_interceptor.rb', line 76 def bind(_scope, gateway) Jsii::Type.check_type(_scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "_scope") Jsii::Type.check_type(gateway, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9ja2FnZW50Y29yZS5JR2F0ZXdheSJ9")), "gateway") jsii_call_method("bind", [_scope, gateway]) end |
#interception_point ⇒ AWSCDK::BedrockAgentCore::InterceptionPoint
The interception point (REQUEST or RESPONSE).
62 63 64 |
# File 'bedrock_agent_core/lambda_interceptor.rb', line 62 def interception_point() jsii_get_property("interceptionPoint") end |