3 D\@s0dZddlmZddlmZGdddeZdS)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. )CloudFormationLintRule) RuleMatchcsXeZdZdZdZdZdZdZddgZfdd Z d d Z d d Z ddZ ddZ ZS)AvailabilityZonez)Check Availibility Zone parameter checks ZW3010z4Availability Zone Parameters should not be hardcodedz4Check if an Availability Zone property is hardcoded.z5https://github.com/aws-cloudformation/cfn-python-lint parametersZavailabilityzonec sptt|jddddddddd d d g }d d ddddg}x|D]}|jj|q>Wx|D]}|jj|qXWdS)ZInitzAWS::DAX::Clusterz"AWS::AutoScaling::AutoScalingGroupzAWS::RDS::DBClusterzAWS::EC2::Volumez'AWS::ElasticLoadBalancing::LoadBalancerzAWS::OpsWorks::InstancezAWS::RDS::DBInstancezAWS::EC2::HostzAWS::EC2::SubnetzAWS::DMS::ReplicationInstancezAWS::EC2::Instancez"AWS::EC2::LaunchTemplate.Placementz!AWS::EC2::SpotFleet.SpotPlacementzAWS::EMR::Cluster.PlacementTypez4AWS::Glue::Connection.PhysicalConnectionRequirementsz:AWS::ElasticLoadBalancingV2::TargetGroup.TargetDescriptionz+AWS::EC2::SpotFleet.LaunchTemplateOverridesN)superr__init__Zresource_property_typesappendZresource_sub_property_types)selfZresource_type_specsZproperty_type_specsZresource_type_specZproperty_type_spec) __class__/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-emcbgzcf/cfn-lint/cfnlint/rules/resources/properties/AvailabilityZone.pyrs,  zAvailabilityZone.__init__cCs8g}|dkr4|ddgkr4d}|jt||j||S)zCheck ref for VPCallz Fn::GetAZsz(Don't hardcode {0} for AvailabilityZones)r )rrformat)r valuepathmatchesmessager r r check_az_value>s zAvailabilityZone.check_az_valuec CsLg}|j|j|d||jddddd|j|j|d||jddddd|S)z Check itselfrN) check_valueZ check_refZcheck_find_in_mapZ check_splitZ check_joinZAvailabilityZones)extendrr)r properties resource_typercfnrr r r checkJszAvailabilityZone.checkcCsg}|j|j|||||S)zMatch for sub properties)rr)r rZ property_typerrrr r r match_resource_sub_properties_sz.AvailabilityZone.match_resource_sub_propertiescCsg}|j|j|||||S)zCheck CloudFormation Properties)rr)r rrrrrr r r match_resource_propertiesgsz*AvailabilityZone.match_resource_properties)__name__ __module__ __qualname____doc__idZ shortdesc descriptionZ source_urltagsrrrrr __classcell__r r )r r rs ! rN)r!Zcfnlintrrrr r r r s