Skip to content
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

fix(aws-apigateway-iot and aws-cloudfront-apigateway-lambda): fixed deprecated warnings #554

Merged
merged 6 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Out of the box implementation of the Construct without any override will set the

### Amazon API Gateway

* Deploy an edge-optimized API endpoint
* Deploy an edge-optimized API Endpoint
* Creates API Resources with `POST` Method to publish messages to IoT Topics
* Creates API Resources with `POST` Method to publish messages to ThingShadow & NamedShadows
* Enable CloudWatch logging for API Gateway
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ test('override api gateway properties with existingLambdaObj', () => {
new CloudFrontToApiGatewayToLambda(stack, 'test-cloudfront-apigateway-lambda', {
existingLambdaObj: fn,
apiGatewayProps: {
options: {
description: "Override description"
}
description: "Override description"
}
});

Expand Down Expand Up @@ -184,9 +182,7 @@ test('override api gateway properties without existingLambdaObj', () => {
endpointConfiguration: {
types: [api.EndpointType.PRIVATE],
},
options: {
description: "Override description"
}
description: "Override description"
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,23 @@ function configureLambdaRestApi(scope: Construct, defaultApiGatewayProps: api.La
cwRole = configureCloudwatchRoleForApi(scope, _api);
}

let usagePlanProps: api.UsagePlanProps = {
// Configure Usage Plan
const usagePlanProps: api.UsagePlanProps = {
apiStages: [{
api: _api,
stage: _api.deploymentStage
}]
};
// If requireApiKey param is set to true, create a api key & associate to Usage Plan

const plan = _api.addUsagePlan('UsagePlan', usagePlanProps);

// If requireApiKey param is set to true, create a api key & associate to Usage Plan
if (apiGatewayProps?.defaultMethodOptions?.apiKeyRequired === true) {
const extraParams = { apiKey: _api.addApiKey('ApiKey')};
usagePlanProps = Object.assign(usagePlanProps, extraParams);
// Configure Usage Plan with API Key
const key = _api.addApiKey('ApiKey');
plan.addApiKey(key);
}

// Configure Usage Plan
_api.addUsagePlan('UsagePlan', usagePlanProps);

// Return the API and CW Role
return [_api, cwRole];
}
Expand Down Expand Up @@ -152,22 +154,23 @@ function configureRestApi(scope: Construct, defaultApiGatewayProps: api.RestApiP
cwRole = configureCloudwatchRoleForApi(scope, _api);
}

let usagePlanProps: api.UsagePlanProps = {
// Configure Usage Plan
const usagePlanProps: api.UsagePlanProps = {
apiStages: [{
api: _api,
stage: _api.deploymentStage
}]
};

const plan = _api.addUsagePlan('UsagePlan', usagePlanProps);

// If requireApiKey param is set to true, create a api key & associate to Usage Plan
if (apiGatewayProps?.defaultMethodOptions?.apiKeyRequired === true) {
const extraParams = { apiKey: _api.addApiKey('ApiKey')};
usagePlanProps = Object.assign(usagePlanProps, extraParams);
// Configure Usage Plan with API Key
const key = _api.addApiKey('ApiKey');
plan.addApiKey(key);
}

// Configure Usage Plan
_api.addUsagePlan('UsagePlan', usagePlanProps);

// Return the API and CW Role
return [_api, cwRole];
}
Expand Down