Skip to content

Commit

Permalink
Fix @aws-apigateway ApiKey.
Browse files Browse the repository at this point in the history
  • Loading branch information
skinny85 committed Jun 19, 2019
1 parent c2ceec2 commit 29d1599
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/@aws-cdk/aws-apigateway/lib/api-key.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Construct, IResource as IResourceBase, Resource } from '@aws-cdk/cdk';
import { Construct, IResource as IResourceBase, PhysicalName, Resource } from '@aws-cdk/cdk';
import { CfnApiKey } from './apigateway.generated';
import { ResourceOptions } from "./resource";
import { RestApi } from './restapi';
Expand Down Expand Up @@ -70,7 +70,7 @@ export interface ApiKeyProps extends ResourceOptions {
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html#cfn-apigateway-apikey-name
* @default automically generated name
*/
readonly name?: string;
readonly apiKeyName?: PhysicalName;
}

/**
Expand All @@ -83,14 +83,16 @@ export class ApiKey extends Resource implements IApiKey {
public readonly keyId: string;

constructor(scope: Construct, id: string, props: ApiKeyProps = { }) {
super(scope, id);
super(scope, id, {
physicalName: props.apiKeyName,
});

const resource = new CfnApiKey(this, 'Resource', {
customerId: props.customerId,
description: props.description,
enabled: props.enabled || true,
generateDistinctId: props.generateDistinctId,
name: props.name,
name: this.physicalName.value,
stageKeys: this.renderStageKeys(props.resources)
});

Expand Down

0 comments on commit 29d1599

Please sign in to comment.