forked from aws-cloudformation/cfn-lint
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Enum.py
32 lines (27 loc) · 1.1 KB
/
Enum.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
from cfnlint.jsonschema._keywords import enum
from cfnlint.rules import CloudFormationLintRule
class Enum(CloudFormationLintRule):
"""Check if properties have a valid value"""
id = "E3030"
shortdesc = "Check if properties have a valid value"
description = "Check if properties have a valid value in case of an enumator"
source_url = "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#enum"
tags = ["resources", "property", "allowed value"]
child_rules = {
"W2030": None,
}
def enum(self, validator, enums, instance, schema):
if (
len(validator.context.path.value_path) > 0
and validator.context.path.value_path[0] == "Parameters"
):
if self.child_rules.get("W2030"):
yield from self.child_rules["W2030"].enum(
validator, enums, instance, schema
)
return
yield from enum(validator, enums, instance, schema)