-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(apigateway): minCompressionSize on SpecRestApi #24067
Changes from 7 commits
eb774c1
d2ce75d
2ea8ec7
52884e9
54e254f
ac12230
6a556a9
c5d4c58
ca26883
54d9345
f6f1f12
9b9ea6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; | ||
import { IVpcEndpoint } from '@aws-cdk/aws-ec2'; | ||
import * as iam from '@aws-cdk/aws-iam'; | ||
import { ArnFormat, CfnOutput, IResource as IResourceBase, Resource, Stack, Token, FeatureFlags, RemovalPolicy } from '@aws-cdk/core'; | ||
import { ArnFormat, CfnOutput, IResource as IResourceBase, Resource, Stack, Token, FeatureFlags, RemovalPolicy, Size } from '@aws-cdk/core'; | ||
import { APIGATEWAY_DISABLE_CLOUDWATCH_ROLE } from '@aws-cdk/cx-api'; | ||
import { Construct } from 'constructs'; | ||
import { ApiDefinition } from './api-definition'; | ||
|
@@ -216,6 +216,14 @@ export interface RestApiProps extends RestApiOptions { | |
*/ | ||
readonly binaryMediaTypes?: string[]; | ||
|
||
/** | ||
* Deprecated | ||
* | ||
* @default - Compression is disabled. | ||
* @deprecated - superseded by `minCompressionSize` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👨🍳👌 |
||
*/ | ||
readonly minimumCompressionSize?: number; | ||
|
||
/** | ||
* A nullable integer that is used to enable compression (with non-negative | ||
* between 0 and 10485760 (10M) bytes, inclusive) or disable compression | ||
|
@@ -226,7 +234,7 @@ export interface RestApiProps extends RestApiOptions { | |
* | ||
* @default - Compression is disabled. | ||
*/ | ||
readonly minimumCompressionSize?: number; | ||
readonly minCompressionSize?: Size; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is morally ~the same, but I would have expected you to leave the old property in place and In any case I think you'd like to adjust the doc comment for the new property. For example, it's no longer an "integer". |
||
|
||
/** | ||
* The ID of the API Gateway RestApi resource that you want to clone. | ||
|
@@ -261,6 +269,18 @@ export interface SpecRestApiProps extends RestApiBaseProps { | |
* @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html | ||
*/ | ||
readonly apiDefinition: ApiDefinition; | ||
|
||
/** | ||
* A nullable integer that is used to enable compression (with non-negative | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not an integer. |
||
* between 0 and 10485760 (10M) bytes, inclusive) or disable compression | ||
* (when undefined) on an API. When compression is enabled, compression or | ||
* decompression is not applied on the payload if the payload size is | ||
* smaller than this value. Setting it to zero allows compression for any | ||
* payload size. | ||
* | ||
* @default - Compression is disabled. | ||
*/ | ||
readonly minCompressionSize?: Size; | ||
} | ||
|
||
/** | ||
|
@@ -648,6 +668,7 @@ export class SpecRestApi extends RestApiBase { | |
name: this.restApiName, | ||
policy: props.policy, | ||
failOnWarnings: props.failOnWarnings, | ||
minimumCompressionSize: props.minCompressionSize?.toBytes(), | ||
body: apiDefConfig.inlineDefinition ?? undefined, | ||
bodyS3Location: apiDefConfig.inlineDefinition ? undefined : apiDefConfig.s3Location, | ||
endpointConfiguration: this._configureEndpoints(props), | ||
|
@@ -763,7 +784,7 @@ export class RestApi extends RestApiBase { | |
description: props.description, | ||
policy: props.policy, | ||
failOnWarnings: props.failOnWarnings, | ||
minimumCompressionSize: props.minimumCompressionSize, | ||
rix0rrr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
minimumCompressionSize: props.minCompressionSize?.toBytes(), | ||
binaryMediaTypes: props.binaryMediaTypes, | ||
endpointConfiguration: this._configureEndpoints(props), | ||
apiKeySourceType: props.apiKeySourceType, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"version":"21.0.0"} | ||
{"version":"30.0.0"} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "21.0.0", | ||
"version": "30.0.0", | ||
"testCases": { | ||
"apigateway-restapi/DefaultTest": { | ||
"stacks": [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both properties need to be documented, even if they are deprecated.