Skip to content

Commit

Permalink
fix(aws-apigateway-iot and aws-cloudfront-apigateway-lambda): fixed d…
Browse files Browse the repository at this point in the history
…eprecated warnings (#554)

* updated README for iot-sqs and kinesisstreams-gluejob

* fixed deprecated warnings

* empty commit
  • Loading branch information
mickychetta authored Dec 21, 2021
1 parent bf45829 commit 655c4af
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
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

0 comments on commit 655c4af

Please sign in to comment.