# RateLimitedApiKeyProps

RateLimitedApiKey properties.

Extends: [ApiKeyProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.ApiKeyProps.html)
Used as props by: [RateLimitedApiKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.RateLimitedApiKey.html)

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

## Example

TypeScript:

```ts
declare const api: apigateway.RestApi;

const key = new apigateway.RateLimitedApiKey(this, 'rate-limited-api-key', {
  customerId: 'hello-customer',
  apiStages: [{ stage: api.deploymentStage }],
  quota: {
    limit: 10000,
    period: apigateway.Period.MONTH
  }
});
```

Python:

```python
# api: apigateway.RestApi

key = apigateway.RateLimitedApiKey(self, "rate-limited-api-key",
    customer_id="hello-customer",
    api_stages=[apigateway.UsagePlanPerApiStage(stage=api.deployment_stage)],
    quota=apigateway.QuotaSettings(
        limit=10000,
        period=apigateway.Period.MONTH
    )
)
```

Java:

```java
RestApi api;

RateLimitedApiKey key = RateLimitedApiKey.Builder.create(this, "rate-limited-api-key")
        .customerId("hello-customer")
        .apiStages(List.of(UsagePlanPerApiStage.builder().stage(api.getDeploymentStage()).build()))
        .quota(QuotaSettings.builder()
                .limit(10000)
                .period(Period.MONTH)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
RestApi api;

var key = new RateLimitedApiKey(this, "rate-limited-api-key", new RateLimitedApiKeyProps {
    CustomerId = "hello-customer",
    ApiStages = new [] { new UsagePlanPerApiStage { Stage = api.DeploymentStage } },
    Quota = new QuotaSettings {
        Limit = 10000,
        Period = Period.MONTH
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var api RestApi

key := apigateway.NewRateLimitedApiKey(this, jsii.String("rate-limited-api-key"), &RateLimitedApiKeyProps{
	CustomerId: jsii.String("hello-customer"),
	ApiStages: []UsagePlanPerApiStage{
		&UsagePlanPerApiStage{
			Stage: api.DeploymentStage,
		},
	},
	Quota: &QuotaSettings{
		Limit: jsii.Number(10000),
		Period: apigateway.Period_MONTH,
	},
})
```

## Properties

- `apiKeyName`: string — A name for the API key.

  **Default:** automically generated name

  If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the API key name.

- `apiStages`: [UsagePlanPerApiStage](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.UsagePlanPerApiStage.html)[] = none — API Stages to be associated with the RateLimitedApiKey.

  If you already prepared UsagePlan resource explicitly, you should use `stages` property.
  If you prefer to prepare UsagePlan resource implicitly via RateLimitedApiKey,
  or you should specify throttle settings at each stage individually, you should use `apiStages` property.

- `customerId`: string = none — An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.

- `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.

- `description`: string = none — A description of the purpose of the API key.

- `enabled`: boolean = true — Indicates whether the API key can be used by clients.

- `generateDistinctId`: boolean = false — Specifies whether the key identifier is distinct from the created API key value.

- `quota`: [QuotaSettings](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.QuotaSettings.html) = none — Number of requests clients can make in a given time period.

- `resources`: [IRestApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.IRestApi.html)[] = none — - use `stages` instead

- `stages`: [IStage](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.IStage.html)[] — A list of Stages this api key is associated with.

  **Default:** the api key is not associated with any stages

- `throttle`: [ThrottleSettings](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.ThrottleSettings.html) = none — Overall throttle settings for the API.

- `value`: string = none — The value of the API key.

  Must be at least 20 characters long.
