3 Dã\ò ã@s8dZddlZddlmZddlmZGdd„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. éN)ÚCloudFormationLintRule)Ú RuleMatchc@s8eZdZdZdZdZdZdZddgZdd „Z d d „Z d S) Ú DependsOnz!Check Base Resource ConfigurationZE3005z$Check DependsOn values for Resourcesz)Check that the DependsOn values are validz[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.htmlÚ resourcesZ dependsoncCsrg}t|tjtjfƒs@d}|jt||jdjtt |ƒƒƒƒƒ|S||krnd}|jt||jdjtt |ƒƒƒƒƒ|S)z"Check resource names for DependsOnz+DependsOn values should be of string at {0}ú/z1DependsOn should reference other resources at {0}) Ú isinstanceÚsixÚ text_typeÚ string_typesÚappendrÚformatÚjoinÚmapÚstr)ÚselfÚkeyÚpathrÚmatchesÚmessage©rú{/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-emcbgzcf/cfn-lint/cfnlint/rules/resources/DependsOn.pyÚ check_values""zDependsOn.check_valuec Cs¤g}|jƒ}x’|jƒD]†\}}|jdƒ}|rd|dg}|jjd|ƒt|tƒrˆxLt|ƒD]*\}} |j|j | |dd…|g|ƒƒqXWq|j|j |||ƒƒqW|S)zCheck CloudFormation ResourcesrZ Resourcesz.Validating DependsOn for %s base configurationN) Ú get_resourcesÚitemsÚgetÚloggerÚdebugrÚlistÚ enumerateÚextendr) rZcfnrrÚ resource_nameZresource_valuesZ depends_onsrÚindexZ depends_onrrrÚmatch,s   (zDependsOn.matchN) Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚidZ shortdescÚ descriptionZ source_urlÚtagsrr"rrrrrsr)r&rZcfnlintrrrrrrrÚs