From 29dcb0a6f872ddcbe315cdd09a68f50ecc3d5826 Mon Sep 17 00:00:00 2001 From: Niranjan Jayakar Date: Tue, 21 Apr 2020 15:46:14 +0100 Subject: [PATCH 1/4] chore(efs): align construct library to latest standards - Drop the `Efs` prefix to the exported types. - Change the type of provisioned throughput property to use `Size`. BREAKING CHANGE: Exported types no longer have the `Efs` prefix. * **efs:** `provisionedThroughputInMibps` property is renamed to `provisionedThroughputInSeconds` and has the type `Size`. --- .../@aws-cdk/aws-efs/lib/efs-file-system.ts | 81 +++++++----------- packages/@aws-cdk/aws-efs/package.json | 8 -- .../aws-efs/test/efs-file-system.test.ts | 85 ++++++++----------- 3 files changed, 67 insertions(+), 107 deletions(-) diff --git a/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts b/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts index b546dcbc5b0ae..58709404efade 100644 --- a/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts +++ b/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts @@ -1,15 +1,16 @@ import * as ec2 from '@aws-cdk/aws-ec2'; import * as kms from '@aws-cdk/aws-kms'; -import {Construct, Resource, Tag} from '@aws-cdk/core'; -import {CfnFileSystem, CfnMountTarget} from './efs.generated'; +import { Construct, IResource, Resource, Size, Tag } from '@aws-cdk/core'; +import { CfnFileSystem, CfnMountTarget } from './efs.generated'; -// tslint:disable: max-line-length +// tslint:disable:max-line-length /** * EFS Lifecycle Policy, if a file is not accessed for given days, it will move to EFS Infrequent Access. * * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-elasticfilesystem-filesystem-lifecyclepolicies */ -export enum EfsLifecyclePolicyProperty { +// tslint:enable +export enum LifecyclePolicyProperty { /** * After 7 days of not being accessed. */ @@ -41,7 +42,7 @@ export enum EfsLifecyclePolicyProperty { * * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-efs-filesystem-performancemode */ -export enum EfsPerformanceMode { +export enum PerformanceMode { /** * This is the general purpose performance mode for most file systems. */ @@ -59,7 +60,7 @@ export enum EfsPerformanceMode { * * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-elasticfilesystem-filesystem-throughputmode */ -export enum EfsThroughputMode { +export enum ThroughputMode { /** * This mode on Amazon EFS scales as the size of the file system in the standard storage class grows. */ @@ -74,7 +75,7 @@ export enum EfsThroughputMode { /** * Interface to implement AWS File Systems. */ -export interface IEfsFileSystem extends ec2.IConnectable { +export interface IFileSystem extends ec2.IConnectable, IResource { /** * The ID of the file system, assigned by Amazon EFS. * @@ -86,7 +87,7 @@ export interface IEfsFileSystem extends ec2.IConnectable { /** * Properties of EFS FileSystem. */ -export interface EfsFileSystemProps { +export interface FileSystemProps { /** * VPC to launch the file system in. @@ -133,51 +134,36 @@ export interface EfsFileSystemProps { * * @default - none */ - readonly lifecyclePolicy?: EfsLifecyclePolicyProperty; + readonly lifecyclePolicy?: LifecyclePolicyProperty; /** * Enum to mention the performance mode of the file system. * * @default - GENERAL_PURPOSE */ - readonly performanceMode?: EfsPerformanceMode; + readonly performanceMode?: PerformanceMode; /** * Enum to mention the throughput mode of the file system. * * @default - BURSTING */ - readonly throughputMode?: EfsThroughputMode; + readonly throughputMode?: ThroughputMode; /** - * Provisioned throughput for the file system. This is a required property if the throughput mode is set to PROVISIONED. - * Valid values are 1-1024. + * Provisioned throughput for the file system. + * This is a required property if the throughput mode is set to PROVISIONED. + * Valid values are 1MiB/s -> 1GiB/s * * @default - None, errors out */ - readonly provisionedThroughputInMibps?: number; -} - -/** - * A new or imported EFS File System. - */ -abstract class EfsFileSystemBase extends Resource implements IEfsFileSystem { - - /** - * The security groups/rules used to allow network connections to the file system. - */ - public abstract readonly connections: ec2.Connections; - - /** - * @attribute - */ - public abstract readonly fileSystemId: string; + readonly provisionedThroughputPerSecond?: Size; } /** * Properties that describe an existing EFS file system. */ -export interface EfsFileSystemAttributes { +export interface FileSystemAttributes { /** * The security group of the file system */ @@ -199,17 +185,17 @@ export interface EfsFileSystemAttributes { * * @resource AWS::EFS::FileSystem */ -export class EfsFileSystem extends EfsFileSystemBase { +export class FileSystem extends Resource implements IFileSystem { /** * Import an existing File System from the given properties. */ - public static fromEfsFileSystemAttributes(scope: Construct, id: string, attrs: EfsFileSystemAttributes): IEfsFileSystem { - class Import extends EfsFileSystemBase implements IEfsFileSystem { + public static fromFileSystemAttributes(scope: Construct, id: string, attrs: FileSystemAttributes): IFileSystem { + class Import extends Resource implements IFileSystem { public readonly fileSystemId = attrs.fileSystemID; public readonly connections = new ec2.Connections({ securityGroups: [attrs.securityGroup], - defaultPort: ec2.Port.tcp(EfsFileSystem.DEFAULT_PORT), + defaultPort: ec2.Port.tcp(FileSystem.DEFAULT_PORT), }); } @@ -231,37 +217,32 @@ export class EfsFileSystem extends EfsFileSystemBase { */ public readonly fileSystemId: string; - private readonly efsFileSystem: CfnFileSystem; - /** * Constructor for creating a new EFS FileSystem. */ - constructor(scope: Construct, id: string, props: EfsFileSystemProps) { + constructor(scope: Construct, id: string, props: FileSystemProps) { super(scope, id); - if (props.throughputMode === EfsThroughputMode.PROVISIONED) { - if (props.provisionedThroughputInMibps === undefined) { + if (props.throughputMode === ThroughputMode.PROVISIONED) { + if (props.provisionedThroughputPerSecond === undefined) { throw new Error('Property provisionedThroughputInMibps is required when throughputMode is PROVISIONED'); - } else if (!Number.isInteger(props.provisionedThroughputInMibps)) { - throw new Error('Invalid input for provisionedThroughputInMibps'); - } else if (props.provisionedThroughputInMibps < 1 || props.provisionedThroughputInMibps > 1024) { - this.node.addWarning('Valid values for throughput are 1-1024 MiB/s. You can get this limit increased by contacting AWS Support.'); + } else if (props.provisionedThroughputPerSecond.toMebibytes() > 1024) { + throw new Error('Valid values for throughput are 1MiB/s - 1GiB/s. You can get this limit increased by contacting AWS Support.'); } } - this.efsFileSystem = new CfnFileSystem(this, 'Resource', { + const filesystem = new CfnFileSystem(this, 'Resource', { encrypted: props.encrypted, kmsKeyId: (props.kmsKey ? props.kmsKey.keyId : undefined), lifecyclePolicies: (props.lifecyclePolicy ? Array.of({ - transitionToIa: EfsLifecyclePolicyProperty[props.lifecyclePolicy], + transitionToIa: LifecyclePolicyProperty[props.lifecyclePolicy], } as CfnFileSystem.LifecyclePolicyProperty) : undefined), performanceMode: props.performanceMode, throughputMode: props.throughputMode, - provisionedThroughputInMibps: props.provisionedThroughputInMibps, + provisionedThroughputInMibps: props.provisionedThroughputPerSecond ? props.provisionedThroughputPerSecond.toMebibytes() : undefined, }); - this.fileSystemId = this.efsFileSystem.ref; - this.node.defaultChild = this.efsFileSystem; + this.fileSystemId = filesystem.ref; Tag.add(this, 'Name', props.fileSystemName || this.node.path); const securityGroup = (props.securityGroup || new ec2.SecurityGroup(this, 'EfsSecurityGroup', { @@ -270,7 +251,7 @@ export class EfsFileSystem extends EfsFileSystemBase { this.connections = new ec2.Connections({ securityGroups: [securityGroup], - defaultPort: ec2.Port.tcp(EfsFileSystem.DEFAULT_PORT), + defaultPort: ec2.Port.tcp(FileSystem.DEFAULT_PORT), }); const subnets = props.vpc.selectSubnets(props.vpcSubnets); diff --git a/packages/@aws-cdk/aws-efs/package.json b/packages/@aws-cdk/aws-efs/package.json index 719e6deb95609..e273fcf3f8a1c 100644 --- a/packages/@aws-cdk/aws-efs/package.json +++ b/packages/@aws-cdk/aws-efs/package.json @@ -104,14 +104,6 @@ "engines": { "node": ">= 10.12.0" }, - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-efs.EfsFileSystemProps", - "resource-interface:@aws-cdk/aws-efs.EfsFileSystem", - "construct-interface-extends-iconstruct:@aws-cdk/aws-efs.IEfsFileSystem", - "resource-interface-extends-resource:@aws-cdk/aws-efs.IEfsFileSystem" - ] - }, "stability": "experimental", "maturity": "experimental", "awscdkio": { diff --git a/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts b/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts index 2aef981984a5b..8ebac02533b54 100644 --- a/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts +++ b/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts @@ -1,9 +1,8 @@ import {expect as expectCDK, haveResource} from '@aws-cdk/assert'; import * as ec2 from '@aws-cdk/aws-ec2'; import * as kms from '@aws-cdk/aws-kms'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import {Stack, Tag} from '@aws-cdk/core'; -import {EfsFileSystem, EfsLifecyclePolicyProperty, EfsPerformanceMode, EfsThroughputMode} from '../lib/efs-file-system'; +import { Size, Stack, Tag } from '@aws-cdk/core'; +import { FileSystem, LifecyclePolicyProperty, PerformanceMode, ThroughputMode} from '../lib'; let stack = new Stack(); let vpc = new ec2.Vpc(stack, 'VPC'); @@ -15,7 +14,7 @@ beforeEach( () => { test('default file system is created correctly', () => { // WHEN - new EfsFileSystem(stack, 'EfsFileSystem', { + new FileSystem(stack, 'EfsFileSystem', { vpc, }); // THEN @@ -26,7 +25,7 @@ test('default file system is created correctly', () => { test('unencrypted file system is created correctly with default KMS', () => { // WHEN - new EfsFileSystem(stack, 'EfsFileSystem', { + new FileSystem(stack, 'EfsFileSystem', { vpc, encrypted: false, }); @@ -38,7 +37,7 @@ test('unencrypted file system is created correctly with default KMS', () => { test('encrypted file system is created correctly with default KMS', () => { // WHEN - new EfsFileSystem(stack, 'EfsFileSystem', { + new FileSystem(stack, 'EfsFileSystem', { vpc, encrypted: true, }); @@ -52,7 +51,7 @@ test('encrypted file system is created correctly with custom KMS', () => { const key = new kms.Key(stack, 'customKeyFS'); // WHEN - new EfsFileSystem(stack, 'EfsFileSystem', { + new FileSystem(stack, 'EfsFileSystem', { vpc, encrypted: true, kmsKey: key, @@ -75,9 +74,9 @@ test('encrypted file system is created correctly with custom KMS', () => { test('file system is created correctly with life cycle property', () => { // WHEN - new EfsFileSystem(stack, 'EfsFileSystem', { + new FileSystem(stack, 'EfsFileSystem', { vpc, - lifecyclePolicy: EfsLifecyclePolicyProperty.AFTER_14_DAYS, + lifecyclePolicy: LifecyclePolicyProperty.AFTER_14_DAYS, }); // THEN expectCDK(stack).to(haveResource('AWS::EFS::FileSystem', { @@ -89,9 +88,9 @@ test('file system is created correctly with life cycle property', () => { test('file system is created correctly with performance mode', () => { // WHEN - new EfsFileSystem(stack, 'EfsFileSystem', { + new FileSystem(stack, 'EfsFileSystem', { vpc, - performanceMode: EfsPerformanceMode.MAX_IO, + performanceMode: PerformanceMode.MAX_IO, }); // THEN expectCDK(stack).to(haveResource('AWS::EFS::FileSystem', { @@ -101,9 +100,9 @@ test('file system is created correctly with performance mode', () => { test('file system is created correctly with bursting throughput mode', () => { // WHEN - new EfsFileSystem(stack, 'EfsFileSystem', { + new FileSystem(stack, 'EfsFileSystem', { vpc, - throughputMode: EfsThroughputMode.BURSTING, + throughputMode: ThroughputMode.BURSTING, }); // THEN expectCDK(stack).to(haveResource('AWS::EFS::FileSystem', { @@ -113,57 +112,45 @@ test('file system is created correctly with bursting throughput mode', () => { test('Exception when throughput mode is set to PROVISIONED, but provisioned throughput is not set', () => { expect(() => { - new EfsFileSystem(stack, 'EfsFileSystem', { + new FileSystem(stack, 'EfsFileSystem', { vpc, - throughputMode: EfsThroughputMode.PROVISIONED, + throughputMode: ThroughputMode.PROVISIONED, }); }).toThrowError(/Property provisionedThroughputInMibps is required when throughputMode is PROVISIONED/); }); -test('Warning when provisioned throughput is less than the valid range', () => { - const fileSystem = new EfsFileSystem(stack, 'EfsFileSystem', { +test('fails when provisioned throughput is less than the valid range', () => { + expect(() => new FileSystem(stack, 'EfsFileSystem', { vpc, - throughputMode: EfsThroughputMode.PROVISIONED, - provisionedThroughputInMibps: 0, - }); - - expect(fileSystem.node.metadata[0].type).toMatch(cxschema.ArtifactMetadataEntryType.WARN); - expect(fileSystem.node.metadata[0].data).toContain('Valid values for throughput are 1-1024 MiB/s'); - expect(fileSystem.node.metadata[0].data).toContain('You can get this limit increased by contacting AWS Support'); - - expectCDK(stack).to(haveResource('AWS::EFS::FileSystem')); + throughputMode: ThroughputMode.PROVISIONED, + provisionedThroughputPerSecond: Size.kibibytes(10), + })).toThrow(/cannot be converted into a whole number/); }); -test('Warning when provisioned throughput is above than the valid range', () => { - const fileSystem = new EfsFileSystem(stack, 'EfsFileSystem1', { +test('fails when provisioned throughput is above 1Gibps', () => { + expect(() => new FileSystem(stack, 'EfsFileSystem1', { vpc, - throughputMode: EfsThroughputMode.PROVISIONED, - provisionedThroughputInMibps: 1025, - }); - - expect(fileSystem.node.metadata[0].type).toMatch(cxschema.ArtifactMetadataEntryType.WARN); - expect(fileSystem.node.metadata[0].data).toContain('Valid values for throughput are 1-1024 MiB/s'); - expect(fileSystem.node.metadata[0].data).toContain('You can get this limit increased by contacting AWS Support'); - - expectCDK(stack).to(haveResource('AWS::EFS::FileSystem')); + throughputMode: ThroughputMode.PROVISIONED, + provisionedThroughputPerSecond: Size.mebibytes(1025), + })).toThrow(/values for throughput/); }); -test('Error when provisioned throughput is invalid number', () => { +test('fails when provisioned throughput is not a whole number of mebibytes', () => { expect(() => { - new EfsFileSystem(stack, 'EfsFileSystem2', { + new FileSystem(stack, 'EfsFileSystem2', { vpc, - throughputMode: EfsThroughputMode.PROVISIONED, - provisionedThroughputInMibps: 1.5, + throughputMode: ThroughputMode.PROVISIONED, + provisionedThroughputPerSecond: Size.kibibytes(2050), }); - }).toThrowError(/Invalid input for provisionedThroughputInMibps/); + }).toThrowError(/cannot be converted into a whole number/); }); test('file system is created correctly with provisioned throughput mode', () => { // WHEN - new EfsFileSystem(stack, 'EfsFileSystem', { + new FileSystem(stack, 'EfsFileSystem', { vpc, - throughputMode: EfsThroughputMode.PROVISIONED, - provisionedThroughputInMibps: 5, + throughputMode: ThroughputMode.PROVISIONED, + provisionedThroughputPerSecond: Size.mebibytes(5), }); // THEN expectCDK(stack).to(haveResource('AWS::EFS::FileSystem', { @@ -174,7 +161,7 @@ test('file system is created correctly with provisioned throughput mode', () => test('existing file system is imported correctly', () => { // WHEN - const fs = EfsFileSystem.fromEfsFileSystemAttributes(stack, 'existingFS', { + const fs = FileSystem.fromFileSystemAttributes(stack, 'existingFS', { fileSystemID: 'fs123', securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { allowAllOutbound: false, @@ -191,7 +178,7 @@ test('existing file system is imported correctly', () => { test('support tags', () => { // WHEN - const fileSystem = new EfsFileSystem(stack, 'EfsFileSystem', { + const fileSystem = new FileSystem(stack, 'EfsFileSystem', { vpc, }); Tag.add(fileSystem, 'Name', 'LookAtMeAndMyFancyTags'); @@ -206,7 +193,7 @@ test('support tags', () => { test('file system is created correctly when given a name', () => { // WHEN - new EfsFileSystem(stack, 'EfsFileSystem', { + new FileSystem(stack, 'EfsFileSystem', { fileSystemName: 'MyNameableFileSystem', vpc, }); @@ -221,7 +208,7 @@ test('file system is created correctly when given a name', () => { test('auto-named if none provided', () => { // WHEN - const fileSystem = new EfsFileSystem(stack, 'EfsFileSystem', { + const fileSystem = new FileSystem(stack, 'EfsFileSystem', { vpc, }); From a1f860aaf51432ec500766b44992a0abfe1ea4ea Mon Sep 17 00:00:00 2001 From: Niranjan Jayakar Date: Wed, 22 Apr 2020 09:23:50 +0100 Subject: [PATCH 2/4] PR feedback --- .../@aws-cdk/aws-efs/lib/efs-file-system.ts | 24 ++++++++----------- packages/@aws-cdk/aws-efs/package.json | 1 - .../aws-efs/test/efs-file-system.test.ts | 14 +++-------- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts b/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts index 58709404efade..ce687cdf37015 100644 --- a/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts +++ b/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts @@ -10,7 +10,7 @@ import { CfnFileSystem, CfnMountTarget } from './efs.generated'; * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-elasticfilesystem-filesystem-lifecyclepolicies */ // tslint:enable -export enum LifecyclePolicyProperty { +export enum LifecyclePolicy { /** * After 7 days of not being accessed. */ @@ -134,7 +134,7 @@ export interface FileSystemProps { * * @default - none */ - readonly lifecyclePolicy?: LifecyclePolicyProperty; + readonly lifecyclePolicy?: LifecyclePolicy; /** * Enum to mention the performance mode of the file system. @@ -153,9 +153,9 @@ export interface FileSystemProps { /** * Provisioned throughput for the file system. * This is a required property if the throughput mode is set to PROVISIONED. - * Valid values are 1MiB/s -> 1GiB/s + * Must be at least 1MiB/s. * - * @default - None, errors out + * @default - none, errors out */ readonly provisionedThroughputPerSecond?: Size; } @@ -172,7 +172,7 @@ export interface FileSystemAttributes { /** * The File System's ID. */ - readonly fileSystemID: string; + readonly fileSystemId: string; } /** @@ -192,7 +192,7 @@ export class FileSystem extends Resource implements IFileSystem { */ public static fromFileSystemAttributes(scope: Construct, id: string, attrs: FileSystemAttributes): IFileSystem { class Import extends Resource implements IFileSystem { - public readonly fileSystemId = attrs.fileSystemID; + public readonly fileSystemId = attrs.fileSystemId; public readonly connections = new ec2.Connections({ securityGroups: [attrs.securityGroup], defaultPort: ec2.Port.tcp(FileSystem.DEFAULT_PORT), @@ -223,23 +223,19 @@ export class FileSystem extends Resource implements IFileSystem { constructor(scope: Construct, id: string, props: FileSystemProps) { super(scope, id); - if (props.throughputMode === ThroughputMode.PROVISIONED) { - if (props.provisionedThroughputPerSecond === undefined) { - throw new Error('Property provisionedThroughputInMibps is required when throughputMode is PROVISIONED'); - } else if (props.provisionedThroughputPerSecond.toMebibytes() > 1024) { - throw new Error('Valid values for throughput are 1MiB/s - 1GiB/s. You can get this limit increased by contacting AWS Support.'); - } + if (props.throughputMode === ThroughputMode.PROVISIONED && props.provisionedThroughputPerSecond === undefined) { + throw new Error('Property provisionedThroughputPerSecond is required when throughputMode is PROVISIONED'); } const filesystem = new CfnFileSystem(this, 'Resource', { encrypted: props.encrypted, kmsKeyId: (props.kmsKey ? props.kmsKey.keyId : undefined), lifecyclePolicies: (props.lifecyclePolicy ? Array.of({ - transitionToIa: LifecyclePolicyProperty[props.lifecyclePolicy], + transitionToIa: LifecyclePolicy[props.lifecyclePolicy], } as CfnFileSystem.LifecyclePolicyProperty) : undefined), performanceMode: props.performanceMode, throughputMode: props.throughputMode, - provisionedThroughputInMibps: props.provisionedThroughputPerSecond ? props.provisionedThroughputPerSecond.toMebibytes() : undefined, + provisionedThroughputInMibps: props.provisionedThroughputPerSecond?.toMebibytes(), }); this.fileSystemId = filesystem.ref; diff --git a/packages/@aws-cdk/aws-efs/package.json b/packages/@aws-cdk/aws-efs/package.json index e273fcf3f8a1c..665795f1a0136 100644 --- a/packages/@aws-cdk/aws-efs/package.json +++ b/packages/@aws-cdk/aws-efs/package.json @@ -104,7 +104,6 @@ "engines": { "node": ">= 10.12.0" }, - "stability": "experimental", "maturity": "experimental", "awscdkio": { "announce": false diff --git a/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts b/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts index 8ebac02533b54..8005038290ebd 100644 --- a/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts +++ b/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts @@ -2,7 +2,7 @@ import {expect as expectCDK, haveResource} from '@aws-cdk/assert'; import * as ec2 from '@aws-cdk/aws-ec2'; import * as kms from '@aws-cdk/aws-kms'; import { Size, Stack, Tag } from '@aws-cdk/core'; -import { FileSystem, LifecyclePolicyProperty, PerformanceMode, ThroughputMode} from '../lib'; +import { FileSystem, LifecyclePolicy, PerformanceMode, ThroughputMode} from '../lib'; let stack = new Stack(); let vpc = new ec2.Vpc(stack, 'VPC'); @@ -76,7 +76,7 @@ test('file system is created correctly with life cycle property', () => { // WHEN new FileSystem(stack, 'EfsFileSystem', { vpc, - lifecyclePolicy: LifecyclePolicyProperty.AFTER_14_DAYS, + lifecyclePolicy: LifecyclePolicy.AFTER_14_DAYS, }); // THEN expectCDK(stack).to(haveResource('AWS::EFS::FileSystem', { @@ -127,14 +127,6 @@ test('fails when provisioned throughput is less than the valid range', () => { })).toThrow(/cannot be converted into a whole number/); }); -test('fails when provisioned throughput is above 1Gibps', () => { - expect(() => new FileSystem(stack, 'EfsFileSystem1', { - vpc, - throughputMode: ThroughputMode.PROVISIONED, - provisionedThroughputPerSecond: Size.mebibytes(1025), - })).toThrow(/values for throughput/); -}); - test('fails when provisioned throughput is not a whole number of mebibytes', () => { expect(() => { new FileSystem(stack, 'EfsFileSystem2', { @@ -162,7 +154,7 @@ test('file system is created correctly with provisioned throughput mode', () => test('existing file system is imported correctly', () => { // WHEN const fs = FileSystem.fromFileSystemAttributes(stack, 'existingFS', { - fileSystemID: 'fs123', + fileSystemId: 'fs123', securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { allowAllOutbound: false, }), From 8de434af0d947b9e5363397ff7bd9f803e8076d2 Mon Sep 17 00:00:00 2001 From: Niranjan Jayakar Date: Wed, 22 Apr 2020 09:55:48 +0100 Subject: [PATCH 3/4] revert accidental package.json --- packages/@aws-cdk/aws-efs/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/@aws-cdk/aws-efs/package.json b/packages/@aws-cdk/aws-efs/package.json index 665795f1a0136..e273fcf3f8a1c 100644 --- a/packages/@aws-cdk/aws-efs/package.json +++ b/packages/@aws-cdk/aws-efs/package.json @@ -104,6 +104,7 @@ "engines": { "node": ">= 10.12.0" }, + "stability": "experimental", "maturity": "experimental", "awscdkio": { "announce": false From 869652065354fafb5456243a20d2eef5daae71db Mon Sep 17 00:00:00 2001 From: Niranjan Jayakar Date: Wed, 22 Apr 2020 10:13:52 +0100 Subject: [PATCH 4/4] fix error message --- packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts b/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts index 8005038290ebd..d9c2cf12f0dac 100644 --- a/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts +++ b/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts @@ -116,7 +116,7 @@ test('Exception when throughput mode is set to PROVISIONED, but provisioned thro vpc, throughputMode: ThroughputMode.PROVISIONED, }); - }).toThrowError(/Property provisionedThroughputInMibps is required when throughputMode is PROVISIONED/); + }).toThrowError(/Property provisionedThroughputPerSecond is required when throughputMode is PROVISIONED/); }); test('fails when provisioned throughput is less than the valid range', () => {