Skip to content

Commit

Permalink
feat(apigatewayv2): configure description for HttpApi (#10863)
Browse files Browse the repository at this point in the history
Allows setting the description for HttpAPI.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
iRoachie committed Oct 16, 2020
1 parent 3839796 commit 895372f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/@aws-cdk/aws-apigatewayv2/lib/http/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ export interface HttpApiProps {
*/
readonly apiName?: string;

/**
* The description of the API.
* @default - none
*/
readonly description?: string;

/**
* An integration that will be configured on the catch-all route ($default).
* @default - none
Expand Down Expand Up @@ -267,6 +273,7 @@ export class HttpApi extends HttpApiBase {
name: this.httpApiName,
protocolType: 'HTTP',
corsConfiguration,
description: props?.description,
};

const resource = new CfnApi(this, 'Resource', apiProps);
Expand Down
13 changes: 13 additions & 0 deletions packages/@aws-cdk/aws-apigatewayv2/test/http/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,17 @@ describe('HttpApi', () => {
expect(countMetric.statistic).toEqual(statistic);
});
});

test('description is set', () => {
const stack = new Stack();
new HttpApi(stack, 'api', {
description: 'My Api',
});

expect(stack).toHaveResource('AWS::ApiGatewayV2::Api', {
Name: 'api',
ProtocolType: 'HTTP',
Description: 'My Api',
});
});
});

0 comments on commit 895372f

Please sign in to comment.