3 D\@s@dZddlZddlmZddlmZddlZGdddeZdS)a Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. N)CloudFormationLintRule) RuleMatchc@s@eZdZdZdZdZdZdZddgZdd Z d d Z d d Z dS)Vpcz$Check if EC2 VPC Resource PropertiesZE2505zResource EC2 VPC Propertiesz^Check if the default tenancy is default or dedicated and that CidrBlock is a valid CIDR range.zXhttps://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.htmlZ propertiesZvpccCszg}tjtjj|s:d}|jt||jdjd|gnTypez/CidrBlock needs to be a valid Cidr Range at {0}rrNz3CidrBlock parameter should be of type [{0}] for {1}z, ) getr r Zis_custom_resourcerrrrmapstr) rrr parameters resourcesrZ allowed_typesZ resource_objZ resource_typerZ parameterZparameter_typeZ path_errorrrrcheck_cidr_ref1s.       zVpc.check_cidr_refcCs$g}|j|jdd|j|jd|S)z!Check EC2 VPC Resource Parametersz AWS::EC2::VPCZ CidrBlock) check_valueZ check_ref)extendZcheck_resource_propertyrr$)rZcfnrrrrr Ns z Vpc.matchN) __name__ __module__ __qualname____doc__idZ shortdesc descriptionZ source_urltagsrr$r rrrrrsr)r*r r rrZcfnlint.helpersrrrrrs