3 D\~@s8dZddlmZddlmZddlZGdddeZdS)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) RuleMatchNc@s.eZdZdZdZdZd ZdZdgZdd Z d S) Configurationz!Check Base Resource ConfigurationZE3001z#Basic CloudFormation Resource Checkz/Making sure the basic CloudFormation resources zare properly configuredz5https://github.com/aws-cloudformation/cfn-python-lint resourcesc Csg}ddddddddd g }d dddd dg}|jjd i}t|ts\d }|jtd g|n,x(|jjd ijD]\}}|jjd |t|tsd}|jtd |g|j |qr|jdd} g} | j ds| dkr|} n|} x>|jD]2\} } | | krd}|jtd || g|j | |qW|jdd} | sRd}|jtd |g|j |nr|jjdxdt j j jD]T\} }| |jkrl| |dkrl| j dsld}|jtd |dg|j | || qlWd|krrt j j |jd}| |dkrr|d| d}t|dkrrd}x,|jD] \} }|jddr|d7}qW|dkrr| dkrfd|jkrf|jjdqrd}|jtd |g|j |qrW|S) zCheck CloudFormation ResourcesZCreationPolicyZDeletionPolicyZ DependsOnZMetadataZ UpdatePolicyZUpdateReplacePolicyZ PropertiesType ConditionVersionZ Resourcesz Resource not properly configuredz)Validating resource %s base configurationz'Resource not properly configured at {0}Custom::z#AWS::CloudFormation::CustomResourcez/Invalid resource attribute {0} for resource {1}z!Type not defined for resource {0}z!Check resource types by region...Z ResourceTypesAWS::Serverless::z7Invalid or unsupported Type {0} for resource {1} in {2}rZRequiredFz"AWS::CloudFormation::WaitConditionzFException to required properties section as CreationPolicy is defined.z'Properties not defined for resource {0})r r )templateget isinstancedictappendritemsloggerdebugformat startswithcfnlintZhelpersZRESOURCE_SPECSZregionslenkeys)selfZcfnmatchesZvalid_attributesZvalid_custom_attributesrmessage resource_nameZresource_valuesZ resource_typeZcheck_attributesZ property_key_ZregionspecsZ resource_specZproperties_specrequiredZ property_specr!/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-emcbgzcf/cfn-lint/cfnlint/rules/resources/Configuration.pymatchs          zConfiguration.matchNzFMaking sure the basic CloudFormation resources are properly configured) __name__ __module__ __qualname____doc__idZ shortdesc descriptionZ source_urltagsr#r!r!r!r"rsr)r'rrrZcfnlint.helpersrr!r!r!r"s