ProxyResourceOptions Struct
| Source | aws-apigateway/lib/resource.ts |
|---|
Example
declare const resource: apigateway.Resource;
declare const handler: lambda.Function;
const proxy = resource.addProxy({
defaultIntegration: new apigateway.LambdaIntegration(handler),
// "false" will require explicitly adding methods on the `proxy` resource
anyMethod: true // "true" is the default
});
# resource: apigateway.Resource
# handler: lambda.Function
proxy = resource.add_proxy(
default_integration=apigateway.LambdaIntegration(handler),
# "false" will require explicitly adding methods on the `proxy` resource
any_method=True
)
Resource resource;
Function handler;
ProxyResource proxy = resource.addProxy(ProxyResourceOptions.builder()
.defaultIntegration(new LambdaIntegration(handler))
// "false" will require explicitly adding methods on the `proxy` resource
.anyMethod(true)
.build());
// Install: dotnet add package Amazon.CDK.Lib
Resource resource;
Function handler;
var proxy = resource.AddProxy(new ProxyResourceOptions {
DefaultIntegration = new LambdaIntegration(handler),
// "false" will require explicitly adding methods on the `proxy` resource
AnyMethod = true
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var resource Resource
var handler Function
proxy := resource.AddProxy(&ProxyResourceOptions{
DefaultIntegration: apigateway.NewLambdaIntegration(handler),
// "false" will require explicitly adding methods on the `proxy` resource
AnyMethod: jsii.Boolean(true),
})
Properties
anyMethodoptionalbooleanany_methodoptionalboolanyMethodoptionalBooleanAnyMethodoptionalboolAnyMethodoptional*bool = true #If set to false, you will have to explicitly add methods to this resource after it's created.
autoConfigurePathParameteroptionalbooleanauto_configure_path_parameteroptionalboolautoConfigurePathParameteroptionalBooleanAutoConfigurePathParameteroptionalboolAutoConfigurePathParameteroptional*bool = false #notes
When enabled, this property automatically configures both the method request and integration request to properly handle the proxy path parameter:
- Adds
method.request.path.proxy: trueto method request parameters - Adds
integration.request.path.proxy: 'method.request.path.proxy'to integration request parameters
This matches the behavior of the AWS Console when creating proxy resources and eliminates the need to manually configure path parameters.
This is meant for integrations whose URI uses {proxy}, such as HTTP integrations. Lambda proxy (AWS_PROXY) integrations do not need it, as Lambda already receives the full request path. The mapping is added even when the integration URI has no {proxy}.
Mock integrations are left unchanged. When the proxy is added to the root resource, the method that is also added to the root has no {proxy} path parameter, so it is not configured.
defaultCorsPreflightOptionsoptionalCorsOptionsdefault_cors_preflight_optionsoptionalCorsOptionsdefaultCorsPreflightOptionsoptionalCorsOptionsDefaultCorsPreflightOptionsoptionalCorsOptionsDefaultCorsPreflightOptionsoptionalCorsOptions #Default: CORS is disabled
You can add CORS at the resource-level using addCorsPreflight.
defaultIntegrationoptionalIntegrationdefault_integrationoptionalIntegrationdefaultIntegrationoptionalIntegrationDefaultIntegrationoptionalIntegrationDefaultIntegrationoptionalIntegration #Default: Inherited from parent.
defaultMethodOptionsoptionalMethodOptionsdefault_method_optionsoptionalMethodOptionsdefaultMethodOptionsoptionalMethodOptionsDefaultMethodOptionsoptionalMethodOptionsDefaultMethodOptionsoptionalMethodOptions #Default: Inherited from parent.