-
Notifications
You must be signed in to change notification settings - Fork 594
/
PropertiesTemplated.py
48 lines (37 loc) · 1.49 KB
/
PropertiesTemplated.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
from __future__ import annotations
from typing import Any
from cfnlint.helpers import FUNCTIONS, TEMPLATED_PROPERTY_CFN_PATHS
from cfnlint.jsonschema import ValidationError, ValidationResult, Validator
from cfnlint.rules.jsonschema.CfnLintKeyword import CfnLintKeyword
class PropertiesTemplated(CfnLintKeyword):
"""Check Base Resource Configuration"""
id = "W3002"
shortdesc = (
"Warn when properties are configured to only work with the package command"
)
description = (
"Some properties can be configured to only work with the CloudFormation"
"package command. Warn when this is the case so user is aware."
)
source_url = (
"https://docs.aws.amazon.com/cli/latest/reference/cloudformation/package.html"
)
tags = ["resources"]
def __init__(self):
"""Init"""
super().__init__(TEMPLATED_PROPERTY_CFN_PATHS)
def validate(
self, validator: Validator, keywords: Any, instance: Any, schema: dict[str, Any]
) -> ValidationResult:
if not isinstance(instance, str):
return
if validator.cfn.has_serverless_transform():
return
if validator.context.path.path[-1] in FUNCTIONS:
return
if not instance.startswith("s3://") and not instance.startswith("https://"):
yield ValidationError("This code may only work with 'package' cli command")