def match()

in cfn-lint-custom-rules/rules/AMSRequiredAttributeValues.py [0:0]


    def match(self, cfn):
        """Check CloudFormation Resources"""

        matches = []

        for resource_name, resource_values in cfn.template.get("Resources", {}).items():
            self.logger.debug("Validating Properties for %s resource", resource_name)

            resource_type = resource_values.get("Type", "")

            if resource_type in self.required_attribute_values.keys():
                for attribute, attribute_value in resource_values["Properties"].items():
                    if not self.match_allowed_values(attribute, attribute_value, resource_type):
                        message = "AMS - Property {0} in {1} does not match with one of: {2}"
                        matches.append(
                            RuleMatch(
                                ["Resources", resource_name, attribute],
                                message.format(
                                    attribute,
                                    resource_values.get("Type", ""),
                                    str(self.required_attribute_values[resource_type][attribute]),
                                ),
                            )
                        )

        return matches