Interface InterceptorOptions
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
InterceptorOptions.Jsii$Proxy
@Generated(value="jsii-pacmak/1.129.0 (build eaca441)",
date="2026-05-19T08:18:44.451Z")
@Stability(Stable)
public interface InterceptorOptions
extends software.amazon.jsii.JsiiSerializable
Options for configuring an interceptor.
Example:
// Create Lambda functions for interceptors
Function requestInterceptorFn = Function.Builder.create(this, "RequestInterceptor")
.runtime(Runtime.PYTHON_3_12)
.handler("index.handler")
.code(Code.fromInline("\ndef handler(event, context):\n # Validate and transform request\n return {\n \"interceptorOutputVersion\": \"1.0\",\n \"mcp\": {\n \"transformedGatewayRequest\": event[\"mcp\"][\"gatewayRequest\"]\n }\n }\n "))
.build();
Function responseInterceptorFn = Function.Builder.create(this, "ResponseInterceptor")
.runtime(Runtime.PYTHON_3_12)
.handler("index.handler")
.code(Code.fromInline("\ndef handler(event, context):\n # Filter or transform response\n return {\n \"interceptorOutputVersion\": \"1.0\",\n \"mcp\": {\n \"transformedGatewayResponse\": event[\"mcp\"][\"gatewayResponse\"]\n }\n }\n "))
.build();
// Create gateway with interceptors
Gateway gateway = Gateway.Builder.create(this, "MyGateway")
.gatewayName("my-gateway")
.interceptorConfigurations(List.of(LambdaInterceptor.forRequest(requestInterceptorFn, InterceptorOptions.builder()
.passRequestHeaders(true)
.build()), LambdaInterceptor.forResponse(responseInterceptorFn)))
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forInterceptorOptionsstatic final classAn implementation forInterceptorOptions -
Method Summary
Modifier and TypeMethodDescriptionstatic InterceptorOptions.Builderbuilder()default BooleanWhether to pass request headers to the interceptor Lambda function.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getPassRequestHeaders
Whether to pass request headers to the interceptor Lambda function.Security Warning: Request headers can contain sensitive information such as authentication tokens and credentials. Only enable this if your interceptor needs access to headers and you have verified that sensitive information is not logged or exposed.
Default: false - Headers are not passed to interceptor for security
-
builder
- Returns:
- a
InterceptorOptions.BuilderofInterceptorOptions
-