Skip to content

Commit a1f860a

Browse files
author
Niranjan Jayakar
committed
PR feedback
1 parent 29dcb0a commit a1f860a

File tree

3 files changed

+13
-26
lines changed

3 files changed

+13
-26
lines changed

packages/@aws-cdk/aws-efs/lib/efs-file-system.ts

+10-14
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { CfnFileSystem, CfnMountTarget } from './efs.generated';
1010
* @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-elasticfilesystem-filesystem-lifecyclepolicies
1111
*/
1212
// tslint:enable
13-
export enum LifecyclePolicyProperty {
13+
export enum LifecyclePolicy {
1414
/**
1515
* After 7 days of not being accessed.
1616
*/
@@ -134,7 +134,7 @@ export interface FileSystemProps {
134134
*
135135
* @default - none
136136
*/
137-
readonly lifecyclePolicy?: LifecyclePolicyProperty;
137+
readonly lifecyclePolicy?: LifecyclePolicy;
138138

139139
/**
140140
* Enum to mention the performance mode of the file system.
@@ -153,9 +153,9 @@ export interface FileSystemProps {
153153
/**
154154
* Provisioned throughput for the file system.
155155
* This is a required property if the throughput mode is set to PROVISIONED.
156-
* Valid values are 1MiB/s -> 1GiB/s
156+
* Must be at least 1MiB/s.
157157
*
158-
* @default - None, errors out
158+
* @default - none, errors out
159159
*/
160160
readonly provisionedThroughputPerSecond?: Size;
161161
}
@@ -172,7 +172,7 @@ export interface FileSystemAttributes {
172172
/**
173173
* The File System's ID.
174174
*/
175-
readonly fileSystemID: string;
175+
readonly fileSystemId: string;
176176
}
177177

178178
/**
@@ -192,7 +192,7 @@ export class FileSystem extends Resource implements IFileSystem {
192192
*/
193193
public static fromFileSystemAttributes(scope: Construct, id: string, attrs: FileSystemAttributes): IFileSystem {
194194
class Import extends Resource implements IFileSystem {
195-
public readonly fileSystemId = attrs.fileSystemID;
195+
public readonly fileSystemId = attrs.fileSystemId;
196196
public readonly connections = new ec2.Connections({
197197
securityGroups: [attrs.securityGroup],
198198
defaultPort: ec2.Port.tcp(FileSystem.DEFAULT_PORT),
@@ -223,23 +223,19 @@ export class FileSystem extends Resource implements IFileSystem {
223223
constructor(scope: Construct, id: string, props: FileSystemProps) {
224224
super(scope, id);
225225

226-
if (props.throughputMode === ThroughputMode.PROVISIONED) {
227-
if (props.provisionedThroughputPerSecond === undefined) {
228-
throw new Error('Property provisionedThroughputInMibps is required when throughputMode is PROVISIONED');
229-
} else if (props.provisionedThroughputPerSecond.toMebibytes() > 1024) {
230-
throw new Error('Valid values for throughput are 1MiB/s - 1GiB/s. You can get this limit increased by contacting AWS Support.');
231-
}
226+
if (props.throughputMode === ThroughputMode.PROVISIONED && props.provisionedThroughputPerSecond === undefined) {
227+
throw new Error('Property provisionedThroughputPerSecond is required when throughputMode is PROVISIONED');
232228
}
233229

234230
const filesystem = new CfnFileSystem(this, 'Resource', {
235231
encrypted: props.encrypted,
236232
kmsKeyId: (props.kmsKey ? props.kmsKey.keyId : undefined),
237233
lifecyclePolicies: (props.lifecyclePolicy ? Array.of({
238-
transitionToIa: LifecyclePolicyProperty[props.lifecyclePolicy],
234+
transitionToIa: LifecyclePolicy[props.lifecyclePolicy],
239235
} as CfnFileSystem.LifecyclePolicyProperty) : undefined),
240236
performanceMode: props.performanceMode,
241237
throughputMode: props.throughputMode,
242-
provisionedThroughputInMibps: props.provisionedThroughputPerSecond ? props.provisionedThroughputPerSecond.toMebibytes() : undefined,
238+
provisionedThroughputInMibps: props.provisionedThroughputPerSecond?.toMebibytes(),
243239
});
244240

245241
this.fileSystemId = filesystem.ref;

packages/@aws-cdk/aws-efs/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@
104104
"engines": {
105105
"node": ">= 10.12.0"
106106
},
107-
"stability": "experimental",
108107
"maturity": "experimental",
109108
"awscdkio": {
110109
"announce": false

packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts

+3-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {expect as expectCDK, haveResource} from '@aws-cdk/assert';
22
import * as ec2 from '@aws-cdk/aws-ec2';
33
import * as kms from '@aws-cdk/aws-kms';
44
import { Size, Stack, Tag } from '@aws-cdk/core';
5-
import { FileSystem, LifecyclePolicyProperty, PerformanceMode, ThroughputMode} from '../lib';
5+
import { FileSystem, LifecyclePolicy, PerformanceMode, ThroughputMode} from '../lib';
66

77
let stack = new Stack();
88
let vpc = new ec2.Vpc(stack, 'VPC');
@@ -76,7 +76,7 @@ test('file system is created correctly with life cycle property', () => {
7676
// WHEN
7777
new FileSystem(stack, 'EfsFileSystem', {
7878
vpc,
79-
lifecyclePolicy: LifecyclePolicyProperty.AFTER_14_DAYS,
79+
lifecyclePolicy: LifecyclePolicy.AFTER_14_DAYS,
8080
});
8181
// THEN
8282
expectCDK(stack).to(haveResource('AWS::EFS::FileSystem', {
@@ -127,14 +127,6 @@ test('fails when provisioned throughput is less than the valid range', () => {
127127
})).toThrow(/cannot be converted into a whole number/);
128128
});
129129

130-
test('fails when provisioned throughput is above 1Gibps', () => {
131-
expect(() => new FileSystem(stack, 'EfsFileSystem1', {
132-
vpc,
133-
throughputMode: ThroughputMode.PROVISIONED,
134-
provisionedThroughputPerSecond: Size.mebibytes(1025),
135-
})).toThrow(/values for throughput/);
136-
});
137-
138130
test('fails when provisioned throughput is not a whole number of mebibytes', () => {
139131
expect(() => {
140132
new FileSystem(stack, 'EfsFileSystem2', {
@@ -162,7 +154,7 @@ test('file system is created correctly with provisioned throughput mode', () =>
162154
test('existing file system is imported correctly', () => {
163155
// WHEN
164156
const fs = FileSystem.fromFileSystemAttributes(stack, 'existingFS', {
165-
fileSystemID: 'fs123',
157+
fileSystemId: 'fs123',
166158
securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', {
167159
allowAllOutbound: false,
168160
}),

0 commit comments

Comments
 (0)