# ProxyResourceOptions

Extends: [ResourceOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.ResourceOptions.html)
Used as argument in: [IResource.addProxy](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.IResource.html#addproxy)

- Source: [`aws-apigateway/lib/resource.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-apigateway/lib/resource.ts#L519)

## Example

TypeScript:

```ts
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
});
```

Python:

```python
# 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
)
```

Java:

```java
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());
```

C# / .NET:

```csharp
// 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
});
```

Golang:

```go
// 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

- `anyMethod`: boolean = true — Adds an "ANY" method to this resource.

  If set to `false`, you will have to explicitly
  add methods to this resource after it's created.

- `autoConfigurePathParameter`: boolean = false — Automatically configure path parameter mapping for the proxy resource.

  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: true` to 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.

- `defaultCorsPreflightOptions`: [CorsOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.CorsOptions.html) — Adds a CORS preflight OPTIONS method to this resource and all child resources.

  **Default:** CORS is disabled

  You can add CORS at the resource-level using `addCorsPreflight`.

- `defaultIntegration`: [Integration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.Integration.html) — An integration to use as a default for all methods created within this API unless an integration is specified.

  **Default:** Inherited from parent.

- `defaultMethodOptions`: [MethodOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.MethodOptions.html) — Method options to use as a default for all methods created within this API unless custom options are specified.

  **Default:** Inherited from parent.
