3 Dã\Âã@s8dZddlmZddlmZddlZGdd„deƒZdS)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)Ú RuleMatchNcsNeZdZdZdZdZdZdZdgZ‡fdd „Z d d „Z d d „Z dd„Z ‡Z S)Ú Exclusivez'Check Properties Resource ConfigurationZE2520z,Check Properties that are mutually exclusivez&Making sure CloudFormation properties z"that are exclusive are not definedz5https://github.com/aws-cloudformation/cfn-python-lintÚ resourcescsjtt|ƒjƒtjjdƒ}|d|_|d|_x|jD]}|jj |ƒq6Wx|jD]}|j j |ƒqRWdS)ZInitz#data/AdditionalSpecs/Exclusive.jsonZ ResourceTypesZ PropertyTypesN) ÚsuperrÚ__init__ÚcfnlintZhelpersZload_resourcesÚresource_types_specsÚproperty_types_specsZresource_property_typesÚappendZresource_sub_property_types)ÚselfZ exclusivespecZresource_type_specZproperty_type_spec)Ú __class__©ú†/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-emcbgzcf/cfn-lint/cfnlint/rules/resources/properties/Exclusive.pyrs     zExclusive.__init__c Csäg}|j|ƒ}xÐ|D]È}xÂ|dD]¶}||kr"x¨||D]œ} | |dkr8|ddkr†d} |jt||g| j| |djtt|ƒƒƒƒƒq8djdd„|djƒDƒƒ} d } |jt||g| j| || djtt|ƒƒƒƒƒq8Wq"WqW|S) z Check itselfZObjectZScenarioNz.Property {0} should NOT exist with {1} for {2}ú/z and cSsg|]\}}d||f‘qS)zwhen condition "%s" is %sr)Ú.0ÚkÚvrrrú ;sz#Exclusive.check..z2Property {0} should NOT exist with {1} {2} for {3})Zget_object_without_conditionsr rÚformatÚjoinÚmapÚstrÚitems) r Ú propertiesÚ exclusionsÚpathÚcfnÚmatchesZ property_setsZ property_setÚpropZ excl_propertyÚmessageZ scenario_textrrrÚcheck*s$     ,zExclusive.checkcCs,g}|jj|iƒ}|j|j||||ƒƒ|S)zMatch for sub properties)r ÚgetÚextendr!)r rZ property_typerrrrrrrÚmatch_resource_sub_propertiesDsz'Exclusive.match_resource_sub_propertiescCs,g}|jj|iƒ}|j|j||||ƒƒ|S)zCheck CloudFormation Properties)r r"r#r!)r rZ resource_typerrrrrrrÚmatch_resource_propertiesMsz#Exclusive.match_resource_propertieszHMaking sure CloudFormation properties that are exclusive are not defined)Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚidZ shortdescÚ descriptionZ source_urlÚtagsrr!r$r%Ú __classcell__rr)r rrs  r)r)rrrZcfnlint.helpersrrrrrÚs