@@ -717,40 +717,129 @@ describe('vpc endpoint', () => {
717
717
718
718
719
719
} ) ;
720
- test ( 'test vpc interface endpoint for transcribe can be created correctly in cn-north-1' , ( ) => {
720
+ test . each ( [
721
+ [ 'transcribe' , InterfaceVpcEndpointAwsService . TRANSCRIBE ] ,
722
+ ] ) ( 'test vpc interface endpoint with .cn suffix for %s can be created correctly in China regions' , ( name : string , given : InterfaceVpcEndpointAwsService ) => {
723
+ //GIVEN
724
+ const stack1 = new Stack ( undefined , 'TestStack' , { env : { account : '123456789012' , region : 'cn-north-1' } } ) ;
725
+ const stack2 = new Stack ( undefined , 'TestStack' , { env : { account : '123456789012' , region : 'cn-northwest-1' } } ) ;
726
+ const vpc1 = new Vpc ( stack1 , 'VPC' ) ;
727
+ const vpc2 = new Vpc ( stack2 , 'VPC' ) ;
728
+
729
+ //WHEN
730
+ vpc1 . addInterfaceEndpoint ( 'Endpoint' , { service : given } ) ;
731
+ vpc2 . addInterfaceEndpoint ( 'Endpoint' , { service : given } ) ;
732
+
733
+ //THEN
734
+ Template . fromStack ( stack1 ) . hasResourceProperties ( 'AWS::EC2::VPCEndpoint' , {
735
+ ServiceName : `cn.com.amazonaws.cn-north-1.${ name } .cn` ,
736
+ } ) ;
737
+ Template . fromStack ( stack2 ) . hasResourceProperties ( 'AWS::EC2::VPCEndpoint' , {
738
+ ServiceName : `cn.com.amazonaws.cn-northwest-1.${ name } .cn` ,
739
+ } ) ;
740
+ } ) ;
741
+ test . each ( [
742
+ [ 'application-autoscaling' , InterfaceVpcEndpointAwsService . APPLICATION_AUTOSCALING ] ,
743
+ [ 'appmesh-envoy-management' , InterfaceVpcEndpointAwsService . APP_MESH ] ,
744
+ [ 'athena' , InterfaceVpcEndpointAwsService . ATHENA ] ,
745
+ [ 'autoscaling' , InterfaceVpcEndpointAwsService . AUTOSCALING ] ,
746
+ [ 'awsconnector' , InterfaceVpcEndpointAwsService . SERVER_MIGRATION_SERVICE_AWSCONNECTOR ] ,
747
+ [ 'backup' , InterfaceVpcEndpointAwsService . BACKUP ] ,
748
+ [ 'batch' , InterfaceVpcEndpointAwsService . BATCH ] ,
749
+ [ 'cassandra' , InterfaceVpcEndpointAwsService . KEYSPACES ] ,
750
+ [ 'cloudcontrolapi' , InterfaceVpcEndpointAwsService . CLOUD_CONTROL_API ] ,
751
+ [ 'cloudformation' , InterfaceVpcEndpointAwsService . CLOUDFORMATION ] ,
752
+ [ 'cloudformation' , InterfaceVpcEndpointAwsService . CLOUDFORMATION ] ,
753
+ [ 'codedeploy-commands-secure' , InterfaceVpcEndpointAwsService . CODEDEPLOY_COMMANDS_SECURE ] ,
754
+ [ 'databrew' , InterfaceVpcEndpointAwsService . GLUE_DATABREW ] ,
755
+ [ 'dms' , InterfaceVpcEndpointAwsService . DATABASE_MIGRATION_SERVICE ] ,
756
+ [ 'ebs' , InterfaceVpcEndpointAwsService . EBS_DIRECT ] ,
757
+ [ 'ec2' , InterfaceVpcEndpointAwsService . EC2 ] ,
758
+ [ 'ecr.api' , InterfaceVpcEndpointAwsService . ECR ] ,
759
+ [ 'ecr.dkr' , InterfaceVpcEndpointAwsService . ECR_DOCKER ] ,
760
+ [ 'eks' , InterfaceVpcEndpointAwsService . EKS ] ,
761
+ [ 'elasticache' , InterfaceVpcEndpointAwsService . ELASTICACHE ] ,
762
+ [ 'elasticbeanstalk' , InterfaceVpcEndpointAwsService . ELASTIC_BEANSTALK ] ,
763
+ [ 'elasticfilesystem' , InterfaceVpcEndpointAwsService . ELASTIC_FILESYSTEM ] ,
764
+ [ 'elasticfilesystem-fips' , InterfaceVpcEndpointAwsService . ELASTIC_FILESYSTEM_FIPS ] ,
765
+ [ 'emr-containers' , InterfaceVpcEndpointAwsService . EMR_EKS ] ,
766
+ [ 'execute-api' , InterfaceVpcEndpointAwsService . APIGATEWAY ] ,
767
+ [ 'fsx' , InterfaceVpcEndpointAwsService . FSX ] ,
768
+ [ 'imagebuilder' , InterfaceVpcEndpointAwsService . IMAGE_BUILDER ] ,
769
+ [ 'iot.data' , InterfaceVpcEndpointAwsService . IOT_CORE ] ,
770
+ [ 'kinesis-streams' , InterfaceVpcEndpointAwsService . KINESIS_STREAMS ] ,
771
+ [ 'lambda' , InterfaceVpcEndpointAwsService . LAMBDA ] ,
772
+ [ 'license-manager' , InterfaceVpcEndpointAwsService . LICENSE_MANAGER ] ,
773
+ [ 'monitoring' , InterfaceVpcEndpointAwsService . CLOUDWATCH_MONITORING ] ,
774
+ [ 'rds' , InterfaceVpcEndpointAwsService . RDS ] ,
775
+ [ 'redshift' , InterfaceVpcEndpointAwsService . REDSHIFT ] ,
776
+ [ 'redshift-data' , InterfaceVpcEndpointAwsService . REDSHIFT_DATA ] ,
777
+ [ 's3' , InterfaceVpcEndpointAwsService . S3 ] ,
778
+ [ 'sagemaker.api' , InterfaceVpcEndpointAwsService . SAGEMAKER_API ] ,
779
+ [ 'sagemaker.featurestore-runtime' , InterfaceVpcEndpointAwsService . SAGEMAKER_FEATURESTORE_RUNTIME ] ,
780
+ [ 'sagemaker.runtime' , InterfaceVpcEndpointAwsService . SAGEMAKER_RUNTIME ] ,
781
+ [ 'securityhub' , InterfaceVpcEndpointAwsService . SECURITYHUB ] ,
782
+ [ 'servicecatalog' , InterfaceVpcEndpointAwsService . SERVICE_CATALOG ] ,
783
+ [ 'sms' , InterfaceVpcEndpointAwsService . SERVER_MIGRATION_SERVICE ] ,
784
+ [ 'sqs' , InterfaceVpcEndpointAwsService . SQS ] ,
785
+ [ 'states' , InterfaceVpcEndpointAwsService . STEP_FUNCTIONS ] ,
786
+ [ 'states' , InterfaceVpcEndpointAwsService . STEP_FUNCTIONS ] ,
787
+ [ 'sts' , InterfaceVpcEndpointAwsService . STS ] ,
788
+ [ 'sync-states' , InterfaceVpcEndpointAwsService . STEP_FUNCTIONS_SYNC ] ,
789
+ [ 'synthetics' , InterfaceVpcEndpointAwsService . CLOUDWATCH_SYNTHETICS ] ,
790
+ [ 'transcribestreaming' , InterfaceVpcEndpointAwsService . TRANSCRIBE_STREAMING ] ,
791
+ [ 'transfer' , InterfaceVpcEndpointAwsService . TRANSFER ] ,
792
+ [ 'xray' , InterfaceVpcEndpointAwsService . XRAY ] ,
793
+ ] ) ( 'test vpc interface endpoint for %s can be created correctly in China regions' , ( name : string , given : InterfaceVpcEndpointAwsService ) => {
794
+ //GIVEN
795
+ const stack1 = new Stack ( undefined , 'TestStack' , { env : { account : '123456789012' , region : 'cn-north-1' } } ) ;
796
+ const stack2 = new Stack ( undefined , 'TestStack' , { env : { account : '123456789012' , region : 'cn-northwest-1' } } ) ;
797
+ const vpc1 = new Vpc ( stack1 , 'VPC' ) ;
798
+ const vpc2 = new Vpc ( stack2 , 'VPC' ) ;
799
+
800
+ //WHEN
801
+ vpc1 . addInterfaceEndpoint ( 'Endpoint' , { service : given } ) ;
802
+ vpc2 . addInterfaceEndpoint ( 'Endpoint' , { service : given } ) ;
803
+
804
+ //THEN
805
+ Template . fromStack ( stack1 ) . hasResourceProperties ( 'AWS::EC2::VPCEndpoint' , {
806
+ ServiceName : `cn.com.amazonaws.cn-north-1.${ name } ` ,
807
+ } ) ;
808
+ Template . fromStack ( stack2 ) . hasResourceProperties ( 'AWS::EC2::VPCEndpoint' , {
809
+ ServiceName : `cn.com.amazonaws.cn-northwest-1.${ name } ` ,
810
+ } ) ;
811
+ } ) ;
812
+ test . each ( [
813
+ [ 'iotsitewise.api' , InterfaceVpcEndpointAwsService . IOT_SITEWISE_API ] ,
814
+ [ 'iotsitewise.data' , InterfaceVpcEndpointAwsService . IOT_SITEWISE_DATA ] ,
815
+ ] ) ( 'test vpc interface endpoint for %s can be created correctly in cn-north-1 only' , ( name : string , given : InterfaceVpcEndpointAwsService ) => {
721
816
//GIVEN
722
817
const stack = new Stack ( undefined , 'TestStack' , { env : { account : '123456789012' , region : 'cn-north-1' } } ) ;
723
818
const vpc = new Vpc ( stack , 'VPC' ) ;
724
819
725
820
//WHEN
726
- vpc . addInterfaceEndpoint ( 'Transcribe Endpoint' , {
727
- service : InterfaceVpcEndpointAwsService . TRANSCRIBE ,
728
- } ) ;
821
+ vpc . addInterfaceEndpoint ( 'Endpoint' , { service : given } ) ;
729
822
730
823
//THEN
731
824
Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::EC2::VPCEndpoint' , {
732
- ServiceName : ' cn.com.amazonaws.cn-north-1.transcribe.cn' ,
825
+ ServiceName : ` cn.com.amazonaws.cn-north-1.${ name } ` ,
733
826
} ) ;
734
-
735
-
736
827
} ) ;
737
-
738
- test ( 'test vpc interface endpoint for transcribe can be created correctly in cn-northwest-1' , ( ) => {
828
+ test . each ( [
829
+ [ 'account' , InterfaceVpcEndpointAwsService . ACCOUNT_MANAGEMENT ] ,
830
+ [ 'workspaces' , InterfaceVpcEndpointAwsService . WORKSPACES ] ,
831
+ ] ) ( 'test vpc interface endpoint for %s can be created correctly in cn-northwest-1 only' , ( name : string , given : InterfaceVpcEndpointAwsService ) => {
739
832
//GIVEN
740
833
const stack = new Stack ( undefined , 'TestStack' , { env : { account : '123456789012' , region : 'cn-northwest-1' } } ) ;
741
834
const vpc = new Vpc ( stack , 'VPC' ) ;
742
835
743
836
//WHEN
744
- vpc . addInterfaceEndpoint ( 'Transcribe Endpoint' , {
745
- service : InterfaceVpcEndpointAwsService . TRANSCRIBE ,
746
- } ) ;
837
+ vpc . addInterfaceEndpoint ( 'Endpoint' , { service : given } ) ;
747
838
748
839
//THEN
749
840
Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::EC2::VPCEndpoint' , {
750
- ServiceName : ' cn.com.amazonaws.cn-northwest-1.transcribe.cn' ,
841
+ ServiceName : ` cn.com.amazonaws.cn-northwest-1.${ name } ` ,
751
842
} ) ;
752
-
753
-
754
843
} ) ;
755
844
756
845
test ( 'test codeartifact vpc interface endpoint in us-west-2' , ( ) => {
0 commit comments