forked from aws-cloudformation/cfn-lint
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Enum.py
30 lines (24 loc) · 1.08 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
"""
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 parameters have a valid value"""
id = "W2030"
shortdesc = "Check if parameters have a valid value"
description = (
"Check if parameters have a valid value in case of an enumator. The Parameter's"
" allowed values is based on the usages in property (Ref)"
)
source_url = "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#enum"
tags = ["parameters", "resources", "property", "allowed value"]
# This rule is triggered from the equivalent rule E3030
# the values are fed from there and we adjust the error outputs
# appropriately
def enum(self, validator, enums, instance, schema):
for err in enum(validator, enums, instance, schema):
err.rule = self
err.path_override = validator.context.path.value_path
yield err