Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- testbed/aws-cloudformation__cfn-lint/.git-blame-ignore-revs +3 -0
- testbed/aws-cloudformation__cfn-lint/.gitignore +123 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/__init__.py +14 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/_typing.py +16 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/api.py +84 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/__init__.py +9 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/_condition.py +250 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/_equals.py +177 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/_errors.py +13 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/_rule.py +148 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/_utils.py +22 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/conditions.py +460 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/config.py +879 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/__init__.py +3 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/_mappings.py +98 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/conditions/__init__.py +4 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/conditions/_condition.py +133 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/conditions/_conditions.py +153 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/conditions/_equals.py +129 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/conditions/_utils.py +131 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/conditions/exceptions.py +60 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/context.py +475 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/core.py +78 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/custom_rules.txt +4 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/__init__.py +4 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/__init__.py +3 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_east_2/aws-quicksight-datasource.json +951 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-amazonmq-configuration.json +85 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-amazonmq-configurationassociation.json +46 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-api.json +143 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-authorizer.json +78 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-deployment.json +30 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-integrationresponse.json +49 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-model.json +42 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-route.json +70 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-routeresponse.json +50 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-vpclink.json +51 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-applicationautoscaling-scalabletarget.json +155 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-autoscaling-launchconfiguration.json +199 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-autoscaling-scalingpolicy.json +429 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-cassandra-keyspace.json +119 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-cloudformation-stack.json +71 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-codebuild-project.json +596 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-codepipeline-customactiontype.json +140 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-config-aggregationauthorization.json +54 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-config-configrule.json +178 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-datapipeline-pipeline.json +172 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-directoryservice-simplead.json +99 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-docdb-dbclusterparametergroup.json +66 -0
- testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-ec2-clientvpnauthorizationrule.json +41 -0
testbed/aws-cloudformation__cfn-lint/.git-blame-ignore-revs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Add in isort and ran on src/ and test/
|
| 2 |
+
# Run black with double quotes on all files
|
| 3 |
+
dfdc6f924628f74de71182d25a629f568ebccb0f
|
testbed/aws-cloudformation__cfn-lint/.gitignore
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto generated files for testing
|
| 2 |
+
test/fixtures/templates/bad/limit_numbers.yaml
|
| 3 |
+
test/fixtures/templates/bad/limit_size.yaml
|
| 4 |
+
|
| 5 |
+
# Local files for Build and Release
|
| 6 |
+
Dockerfile.local
|
| 7 |
+
create-release.sh
|
| 8 |
+
|
| 9 |
+
# Byte-compiled / optimized / DLL files
|
| 10 |
+
__pycache__/
|
| 11 |
+
*.py[cod]
|
| 12 |
+
*$py.class
|
| 13 |
+
|
| 14 |
+
# C extensions
|
| 15 |
+
*.so
|
| 16 |
+
|
| 17 |
+
# Distribution / packaging
|
| 18 |
+
.Python
|
| 19 |
+
build/
|
| 20 |
+
develop-eggs/
|
| 21 |
+
dist/
|
| 22 |
+
downloads/
|
| 23 |
+
eggs/
|
| 24 |
+
.eggs/
|
| 25 |
+
lib/
|
| 26 |
+
lib64/
|
| 27 |
+
parts/
|
| 28 |
+
sdist/
|
| 29 |
+
var/
|
| 30 |
+
wheels/
|
| 31 |
+
*.egg-info/
|
| 32 |
+
.installed.cfg
|
| 33 |
+
*.egg
|
| 34 |
+
MANIFEST
|
| 35 |
+
|
| 36 |
+
# PyInstaller
|
| 37 |
+
# Usually these files are written by a python script from a template
|
| 38 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 39 |
+
*.manifest
|
| 40 |
+
*.spec
|
| 41 |
+
|
| 42 |
+
# Installer logs
|
| 43 |
+
pip-log.txt
|
| 44 |
+
pip-delete-this-directory.txt
|
| 45 |
+
|
| 46 |
+
# Unit test / coverage reports
|
| 47 |
+
htmlcov/
|
| 48 |
+
.tox/
|
| 49 |
+
.coverage
|
| 50 |
+
.coverage.*
|
| 51 |
+
.cache
|
| 52 |
+
.pytest_cache/
|
| 53 |
+
.ruff_cache/
|
| 54 |
+
nosetests.xml
|
| 55 |
+
coverage.xml
|
| 56 |
+
*.cover
|
| 57 |
+
.hypothesis/
|
| 58 |
+
|
| 59 |
+
# Translations
|
| 60 |
+
*.mo
|
| 61 |
+
*.pot
|
| 62 |
+
|
| 63 |
+
# Django stuff:
|
| 64 |
+
*.log
|
| 65 |
+
.static_storage/
|
| 66 |
+
.media/
|
| 67 |
+
local_settings.py
|
| 68 |
+
|
| 69 |
+
# Flask stuff:
|
| 70 |
+
instance/
|
| 71 |
+
.webassets-cache
|
| 72 |
+
|
| 73 |
+
# Scrapy stuff:
|
| 74 |
+
.scrapy
|
| 75 |
+
|
| 76 |
+
# Sphinx documentation
|
| 77 |
+
docs/_build/
|
| 78 |
+
|
| 79 |
+
# PyBuilder
|
| 80 |
+
target/
|
| 81 |
+
|
| 82 |
+
# Jupyter Notebook
|
| 83 |
+
.ipynb_checkpoints
|
| 84 |
+
|
| 85 |
+
# pyenv
|
| 86 |
+
.python-version
|
| 87 |
+
|
| 88 |
+
# celery beat schedule file
|
| 89 |
+
celerybeat-schedule
|
| 90 |
+
|
| 91 |
+
# SageMath parsed files
|
| 92 |
+
*.sage.py
|
| 93 |
+
|
| 94 |
+
# Environments
|
| 95 |
+
.env
|
| 96 |
+
.venv
|
| 97 |
+
env/
|
| 98 |
+
venv/
|
| 99 |
+
ENV/
|
| 100 |
+
env.bak/
|
| 101 |
+
venv.bak/
|
| 102 |
+
|
| 103 |
+
# Spyder project settings
|
| 104 |
+
.spyderproject
|
| 105 |
+
.spyproject
|
| 106 |
+
|
| 107 |
+
# Rope project settings
|
| 108 |
+
.ropeproject
|
| 109 |
+
|
| 110 |
+
# mkdocs documentation
|
| 111 |
+
/site
|
| 112 |
+
|
| 113 |
+
# mypy
|
| 114 |
+
.mypy_cache/
|
| 115 |
+
|
| 116 |
+
# vscode
|
| 117 |
+
.vscode/
|
| 118 |
+
|
| 119 |
+
# osx
|
| 120 |
+
.DS_Store
|
| 121 |
+
|
| 122 |
+
# Pycharm
|
| 123 |
+
.idea/
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/__init__.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import logging
|
| 7 |
+
|
| 8 |
+
from cfnlint.api import lint, lint_all
|
| 9 |
+
from cfnlint.config import ConfigMixIn, ManualArgs
|
| 10 |
+
from cfnlint.rules import Rules
|
| 11 |
+
from cfnlint.template import Template
|
| 12 |
+
from cfnlint.template.transforms import Transform
|
| 13 |
+
|
| 14 |
+
LOGGER = logging.getLogger(__name__)
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/_typing.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from typing import TYPE_CHECKING, Any, List, Protocol, Union
|
| 7 |
+
|
| 8 |
+
if TYPE_CHECKING:
|
| 9 |
+
from cfnlint.rules import RuleMatch
|
| 10 |
+
|
| 11 |
+
RuleMatches = List["RuleMatch"]
|
| 12 |
+
Path = List[Union[str, int]]
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class CheckValueFn(Protocol):
|
| 16 |
+
def __call__(self, value: Any, path: Path, **kwargs: Any) -> List["RuleMatch"]: ...
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/api.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
from typing import List
|
| 9 |
+
|
| 10 |
+
from cfnlint.config import ConfigMixIn, ManualArgs
|
| 11 |
+
from cfnlint.decode.decode import decode_str
|
| 12 |
+
from cfnlint.helpers import REGION_PRIMARY, REGIONS
|
| 13 |
+
from cfnlint.rules import Match, RulesCollection
|
| 14 |
+
from cfnlint.runner import Runner, TemplateRunner
|
| 15 |
+
|
| 16 |
+
Matches = List[Match]
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def lint(
|
| 20 |
+
s: str,
|
| 21 |
+
rules: RulesCollection | None = None,
|
| 22 |
+
regions: list[str] | None = None,
|
| 23 |
+
config: ManualArgs | None = None,
|
| 24 |
+
) -> list[Match]:
|
| 25 |
+
"""Validate a string template using the specified rules and regions.
|
| 26 |
+
|
| 27 |
+
Parameters
|
| 28 |
+
----------
|
| 29 |
+
s : str
|
| 30 |
+
the template string
|
| 31 |
+
rules : RulesCollection
|
| 32 |
+
The rules to run against s
|
| 33 |
+
regions : list[str]
|
| 34 |
+
The regions to test against s
|
| 35 |
+
|
| 36 |
+
Returns
|
| 37 |
+
-------
|
| 38 |
+
list
|
| 39 |
+
a list of errors if any were found, else an empty list
|
| 40 |
+
"""
|
| 41 |
+
template, errors = decode_str(s)
|
| 42 |
+
if errors:
|
| 43 |
+
return errors
|
| 44 |
+
|
| 45 |
+
if template is None:
|
| 46 |
+
return []
|
| 47 |
+
|
| 48 |
+
if not regions:
|
| 49 |
+
regions = [REGION_PRIMARY]
|
| 50 |
+
|
| 51 |
+
if not config:
|
| 52 |
+
config_mixin = ConfigMixIn(
|
| 53 |
+
regions=regions,
|
| 54 |
+
)
|
| 55 |
+
else:
|
| 56 |
+
config_mixin = ConfigMixIn(**config)
|
| 57 |
+
|
| 58 |
+
if isinstance(rules, RulesCollection):
|
| 59 |
+
template_runner = TemplateRunner(None, template, config_mixin, rules) # type: ignore # noqa: E501
|
| 60 |
+
return list(template_runner.run())
|
| 61 |
+
|
| 62 |
+
runner = Runner(config_mixin)
|
| 63 |
+
return list(runner.validate_template(None, template))
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def lint_all(s: str) -> list[Match]:
|
| 67 |
+
"""Validate a string template against all regions and rules.
|
| 68 |
+
|
| 69 |
+
Parameters
|
| 70 |
+
----------
|
| 71 |
+
s : str
|
| 72 |
+
the template string
|
| 73 |
+
|
| 74 |
+
Returns
|
| 75 |
+
-------
|
| 76 |
+
list
|
| 77 |
+
a list of errors if any were found, else an empty list
|
| 78 |
+
"""
|
| 79 |
+
return lint(
|
| 80 |
+
s=s,
|
| 81 |
+
config=ManualArgs(
|
| 82 |
+
include_checks=["I"], include_experimental=True, regions=REGIONS
|
| 83 |
+
),
|
| 84 |
+
)
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/__init__.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
__all__ = ["Conditions"]
|
| 7 |
+
|
| 8 |
+
from cfnlint.conditions._errors import UnknownSatisfisfaction
|
| 9 |
+
from cfnlint.conditions.conditions import Conditions
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/_condition.py
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
from typing import Any, Dict, Mapping, Sequence, Union
|
| 9 |
+
|
| 10 |
+
from sympy import And, Not, Or, Symbol
|
| 11 |
+
from sympy.logic.boolalg import BooleanFunction, BooleanTrue
|
| 12 |
+
|
| 13 |
+
from cfnlint.conditions._equals import Equal
|
| 14 |
+
from cfnlint.helpers import FUNCTION_CONDITIONS
|
| 15 |
+
|
| 16 |
+
# we leave the type hinting here
|
| 17 |
+
_CONDITION = Dict[str, Union[str, Sequence["_CONDITION"]]]
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class Condition:
|
| 21 |
+
"""The generic class to represent any type of Condition"""
|
| 22 |
+
|
| 23 |
+
def __init__(self) -> None:
|
| 24 |
+
self._fn_equals: Equal | None = None
|
| 25 |
+
self._condition: ConditionList | ConditionNamed | None = None
|
| 26 |
+
|
| 27 |
+
def _init_condition(
|
| 28 |
+
self,
|
| 29 |
+
condition: _CONDITION,
|
| 30 |
+
all_conditions: dict[str, dict],
|
| 31 |
+
) -> None:
|
| 32 |
+
if len(condition) == 1:
|
| 33 |
+
for k, v in condition.items():
|
| 34 |
+
if k in FUNCTION_CONDITIONS:
|
| 35 |
+
if not isinstance(v, list):
|
| 36 |
+
raise ValueError(f"{k} value should be an array")
|
| 37 |
+
if k == "Fn::Equals":
|
| 38 |
+
self._fn_equals = Equal(v)
|
| 39 |
+
elif k == "Fn::And":
|
| 40 |
+
self._condition = ConditionAnd(v, all_conditions)
|
| 41 |
+
elif k == "Fn::Or":
|
| 42 |
+
self._condition = ConditionOr(v, all_conditions)
|
| 43 |
+
elif k == "Fn::Not":
|
| 44 |
+
self._condition = ConditionNot(v, all_conditions)
|
| 45 |
+
elif k == "Condition":
|
| 46 |
+
if not isinstance(v, str):
|
| 47 |
+
raise ValueError(f"Condition value {v!r} must be a string")
|
| 48 |
+
self._condition = ConditionNamed(v, all_conditions)
|
| 49 |
+
else:
|
| 50 |
+
raise ValueError(f"Unknown key ({k}) in condition")
|
| 51 |
+
else:
|
| 52 |
+
raise ValueError("Condition value must be an object of length 1")
|
| 53 |
+
|
| 54 |
+
@property
|
| 55 |
+
def equals(self) -> list[Equal]:
|
| 56 |
+
"""Returns a Sequence of the Equals that make up the Condition
|
| 57 |
+
|
| 58 |
+
Args: None
|
| 59 |
+
|
| 60 |
+
Returns:
|
| 61 |
+
Sequence[EqualParameter] | Sequence[Equal] | None:
|
| 62 |
+
The Equal that are part of the condition
|
| 63 |
+
"""
|
| 64 |
+
if self._fn_equals:
|
| 65 |
+
return [self._fn_equals]
|
| 66 |
+
if self._condition:
|
| 67 |
+
return self._condition.equals
|
| 68 |
+
return []
|
| 69 |
+
|
| 70 |
+
def build_cnf(self, params: dict[str, Symbol]) -> BooleanFunction | Symbol | None:
|
| 71 |
+
"""Build a SymPy CNF based on the provided params
|
| 72 |
+
|
| 73 |
+
Args:
|
| 74 |
+
params dict[str, Symbol]: params is a dict that represents
|
| 75 |
+
the hash of an Equal and the SymPy Symbols
|
| 76 |
+
|
| 77 |
+
Returns:
|
| 78 |
+
Any: Any number of different SymPy CNF clauses
|
| 79 |
+
"""
|
| 80 |
+
if self._condition:
|
| 81 |
+
return self._condition.build_cnf(params)
|
| 82 |
+
if self._fn_equals:
|
| 83 |
+
return self._fn_equals.build_cnf(params)
|
| 84 |
+
return BooleanTrue()
|
| 85 |
+
|
| 86 |
+
def _test(self, scenarios: Mapping[str, str]) -> bool:
|
| 87 |
+
if self._fn_equals:
|
| 88 |
+
return self._fn_equals.test(scenarios)
|
| 89 |
+
if self._condition:
|
| 90 |
+
# pylint: disable=W0212
|
| 91 |
+
return self._condition._test(scenarios)
|
| 92 |
+
return False
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
class ConditionList(Condition):
|
| 96 |
+
"""The generic class to represent any type of List condition
|
| 97 |
+
List conditions are And, Or, Not
|
| 98 |
+
"""
|
| 99 |
+
|
| 100 |
+
def __init__(
|
| 101 |
+
self, conditions: Sequence[_CONDITION], all_conditions: dict[str, dict]
|
| 102 |
+
) -> None:
|
| 103 |
+
super().__init__()
|
| 104 |
+
self._conditions: list[ConditionUnnammed] = []
|
| 105 |
+
self._prefix_path: str = ""
|
| 106 |
+
for condition in conditions:
|
| 107 |
+
self._conditions.append(ConditionUnnammed(condition, all_conditions))
|
| 108 |
+
|
| 109 |
+
@property
|
| 110 |
+
def equals(self) -> list[Equal]:
|
| 111 |
+
"""Returns a List of the Equals that make up the Condition
|
| 112 |
+
|
| 113 |
+
Args: None
|
| 114 |
+
|
| 115 |
+
Returns:
|
| 116 |
+
list[Equal]: The Equal that are part of the condition
|
| 117 |
+
"""
|
| 118 |
+
equals: list[Equal] = []
|
| 119 |
+
for condition in self._conditions:
|
| 120 |
+
equals.extend(condition.equals)
|
| 121 |
+
return equals
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
class ConditionAnd(ConditionList):
|
| 125 |
+
"""Represents the logic specific to an And Condition"""
|
| 126 |
+
|
| 127 |
+
def __init__(
|
| 128 |
+
self, conditions: Sequence[_CONDITION], all_conditions: dict[str, dict]
|
| 129 |
+
) -> None:
|
| 130 |
+
super().__init__(conditions, all_conditions)
|
| 131 |
+
self._prefix_path = "Fn::And"
|
| 132 |
+
|
| 133 |
+
def build_cnf(self, params: dict[str, Symbol]) -> BooleanFunction:
|
| 134 |
+
"""Build a SymPy CNF solver based on the provided params
|
| 135 |
+
Args:
|
| 136 |
+
params dict[str, Symbol]: params is a dict that represents
|
| 137 |
+
the hash of an Equal and the SymPy Symbols
|
| 138 |
+
Returns:
|
| 139 |
+
BooleanFunction: An And SymPy BooleanFunction
|
| 140 |
+
"""
|
| 141 |
+
conditions: list[Any] = []
|
| 142 |
+
for child in self._conditions:
|
| 143 |
+
conditions.append(child.build_cnf(params))
|
| 144 |
+
|
| 145 |
+
return And(*conditions)
|
| 146 |
+
|
| 147 |
+
def _test(self, scenarios: Mapping[str, str]) -> bool:
|
| 148 |
+
# pylint: disable=W0212
|
| 149 |
+
return all(condition._test(scenarios) for condition in self._conditions)
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
class ConditionNot(ConditionList):
|
| 153 |
+
"""Represents the logic specific to an Not Condition"""
|
| 154 |
+
|
| 155 |
+
def __init__(
|
| 156 |
+
self, conditions: Sequence[_CONDITION], all_conditions: dict[str, dict]
|
| 157 |
+
) -> None:
|
| 158 |
+
super().__init__(conditions, all_conditions)
|
| 159 |
+
self._prefix_path = "Fn::Not"
|
| 160 |
+
if len(conditions) != 1:
|
| 161 |
+
raise ValueError("Condition length must be 1")
|
| 162 |
+
|
| 163 |
+
def build_cnf(self, params: dict[str, Symbol]) -> BooleanFunction:
|
| 164 |
+
"""Build a SymPy CNF solver based on the provided params
|
| 165 |
+
Args:
|
| 166 |
+
params dict[str, Symbol]: params is a dict that represents
|
| 167 |
+
the hash of an Equal and the SymPy Symbol
|
| 168 |
+
Returns:
|
| 169 |
+
BooleanFunction: A Not SymPy BooleanFunction
|
| 170 |
+
"""
|
| 171 |
+
return Not(self._conditions[0].build_cnf(params))
|
| 172 |
+
|
| 173 |
+
def _test(self, scenarios: Mapping[str, str]) -> bool:
|
| 174 |
+
# pylint: disable=W0212
|
| 175 |
+
return not any(condition._test(scenarios) for condition in self._conditions)
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
class ConditionOr(ConditionList):
|
| 179 |
+
"""Represents the logic specific to an Or Condition"""
|
| 180 |
+
|
| 181 |
+
def __init__(
|
| 182 |
+
self, conditions: Sequence[_CONDITION], all_conditions: dict[str, dict]
|
| 183 |
+
) -> None:
|
| 184 |
+
super().__init__(conditions, all_conditions)
|
| 185 |
+
self._prefix_path = "Fn::Or"
|
| 186 |
+
|
| 187 |
+
def build_cnf(self, params: dict[str, Symbol]) -> BooleanFunction:
|
| 188 |
+
"""Build a SymPy CNF solver based on the provided params
|
| 189 |
+
Args:
|
| 190 |
+
params dict[str, Symbol]: params is a dict that represents
|
| 191 |
+
the hash of an Equal and the SymPy Symbols
|
| 192 |
+
Returns:
|
| 193 |
+
BooleanFunction: An Or SymPy BooleanFunction
|
| 194 |
+
"""
|
| 195 |
+
conditions: list[Any] = []
|
| 196 |
+
for child in self._conditions:
|
| 197 |
+
conditions.append(child.build_cnf(params))
|
| 198 |
+
return Or(*conditions)
|
| 199 |
+
|
| 200 |
+
def _test(self, scenarios: Mapping[str, str]) -> bool:
|
| 201 |
+
# pylint: disable=W0212
|
| 202 |
+
return any(condition._test(scenarios) for condition in self._conditions)
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
class ConditionUnnammed(Condition):
|
| 206 |
+
"""Represents an unnamed condition which is basically a nested Equals"""
|
| 207 |
+
|
| 208 |
+
def __init__(self, condition: Any, all_conditions: dict[str, dict]) -> None:
|
| 209 |
+
super().__init__()
|
| 210 |
+
if isinstance(condition, dict):
|
| 211 |
+
self._init_condition(condition, all_conditions)
|
| 212 |
+
else:
|
| 213 |
+
raise ValueError("Condition must have a value that is an object")
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
class ConditionNamed(Condition):
|
| 217 |
+
"""The parent condition that directly represents a named condition in a template"""
|
| 218 |
+
|
| 219 |
+
def __init__(self, name: str, all_conditions: dict[str, dict]) -> None:
|
| 220 |
+
super().__init__()
|
| 221 |
+
condition = all_conditions.get(name)
|
| 222 |
+
if isinstance(condition, dict):
|
| 223 |
+
self._name = name
|
| 224 |
+
self._init_condition(condition, all_conditions)
|
| 225 |
+
else:
|
| 226 |
+
raise ValueError(f"Condition {name} must have a value that is an object")
|
| 227 |
+
|
| 228 |
+
def build_true_cnf(self, params: dict[str, Symbol]) -> Any:
|
| 229 |
+
"""Build a SymPy CNF for a True based scenario
|
| 230 |
+
Args:
|
| 231 |
+
params dict[str, Symbol]: params is a dict that represents
|
| 232 |
+
the hash of an Equal and the SymPy Symbols
|
| 233 |
+
Returns:
|
| 234 |
+
Any: A SymPy CNF clause
|
| 235 |
+
"""
|
| 236 |
+
return self.build_cnf(params)
|
| 237 |
+
|
| 238 |
+
def build_false_cnf(self, params: dict[str, Symbol]) -> Any:
|
| 239 |
+
"""Build a SymPy CNF for a False based scenario
|
| 240 |
+
Args:
|
| 241 |
+
params dict[str, Symbol]: params is a dict that represents
|
| 242 |
+
the hash of an Equal and the SymPy CNF Symbols
|
| 243 |
+
Returns:
|
| 244 |
+
Any: A Not SymPy CNF clause
|
| 245 |
+
"""
|
| 246 |
+
return Not(self.build_true_cnf(params))
|
| 247 |
+
|
| 248 |
+
def test(self, scenarios: Mapping[str, str]) -> bool:
|
| 249 |
+
"""Test a condition based on a scenario"""
|
| 250 |
+
return self._test(scenarios)
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/_equals.py
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import json
|
| 9 |
+
import logging
|
| 10 |
+
from typing import Any, Mapping, Tuple
|
| 11 |
+
|
| 12 |
+
from sympy import Symbol
|
| 13 |
+
from sympy.logic.boolalg import BooleanFalse, BooleanTrue
|
| 14 |
+
|
| 15 |
+
from cfnlint.conditions._utils import get_hash
|
| 16 |
+
from cfnlint.helpers import is_function
|
| 17 |
+
|
| 18 |
+
LOGGER = logging.getLogger(__name__)
|
| 19 |
+
REF_REGION = get_hash({"Ref": "AWS::Region"})
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class EqualParameter:
|
| 23 |
+
hash: str = ""
|
| 24 |
+
|
| 25 |
+
def __init__(self, value: dict):
|
| 26 |
+
self._value = value
|
| 27 |
+
k, _ = is_function(value)
|
| 28 |
+
|
| 29 |
+
# we can only do satisfaction validation
|
| 30 |
+
# on Refs currently
|
| 31 |
+
if k not in ["Ref"]:
|
| 32 |
+
self._satisfiable = False
|
| 33 |
+
else:
|
| 34 |
+
self._satisfiable = True
|
| 35 |
+
|
| 36 |
+
self.hash: str = get_hash(value)
|
| 37 |
+
|
| 38 |
+
def __eq__(self, __o: Any):
|
| 39 |
+
if isinstance(__o, str):
|
| 40 |
+
return self.hash == __o
|
| 41 |
+
return self.hash == __o.hash
|
| 42 |
+
|
| 43 |
+
@property
|
| 44 |
+
def satisfiable(self) -> bool:
|
| 45 |
+
"""Returns a boolean value if the parameter can be True or False
|
| 46 |
+
|
| 47 |
+
Args: None
|
| 48 |
+
|
| 49 |
+
Returns:
|
| 50 |
+
bool: True if the parameter can be True or False, False otherwise
|
| 51 |
+
"""
|
| 52 |
+
return self._satisfiable
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
class Equal:
|
| 56 |
+
hash: str
|
| 57 |
+
_left: EqualParameter | str
|
| 58 |
+
_right: EqualParameter | str
|
| 59 |
+
_is_static: bool | None
|
| 60 |
+
_is_region: Tuple[bool, str]
|
| 61 |
+
|
| 62 |
+
def __init__(self, equal: list[str | dict]) -> None:
|
| 63 |
+
self._is_static = None
|
| 64 |
+
if isinstance(equal, list) and len(equal) == 2:
|
| 65 |
+
# sort to keep consistancy from random ordering
|
| 66 |
+
# pylint: disable=unnecessary-lambda
|
| 67 |
+
equal_s = sorted(equal, key=lambda value: json.dumps(value))
|
| 68 |
+
|
| 69 |
+
self._left = self._init_parameter(equal_s[0])
|
| 70 |
+
self._right = self._init_parameter(equal_s[1])
|
| 71 |
+
|
| 72 |
+
self.hash = get_hash([self._left, self._right])
|
| 73 |
+
if isinstance(self._left, str) and isinstance(self._right, str):
|
| 74 |
+
self._is_static = self._left == self._right
|
| 75 |
+
elif isinstance(self._left, EqualParameter) and isinstance(
|
| 76 |
+
self._right, EqualParameter
|
| 77 |
+
):
|
| 78 |
+
if self._left == self._right:
|
| 79 |
+
self._is_static = True
|
| 80 |
+
|
| 81 |
+
self._is_region = (False, "")
|
| 82 |
+
if isinstance(self._left, EqualParameter):
|
| 83 |
+
if self._left.hash == REF_REGION and isinstance(self._right, str):
|
| 84 |
+
self._is_region = (True, self._right)
|
| 85 |
+
if isinstance(self._right, EqualParameter):
|
| 86 |
+
if self._right.hash == REF_REGION and isinstance(self._left, str):
|
| 87 |
+
self._is_region = (True, self._left)
|
| 88 |
+
|
| 89 |
+
return
|
| 90 |
+
raise ValueError("Equals has to be a list of two values")
|
| 91 |
+
|
| 92 |
+
def _init_parameter(self, parameter: dict[str, Any] | str) -> EqualParameter | str:
|
| 93 |
+
if isinstance(parameter, dict):
|
| 94 |
+
return EqualParameter(parameter)
|
| 95 |
+
return str(parameter)
|
| 96 |
+
|
| 97 |
+
@property
|
| 98 |
+
def is_static(self) -> bool | None:
|
| 99 |
+
"""Returns a boolean value if the result is always True or False or None if
|
| 100 |
+
it isn't a static boolean
|
| 101 |
+
|
| 102 |
+
Args: None
|
| 103 |
+
|
| 104 |
+
Returns:
|
| 105 |
+
bool | None: None if the equals can be True or False or True/False if
|
| 106 |
+
the equals will always return the same result
|
| 107 |
+
"""
|
| 108 |
+
return self._is_static
|
| 109 |
+
|
| 110 |
+
@property
|
| 111 |
+
def parameters(self) -> list[EqualParameter]:
|
| 112 |
+
"""Returns a List of the EqualParameter that make up the Condition
|
| 113 |
+
|
| 114 |
+
Args: None
|
| 115 |
+
|
| 116 |
+
Returns:
|
| 117 |
+
list[Equal]: A list of the left and right equal parameters if they are
|
| 118 |
+
of type EqualParameter
|
| 119 |
+
"""
|
| 120 |
+
params = []
|
| 121 |
+
if isinstance(self._left, EqualParameter):
|
| 122 |
+
params.append(self._left)
|
| 123 |
+
if isinstance(self._right, EqualParameter):
|
| 124 |
+
params.append(self._right)
|
| 125 |
+
return params
|
| 126 |
+
|
| 127 |
+
@property
|
| 128 |
+
def is_region(self) -> Tuple[bool, str]:
|
| 129 |
+
"""Returns a Tuple if the condition is comparing a region to a string
|
| 130 |
+
|
| 131 |
+
Args: None
|
| 132 |
+
|
| 133 |
+
Returns:
|
| 134 |
+
Tuple[bool, str]: Tuple where the boolean is True if the condition
|
| 135 |
+
is using Ref: AWS::Region and the second element is for the region
|
| 136 |
+
being compared
|
| 137 |
+
"""
|
| 138 |
+
return self._is_region
|
| 139 |
+
|
| 140 |
+
@property
|
| 141 |
+
def left(self):
|
| 142 |
+
return self._left
|
| 143 |
+
|
| 144 |
+
@property
|
| 145 |
+
def right(self):
|
| 146 |
+
return self._right
|
| 147 |
+
|
| 148 |
+
def build_cnf(
|
| 149 |
+
self, params: dict[str, Symbol]
|
| 150 |
+
) -> BooleanTrue | BooleanFalse | Symbol:
|
| 151 |
+
"""Build a SymPy CNF solver based on the provided params
|
| 152 |
+
Args:
|
| 153 |
+
params dict[str, Symbol]: params is a dict that represents
|
| 154 |
+
the hash of an Equal and the SymPy Symbol
|
| 155 |
+
Returns:
|
| 156 |
+
BooleanFunction: A Not SymPy BooleanFunction
|
| 157 |
+
"""
|
| 158 |
+
if self._is_static is not None:
|
| 159 |
+
if self._is_static:
|
| 160 |
+
return BooleanTrue()
|
| 161 |
+
return BooleanFalse()
|
| 162 |
+
|
| 163 |
+
return params.get(self.hash, Symbol(self.hash))
|
| 164 |
+
|
| 165 |
+
def test(self, scenarios: Mapping[str, str]) -> bool:
|
| 166 |
+
"""Do an equals based on the provided scenario"""
|
| 167 |
+
if self._is_static in [True, False]:
|
| 168 |
+
return self._is_static
|
| 169 |
+
for scenario, value in scenarios.items():
|
| 170 |
+
if isinstance(self._left, EqualParameter):
|
| 171 |
+
if scenario == self._left:
|
| 172 |
+
return value == self._right
|
| 173 |
+
if isinstance(self._right, EqualParameter):
|
| 174 |
+
if scenario == self._right:
|
| 175 |
+
return value == self._left
|
| 176 |
+
|
| 177 |
+
raise ValueError("An appropriate scenario was not found")
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/_errors.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class UnknownSatisfisfaction(Exception):
|
| 10 |
+
"""Unknown Satisfisfaction Exception"""
|
| 11 |
+
|
| 12 |
+
def __init__(self, message: str, **kwargs: Any):
|
| 13 |
+
super().__init__(message, **kwargs)
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/_rule.py
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import logging
|
| 9 |
+
from typing import Any, Dict
|
| 10 |
+
|
| 11 |
+
from sympy import And, Implies, Symbol
|
| 12 |
+
from sympy.logic.boolalg import BooleanFunction, BooleanTrue
|
| 13 |
+
|
| 14 |
+
from cfnlint.conditions._condition import (
|
| 15 |
+
ConditionAnd,
|
| 16 |
+
ConditionList,
|
| 17 |
+
ConditionNamed,
|
| 18 |
+
ConditionNot,
|
| 19 |
+
ConditionOr,
|
| 20 |
+
)
|
| 21 |
+
from cfnlint.conditions._equals import Equal
|
| 22 |
+
from cfnlint.helpers import FUNCTION_CONDITIONS
|
| 23 |
+
|
| 24 |
+
LOGGER = logging.getLogger(__name__)
|
| 25 |
+
|
| 26 |
+
# we leave the type hinting here
|
| 27 |
+
_RULE = Dict[str, Any]
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class _Assertion:
|
| 31 |
+
def __init__(self, condition: Any, all_conditions: dict[str, dict]) -> None:
|
| 32 |
+
self._fn_equals: Equal | None = None
|
| 33 |
+
self._condition: ConditionList | ConditionNamed | None = None
|
| 34 |
+
|
| 35 |
+
if len(condition) == 1:
|
| 36 |
+
for k, v in condition.items():
|
| 37 |
+
if k in FUNCTION_CONDITIONS:
|
| 38 |
+
if not isinstance(v, list):
|
| 39 |
+
raise ValueError(f"{k} value should be an array")
|
| 40 |
+
if k == "Fn::Equals":
|
| 41 |
+
self._fn_equals = Equal(v)
|
| 42 |
+
elif k == "Fn::And":
|
| 43 |
+
self._condition = ConditionAnd(v, all_conditions)
|
| 44 |
+
elif k == "Fn::Or":
|
| 45 |
+
self._condition = ConditionOr(v, all_conditions)
|
| 46 |
+
elif k == "Fn::Not":
|
| 47 |
+
self._condition = ConditionNot(v, all_conditions)
|
| 48 |
+
elif k == "Condition":
|
| 49 |
+
if not isinstance(v, str):
|
| 50 |
+
raise ValueError(f"Condition value {v!r} must be a string")
|
| 51 |
+
self._condition = ConditionNamed(v, all_conditions)
|
| 52 |
+
else:
|
| 53 |
+
raise ValueError(f"Unknown key ({k}) in condition")
|
| 54 |
+
else:
|
| 55 |
+
raise ValueError("Condition value must be an object of length 1")
|
| 56 |
+
|
| 57 |
+
def build_cnf(self, params: dict[str, Symbol]) -> BooleanFunction | Symbol | None:
|
| 58 |
+
if self._fn_equals:
|
| 59 |
+
try:
|
| 60 |
+
return self._fn_equals.build_cnf(params)
|
| 61 |
+
except Exception as e:
|
| 62 |
+
LOGGER.debug(f"Error building condition: {e}")
|
| 63 |
+
|
| 64 |
+
if self._condition:
|
| 65 |
+
try:
|
| 66 |
+
return self._condition.build_cnf(params)
|
| 67 |
+
except Exception as e:
|
| 68 |
+
LOGGER.debug(f"Error building condition: {e}")
|
| 69 |
+
|
| 70 |
+
return BooleanTrue()
|
| 71 |
+
|
| 72 |
+
@property
|
| 73 |
+
def equals(self) -> list[Equal]:
|
| 74 |
+
if self._fn_equals:
|
| 75 |
+
return [self._fn_equals]
|
| 76 |
+
if self._condition:
|
| 77 |
+
return self._condition.equals
|
| 78 |
+
return []
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
class _Assertions:
|
| 82 |
+
def __init__(self, assertions: list[dict], all_conditions: dict[str, dict]) -> None:
|
| 83 |
+
self._assertions: list[_Assertion] = []
|
| 84 |
+
for assertion in assertions:
|
| 85 |
+
assert_ = assertion.get("Assert", {})
|
| 86 |
+
self._assertions.append(_Assertion(assert_, all_conditions))
|
| 87 |
+
|
| 88 |
+
def build_cnf(self, params: dict[str, Symbol]) -> BooleanFunction | Symbol | None:
|
| 89 |
+
|
| 90 |
+
assertions = []
|
| 91 |
+
for assertion in self._assertions:
|
| 92 |
+
assertions.append(assertion.build_cnf(params))
|
| 93 |
+
|
| 94 |
+
try:
|
| 95 |
+
return And(*assertions)
|
| 96 |
+
except Exception as e:
|
| 97 |
+
LOGGER.debug(f"Error building conditions: {e}")
|
| 98 |
+
return BooleanTrue()
|
| 99 |
+
|
| 100 |
+
@property
|
| 101 |
+
def equals(self) -> list[Equal]:
|
| 102 |
+
|
| 103 |
+
results = []
|
| 104 |
+
for assertion in self._assertions:
|
| 105 |
+
results.extend(assertion.equals)
|
| 106 |
+
return results
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
class Rule:
|
| 110 |
+
|
| 111 |
+
def __init__(self, rule: _RULE, all_conditions: dict[str, dict]) -> None:
|
| 112 |
+
self._condition: _Assertion | None = None
|
| 113 |
+
self._assertions: _Assertions | None = None
|
| 114 |
+
self._init_rule(rule, all_conditions)
|
| 115 |
+
|
| 116 |
+
def _init_rule(
|
| 117 |
+
self,
|
| 118 |
+
rule: _RULE,
|
| 119 |
+
all_conditions: dict[str, dict],
|
| 120 |
+
) -> None:
|
| 121 |
+
condition = rule.get("RuleCondition")
|
| 122 |
+
if condition:
|
| 123 |
+
self._condition = _Assertion(condition, all_conditions)
|
| 124 |
+
|
| 125 |
+
assertions = rule.get("Assertions")
|
| 126 |
+
if not assertions:
|
| 127 |
+
raise ValueError("Rule must have Assertions")
|
| 128 |
+
self._assertions = _Assertions(assertions, all_conditions)
|
| 129 |
+
|
| 130 |
+
@property
|
| 131 |
+
def equals(self) -> list[Equal]:
|
| 132 |
+
result = []
|
| 133 |
+
if self._condition:
|
| 134 |
+
result.extend(self._condition.equals)
|
| 135 |
+
if self._assertions:
|
| 136 |
+
result.extend(self._assertions.equals)
|
| 137 |
+
return result
|
| 138 |
+
|
| 139 |
+
def build_cnf(self, params: dict[str, Symbol]) -> BooleanFunction | Symbol | None:
|
| 140 |
+
|
| 141 |
+
if self._assertions:
|
| 142 |
+
if self._condition:
|
| 143 |
+
return Implies(
|
| 144 |
+
self._condition.build_cnf(params),
|
| 145 |
+
self._assertions.build_cnf(params),
|
| 146 |
+
)
|
| 147 |
+
return self._assertions.build_cnf(params)
|
| 148 |
+
return None
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/_utils.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import hashlib
|
| 7 |
+
import json
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class ObjectEncoder(json.JSONEncoder):
|
| 11 |
+
def default(self, o):
|
| 12 |
+
if hasattr(o, "_value"):
|
| 13 |
+
# pylint: disable=protected-access
|
| 14 |
+
return o._value
|
| 15 |
+
return o
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def get_hash(o):
|
| 19 |
+
"""Return a hash of an object"""
|
| 20 |
+
return hashlib.sha1(
|
| 21 |
+
json.dumps(o, sort_keys=True, cls=ObjectEncoder).encode("utf-8")
|
| 22 |
+
).hexdigest()
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/conditions/conditions.py
ADDED
|
@@ -0,0 +1,460 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import itertools
|
| 9 |
+
import logging
|
| 10 |
+
import traceback
|
| 11 |
+
from functools import lru_cache
|
| 12 |
+
from typing import Any, Iterator, Set, Tuple
|
| 13 |
+
|
| 14 |
+
from sympy import And, Implies, Not, Symbol
|
| 15 |
+
from sympy.assumptions.cnf import EncodedCNF
|
| 16 |
+
from sympy.logic.boolalg import BooleanFalse, BooleanTrue
|
| 17 |
+
from sympy.logic.inference import satisfiable
|
| 18 |
+
|
| 19 |
+
from cfnlint.conditions._condition import ConditionNamed
|
| 20 |
+
from cfnlint.conditions._equals import Equal, EqualParameter
|
| 21 |
+
from cfnlint.conditions._errors import UnknownSatisfisfaction
|
| 22 |
+
from cfnlint.conditions._rule import Rule
|
| 23 |
+
from cfnlint.conditions._utils import get_hash
|
| 24 |
+
|
| 25 |
+
LOGGER = logging.getLogger(__name__)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class Conditions:
|
| 29 |
+
"""Conditions provides the logic for relating individual condition together"""
|
| 30 |
+
|
| 31 |
+
_max_scenarios: int = 128 # equivalent to 2^7
|
| 32 |
+
|
| 33 |
+
def __init__(self, cfn) -> None:
|
| 34 |
+
self._conditions: dict[str, ConditionNamed] = {}
|
| 35 |
+
self._parameters: dict[str, list[str]] = {}
|
| 36 |
+
self._rules: list[Rule] = []
|
| 37 |
+
self._init_conditions(cfn=cfn)
|
| 38 |
+
self._init_parameters(cfn=cfn)
|
| 39 |
+
self._init_rules(cfn=cfn)
|
| 40 |
+
self._cnf, self._solver_params = self._build_cnf(list(self._conditions.keys()))
|
| 41 |
+
|
| 42 |
+
def _init_conditions(self, cfn):
|
| 43 |
+
conditions = cfn.template.get("Conditions")
|
| 44 |
+
if isinstance(conditions, dict):
|
| 45 |
+
for k, _ in conditions.items():
|
| 46 |
+
try:
|
| 47 |
+
self._conditions[k] = ConditionNamed(k, conditions)
|
| 48 |
+
except ValueError as e:
|
| 49 |
+
LOGGER.debug(
|
| 50 |
+
"Captured error while building condition %s: %s", k, str(e)
|
| 51 |
+
)
|
| 52 |
+
except Exception as e: # pylint: disable=broad-exception-caught
|
| 53 |
+
if LOGGER.getEffectiveLevel() == logging.DEBUG:
|
| 54 |
+
error_message = traceback.format_exc()
|
| 55 |
+
else:
|
| 56 |
+
error_message = str(e)
|
| 57 |
+
LOGGER.debug(
|
| 58 |
+
"Captured unknown error while building condition %s: %s",
|
| 59 |
+
k,
|
| 60 |
+
error_message,
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
def _init_parameters(self, cfn: Any) -> None:
|
| 64 |
+
parameters = cfn.template.get("Parameters")
|
| 65 |
+
if not isinstance(parameters, dict):
|
| 66 |
+
return
|
| 67 |
+
for parameter_name, parameter in parameters.items():
|
| 68 |
+
if not isinstance(parameter, dict):
|
| 69 |
+
continue
|
| 70 |
+
allowed_values = parameter.get("AllowedValues")
|
| 71 |
+
if not allowed_values or not isinstance(allowed_values, list):
|
| 72 |
+
continue
|
| 73 |
+
|
| 74 |
+
param_hash = get_hash({"Ref": parameter_name})
|
| 75 |
+
self._parameters[param_hash] = []
|
| 76 |
+
for allowed_value in allowed_values:
|
| 77 |
+
if isinstance(allowed_value, (str, int, float, bool)):
|
| 78 |
+
self._parameters[param_hash].append(get_hash(str(allowed_value)))
|
| 79 |
+
|
| 80 |
+
def _init_rules(self, cfn: Any) -> None:
|
| 81 |
+
rules = cfn.template.get("Rules")
|
| 82 |
+
conditions = cfn.template.get("Conditions", {})
|
| 83 |
+
if not isinstance(rules, dict) or not isinstance(conditions, dict):
|
| 84 |
+
return
|
| 85 |
+
for k, v in rules.items():
|
| 86 |
+
if not isinstance(v, dict):
|
| 87 |
+
continue
|
| 88 |
+
try:
|
| 89 |
+
self._rules.append(Rule(v, conditions))
|
| 90 |
+
except ValueError as e:
|
| 91 |
+
LOGGER.debug("Captured error while building rule %s: %s", k, str(e))
|
| 92 |
+
except Exception as e: # pylint: disable=broad-exception-caught
|
| 93 |
+
if LOGGER.getEffectiveLevel() == logging.DEBUG:
|
| 94 |
+
error_message = traceback.format_exc()
|
| 95 |
+
else:
|
| 96 |
+
error_message = str(e)
|
| 97 |
+
LOGGER.debug(
|
| 98 |
+
"Captured unknown error while building rule %s: %s",
|
| 99 |
+
k,
|
| 100 |
+
error_message,
|
| 101 |
+
)
|
| 102 |
+
|
| 103 |
+
def get(self, name: str, default: Any = None) -> ConditionNamed:
|
| 104 |
+
"""Return the conditions"""
|
| 105 |
+
return self._conditions.get(name, default)
|
| 106 |
+
|
| 107 |
+
def _build_cnf(
|
| 108 |
+
self, condition_names: list[str]
|
| 109 |
+
) -> Tuple[EncodedCNF, dict[str, Any]]:
|
| 110 |
+
cnf = EncodedCNF()
|
| 111 |
+
|
| 112 |
+
# build parameters and equals into solver
|
| 113 |
+
equal_vars: dict[str, Symbol | BooleanFalse | BooleanTrue] = {}
|
| 114 |
+
|
| 115 |
+
equals: dict[str, Equal] = {}
|
| 116 |
+
|
| 117 |
+
def _build_equal_vars(c_equals: list[Equal]):
|
| 118 |
+
for c_equal in c_equals:
|
| 119 |
+
if c_equal.hash in equal_vars:
|
| 120 |
+
continue
|
| 121 |
+
|
| 122 |
+
if c_equal.is_static is not None:
|
| 123 |
+
if c_equal.is_static:
|
| 124 |
+
equal_vars[c_equal.hash] = BooleanTrue()
|
| 125 |
+
else:
|
| 126 |
+
equal_vars[c_equal.hash] = BooleanFalse()
|
| 127 |
+
else:
|
| 128 |
+
equal_vars[c_equal.hash] = Symbol(c_equal.hash)
|
| 129 |
+
# See if parameter in this equals is the same as another equals
|
| 130 |
+
for param in c_equal.parameters:
|
| 131 |
+
for e_hash, e_equals in equals.items():
|
| 132 |
+
if param in e_equals.parameters:
|
| 133 |
+
# equivalent to NAND logic. We want to make
|
| 134 |
+
# sure that both equals are not both True
|
| 135 |
+
# at the same time
|
| 136 |
+
cnf.add_prop(
|
| 137 |
+
~(equal_vars[c_equal.hash] & equal_vars[e_hash])
|
| 138 |
+
)
|
| 139 |
+
equals[c_equal.hash] = c_equal
|
| 140 |
+
|
| 141 |
+
for rule in self._rules:
|
| 142 |
+
_build_equal_vars(rule.equals)
|
| 143 |
+
|
| 144 |
+
for condition_name in condition_names:
|
| 145 |
+
_build_equal_vars(self._conditions[condition_name].equals)
|
| 146 |
+
|
| 147 |
+
# Determine if a set of conditions can never be all false
|
| 148 |
+
allowed_values = self._parameters.copy()
|
| 149 |
+
if allowed_values:
|
| 150 |
+
# iteration 1 cleans up all the hash values
|
| 151 |
+
# from allowed_values to know if we
|
| 152 |
+
# used them all
|
| 153 |
+
for _, equal_1 in equals.items():
|
| 154 |
+
for param in equal_1.parameters:
|
| 155 |
+
if param.hash not in allowed_values:
|
| 156 |
+
continue
|
| 157 |
+
if isinstance(equal_1.left, str):
|
| 158 |
+
if get_hash(equal_1.left) in allowed_values[param.hash]:
|
| 159 |
+
allowed_values[param.hash].remove(get_hash(equal_1.left))
|
| 160 |
+
else:
|
| 161 |
+
equal_vars[equal_1.hash] = BooleanFalse()
|
| 162 |
+
if isinstance(equal_1.right, str):
|
| 163 |
+
if get_hash(equal_1.right) in allowed_values[param.hash]:
|
| 164 |
+
allowed_values[param.hash].remove(get_hash(equal_1.right))
|
| 165 |
+
else:
|
| 166 |
+
equal_vars[equal_1.hash] = BooleanFalse()
|
| 167 |
+
|
| 168 |
+
# iteration 2 builds the cnf formulas to make sure any empty lists
|
| 169 |
+
# are now full not equals
|
| 170 |
+
for allowed_hash, allowed_value in allowed_values.items():
|
| 171 |
+
# means the list is empty and all allowed values are validated
|
| 172 |
+
# so not all equals can be false
|
| 173 |
+
if not allowed_value:
|
| 174 |
+
prop = None
|
| 175 |
+
for _, equal_1 in equals.items():
|
| 176 |
+
for param in equal_1.parameters:
|
| 177 |
+
if allowed_hash == param.hash:
|
| 178 |
+
if prop is None:
|
| 179 |
+
prop = Not(equal_vars[equal_1.hash])
|
| 180 |
+
else:
|
| 181 |
+
prop = prop & Not(equal_vars[equal_1.hash])
|
| 182 |
+
# Need to make sure they aren't all False
|
| 183 |
+
# So Not(Not(Equal1) & Not(Equal2))
|
| 184 |
+
# When Equal1 False and Equal2 False
|
| 185 |
+
# Not(True & True) = False allowing this not to happen
|
| 186 |
+
if prop is not None:
|
| 187 |
+
cnf.add_prop(Not(prop))
|
| 188 |
+
|
| 189 |
+
for rule in self._rules:
|
| 190 |
+
cnf.add_prop(rule.build_cnf(equal_vars))
|
| 191 |
+
|
| 192 |
+
return (cnf, equal_vars)
|
| 193 |
+
|
| 194 |
+
def build_scenarios(
|
| 195 |
+
self, conditions: dict[str, Set[bool]], region: str | None = None
|
| 196 |
+
) -> Iterator[dict[str, bool]]:
|
| 197 |
+
"""Given a list of condition names this function will
|
| 198 |
+
yield scenarios that represent those conditions and
|
| 199 |
+
there result (True/False)
|
| 200 |
+
|
| 201 |
+
Args:
|
| 202 |
+
condition_names (list[str]): A list of condition names
|
| 203 |
+
|
| 204 |
+
Returns:
|
| 205 |
+
Iterator[dict[str, bool]]: yield dict objects of {ConditionName: True/False}
|
| 206 |
+
"""
|
| 207 |
+
# nothing to yield if there are no conditions
|
| 208 |
+
if len(conditions) == 0:
|
| 209 |
+
return
|
| 210 |
+
|
| 211 |
+
c_cnf = self._cnf.copy()
|
| 212 |
+
condition_names = []
|
| 213 |
+
conditions_set = {}
|
| 214 |
+
for condition_name, values in conditions.items():
|
| 215 |
+
if condition_name in self._conditions:
|
| 216 |
+
if values == {True}:
|
| 217 |
+
c_cnf.add_prop(
|
| 218 |
+
self._conditions[condition_name].build_true_cnf(
|
| 219 |
+
self._solver_params
|
| 220 |
+
)
|
| 221 |
+
)
|
| 222 |
+
conditions_set[condition_name] = True
|
| 223 |
+
continue
|
| 224 |
+
if values == {False}:
|
| 225 |
+
c_cnf.add_prop(
|
| 226 |
+
self._conditions[condition_name].build_false_cnf(
|
| 227 |
+
self._solver_params
|
| 228 |
+
)
|
| 229 |
+
)
|
| 230 |
+
conditions_set[condition_name] = False
|
| 231 |
+
continue
|
| 232 |
+
condition_names.append(condition_name)
|
| 233 |
+
|
| 234 |
+
try:
|
| 235 |
+
# build a large matric of True/False options
|
| 236 |
+
# based on the provided conditions
|
| 237 |
+
scenarios_attempted = 0
|
| 238 |
+
if region:
|
| 239 |
+
products = itertools.starmap(
|
| 240 |
+
self.build_scenerios_on_region,
|
| 241 |
+
itertools.product(condition_names, [region]),
|
| 242 |
+
)
|
| 243 |
+
else:
|
| 244 |
+
products = itertools.product([True, False], repeat=len(condition_names)) # type: ignore
|
| 245 |
+
|
| 246 |
+
for p in products:
|
| 247 |
+
cnf = c_cnf.copy()
|
| 248 |
+
params = dict(zip(condition_names, p))
|
| 249 |
+
for condition_name, opt in params.items():
|
| 250 |
+
if opt:
|
| 251 |
+
cnf.add_prop(
|
| 252 |
+
self._conditions[condition_name].build_true_cnf(
|
| 253 |
+
self._solver_params
|
| 254 |
+
)
|
| 255 |
+
)
|
| 256 |
+
else:
|
| 257 |
+
cnf.add_prop(
|
| 258 |
+
self._conditions[condition_name].build_false_cnf(
|
| 259 |
+
self._solver_params
|
| 260 |
+
)
|
| 261 |
+
)
|
| 262 |
+
|
| 263 |
+
# if the scenario can be satisfied then return it
|
| 264 |
+
if satisfiable(cnf):
|
| 265 |
+
yield {**params, **conditions_set}
|
| 266 |
+
|
| 267 |
+
scenarios_attempted += 1
|
| 268 |
+
# On occassions people will use a lot of non-related conditions
|
| 269 |
+
# this is fail safe to limit the maximum number of responses
|
| 270 |
+
if scenarios_attempted >= self._max_scenarios:
|
| 271 |
+
return
|
| 272 |
+
except KeyError:
|
| 273 |
+
# KeyError is because the listed condition doesn't exist because of bad
|
| 274 |
+
# formatting or just the wrong condition name
|
| 275 |
+
return
|
| 276 |
+
|
| 277 |
+
def _build_cfn_implies(self, scenarios) -> And:
|
| 278 |
+
conditions = []
|
| 279 |
+
for condition_name, opt in scenarios.items():
|
| 280 |
+
if opt:
|
| 281 |
+
conditions.append(
|
| 282 |
+
self._conditions[condition_name].build_true_cnf(self._solver_params)
|
| 283 |
+
)
|
| 284 |
+
else:
|
| 285 |
+
conditions.append(
|
| 286 |
+
self._conditions[condition_name].build_false_cnf(
|
| 287 |
+
self._solver_params
|
| 288 |
+
)
|
| 289 |
+
)
|
| 290 |
+
|
| 291 |
+
return And(*conditions)
|
| 292 |
+
|
| 293 |
+
def check_implies(self, scenarios: dict[str, bool], implies: str) -> bool:
|
| 294 |
+
"""Based on a bunch of scenario conditions and their Truth/False value
|
| 295 |
+
determine if implies condition is True any time the scenarios are satisfied
|
| 296 |
+
solver, solver_params = self._build_solver(list(scenarios.keys()) + [implies])
|
| 297 |
+
|
| 298 |
+
Args:
|
| 299 |
+
scenarios (dict[str, bool]): A list of condition names
|
| 300 |
+
and if they are True or False implies: the condition name that
|
| 301 |
+
we are implying will also be True
|
| 302 |
+
|
| 303 |
+
Returns:
|
| 304 |
+
bool: if the implied condition will be True if the scenario is True
|
| 305 |
+
"""
|
| 306 |
+
try:
|
| 307 |
+
cnf = self._cnf.copy()
|
| 308 |
+
# if the implies condition has to be false in the scenarios we
|
| 309 |
+
# know it can never be true
|
| 310 |
+
if not scenarios.get(implies, True):
|
| 311 |
+
return False
|
| 312 |
+
|
| 313 |
+
and_condition = self._build_cfn_implies(scenarios)
|
| 314 |
+
cnf.add_prop(and_condition)
|
| 315 |
+
implies_condition = self._conditions[implies].build_true_cnf(
|
| 316 |
+
self._solver_params
|
| 317 |
+
)
|
| 318 |
+
cnf.add_prop(Not(Implies(and_condition, implies_condition)))
|
| 319 |
+
|
| 320 |
+
results = satisfiable(cnf)
|
| 321 |
+
if results:
|
| 322 |
+
return False
|
| 323 |
+
|
| 324 |
+
return True
|
| 325 |
+
except KeyError:
|
| 326 |
+
# KeyError is because the listed condition doesn't exist because of bad
|
| 327 |
+
# formatting or just the wrong condition name
|
| 328 |
+
return True
|
| 329 |
+
|
| 330 |
+
@lru_cache
|
| 331 |
+
def build_scenerios_on_region(self, condition_name: str, region: str) -> list[bool]:
|
| 332 |
+
"""Based on a region validate if the condition_name could be true
|
| 333 |
+
|
| 334 |
+
Args:
|
| 335 |
+
condition_name (str): The name of the condition we are validating against
|
| 336 |
+
region (str): the name of the region
|
| 337 |
+
|
| 338 |
+
Returns:
|
| 339 |
+
list[bool]: Returns True, False, or True and False depending on if the
|
| 340 |
+
condition could be True, False or both based on the region parameter
|
| 341 |
+
"""
|
| 342 |
+
cnf_region = self._cnf.copy()
|
| 343 |
+
found_region = False
|
| 344 |
+
|
| 345 |
+
# validate the condition name exists
|
| 346 |
+
# return True/False if it doesn't
|
| 347 |
+
if condition_name not in self._conditions:
|
| 348 |
+
return [True, False]
|
| 349 |
+
|
| 350 |
+
for eql in self._conditions[condition_name].equals:
|
| 351 |
+
is_region, equal_region = eql.is_region
|
| 352 |
+
if is_region:
|
| 353 |
+
found_region = True
|
| 354 |
+
if equal_region == region:
|
| 355 |
+
cnf_region.add_prop(And(self._solver_params[eql.hash]))
|
| 356 |
+
else:
|
| 357 |
+
cnf_region.add_prop(Not(self._solver_params[eql.hash]))
|
| 358 |
+
|
| 359 |
+
# The condition doesn't use a region parameter so it can be True or False
|
| 360 |
+
# Note: It is possible its a hard coded condition but
|
| 361 |
+
# for now we will return True and False
|
| 362 |
+
if not found_region:
|
| 363 |
+
return [True, False]
|
| 364 |
+
|
| 365 |
+
results = []
|
| 366 |
+
cnf_test = cnf_region.copy()
|
| 367 |
+
cnf_test.add_prop(
|
| 368 |
+
self._conditions[condition_name].build_true_cnf(self._solver_params)
|
| 369 |
+
)
|
| 370 |
+
if satisfiable(cnf_test):
|
| 371 |
+
results.append(True)
|
| 372 |
+
|
| 373 |
+
cnf_test = cnf_region.copy()
|
| 374 |
+
cnf_test.add_prop(
|
| 375 |
+
self._conditions[condition_name].build_false_cnf(self._solver_params)
|
| 376 |
+
)
|
| 377 |
+
if satisfiable(cnf_test):
|
| 378 |
+
results.append(False)
|
| 379 |
+
|
| 380 |
+
return results
|
| 381 |
+
|
| 382 |
+
def satisfiable(
|
| 383 |
+
self, conditions: dict[str, bool], parameter_values: dict[str, str]
|
| 384 |
+
) -> bool:
|
| 385 |
+
"""Given a list of condition names this function will
|
| 386 |
+
determine if the conditions are satisfied
|
| 387 |
+
|
| 388 |
+
Args:
|
| 389 |
+
condition_names (dict[str, bool]): A list of condition names with if
|
| 390 |
+
they are True or False
|
| 391 |
+
|
| 392 |
+
Returns:
|
| 393 |
+
bool: True if the conditions are satisfied
|
| 394 |
+
|
| 395 |
+
Raises:
|
| 396 |
+
UnknownSatisfisfaction: If we don't know how to satisfy a condition
|
| 397 |
+
"""
|
| 398 |
+
if not conditions:
|
| 399 |
+
if self._rules:
|
| 400 |
+
satisfied = satisfiable(self._cnf, all_models=False)
|
| 401 |
+
if satisfied is False:
|
| 402 |
+
return satisfied
|
| 403 |
+
return True
|
| 404 |
+
else:
|
| 405 |
+
return True
|
| 406 |
+
|
| 407 |
+
cnf = self._cnf.copy()
|
| 408 |
+
at_least_one_param_found = False
|
| 409 |
+
|
| 410 |
+
for condition_name, opt in conditions.items():
|
| 411 |
+
for c_equals in self._conditions[condition_name].equals:
|
| 412 |
+
found_params = {}
|
| 413 |
+
for param, value in parameter_values.items():
|
| 414 |
+
ref_hash = get_hash({"Ref": param})
|
| 415 |
+
|
| 416 |
+
for c_equal_param in c_equals.parameters:
|
| 417 |
+
if isinstance(c_equal_param, EqualParameter):
|
| 418 |
+
if c_equal_param.satisfiable is False:
|
| 419 |
+
raise UnknownSatisfisfaction(
|
| 420 |
+
f"Can't resolve satisfaction for {condition_name!r}"
|
| 421 |
+
)
|
| 422 |
+
|
| 423 |
+
if ref_hash in c_equals.parameters:
|
| 424 |
+
found_params = {ref_hash: value}
|
| 425 |
+
|
| 426 |
+
if not found_params:
|
| 427 |
+
continue
|
| 428 |
+
|
| 429 |
+
at_least_one_param_found = True
|
| 430 |
+
if c_equals.test(found_params):
|
| 431 |
+
cnf.add_prop(Symbol(c_equals.hash))
|
| 432 |
+
else:
|
| 433 |
+
cnf.add_prop(Not(Symbol(c_equals.hash)))
|
| 434 |
+
|
| 435 |
+
if opt:
|
| 436 |
+
cnf.add_prop(
|
| 437 |
+
self._conditions[condition_name].build_true_cnf(
|
| 438 |
+
self._solver_params
|
| 439 |
+
)
|
| 440 |
+
)
|
| 441 |
+
else:
|
| 442 |
+
cnf.add_prop(
|
| 443 |
+
self._conditions[condition_name].build_false_cnf(
|
| 444 |
+
self._solver_params
|
| 445 |
+
)
|
| 446 |
+
)
|
| 447 |
+
|
| 448 |
+
if at_least_one_param_found is False:
|
| 449 |
+
if self._rules:
|
| 450 |
+
satisfied = satisfiable(self._cnf, all_models=False)
|
| 451 |
+
if satisfied is False:
|
| 452 |
+
return satisfied
|
| 453 |
+
return True
|
| 454 |
+
else:
|
| 455 |
+
return True
|
| 456 |
+
|
| 457 |
+
satisfied = satisfiable(cnf, all_models=False)
|
| 458 |
+
if satisfied is False:
|
| 459 |
+
return satisfied
|
| 460 |
+
return True
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/config.py
ADDED
|
@@ -0,0 +1,879 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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PDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import argparse
|
| 9 |
+
import copy
|
| 10 |
+
import glob
|
| 11 |
+
import json
|
| 12 |
+
import logging
|
| 13 |
+
import os
|
| 14 |
+
import sys
|
| 15 |
+
from pathlib import Path
|
| 16 |
+
from typing import Any, Dict, Sequence, TypedDict
|
| 17 |
+
|
| 18 |
+
from typing_extensions import Unpack
|
| 19 |
+
|
| 20 |
+
import cfnlint.decode.cfn_yaml
|
| 21 |
+
from cfnlint.helpers import REGIONS, format_json_string
|
| 22 |
+
from cfnlint.jsonschema import StandardValidator
|
| 23 |
+
from cfnlint.version import __version__
|
| 24 |
+
|
| 25 |
+
# pylint: disable=too-many-public-methods
|
| 26 |
+
LOGGER = logging.getLogger("cfnlint")
|
| 27 |
+
|
| 28 |
+
_DEFAULT_RULESDIR = os.path.join(os.path.dirname(__file__), "rules")
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def configure_logging(debug_logging, info_logging):
|
| 32 |
+
ch = logging.StreamHandler()
|
| 33 |
+
|
| 34 |
+
if debug_logging:
|
| 35 |
+
LOGGER.setLevel(logging.DEBUG)
|
| 36 |
+
elif info_logging:
|
| 37 |
+
LOGGER.setLevel(logging.INFO)
|
| 38 |
+
else:
|
| 39 |
+
LOGGER.setLevel(logging.WARNING)
|
| 40 |
+
log_formatter = logging.Formatter(
|
| 41 |
+
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
| 42 |
+
)
|
| 43 |
+
ch.setFormatter(log_formatter)
|
| 44 |
+
|
| 45 |
+
# make sure all other log handlers are removed before adding it back
|
| 46 |
+
for handler in LOGGER.handlers:
|
| 47 |
+
LOGGER.removeHandler(handler)
|
| 48 |
+
LOGGER.addHandler(ch)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class ConfigFileArgs:
|
| 52 |
+
"""
|
| 53 |
+
Config File arguments.
|
| 54 |
+
Parses .cfnlintrc OR .cfnlintrc.yaml OR .cfnlintrc.yml
|
| 55 |
+
in the Home and Project folder.
|
| 56 |
+
"""
|
| 57 |
+
|
| 58 |
+
file_args: Dict = {}
|
| 59 |
+
_user_config_file = None
|
| 60 |
+
_project_config_file = None
|
| 61 |
+
_custom_config_file = None
|
| 62 |
+
|
| 63 |
+
def __init__(self, schema=None, config_file=None):
|
| 64 |
+
# self.file_args = self.get_config_file_defaults()
|
| 65 |
+
self.file_args = {}
|
| 66 |
+
self.default_schema_file = Path(__file__).parent.joinpath(
|
| 67 |
+
"data/CfnLintCli/config/schema.json"
|
| 68 |
+
)
|
| 69 |
+
with self.default_schema_file.open(encoding="utf-8") as f:
|
| 70 |
+
self.default_schema = json.load(f)
|
| 71 |
+
self.schema = self.default_schema if not schema else schema
|
| 72 |
+
|
| 73 |
+
if config_file:
|
| 74 |
+
self._custom_config_file = config_file
|
| 75 |
+
else:
|
| 76 |
+
LOGGER.debug("Looking for CFLINTRC before attempting to load")
|
| 77 |
+
self._user_config_file, self._project_config_file = self._find_config()
|
| 78 |
+
|
| 79 |
+
self.load()
|
| 80 |
+
|
| 81 |
+
def _find_config(self):
|
| 82 |
+
"""Looks up for user and project level config
|
| 83 |
+
Returns
|
| 84 |
+
-------
|
| 85 |
+
Tuple
|
| 86 |
+
(Path, Path)
|
| 87 |
+
Tuple with both configs and whether they were found
|
| 88 |
+
Example
|
| 89 |
+
-------
|
| 90 |
+
> user_config, project_config = self._find_config()
|
| 91 |
+
"""
|
| 92 |
+
config_file_name = ".cfnlintrc"
|
| 93 |
+
|
| 94 |
+
user_config_path = ""
|
| 95 |
+
home_path = Path.home()
|
| 96 |
+
for path in [
|
| 97 |
+
home_path.joinpath(config_file_name),
|
| 98 |
+
home_path.joinpath(f"{config_file_name}.yaml"),
|
| 99 |
+
home_path.joinpath(f"{config_file_name}.yml"),
|
| 100 |
+
]:
|
| 101 |
+
if self._has_file(path):
|
| 102 |
+
user_config_path = path
|
| 103 |
+
break
|
| 104 |
+
|
| 105 |
+
project_config_path = ""
|
| 106 |
+
cwd_path = Path.cwd()
|
| 107 |
+
for path in [
|
| 108 |
+
cwd_path.joinpath(config_file_name),
|
| 109 |
+
cwd_path.joinpath(f"{config_file_name}.yaml"),
|
| 110 |
+
cwd_path.joinpath(f"{config_file_name}.yml"),
|
| 111 |
+
]:
|
| 112 |
+
if self._has_file(path):
|
| 113 |
+
project_config_path = path
|
| 114 |
+
break
|
| 115 |
+
|
| 116 |
+
return user_config_path, project_config_path
|
| 117 |
+
|
| 118 |
+
def _has_file(self, filename):
|
| 119 |
+
"""Confirm whether file exists
|
| 120 |
+
Parameters
|
| 121 |
+
----------
|
| 122 |
+
filename : str
|
| 123 |
+
Path to a file
|
| 124 |
+
Returns
|
| 125 |
+
-------
|
| 126 |
+
Boolean
|
| 127 |
+
"""
|
| 128 |
+
|
| 129 |
+
return Path(filename).is_file()
|
| 130 |
+
|
| 131 |
+
def load(self):
|
| 132 |
+
"""Load configuration file and expose as a dictionary
|
| 133 |
+
Returns
|
| 134 |
+
-------
|
| 135 |
+
Dict
|
| 136 |
+
CFLINTRC configuration
|
| 137 |
+
"""
|
| 138 |
+
|
| 139 |
+
if self._custom_config_file:
|
| 140 |
+
custom_config = self._read_config(self._custom_config_file)
|
| 141 |
+
LOGGER.debug("Validating Custom CFNLINTRC")
|
| 142 |
+
self.validate_config(custom_config, self.schema)
|
| 143 |
+
LOGGER.debug("Custom configuration loaded as")
|
| 144 |
+
LOGGER.debug("%s", custom_config)
|
| 145 |
+
|
| 146 |
+
self.file_args = custom_config
|
| 147 |
+
else:
|
| 148 |
+
user_config = self._read_config(self._user_config_file)
|
| 149 |
+
LOGGER.debug("Validating User CFNLINTRC")
|
| 150 |
+
self.validate_config(user_config, self.schema)
|
| 151 |
+
|
| 152 |
+
project_config = self._read_config(self._project_config_file)
|
| 153 |
+
LOGGER.debug("Validating Project CFNLINTRC")
|
| 154 |
+
self.validate_config(project_config, self.schema)
|
| 155 |
+
|
| 156 |
+
LOGGER.debug("User configuration loaded as")
|
| 157 |
+
LOGGER.debug("%s", user_config)
|
| 158 |
+
LOGGER.debug("Project configuration loaded as")
|
| 159 |
+
LOGGER.debug("%s", project_config)
|
| 160 |
+
|
| 161 |
+
LOGGER.debug("Merging configurations...")
|
| 162 |
+
self.file_args = self.merge_config(user_config, project_config)
|
| 163 |
+
|
| 164 |
+
def validate_config(self, config, schema):
|
| 165 |
+
"""Validate configuration against schema
|
| 166 |
+
Parameters
|
| 167 |
+
----------
|
| 168 |
+
config : dict
|
| 169 |
+
CFNLINTRC configuration
|
| 170 |
+
schema : dict
|
| 171 |
+
JSONSchema to validate against
|
| 172 |
+
Raises
|
| 173 |
+
-------
|
| 174 |
+
jsonschema.exceptions.ValidationError
|
| 175 |
+
Returned when cfnlintrc doesn't match schema provided
|
| 176 |
+
"""
|
| 177 |
+
LOGGER.debug("Validating CFNLINTRC config with given JSONSchema")
|
| 178 |
+
LOGGER.debug("Schema used: %s", schema)
|
| 179 |
+
LOGGER.debug("Config used: %s", config)
|
| 180 |
+
|
| 181 |
+
validator = StandardValidator(schema=schema)
|
| 182 |
+
validator.validate(config)
|
| 183 |
+
LOGGER.debug("CFNLINTRC looks valid!")
|
| 184 |
+
|
| 185 |
+
def merge_config(self, user_config, project_config):
|
| 186 |
+
"""Merge project and user configuration into a single dictionary
|
| 187 |
+
Creates a new configuration with both configuration merged
|
| 188 |
+
it favours project level over user configuration if keys are duplicated
|
| 189 |
+
NOTE
|
| 190 |
+
----
|
| 191 |
+
It takes any number of nested dicts
|
| 192 |
+
It overrides lists found in user_config with project_config
|
| 193 |
+
Parameters
|
| 194 |
+
----------
|
| 195 |
+
user_config : Dict
|
| 196 |
+
User configuration (~/.cfnlintrc) found at user's home directory
|
| 197 |
+
project_config : Dict
|
| 198 |
+
Project configuration (.cfnlintrc) found at current directory
|
| 199 |
+
Returns
|
| 200 |
+
-------
|
| 201 |
+
Dict
|
| 202 |
+
Merged configuration
|
| 203 |
+
"""
|
| 204 |
+
# Recursively override User config with Project config
|
| 205 |
+
for key in user_config:
|
| 206 |
+
if key in project_config:
|
| 207 |
+
# If both keys are the same, let's check whether they have nested keys
|
| 208 |
+
if isinstance(user_config[key], dict) and isinstance(
|
| 209 |
+
project_config[key], dict
|
| 210 |
+
):
|
| 211 |
+
self.merge_config(user_config[key], project_config[key])
|
| 212 |
+
else:
|
| 213 |
+
user_config[key] = project_config[key]
|
| 214 |
+
LOGGER.debug(
|
| 215 |
+
"Overriding User's key %s with Project's specific value %s.",
|
| 216 |
+
key,
|
| 217 |
+
project_config[key],
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
# Project may have unique config we need to copy over too
|
| 221 |
+
# so that we can have user+project config available as one
|
| 222 |
+
for key in project_config:
|
| 223 |
+
if key not in user_config:
|
| 224 |
+
user_config[key] = project_config[key]
|
| 225 |
+
|
| 226 |
+
return user_config
|
| 227 |
+
|
| 228 |
+
def _read_config(self, config):
|
| 229 |
+
"""Parse given YAML configuration
|
| 230 |
+
Returns
|
| 231 |
+
-------
|
| 232 |
+
Dict
|
| 233 |
+
Parsed YAML configuration as dictionary
|
| 234 |
+
"""
|
| 235 |
+
config = Path(config)
|
| 236 |
+
config_template = None
|
| 237 |
+
|
| 238 |
+
if self._has_file(config):
|
| 239 |
+
LOGGER.debug("Parsing CFNLINTRC")
|
| 240 |
+
config_template = cfnlint.decode.cfn_yaml.load(str(config))
|
| 241 |
+
|
| 242 |
+
if not config_template:
|
| 243 |
+
config_template = {}
|
| 244 |
+
|
| 245 |
+
return config_template
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
def comma_separated_arg(string):
|
| 249 |
+
"""Split a comma separated string"""
|
| 250 |
+
return string.split(",")
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
def _ensure_value(namespace, name, value):
|
| 254 |
+
if getattr(namespace, name, None) is None:
|
| 255 |
+
setattr(namespace, name, value)
|
| 256 |
+
return getattr(namespace, name)
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
class RuleConfigurationAction(argparse.Action):
|
| 260 |
+
"""Override the default Action"""
|
| 261 |
+
|
| 262 |
+
def __init__(
|
| 263 |
+
self,
|
| 264 |
+
option_strings,
|
| 265 |
+
dest,
|
| 266 |
+
nargs=None,
|
| 267 |
+
const=None,
|
| 268 |
+
default=None,
|
| 269 |
+
type=None,
|
| 270 |
+
choices=None,
|
| 271 |
+
required=False,
|
| 272 |
+
help=None,
|
| 273 |
+
metavar=None,
|
| 274 |
+
): # pylint: disable=W0622
|
| 275 |
+
super().__init__(
|
| 276 |
+
option_strings=option_strings,
|
| 277 |
+
dest=dest,
|
| 278 |
+
nargs=nargs,
|
| 279 |
+
const=const,
|
| 280 |
+
default=default,
|
| 281 |
+
type=type,
|
| 282 |
+
choices=choices,
|
| 283 |
+
required=required,
|
| 284 |
+
help=help,
|
| 285 |
+
metavar=metavar,
|
| 286 |
+
)
|
| 287 |
+
|
| 288 |
+
def _parse_rule_configuration(self, string):
|
| 289 |
+
"""Parse the config rule structure"""
|
| 290 |
+
configs = comma_separated_arg(string)
|
| 291 |
+
results = {}
|
| 292 |
+
for config in configs:
|
| 293 |
+
rule_id = config.split(":")[0]
|
| 294 |
+
config_name = config.split(":")[1].split("=")[0]
|
| 295 |
+
config_value = config.split(":")[1].split("=")[1]
|
| 296 |
+
if rule_id not in results:
|
| 297 |
+
results[rule_id] = {}
|
| 298 |
+
results[rule_id][config_name] = config_value
|
| 299 |
+
|
| 300 |
+
return results
|
| 301 |
+
|
| 302 |
+
def __call__(self, parser, namespace, values, option_string=None):
|
| 303 |
+
items = copy.copy(_ensure_value(namespace, self.dest, {}))
|
| 304 |
+
try:
|
| 305 |
+
for value in values:
|
| 306 |
+
new_value = self._parse_rule_configuration(value)
|
| 307 |
+
for v_k, v_vs in new_value.items():
|
| 308 |
+
if v_k in items:
|
| 309 |
+
for s_k, s_v in v_vs.items():
|
| 310 |
+
items[v_k][s_k] = s_v
|
| 311 |
+
else:
|
| 312 |
+
items[v_k] = v_vs
|
| 313 |
+
setattr(namespace, self.dest, items)
|
| 314 |
+
except Exception: # pylint: disable=W0703
|
| 315 |
+
parser.print_help()
|
| 316 |
+
parser.exit()
|
| 317 |
+
|
| 318 |
+
|
| 319 |
+
class CliArgs:
|
| 320 |
+
"""Base Args class"""
|
| 321 |
+
|
| 322 |
+
def __init__(self, cli_args: Sequence[str] | None):
|
| 323 |
+
self.parser = self.create_parser()
|
| 324 |
+
self.cli_args = self.parser.parse_args(cli_args or [])
|
| 325 |
+
|
| 326 |
+
def create_parser(self):
|
| 327 |
+
"""Do first round of parsing parameters to set options"""
|
| 328 |
+
|
| 329 |
+
class ArgumentParser(argparse.ArgumentParser):
|
| 330 |
+
"""Override Argument Parser so we can control the exit code"""
|
| 331 |
+
|
| 332 |
+
def error(self, message):
|
| 333 |
+
self.print_help(sys.stderr)
|
| 334 |
+
self.exit(32, f"{self.prog}: error: {message}\n")
|
| 335 |
+
|
| 336 |
+
class ExtendAction(argparse.Action):
|
| 337 |
+
"""Support argument types that are lists and can
|
| 338 |
+
be specified multiple times.
|
| 339 |
+
"""
|
| 340 |
+
|
| 341 |
+
def __call__(self, parser, namespace, values, option_string=None):
|
| 342 |
+
items = getattr(namespace, self.dest)
|
| 343 |
+
items = [] if items is None else items
|
| 344 |
+
for value in values:
|
| 345 |
+
if isinstance(value, list):
|
| 346 |
+
items.extend(value)
|
| 347 |
+
else:
|
| 348 |
+
items.append(value)
|
| 349 |
+
setattr(namespace, self.dest, items)
|
| 350 |
+
|
| 351 |
+
usage = (
|
| 352 |
+
"\nBasic: cfn-lint test.yaml\n"
|
| 353 |
+
"Ignore a rule: cfn-lint -i E3012 -- test.yaml\n"
|
| 354 |
+
"Configure a rule: cfn-lint -x E3012:strict=true -t test.yaml\n"
|
| 355 |
+
"Lint all yaml files in a folder: cfn-lint dir/**/*.yaml"
|
| 356 |
+
)
|
| 357 |
+
|
| 358 |
+
parser = ArgumentParser(description="CloudFormation Linter", usage=usage)
|
| 359 |
+
parser.register("action", "extend", ExtendAction)
|
| 360 |
+
|
| 361 |
+
standard = parser.add_argument_group("Standard")
|
| 362 |
+
advanced = parser.add_argument_group("Advanced / Debugging")
|
| 363 |
+
|
| 364 |
+
# Allow the template to be passes as an optional or a positional argument
|
| 365 |
+
standard.add_argument(
|
| 366 |
+
"templates",
|
| 367 |
+
metavar="TEMPLATE",
|
| 368 |
+
nargs="*",
|
| 369 |
+
help="The CloudFormation template to be linted",
|
| 370 |
+
)
|
| 371 |
+
standard.add_argument(
|
| 372 |
+
"-t",
|
| 373 |
+
"--template",
|
| 374 |
+
metavar="TEMPLATE",
|
| 375 |
+
dest="template_alt",
|
| 376 |
+
help="The CloudFormation template to be linted",
|
| 377 |
+
nargs="+",
|
| 378 |
+
default=[],
|
| 379 |
+
action="extend",
|
| 380 |
+
)
|
| 381 |
+
standard.add_argument(
|
| 382 |
+
"-b",
|
| 383 |
+
"--ignore-bad-template",
|
| 384 |
+
help="Ignore failures with Bad template",
|
| 385 |
+
action="store_true",
|
| 386 |
+
)
|
| 387 |
+
standard.add_argument(
|
| 388 |
+
"--ignore-templates",
|
| 389 |
+
dest="ignore_templates",
|
| 390 |
+
help="Ignore templates",
|
| 391 |
+
nargs="+",
|
| 392 |
+
default=[],
|
| 393 |
+
action="extend",
|
| 394 |
+
)
|
| 395 |
+
advanced.add_argument(
|
| 396 |
+
"-D", "--debug", help="Enable debug logging", action="store_true"
|
| 397 |
+
)
|
| 398 |
+
advanced.add_argument(
|
| 399 |
+
"-I", "--info", help="Enable information logging", action="store_true"
|
| 400 |
+
)
|
| 401 |
+
standard.add_argument(
|
| 402 |
+
"-f",
|
| 403 |
+
"--format",
|
| 404 |
+
help="Output Format",
|
| 405 |
+
choices=["quiet", "parseable", "json", "junit", "pretty", "sarif"],
|
| 406 |
+
)
|
| 407 |
+
standard.add_argument(
|
| 408 |
+
"-l",
|
| 409 |
+
"--list-rules",
|
| 410 |
+
dest="listrules",
|
| 411 |
+
default=False,
|
| 412 |
+
action="store_true",
|
| 413 |
+
help="list all the rules",
|
| 414 |
+
)
|
| 415 |
+
standard.add_argument(
|
| 416 |
+
"-r",
|
| 417 |
+
"--regions",
|
| 418 |
+
dest="regions",
|
| 419 |
+
nargs="+",
|
| 420 |
+
default=[],
|
| 421 |
+
type=comma_separated_arg,
|
| 422 |
+
action="extend",
|
| 423 |
+
help="list the regions to validate against.",
|
| 424 |
+
)
|
| 425 |
+
advanced.add_argument(
|
| 426 |
+
"-a",
|
| 427 |
+
"--append-rules",
|
| 428 |
+
dest="append_rules",
|
| 429 |
+
nargs="+",
|
| 430 |
+
default=[],
|
| 431 |
+
type=comma_separated_arg,
|
| 432 |
+
action="extend",
|
| 433 |
+
help=(
|
| 434 |
+
"specify one or more rules directories using "
|
| 435 |
+
"one or more --append-rules arguments. "
|
| 436 |
+
),
|
| 437 |
+
)
|
| 438 |
+
standard.add_argument(
|
| 439 |
+
"-i",
|
| 440 |
+
"--ignore-checks",
|
| 441 |
+
dest="ignore_checks",
|
| 442 |
+
nargs="+",
|
| 443 |
+
default=[],
|
| 444 |
+
type=comma_separated_arg,
|
| 445 |
+
action="extend",
|
| 446 |
+
help="only check rules whose id do not match these values",
|
| 447 |
+
)
|
| 448 |
+
standard.add_argument(
|
| 449 |
+
"-c",
|
| 450 |
+
"--include-checks",
|
| 451 |
+
dest="include_checks",
|
| 452 |
+
nargs="+",
|
| 453 |
+
default=[],
|
| 454 |
+
type=comma_separated_arg,
|
| 455 |
+
action="extend",
|
| 456 |
+
help="include rules whose id match these values",
|
| 457 |
+
)
|
| 458 |
+
standard.add_argument(
|
| 459 |
+
"-m",
|
| 460 |
+
"--mandatory-checks",
|
| 461 |
+
dest="mandatory_checks",
|
| 462 |
+
nargs="+",
|
| 463 |
+
default=[],
|
| 464 |
+
type=comma_separated_arg,
|
| 465 |
+
action="extend",
|
| 466 |
+
help=(
|
| 467 |
+
"always check rules whose id match these values, regardless of template"
|
| 468 |
+
" exclusions"
|
| 469 |
+
),
|
| 470 |
+
)
|
| 471 |
+
standard.add_argument(
|
| 472 |
+
"-e",
|
| 473 |
+
"--include-experimental",
|
| 474 |
+
help="Include experimental rules",
|
| 475 |
+
action="store_true",
|
| 476 |
+
)
|
| 477 |
+
standard.add_argument(
|
| 478 |
+
"-x",
|
| 479 |
+
"--configure-rule",
|
| 480 |
+
dest="configure_rules",
|
| 481 |
+
nargs="+",
|
| 482 |
+
default={},
|
| 483 |
+
action=RuleConfigurationAction,
|
| 484 |
+
help=(
|
| 485 |
+
"Provide configuration for a rule. Format RuleId:key=value. Example:"
|
| 486 |
+
" E3012:strict=true"
|
| 487 |
+
),
|
| 488 |
+
)
|
| 489 |
+
standard.add_argument(
|
| 490 |
+
"--config-file",
|
| 491 |
+
dest="config_file",
|
| 492 |
+
help="Specify the cfnlintrc file to use",
|
| 493 |
+
)
|
| 494 |
+
standard.add_argument(
|
| 495 |
+
"-z",
|
| 496 |
+
"--custom-rules",
|
| 497 |
+
dest="custom_rules",
|
| 498 |
+
help="Allows specification of a custom rule file.",
|
| 499 |
+
)
|
| 500 |
+
advanced.add_argument(
|
| 501 |
+
"-o",
|
| 502 |
+
"--override-spec",
|
| 503 |
+
dest="override_spec",
|
| 504 |
+
help="A CloudFormation Spec override file that allows customization",
|
| 505 |
+
)
|
| 506 |
+
advanced.add_argument(
|
| 507 |
+
"-g",
|
| 508 |
+
"--build-graph",
|
| 509 |
+
help=(
|
| 510 |
+
"Creates a file in the same directory as the template that models the"
|
| 511 |
+
" template's resources in DOT format"
|
| 512 |
+
),
|
| 513 |
+
action="store_true",
|
| 514 |
+
)
|
| 515 |
+
advanced.add_argument(
|
| 516 |
+
"-s",
|
| 517 |
+
"--registry-schemas",
|
| 518 |
+
help="one or more directories of CloudFormation Registry Schemas",
|
| 519 |
+
action="extend",
|
| 520 |
+
type=comma_separated_arg,
|
| 521 |
+
nargs="+",
|
| 522 |
+
)
|
| 523 |
+
standard.add_argument(
|
| 524 |
+
"-v",
|
| 525 |
+
"--version",
|
| 526 |
+
help="Version of cfn-lint",
|
| 527 |
+
action="version",
|
| 528 |
+
version=f"%(prog)s {__version__}",
|
| 529 |
+
)
|
| 530 |
+
advanced.add_argument(
|
| 531 |
+
"-u",
|
| 532 |
+
"--update-specs",
|
| 533 |
+
help="Update the CloudFormation Specs",
|
| 534 |
+
action="store_true",
|
| 535 |
+
)
|
| 536 |
+
advanced.add_argument(
|
| 537 |
+
"-p",
|
| 538 |
+
"--patch-specs",
|
| 539 |
+
help="Patch the CloudFormation Specs in place",
|
| 540 |
+
action="store_true",
|
| 541 |
+
)
|
| 542 |
+
advanced.add_argument(
|
| 543 |
+
"--update-documentation", help=argparse.SUPPRESS, action="store_true"
|
| 544 |
+
)
|
| 545 |
+
advanced.add_argument(
|
| 546 |
+
"--update-iam-policies", help=argparse.SUPPRESS, action="store_true"
|
| 547 |
+
)
|
| 548 |
+
standard.add_argument(
|
| 549 |
+
"--output-file",
|
| 550 |
+
type=str,
|
| 551 |
+
default=None,
|
| 552 |
+
help="Writes the output to the specified file, ideal for producing reports",
|
| 553 |
+
)
|
| 554 |
+
standard.add_argument(
|
| 555 |
+
"--merge-configs",
|
| 556 |
+
default=False,
|
| 557 |
+
action="store_true",
|
| 558 |
+
help="Merges lists between configuration layers",
|
| 559 |
+
)
|
| 560 |
+
standard.add_argument(
|
| 561 |
+
"--non-zero-exit-code",
|
| 562 |
+
type=str,
|
| 563 |
+
default="informational",
|
| 564 |
+
choices=["informational", "warning", "error", "none"],
|
| 565 |
+
help="Exit code will be non zero from the specified rule class and higher",
|
| 566 |
+
)
|
| 567 |
+
advanced.add_argument("--force", help=argparse.SUPPRESS, action="store_true")
|
| 568 |
+
|
| 569 |
+
return parser
|
| 570 |
+
|
| 571 |
+
|
| 572 |
+
class TemplateArgs:
|
| 573 |
+
"""Per Template Args"""
|
| 574 |
+
|
| 575 |
+
def __init__(self, template_args):
|
| 576 |
+
self.set_template_args(template_args)
|
| 577 |
+
|
| 578 |
+
def get_template_args(self):
|
| 579 |
+
return self._template_args
|
| 580 |
+
|
| 581 |
+
def set_template_args(self, template):
|
| 582 |
+
defaults = {}
|
| 583 |
+
if isinstance(template, dict):
|
| 584 |
+
configs = template.get("Metadata", {}).get("cfn-lint", {}).get("config", {})
|
| 585 |
+
|
| 586 |
+
if isinstance(configs, dict):
|
| 587 |
+
for key, value in {
|
| 588 |
+
"ignore_checks": (list),
|
| 589 |
+
"regions": (list),
|
| 590 |
+
"append_rules": (list),
|
| 591 |
+
"override_spec": (str),
|
| 592 |
+
"custom_rules": (str),
|
| 593 |
+
"ignore_bad_template": (bool),
|
| 594 |
+
"include_checks": (list),
|
| 595 |
+
"configure_rules": (dict),
|
| 596 |
+
"include_experimental": (bool),
|
| 597 |
+
}.items():
|
| 598 |
+
if key in configs:
|
| 599 |
+
if isinstance(configs[key], value):
|
| 600 |
+
defaults[key] = configs[key]
|
| 601 |
+
|
| 602 |
+
self._template_args = defaults
|
| 603 |
+
|
| 604 |
+
template_args = property(get_template_args, set_template_args)
|
| 605 |
+
|
| 606 |
+
|
| 607 |
+
class ManualArgs(TypedDict, total=False):
|
| 608 |
+
configure_rules: dict[str, dict[str, Any]]
|
| 609 |
+
include_checks: list[str]
|
| 610 |
+
ignore_checks: list[str]
|
| 611 |
+
mandatory_checks: list[str]
|
| 612 |
+
include_experimental: bool
|
| 613 |
+
ignore_bad_template: bool
|
| 614 |
+
ignore_templates: list
|
| 615 |
+
merge_configs: bool
|
| 616 |
+
non_zero_exit_code: str
|
| 617 |
+
output_file: str
|
| 618 |
+
regions: list
|
| 619 |
+
|
| 620 |
+
|
| 621 |
+
# pylint: disable=too-many-public-methods
|
| 622 |
+
class ConfigMixIn(TemplateArgs, CliArgs, ConfigFileArgs):
|
| 623 |
+
"""Mixin for the Configs"""
|
| 624 |
+
|
| 625 |
+
def __init__(self, cli_args: list[str] | None = None, **kwargs: Unpack[ManualArgs]):
|
| 626 |
+
self._manual_args = kwargs or ManualArgs()
|
| 627 |
+
self._templates_to_process = False
|
| 628 |
+
CliArgs.__init__(self, cli_args)
|
| 629 |
+
# configure debug as soon as we can
|
| 630 |
+
TemplateArgs.__init__(self, {})
|
| 631 |
+
ConfigFileArgs.__init__(
|
| 632 |
+
self, config_file=self._get_argument_value("config_file", False, False)
|
| 633 |
+
)
|
| 634 |
+
|
| 635 |
+
def __repr__(self):
|
| 636 |
+
return format_json_string(
|
| 637 |
+
{
|
| 638 |
+
"ignore_checks": self.ignore_checks,
|
| 639 |
+
"include_checks": self.include_checks,
|
| 640 |
+
"mandatory_checks": self.mandatory_checks,
|
| 641 |
+
"include_experimental": self.include_experimental,
|
| 642 |
+
"configure_rules": self.configure_rules,
|
| 643 |
+
"regions": self.regions,
|
| 644 |
+
"ignore_bad_template": self.ignore_bad_template,
|
| 645 |
+
"debug": self.debug,
|
| 646 |
+
"info": self.info,
|
| 647 |
+
"format": self.format,
|
| 648 |
+
"templates": self.templates,
|
| 649 |
+
"append_rules": self.append_rules,
|
| 650 |
+
"override_spec": self.override_spec,
|
| 651 |
+
"custom_rules": self.custom_rules,
|
| 652 |
+
"config_file": self.config_file,
|
| 653 |
+
"merge_configs": self.merge_configs,
|
| 654 |
+
"non_zero_exit_code": self.non_zero_exit_code,
|
| 655 |
+
}
|
| 656 |
+
)
|
| 657 |
+
|
| 658 |
+
def _get_argument_value(self, arg_name, is_template, is_config_file):
|
| 659 |
+
cli_value = getattr(self.cli_args, arg_name)
|
| 660 |
+
template_value = self.template_args.get(arg_name)
|
| 661 |
+
file_value = self.file_args.get(arg_name)
|
| 662 |
+
|
| 663 |
+
# merge list configurations
|
| 664 |
+
# make sure we don't do an infinite loop so skip this check for merge_configs
|
| 665 |
+
if arg_name != "merge_configs":
|
| 666 |
+
if self.merge_configs:
|
| 667 |
+
# the CLI will always have an empty list when the item is a list
|
| 668 |
+
# we will use that to evaluate if we need to merge the lists
|
| 669 |
+
if isinstance(cli_value, list):
|
| 670 |
+
# Use a copy here, otherwise we will
|
| 671 |
+
# accumulate template level config
|
| 672 |
+
# into the cli_value which will persist between template files
|
| 673 |
+
result = cli_value.copy()
|
| 674 |
+
if isinstance(template_value, list):
|
| 675 |
+
result.extend(template_value)
|
| 676 |
+
if isinstance(file_value, list):
|
| 677 |
+
result.extend(file_value)
|
| 678 |
+
return result
|
| 679 |
+
|
| 680 |
+
# return individual items
|
| 681 |
+
if arg_name in self._manual_args:
|
| 682 |
+
return self._manual_args[arg_name]
|
| 683 |
+
if cli_value:
|
| 684 |
+
return cli_value
|
| 685 |
+
if template_value and is_template:
|
| 686 |
+
return template_value
|
| 687 |
+
if file_value and is_config_file:
|
| 688 |
+
return file_value
|
| 689 |
+
return cli_value
|
| 690 |
+
|
| 691 |
+
@property
|
| 692 |
+
def ignore_checks(self):
|
| 693 |
+
return self._get_argument_value("ignore_checks", True, True)
|
| 694 |
+
|
| 695 |
+
@property
|
| 696 |
+
def include_checks(self):
|
| 697 |
+
results = self._get_argument_value("include_checks", True, True)
|
| 698 |
+
return ["W", "E"] + results
|
| 699 |
+
|
| 700 |
+
@property
|
| 701 |
+
def mandatory_checks(self):
|
| 702 |
+
return self._get_argument_value("mandatory_checks", False, True)
|
| 703 |
+
|
| 704 |
+
@property
|
| 705 |
+
def include_experimental(self):
|
| 706 |
+
return self._get_argument_value("include_experimental", True, True)
|
| 707 |
+
|
| 708 |
+
@property
|
| 709 |
+
def regions(self):
|
| 710 |
+
results = self._get_argument_value("regions", True, True)
|
| 711 |
+
if not results:
|
| 712 |
+
default_region_env = os.environ.get("AWS_DEFAULT_REGION", "us-east-1")
|
| 713 |
+
return [os.environ.get("AWS_REGION", default_region_env)]
|
| 714 |
+
if "ALL_REGIONS" in results:
|
| 715 |
+
return REGIONS
|
| 716 |
+
return results
|
| 717 |
+
|
| 718 |
+
@property
|
| 719 |
+
def ignore_bad_template(self):
|
| 720 |
+
return self._get_argument_value("ignore_bad_template", True, True)
|
| 721 |
+
|
| 722 |
+
@property
|
| 723 |
+
def debug(self):
|
| 724 |
+
return self._get_argument_value("debug", False, False)
|
| 725 |
+
|
| 726 |
+
@property
|
| 727 |
+
def info(self):
|
| 728 |
+
return self._get_argument_value("info", False, False)
|
| 729 |
+
|
| 730 |
+
@property
|
| 731 |
+
def format(self):
|
| 732 |
+
return self._get_argument_value("format", False, True)
|
| 733 |
+
|
| 734 |
+
@property
|
| 735 |
+
def templates(self):
|
| 736 |
+
"""
|
| 737 |
+
|
| 738 |
+
Returns a list of Cloudformation templates to lint.
|
| 739 |
+
|
| 740 |
+
Order of precedence:
|
| 741 |
+
- Filenames provided via `-t` CLI
|
| 742 |
+
- Filenames specified in the config file.
|
| 743 |
+
- Arguments provided via `cfn-lint` CLI.
|
| 744 |
+
"""
|
| 745 |
+
|
| 746 |
+
all_filenames = []
|
| 747 |
+
|
| 748 |
+
cli_alt_args = self._get_argument_value("template_alt", False, False)
|
| 749 |
+
file_args = self._get_argument_value("templates", False, True)
|
| 750 |
+
cli_args = self._get_argument_value("templates", False, False)
|
| 751 |
+
|
| 752 |
+
if cli_alt_args:
|
| 753 |
+
filenames = cli_alt_args
|
| 754 |
+
elif file_args:
|
| 755 |
+
filenames = file_args
|
| 756 |
+
elif cli_args:
|
| 757 |
+
filenames = cli_args
|
| 758 |
+
else:
|
| 759 |
+
# No filenames found, could be piped in or be using the api.
|
| 760 |
+
return None
|
| 761 |
+
|
| 762 |
+
# If we're still haven't returned, we've got templates to lint.
|
| 763 |
+
# Build up list of templates to lint.
|
| 764 |
+
self.templates_to_process = True
|
| 765 |
+
|
| 766 |
+
if isinstance(filenames, str):
|
| 767 |
+
filenames = [filenames]
|
| 768 |
+
|
| 769 |
+
ignore_templates = self._ignore_templates()
|
| 770 |
+
all_filenames.extend(self._glob_filenames(filenames))
|
| 771 |
+
|
| 772 |
+
found_files = [i for i in all_filenames if i not in ignore_templates]
|
| 773 |
+
LOGGER.debug(
|
| 774 |
+
f"List of Cloudformation Templates to lint: {found_files} from {filenames}"
|
| 775 |
+
)
|
| 776 |
+
return found_files
|
| 777 |
+
|
| 778 |
+
def _ignore_templates(self):
|
| 779 |
+
ignore_template_args = self._get_argument_value("ignore_templates", False, True)
|
| 780 |
+
if ignore_template_args:
|
| 781 |
+
filenames = ignore_template_args
|
| 782 |
+
else:
|
| 783 |
+
return []
|
| 784 |
+
|
| 785 |
+
# if only one is specified convert it to array
|
| 786 |
+
if isinstance(filenames, str):
|
| 787 |
+
filenames = [filenames]
|
| 788 |
+
|
| 789 |
+
return self._glob_filenames(filenames)
|
| 790 |
+
|
| 791 |
+
def _glob_filenames(self, filenames: Sequence[str]) -> list[str]:
|
| 792 |
+
# handle different shells and Config files
|
| 793 |
+
# some shells don't expand * and configparser won't expand wildcards
|
| 794 |
+
all_filenames = []
|
| 795 |
+
|
| 796 |
+
for filename in filenames:
|
| 797 |
+
add_filenames = glob.glob(filename, recursive=True)
|
| 798 |
+
|
| 799 |
+
if isinstance(add_filenames, list):
|
| 800 |
+
all_filenames.extend(add_filenames)
|
| 801 |
+
else:
|
| 802 |
+
LOGGER.error(f"{filename} could not be processed by glob.glob")
|
| 803 |
+
|
| 804 |
+
return sorted(list(map(str, map(Path, all_filenames))))
|
| 805 |
+
|
| 806 |
+
@property
|
| 807 |
+
def append_rules(self):
|
| 808 |
+
return [_DEFAULT_RULESDIR] + self._get_argument_value(
|
| 809 |
+
"append_rules", False, True
|
| 810 |
+
)
|
| 811 |
+
|
| 812 |
+
@property
|
| 813 |
+
def override_spec(self):
|
| 814 |
+
return self._get_argument_value("override_spec", False, True)
|
| 815 |
+
|
| 816 |
+
@property
|
| 817 |
+
def custom_rules(self):
|
| 818 |
+
"""custom_rules_spec"""
|
| 819 |
+
return self._get_argument_value("custom_rules", False, True)
|
| 820 |
+
|
| 821 |
+
@property
|
| 822 |
+
def update_specs(self):
|
| 823 |
+
return self._get_argument_value("update_specs", False, False)
|
| 824 |
+
|
| 825 |
+
@property
|
| 826 |
+
def patch_specs(self):
|
| 827 |
+
return self._get_argument_value("patch_specs", False, False)
|
| 828 |
+
|
| 829 |
+
@property
|
| 830 |
+
def update_documentation(self):
|
| 831 |
+
return self._get_argument_value("update_documentation", False, False)
|
| 832 |
+
|
| 833 |
+
@property
|
| 834 |
+
def update_iam_policies(self):
|
| 835 |
+
return self._get_argument_value("update_iam_policies", False, False)
|
| 836 |
+
|
| 837 |
+
@property
|
| 838 |
+
def listrules(self):
|
| 839 |
+
return self._get_argument_value("listrules", False, False)
|
| 840 |
+
|
| 841 |
+
@property
|
| 842 |
+
def configure_rules(self):
|
| 843 |
+
return self._get_argument_value("configure_rules", True, True)
|
| 844 |
+
|
| 845 |
+
@property
|
| 846 |
+
def config_file(self):
|
| 847 |
+
return self._get_argument_value("config_file", False, False)
|
| 848 |
+
|
| 849 |
+
@property
|
| 850 |
+
def build_graph(self):
|
| 851 |
+
return self._get_argument_value("build_graph", False, False)
|
| 852 |
+
|
| 853 |
+
@property
|
| 854 |
+
def output_file(self):
|
| 855 |
+
return self._get_argument_value("output_file", False, True)
|
| 856 |
+
|
| 857 |
+
@property
|
| 858 |
+
def registry_schemas(self):
|
| 859 |
+
return self._get_argument_value("registry_schemas", False, True)
|
| 860 |
+
|
| 861 |
+
@property
|
| 862 |
+
def merge_configs(self):
|
| 863 |
+
return self._get_argument_value("merge_configs", True, True)
|
| 864 |
+
|
| 865 |
+
@property
|
| 866 |
+
def non_zero_exit_code(self):
|
| 867 |
+
return self._get_argument_value("non_zero_exit_code", False, False)
|
| 868 |
+
|
| 869 |
+
@property
|
| 870 |
+
def force(self):
|
| 871 |
+
return self._get_argument_value("force", False, False)
|
| 872 |
+
|
| 873 |
+
@property
|
| 874 |
+
def templates_to_process(self):
|
| 875 |
+
return self._templates_to_process
|
| 876 |
+
|
| 877 |
+
@templates_to_process.setter
|
| 878 |
+
def templates_to_process(self, value: bool):
|
| 879 |
+
self._templates_to_process = value
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__all__ = ["Context", "create_context_for_template"]
|
| 2 |
+
|
| 3 |
+
from cfnlint.context.context import Context, Path, create_context_for_template
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/_mappings.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import logging
|
| 9 |
+
from dataclasses import dataclass, field
|
| 10 |
+
from typing import Any, Iterator
|
| 11 |
+
|
| 12 |
+
LOGGER = logging.getLogger(__name__)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
@dataclass(frozen=True)
|
| 16 |
+
class Mappings:
|
| 17 |
+
"""
|
| 18 |
+
This class holds a mapping
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
maps: dict[str, Map] = field(init=True, default_factory=dict)
|
| 22 |
+
is_transform: bool = field(init=True, default=False)
|
| 23 |
+
|
| 24 |
+
@classmethod
|
| 25 |
+
def create_from_dict(cls, instance: Any) -> Mappings:
|
| 26 |
+
|
| 27 |
+
if not isinstance(instance, dict):
|
| 28 |
+
return cls({})
|
| 29 |
+
try:
|
| 30 |
+
result = {}
|
| 31 |
+
is_transform = False
|
| 32 |
+
for k, v in instance.items():
|
| 33 |
+
if k == "Fn::Transform":
|
| 34 |
+
is_transform = True
|
| 35 |
+
elif isinstance(k, str):
|
| 36 |
+
result[k] = Map.create_from_dict(v)
|
| 37 |
+
return cls(result, is_transform)
|
| 38 |
+
except (ValueError, AttributeError) as e:
|
| 39 |
+
LOGGER.debug(e, exc_info=True)
|
| 40 |
+
return cls({})
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
@dataclass(frozen=True)
|
| 44 |
+
class _MappingSecondaryKey:
|
| 45 |
+
"""
|
| 46 |
+
This class holds a mapping value
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
+
keys: dict[str, list[Any] | str | int | float] = field(
|
| 50 |
+
init=True, default_factory=dict
|
| 51 |
+
)
|
| 52 |
+
is_transform: bool = field(init=True, default=False)
|
| 53 |
+
|
| 54 |
+
def value(self, secondary_key: str):
|
| 55 |
+
if secondary_key not in self.keys:
|
| 56 |
+
raise KeyError(secondary_key)
|
| 57 |
+
return self.keys[secondary_key]
|
| 58 |
+
|
| 59 |
+
@classmethod
|
| 60 |
+
def create_from_dict(cls, instance: Any) -> _MappingSecondaryKey:
|
| 61 |
+
if not isinstance(instance, dict):
|
| 62 |
+
return cls({})
|
| 63 |
+
is_transform = False
|
| 64 |
+
keys = {}
|
| 65 |
+
for k, v in instance.items():
|
| 66 |
+
if k == "Fn::Transform":
|
| 67 |
+
is_transform = True
|
| 68 |
+
elif isinstance(k, str) and isinstance(v, (str, list, int, float)):
|
| 69 |
+
keys[k] = v
|
| 70 |
+
return cls(keys, is_transform)
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
@dataclass(frozen=True)
|
| 74 |
+
class Map:
|
| 75 |
+
"""
|
| 76 |
+
This class holds a mapping
|
| 77 |
+
"""
|
| 78 |
+
|
| 79 |
+
keys: dict[str, _MappingSecondaryKey] = field(init=True, default_factory=dict)
|
| 80 |
+
is_transform: bool = field(init=True, default=False)
|
| 81 |
+
|
| 82 |
+
def find_in_map(self, top_key: str, secondary_key: str) -> Iterator[Any]:
|
| 83 |
+
if top_key not in self.keys:
|
| 84 |
+
raise KeyError(top_key)
|
| 85 |
+
yield self.keys[top_key].value(secondary_key)
|
| 86 |
+
|
| 87 |
+
@classmethod
|
| 88 |
+
def create_from_dict(cls, instance: Any) -> Map:
|
| 89 |
+
if not isinstance(instance, dict):
|
| 90 |
+
return cls({})
|
| 91 |
+
is_transform = False
|
| 92 |
+
keys = {}
|
| 93 |
+
for k, v in instance.items():
|
| 94 |
+
if k == "Fn::Transform":
|
| 95 |
+
is_transform = True
|
| 96 |
+
elif isinstance(k, str):
|
| 97 |
+
keys[k] = _MappingSecondaryKey.create_from_dict(v)
|
| 98 |
+
return cls(keys, is_transform)
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/conditions/__init__.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__all__ = ["Conditions", "Unsatisfiable"]
|
| 2 |
+
|
| 3 |
+
from cfnlint.context.conditions._conditions import Conditions
|
| 4 |
+
from cfnlint.context.conditions.exceptions import Unsatisfiable
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/conditions/_condition.py
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
from dataclasses import dataclass, field
|
| 9 |
+
from typing import Any
|
| 10 |
+
|
| 11 |
+
from sympy import And, Not, Or
|
| 12 |
+
from sympy.logic.boolalg import BooleanFunction
|
| 13 |
+
|
| 14 |
+
from cfnlint.conditions._utils import get_hash
|
| 15 |
+
from cfnlint.context.conditions._equals import Equal
|
| 16 |
+
from cfnlint.helpers import FUNCTION_CONDITIONS, is_function
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
@dataclass(frozen=True)
|
| 20 |
+
class Condition:
|
| 21 |
+
instance: Any = field(init=True)
|
| 22 |
+
status: bool | None = field(init=True, default=None)
|
| 23 |
+
hash: str = field(init=False)
|
| 24 |
+
|
| 25 |
+
fn_equals: Equal | None = field(init=True, default=None)
|
| 26 |
+
condition: list["Condition"] | "Condition" | None = field(init=True, default=None)
|
| 27 |
+
cnf: BooleanFunction = field(init=True, default_factory=BooleanFunction)
|
| 28 |
+
|
| 29 |
+
def __post_init__(self):
|
| 30 |
+
object.__setattr__(self, "hash", get_hash(self.instance))
|
| 31 |
+
|
| 32 |
+
@classmethod
|
| 33 |
+
def create_from_instance(
|
| 34 |
+
cls, instance: Any, all_conditions: dict[str, Any]
|
| 35 |
+
) -> "Condition":
|
| 36 |
+
fn_k, fn_v = is_function(instance)
|
| 37 |
+
if fn_k is None:
|
| 38 |
+
raise ValueError("Condition value must be an object of length 1")
|
| 39 |
+
if fn_k in FUNCTION_CONDITIONS:
|
| 40 |
+
if not isinstance(fn_v, list):
|
| 41 |
+
raise ValueError(f"{fn_v!r} value should be an array")
|
| 42 |
+
if fn_k == "Fn::Equals":
|
| 43 |
+
equal = Equal.create_from_instance(fn_v)
|
| 44 |
+
return cls(instance=instance, fn_equals=equal, cnf=equal.cnf)
|
| 45 |
+
|
| 46 |
+
condition = []
|
| 47 |
+
for v in fn_v:
|
| 48 |
+
condition.append(Condition.create_from_instance(v, all_conditions))
|
| 49 |
+
|
| 50 |
+
cnf = None
|
| 51 |
+
if fn_k == "Fn::And":
|
| 52 |
+
cnf = And(*[c.cnf for c in condition])
|
| 53 |
+
elif fn_k == "Fn::Or":
|
| 54 |
+
cnf = Or(*[c.cnf for c in condition])
|
| 55 |
+
elif fn_k == "Fn::Not":
|
| 56 |
+
if len(condition) != 1:
|
| 57 |
+
raise ValueError(
|
| 58 |
+
f"Fn::Not expects only one condition, got {len(condition)}"
|
| 59 |
+
)
|
| 60 |
+
cnf = Not(condition[0].cnf)
|
| 61 |
+
|
| 62 |
+
return cls(instance=instance, condition=condition, cnf=cnf)
|
| 63 |
+
|
| 64 |
+
if fn_k == "Condition":
|
| 65 |
+
if not isinstance(fn_v, str):
|
| 66 |
+
raise ValueError(f"Condition value {fn_v!r} must be a string")
|
| 67 |
+
sub_condition = all_conditions.get(fn_v)
|
| 68 |
+
try:
|
| 69 |
+
sub_all_conditions = all_conditions.copy()
|
| 70 |
+
del sub_all_conditions[fn_v]
|
| 71 |
+
c = Condition.create_from_instance(sub_condition, sub_all_conditions)
|
| 72 |
+
except Exception:
|
| 73 |
+
c = Condition.create_from_instance(
|
| 74 |
+
{"Fn::Equals": [None, None]}, all_conditions
|
| 75 |
+
)
|
| 76 |
+
return cls(instance=instance, condition=c, cnf=c.cnf)
|
| 77 |
+
|
| 78 |
+
raise ValueError(f"Unknown key {fn_k!r} in condition")
|
| 79 |
+
|
| 80 |
+
def evolve(self, status: bool | None) -> "Condition":
|
| 81 |
+
cls = self.__class__
|
| 82 |
+
|
| 83 |
+
if self.status is not None:
|
| 84 |
+
if status != self.status:
|
| 85 |
+
raise ValueError(f"Resetting status to {status} from {self.status}")
|
| 86 |
+
|
| 87 |
+
return cls(
|
| 88 |
+
instance=self.instance,
|
| 89 |
+
status=status,
|
| 90 |
+
cnf=self.cnf,
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
@property
|
| 94 |
+
def is_region(self) -> bool:
|
| 95 |
+
"""Returns True or False if the condition is based on region
|
| 96 |
+
|
| 97 |
+
Args: None
|
| 98 |
+
|
| 99 |
+
Returns:
|
| 100 |
+
bool
|
| 101 |
+
Returns True or False if the condition is based on region
|
| 102 |
+
"""
|
| 103 |
+
if self.fn_equals:
|
| 104 |
+
return self.fn_equals.is_region
|
| 105 |
+
if isinstance(self.condition, list):
|
| 106 |
+
for c in self.condition:
|
| 107 |
+
if c.is_region:
|
| 108 |
+
return True
|
| 109 |
+
return False
|
| 110 |
+
if self.condition:
|
| 111 |
+
return self.condition.is_region
|
| 112 |
+
return False
|
| 113 |
+
|
| 114 |
+
@property
|
| 115 |
+
def equals(self) -> list[Equal]:
|
| 116 |
+
"""Returns a Sequence of the Equals that make up the Condition
|
| 117 |
+
|
| 118 |
+
Args: None
|
| 119 |
+
|
| 120 |
+
Returns:
|
| 121 |
+
Sequence[EqualParameter] | Sequence[Equal] | None:
|
| 122 |
+
The Equal that are part of the condition
|
| 123 |
+
"""
|
| 124 |
+
if self.fn_equals:
|
| 125 |
+
return [self.fn_equals]
|
| 126 |
+
if isinstance(self.condition, list):
|
| 127 |
+
equals = []
|
| 128 |
+
for c in self.condition:
|
| 129 |
+
equals.extend(c.equals)
|
| 130 |
+
return equals
|
| 131 |
+
if self.condition:
|
| 132 |
+
return self.condition.equals
|
| 133 |
+
return []
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/conditions/_conditions.py
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import itertools
|
| 9 |
+
from dataclasses import dataclass, field
|
| 10 |
+
from typing import TYPE_CHECKING, Any, Iterator
|
| 11 |
+
|
| 12 |
+
from sympy import Not, Or
|
| 13 |
+
from sympy.logic.boolalg import BooleanFunction
|
| 14 |
+
from sympy.logic.inference import satisfiable
|
| 15 |
+
|
| 16 |
+
from cfnlint.conditions._utils import get_hash
|
| 17 |
+
from cfnlint.context.conditions._condition import Condition
|
| 18 |
+
from cfnlint.context.conditions._utils import (
|
| 19 |
+
build_instance_from_scenario,
|
| 20 |
+
get_conditions_from_property,
|
| 21 |
+
)
|
| 22 |
+
from cfnlint.context.conditions.exceptions import Unsatisfiable
|
| 23 |
+
|
| 24 |
+
if TYPE_CHECKING:
|
| 25 |
+
from cfnlint.context.context import Context, Parameter
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
@dataclass(frozen=True)
|
| 29 |
+
class Conditions:
|
| 30 |
+
# Template level condition management
|
| 31 |
+
conditions: dict[str, Condition] = field(init=True, default_factory=dict)
|
| 32 |
+
cnf: BooleanFunction | None = field(init=True, default=None)
|
| 33 |
+
_max_scenarios: int = field(init=False, default=128)
|
| 34 |
+
|
| 35 |
+
@classmethod
|
| 36 |
+
def create_from_instance(
|
| 37 |
+
cls, conditions: Any, rules: dict[str, dict], parameters: dict[str, "Parameter"]
|
| 38 |
+
) -> "Conditions":
|
| 39 |
+
obj: dict[str, Condition] = {}
|
| 40 |
+
if not isinstance(conditions, dict):
|
| 41 |
+
raise ValueError("Conditions must be a object")
|
| 42 |
+
for k, v in conditions.items():
|
| 43 |
+
try:
|
| 44 |
+
other_conditions = conditions.copy()
|
| 45 |
+
del other_conditions[k]
|
| 46 |
+
obj[k] = Condition.create_from_instance(v, other_conditions)
|
| 47 |
+
except ValueError:
|
| 48 |
+
# this is a default condition so we can keep the name but it will
|
| 49 |
+
# not associate with another condition and will always be true/false
|
| 50 |
+
obj[k] = Condition.create_from_instance(
|
| 51 |
+
{"Fn::Equals": [None, None]}, conditions
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
cnf = None
|
| 55 |
+
for p_k, p_v in parameters.items():
|
| 56 |
+
|
| 57 |
+
if not p_v.allowed_values:
|
| 58 |
+
continue
|
| 59 |
+
allowed_values = p_v.allowed_values.copy()
|
| 60 |
+
equals_cnfs = []
|
| 61 |
+
for _, c_v in obj.items():
|
| 62 |
+
for i in c_v.equals:
|
| 63 |
+
if i.right.hash == get_hash({"Ref": p_k}):
|
| 64 |
+
if not isinstance(i.left.instance, str):
|
| 65 |
+
continue
|
| 66 |
+
equals_cnfs.append(i.cnf)
|
| 67 |
+
if i.left.instance in allowed_values:
|
| 68 |
+
allowed_values.remove(i.left.instance)
|
| 69 |
+
|
| 70 |
+
if not allowed_values:
|
| 71 |
+
if cnf is None:
|
| 72 |
+
cnf = Or(*equals_cnfs)
|
| 73 |
+
else:
|
| 74 |
+
cnf = cnf & Or(*equals_cnfs)
|
| 75 |
+
|
| 76 |
+
return cls(conditions=obj, cnf=cnf)
|
| 77 |
+
|
| 78 |
+
def evolve(self, status: dict[str, bool]) -> "Conditions":
|
| 79 |
+
cls = self.__class__
|
| 80 |
+
|
| 81 |
+
conditions: dict[str, Condition] = {}
|
| 82 |
+
cnf = self.cnf
|
| 83 |
+
for condition, value in self.conditions.items():
|
| 84 |
+
s = status.get(condition, value.status)
|
| 85 |
+
try:
|
| 86 |
+
conditions[condition] = value.evolve(status=s)
|
| 87 |
+
if s is not None:
|
| 88 |
+
if cnf:
|
| 89 |
+
cnf = (
|
| 90 |
+
cnf & conditions[condition].cnf
|
| 91 |
+
if s
|
| 92 |
+
else cnf & Not(conditions[condition].cnf)
|
| 93 |
+
)
|
| 94 |
+
else:
|
| 95 |
+
cnf = (
|
| 96 |
+
conditions[condition].cnf
|
| 97 |
+
if s
|
| 98 |
+
else Not(conditions[condition].cnf)
|
| 99 |
+
)
|
| 100 |
+
except ValueError as e:
|
| 101 |
+
raise Unsatisfiable(
|
| 102 |
+
new_status=status,
|
| 103 |
+
current_status=self.status,
|
| 104 |
+
) from e
|
| 105 |
+
|
| 106 |
+
if not satisfiable(cnf):
|
| 107 |
+
raise Unsatisfiable(
|
| 108 |
+
new_status=status,
|
| 109 |
+
current_status=self.status,
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
return cls(
|
| 113 |
+
conditions=conditions,
|
| 114 |
+
cnf=cnf,
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
+
def _build_conditions(self, conditions: set[str]) -> Iterator["Conditions"]:
|
| 118 |
+
scenarios_attempted = 0
|
| 119 |
+
for product in itertools.product([True, False], repeat=len(conditions)):
|
| 120 |
+
params = dict(zip(conditions, product))
|
| 121 |
+
try:
|
| 122 |
+
yield self.evolve(params)
|
| 123 |
+
except Unsatisfiable:
|
| 124 |
+
pass
|
| 125 |
+
|
| 126 |
+
scenarios_attempted += 1
|
| 127 |
+
# On occassions people will use a lot of non-related conditions
|
| 128 |
+
# this is fail safe to limit the maximum number of responses
|
| 129 |
+
if scenarios_attempted >= self._max_scenarios:
|
| 130 |
+
return
|
| 131 |
+
|
| 132 |
+
def evolve_from_instance(
|
| 133 |
+
self, instance: Any, context: "Context"
|
| 134 |
+
) -> Iterator[tuple[Any, "Conditions"]]:
|
| 135 |
+
|
| 136 |
+
conditions = get_conditions_from_property(instance)
|
| 137 |
+
|
| 138 |
+
for scenario in self._build_conditions(conditions):
|
| 139 |
+
yield build_instance_from_scenario(
|
| 140 |
+
instance,
|
| 141 |
+
scenario.status,
|
| 142 |
+
is_root=True,
|
| 143 |
+
context=context,
|
| 144 |
+
), scenario
|
| 145 |
+
|
| 146 |
+
@property
|
| 147 |
+
def status(self) -> dict[str, bool]:
|
| 148 |
+
obj = {}
|
| 149 |
+
for name, c in self.conditions.items():
|
| 150 |
+
if c.status is not None:
|
| 151 |
+
obj[name] = c.status
|
| 152 |
+
|
| 153 |
+
return obj
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/conditions/_equals.py
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import logging
|
| 9 |
+
from dataclasses import dataclass, field
|
| 10 |
+
from functools import cmp_to_key
|
| 11 |
+
from typing import Any
|
| 12 |
+
|
| 13 |
+
from sympy import Symbol
|
| 14 |
+
|
| 15 |
+
from cfnlint.conditions._utils import get_hash
|
| 16 |
+
from cfnlint.helpers import is_function
|
| 17 |
+
|
| 18 |
+
LOGGER = logging.getLogger(__name__)
|
| 19 |
+
REF_REGION = get_hash({"Ref": "AWS::Region"})
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def _sorted(a: dict[str, str] | str, b: dict[str, str] | str) -> int:
|
| 23 |
+
if isinstance(a, dict) and isinstance(b, dict):
|
| 24 |
+
a_k, a_v = is_function(a)
|
| 25 |
+
b_k, b_v = is_function(b)
|
| 26 |
+
if a_k is None or b_k is None:
|
| 27 |
+
if a_k is None and b_k is not None:
|
| 28 |
+
return 1
|
| 29 |
+
if a_k is not None and b_k is None:
|
| 30 |
+
return -1
|
| 31 |
+
return 0
|
| 32 |
+
|
| 33 |
+
if a_k == "Ref" and isinstance(a_v, str):
|
| 34 |
+
if b_k == "Ref" and isinstance(b_v, str):
|
| 35 |
+
return -1 if a_v <= b_v else 1
|
| 36 |
+
|
| 37 |
+
return -1 if a_k <= b_k else 1
|
| 38 |
+
|
| 39 |
+
return -1 if str(a) <= str(b) else 1
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
_equals_cmp_key = cmp_to_key(_sorted)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
@dataclass(frozen=True)
|
| 46 |
+
class EqualParameter:
|
| 47 |
+
instance: dict[str, str] | str | None = field(init=True)
|
| 48 |
+
hash: str = field(init=False)
|
| 49 |
+
is_region: bool = field(init=False, default=False)
|
| 50 |
+
|
| 51 |
+
def __post_init__(self):
|
| 52 |
+
object.__setattr__(self, "hash", get_hash(self.instance))
|
| 53 |
+
object.__setattr__(self, "is_region", self.hash == REF_REGION)
|
| 54 |
+
|
| 55 |
+
@classmethod
|
| 56 |
+
def create_from_instance(cls, instance: Any) -> "EqualParameter":
|
| 57 |
+
if isinstance(instance, (str, bool, int, float)):
|
| 58 |
+
return cls(instance=str(instance))
|
| 59 |
+
|
| 60 |
+
if isinstance(instance, dict):
|
| 61 |
+
return cls(instance=instance)
|
| 62 |
+
|
| 63 |
+
# escape version
|
| 64 |
+
if instance is None:
|
| 65 |
+
return cls(instance=None)
|
| 66 |
+
|
| 67 |
+
raise ValueError("EqualParameter has to be a string or a dict")
|
| 68 |
+
|
| 69 |
+
def __eq__(self, __o: Any):
|
| 70 |
+
if isinstance(__o, EqualParameter):
|
| 71 |
+
return self.hash == __o.hash
|
| 72 |
+
return False
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
@dataclass(frozen=True)
|
| 76 |
+
class Equal:
|
| 77 |
+
instance: list[str | dict] = field(init=True)
|
| 78 |
+
hash: str = field(init=False)
|
| 79 |
+
|
| 80 |
+
left: EqualParameter = field(init=True)
|
| 81 |
+
right: EqualParameter = field(init=True)
|
| 82 |
+
|
| 83 |
+
is_static: bool | None = field(init=False, default=None)
|
| 84 |
+
|
| 85 |
+
cnf: Symbol = field(init=False)
|
| 86 |
+
|
| 87 |
+
@classmethod
|
| 88 |
+
def create_from_instance(cls, instance: Any) -> "Equal":
|
| 89 |
+
if not (isinstance(instance, list) and len(instance) == 2):
|
| 90 |
+
raise ValueError("Equals has to be a list of two values")
|
| 91 |
+
|
| 92 |
+
instance.sort(key=_equals_cmp_key)
|
| 93 |
+
left = EqualParameter.create_from_instance(instance[0])
|
| 94 |
+
right = EqualParameter.create_from_instance(instance[1])
|
| 95 |
+
return cls(instance=instance, left=left, right=right)
|
| 96 |
+
|
| 97 |
+
def __post_init__(self):
|
| 98 |
+
object.__setattr__(self, "hash", get_hash(self.instance))
|
| 99 |
+
if isinstance(self.left.instance, (str, int, bool, float)) and isinstance(
|
| 100 |
+
self.right.instance, (str, int, bool, float)
|
| 101 |
+
):
|
| 102 |
+
object.__setattr__(
|
| 103 |
+
self, "is_static", self.left.instance == self.right.instance
|
| 104 |
+
)
|
| 105 |
+
object.__setattr__(self, "cnf", Symbol(self.hash))
|
| 106 |
+
|
| 107 |
+
@property
|
| 108 |
+
def parameters(self) -> list[EqualParameter]:
|
| 109 |
+
"""Returns a List of the EqualParameter that make up the Condition
|
| 110 |
+
|
| 111 |
+
Args: None
|
| 112 |
+
|
| 113 |
+
Returns:
|
| 114 |
+
list[Equal]: A list of the left and right equal parameters if they are
|
| 115 |
+
of type EqualParameter
|
| 116 |
+
"""
|
| 117 |
+
return [self.left, self.right]
|
| 118 |
+
|
| 119 |
+
@property
|
| 120 |
+
def is_region(self) -> bool:
|
| 121 |
+
"""
|
| 122 |
+
Returns a bool if the condition is comparing a region to a string
|
| 123 |
+
|
| 124 |
+
Args: None
|
| 125 |
+
|
| 126 |
+
Returns:
|
| 127 |
+
bool: If a parameter in the equals has {"Ref": "AWS::Region}
|
| 128 |
+
"""
|
| 129 |
+
return (self.left.is_region or self.right.is_region) and not self.is_static
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/conditions/_utils.py
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
from typing import TYPE_CHECKING, Any
|
| 9 |
+
|
| 10 |
+
from cfnlint.decode.node import Mark, dict_node, list_node
|
| 11 |
+
from cfnlint.helpers import is_function
|
| 12 |
+
|
| 13 |
+
if TYPE_CHECKING:
|
| 14 |
+
from cfnlint.context.context import Context
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def get_conditions_from_property(instance: Any, is_root: bool = True) -> set[str]:
|
| 18 |
+
"""
|
| 19 |
+
Gets the name of the conditions used directly inside the object.
|
| 20 |
+
|
| 21 |
+
We do not look at nested objects for conditions.
|
| 22 |
+
|
| 23 |
+
Args:
|
| 24 |
+
instance (Any): The object or listto process.
|
| 25 |
+
is_root (bool): If we are at the root of the object. Default: True.
|
| 26 |
+
|
| 27 |
+
Returns:
|
| 28 |
+
set[str]: The set of conditions used in the object or list.
|
| 29 |
+
"""
|
| 30 |
+
results: set[str] = set()
|
| 31 |
+
if isinstance(instance, list):
|
| 32 |
+
for v in instance:
|
| 33 |
+
results = results.union(get_conditions_from_property(v, is_root=False))
|
| 34 |
+
return results
|
| 35 |
+
|
| 36 |
+
fn_k, fn_v = is_function(instance)
|
| 37 |
+
if fn_k == "Fn::If":
|
| 38 |
+
if isinstance(fn_v, list) and len(fn_v) == 3:
|
| 39 |
+
if isinstance(fn_v[0], str):
|
| 40 |
+
results.add(fn_v[0])
|
| 41 |
+
results = results.union(
|
| 42 |
+
get_conditions_from_property(fn_v[1], is_root=is_root)
|
| 43 |
+
)
|
| 44 |
+
results = results.union(
|
| 45 |
+
get_conditions_from_property(fn_v[2], is_root=is_root)
|
| 46 |
+
)
|
| 47 |
+
return results
|
| 48 |
+
if is_root:
|
| 49 |
+
if isinstance(instance, dict):
|
| 50 |
+
for k, v in instance.items():
|
| 51 |
+
results = results.union(get_conditions_from_property(v, is_root=False))
|
| 52 |
+
return results
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def build_instance_from_scenario(
|
| 56 |
+
instance: Any,
|
| 57 |
+
scenario: dict[str, bool],
|
| 58 |
+
is_root: bool,
|
| 59 |
+
context: "Context",
|
| 60 |
+
) -> Any:
|
| 61 |
+
"""
|
| 62 |
+
Get object values from a provided scenario.
|
| 63 |
+
|
| 64 |
+
This function recursively processes the provided object, resolving any
|
| 65 |
+
conditional logic (such as Fn::If) based on the given scenario.
|
| 66 |
+
|
| 67 |
+
Args:
|
| 68 |
+
instance (Any): The object or listto process.
|
| 69 |
+
scenario (dict): The scenario to use when resolving conditional logic.
|
| 70 |
+
is_root (bool): If we are at the root of the object. Default: True.
|
| 71 |
+
|
| 72 |
+
Returns:
|
| 73 |
+
dict or list or any: The processed object, with conditional logic resolved.
|
| 74 |
+
The return type can be a dictionary, list, or any other data type,
|
| 75 |
+
depending on the structure of the input object.
|
| 76 |
+
"""
|
| 77 |
+
|
| 78 |
+
if isinstance(instance, list):
|
| 79 |
+
new_list: list[Any] = list_node(
|
| 80 |
+
[],
|
| 81 |
+
getattr(instance, "start_mark", Mark(0, 0)),
|
| 82 |
+
getattr(instance, "end_mark", Mark(0, 0)),
|
| 83 |
+
)
|
| 84 |
+
for v in instance:
|
| 85 |
+
new_value = build_instance_from_scenario(
|
| 86 |
+
v,
|
| 87 |
+
scenario,
|
| 88 |
+
is_root=False,
|
| 89 |
+
context=context,
|
| 90 |
+
)
|
| 91 |
+
if new_value is not None:
|
| 92 |
+
new_list.append(new_value)
|
| 93 |
+
return new_list
|
| 94 |
+
|
| 95 |
+
if isinstance(instance, dict):
|
| 96 |
+
fn_k, fn_v = is_function(instance)
|
| 97 |
+
if fn_k == "Fn::If" and "Fn::If" in context.functions:
|
| 98 |
+
if isinstance(fn_v, list) and len(fn_v) == 3:
|
| 99 |
+
if isinstance(fn_v[0], str):
|
| 100 |
+
if_path = scenario.get(fn_v[0], None)
|
| 101 |
+
if if_path is not None:
|
| 102 |
+
new_value = build_instance_from_scenario(
|
| 103 |
+
fn_v[1] if if_path else fn_v[2],
|
| 104 |
+
scenario,
|
| 105 |
+
is_root,
|
| 106 |
+
context=context,
|
| 107 |
+
)
|
| 108 |
+
if new_value is not None:
|
| 109 |
+
return new_value
|
| 110 |
+
return None
|
| 111 |
+
return instance
|
| 112 |
+
if fn_k == "Ref" and fn_v == "AWS::NoValue" and "Ref" in context.functions:
|
| 113 |
+
return None
|
| 114 |
+
if is_root:
|
| 115 |
+
new_obj: dict[str, Any] = dict_node(
|
| 116 |
+
{},
|
| 117 |
+
getattr(instance, "start_mark", Mark(0, 0)),
|
| 118 |
+
getattr(instance, "end_mark", Mark(0, 0)),
|
| 119 |
+
)
|
| 120 |
+
for k, v in instance.items():
|
| 121 |
+
new_value = build_instance_from_scenario(
|
| 122 |
+
v,
|
| 123 |
+
scenario,
|
| 124 |
+
is_root=False,
|
| 125 |
+
context=context,
|
| 126 |
+
)
|
| 127 |
+
if new_value is not None:
|
| 128 |
+
new_obj[k] = new_value
|
| 129 |
+
return new_obj
|
| 130 |
+
|
| 131 |
+
return instance
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/conditions/exceptions.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
from typing import Iterator
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def _get_new_status_message(
|
| 12 |
+
current_status: dict[str, bool], new_status: dict[str, bool]
|
| 13 |
+
) -> Iterator[str]:
|
| 14 |
+
for k, v in new_status.items():
|
| 15 |
+
if v is not None:
|
| 16 |
+
if current_status.get(k) is not None and current_status.get(k) != v:
|
| 17 |
+
yield (
|
| 18 |
+
f"condition {k!r} to {v!r} from current "
|
| 19 |
+
f"status {current_status.get(k)!r}"
|
| 20 |
+
)
|
| 21 |
+
else:
|
| 22 |
+
yield f"condition {k!r} to {v!r}"
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def _get_current_status_message(
|
| 26 |
+
current_status: dict[str, bool], new_status: dict[str, bool]
|
| 27 |
+
) -> Iterator[str]:
|
| 28 |
+
for k, v in current_status.items():
|
| 29 |
+
if v is not None and k not in new_status:
|
| 30 |
+
yield f"condition {k!r} is {v!r}"
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def _build_message(current_status: dict[str, bool], new_status: dict[str, bool]) -> str:
|
| 34 |
+
message = ", and ".join(_get_new_status_message(current_status, new_status))
|
| 35 |
+
|
| 36 |
+
current_message = " and ".join(
|
| 37 |
+
_get_current_status_message(current_status, new_status)
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
if current_message:
|
| 41 |
+
message += f". Where existing status for {current_message}"
|
| 42 |
+
|
| 43 |
+
return f"When setting {message}"
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class Unsatisfiable(ValueError):
|
| 47 |
+
|
| 48 |
+
def __init__(
|
| 49 |
+
self,
|
| 50 |
+
new_status: dict[str, bool],
|
| 51 |
+
current_status: dict[str, bool],
|
| 52 |
+
) -> None:
|
| 53 |
+
message = _build_message(current_status, new_status)
|
| 54 |
+
super().__init__(message)
|
| 55 |
+
self.message = message
|
| 56 |
+
self.current_status = current_status
|
| 57 |
+
self.new_status = new_status
|
| 58 |
+
|
| 59 |
+
def __repr__(self):
|
| 60 |
+
return f"<{self.__class__.__name__}: {self.message!r}>"
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/context/context.py
ADDED
|
@@ -0,0 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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
from abc import ABC, abstractmethod
|
| 9 |
+
from collections import deque
|
| 10 |
+
from dataclasses import InitVar, dataclass, field, fields
|
| 11 |
+
from functools import lru_cache
|
| 12 |
+
from typing import Any, Deque, Iterator, Sequence, Set, Tuple
|
| 13 |
+
|
| 14 |
+
from cfnlint.context._mappings import Mappings
|
| 15 |
+
from cfnlint.context.conditions._conditions import Conditions
|
| 16 |
+
from cfnlint.helpers import (
|
| 17 |
+
BOOLEAN_STRINGS_TRUE,
|
| 18 |
+
FUNCTIONS,
|
| 19 |
+
PSEUDOPARAMS,
|
| 20 |
+
REGION_PRIMARY,
|
| 21 |
+
TRANSFORM_SAM,
|
| 22 |
+
)
|
| 23 |
+
from cfnlint.schema import PROVIDER_SCHEMA_MANAGER, AttributeDict
|
| 24 |
+
|
| 25 |
+
_PSEUDOPARAMS_NON_REGION = ["AWS::AccountId", "AWS::NoValue", "AWS::StackName"]
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
@dataclass
|
| 29 |
+
class Transforms:
|
| 30 |
+
# Template level parameters
|
| 31 |
+
transforms: InitVar[str | list[str] | None]
|
| 32 |
+
_transforms: list[str] = field(init=False, default_factory=list)
|
| 33 |
+
|
| 34 |
+
def __post_init__(self, transforms) -> None:
|
| 35 |
+
if transforms is None:
|
| 36 |
+
return
|
| 37 |
+
if not isinstance(transforms, list):
|
| 38 |
+
transforms = [transforms]
|
| 39 |
+
|
| 40 |
+
for transform in transforms:
|
| 41 |
+
if not isinstance(transform, str):
|
| 42 |
+
continue
|
| 43 |
+
self._transforms.append(transform)
|
| 44 |
+
|
| 45 |
+
self.has_sam_transform = lru_cache()(self.has_sam_transform) # type: ignore
|
| 46 |
+
self.has_language_extensions_transform = lru_cache()( # type: ignore
|
| 47 |
+
self.has_language_extensions_transform
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
def has_language_extensions_transform(self):
|
| 51 |
+
lang_extensions_transform = "AWS::LanguageExtensions"
|
| 52 |
+
return bool(lang_extensions_transform in self._transforms)
|
| 53 |
+
|
| 54 |
+
def has_sam_transform(self):
|
| 55 |
+
return bool(TRANSFORM_SAM in self._transforms)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
@dataclass(frozen=True)
|
| 59 |
+
class Path:
|
| 60 |
+
"""
|
| 61 |
+
A `Path` keeps track of the different Path values
|
| 62 |
+
"""
|
| 63 |
+
|
| 64 |
+
# path keeps track of the path as we move down the template
|
| 65 |
+
# Example: Resources, MyResource, Properties, Name, ...
|
| 66 |
+
path: Deque[str | int] = field(init=True, default_factory=deque)
|
| 67 |
+
|
| 68 |
+
# value_path is an override of the value if we got it from another place
|
| 69 |
+
# like a Parameter default value
|
| 70 |
+
# Example: Parameters, MyParameter, Default, ...
|
| 71 |
+
value_path: Deque[str | int] = field(init=True, default_factory=deque)
|
| 72 |
+
|
| 73 |
+
# cfn_path is a generic path used by cfn-lint to help make
|
| 74 |
+
# writing rules easier. The resource name is replaced by the type
|
| 75 |
+
# lists are replaced with a *
|
| 76 |
+
# Example: Resources, AWS::S3::Bucket, Properties, Name, ...
|
| 77 |
+
# Example: Resources, *, Type
|
| 78 |
+
cfn_path: Deque[str] = field(init=True, default_factory=deque)
|
| 79 |
+
|
| 80 |
+
def descend(self, **kwargs) -> "Path":
|
| 81 |
+
"""
|
| 82 |
+
Create a new Path by appending values
|
| 83 |
+
"""
|
| 84 |
+
cls = self.__class__
|
| 85 |
+
|
| 86 |
+
if kwargs.get("cfn_path") in FUNCTIONS:
|
| 87 |
+
raise ValueError(f"{kwargs['cfn_path']!r} cannot be in 'cfn_path'")
|
| 88 |
+
elif isinstance(kwargs.get("cfn_path"), int):
|
| 89 |
+
raise ValueError(f"{kwargs['cfn_path']!r} cannot be an integer")
|
| 90 |
+
|
| 91 |
+
for f in fields(Path):
|
| 92 |
+
if kwargs.get(f.name) is not None:
|
| 93 |
+
kwargs[f.name] = getattr(self, f.name) + deque([kwargs[f.name]])
|
| 94 |
+
else:
|
| 95 |
+
kwargs[f.name] = getattr(self, f.name)
|
| 96 |
+
|
| 97 |
+
return cls(**kwargs)
|
| 98 |
+
|
| 99 |
+
def evolve(self, **kwargs):
|
| 100 |
+
"""
|
| 101 |
+
Create a new path without appending values
|
| 102 |
+
"""
|
| 103 |
+
cls = self.__class__
|
| 104 |
+
|
| 105 |
+
for f in fields(Path):
|
| 106 |
+
kwargs.setdefault(f.name, getattr(self, f.name))
|
| 107 |
+
|
| 108 |
+
return cls(**kwargs)
|
| 109 |
+
|
| 110 |
+
@property
|
| 111 |
+
def path_string(self):
|
| 112 |
+
return "/".join(str(p) for p in self.path)
|
| 113 |
+
|
| 114 |
+
@property
|
| 115 |
+
def cfn_path_string(self):
|
| 116 |
+
return "/".join(self.cfn_path)
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
@dataclass(frozen=True)
|
| 120 |
+
class Context:
|
| 121 |
+
"""
|
| 122 |
+
A `Context` keeps track of the current context that we are evaluating against
|
| 123 |
+
Arguments:
|
| 124 |
+
|
| 125 |
+
region:
|
| 126 |
+
|
| 127 |
+
The region being evaluated against.
|
| 128 |
+
|
| 129 |
+
conditions:
|
| 130 |
+
|
| 131 |
+
The conditions being used and their current state
|
| 132 |
+
"""
|
| 133 |
+
|
| 134 |
+
# what regions we are processing
|
| 135 |
+
regions: Sequence[str] = field(
|
| 136 |
+
init=True, default_factory=lambda: list([REGION_PRIMARY])
|
| 137 |
+
)
|
| 138 |
+
|
| 139 |
+
# supported functions at this point in the template
|
| 140 |
+
functions: Sequence[str] = field(init=True, default_factory=list)
|
| 141 |
+
|
| 142 |
+
path: Path = field(init=True, default_factory=Path)
|
| 143 |
+
|
| 144 |
+
# cfn-lint Template class
|
| 145 |
+
parameters: dict[str, "Parameter"] = field(init=True, default_factory=dict)
|
| 146 |
+
resources: dict[str, "Resource"] = field(init=True, default_factory=dict)
|
| 147 |
+
conditions: Conditions = field(init=True, default_factory=Conditions)
|
| 148 |
+
mappings: Mappings = field(init=True, default_factory=Mappings)
|
| 149 |
+
|
| 150 |
+
strict_types: bool = field(init=True, default=True)
|
| 151 |
+
|
| 152 |
+
pseudo_parameters: Set[str] = field(
|
| 153 |
+
init=True, default_factory=lambda: set(PSEUDOPARAMS)
|
| 154 |
+
)
|
| 155 |
+
|
| 156 |
+
# Combiniation of storing any resolved ref
|
| 157 |
+
# and adds in any Refs available from things like Fn::Sub
|
| 158 |
+
ref_values: dict[str, Any] = field(init=True, default_factory=dict)
|
| 159 |
+
|
| 160 |
+
transforms: Transforms = field(init=True, default_factory=lambda: Transforms([]))
|
| 161 |
+
|
| 162 |
+
# is the value a resolved value
|
| 163 |
+
is_resolved_value: bool = field(init=True, default=False)
|
| 164 |
+
|
| 165 |
+
def evolve(self, **kwargs) -> "Context":
|
| 166 |
+
"""
|
| 167 |
+
Create a new context without merging together attributes
|
| 168 |
+
"""
|
| 169 |
+
cls = self.__class__
|
| 170 |
+
|
| 171 |
+
if "ref_values" in kwargs:
|
| 172 |
+
new_ref_values = self.ref_values.copy()
|
| 173 |
+
new_ref_values.update(kwargs["ref_values"])
|
| 174 |
+
kwargs["ref_values"] = new_ref_values
|
| 175 |
+
|
| 176 |
+
for f in fields(Context):
|
| 177 |
+
if f.init:
|
| 178 |
+
kwargs.setdefault(f.name, getattr(self, f.name))
|
| 179 |
+
|
| 180 |
+
return cls(**kwargs)
|
| 181 |
+
|
| 182 |
+
def ref_value(self, instance: str) -> Iterator[Tuple[str | list[str], "Context"]]:
|
| 183 |
+
if instance in PSEUDOPARAMS and instance not in self.pseudo_parameters:
|
| 184 |
+
return
|
| 185 |
+
|
| 186 |
+
if instance in self.ref_values:
|
| 187 |
+
yield self.ref_values[instance], self
|
| 188 |
+
return
|
| 189 |
+
|
| 190 |
+
# Non regionalized items first
|
| 191 |
+
if instance in _PSEUDOPARAMS_NON_REGION and instance in self.pseudo_parameters:
|
| 192 |
+
pseudo_value = _get_pseudo_value(instance)
|
| 193 |
+
if pseudo_value is not None:
|
| 194 |
+
yield pseudo_value, self.evolve(ref_values={instance: pseudo_value})
|
| 195 |
+
return
|
| 196 |
+
if instance in self.parameters:
|
| 197 |
+
for v, path in self.parameters[instance].ref(self):
|
| 198 |
+
|
| 199 |
+
# validate that ref is possible with path
|
| 200 |
+
# need to evaluate if Fn::If would be not true if value is
|
| 201 |
+
# what it is
|
| 202 |
+
yield v, self.evolve(
|
| 203 |
+
path=self.path.evolve(
|
| 204 |
+
value_path=deque(["Parameters", instance]) + path
|
| 205 |
+
),
|
| 206 |
+
ref_values={instance: v},
|
| 207 |
+
)
|
| 208 |
+
return
|
| 209 |
+
|
| 210 |
+
# Regionalized values second
|
| 211 |
+
if instance in PSEUDOPARAMS and instance in self.pseudo_parameters:
|
| 212 |
+
for region in self.regions:
|
| 213 |
+
# We can resolve all region based pseudo values
|
| 214 |
+
# as we are now deciding on a region.
|
| 215 |
+
yield _get_pseudo_value_by_region(instance, region), self.evolve(
|
| 216 |
+
regions=[region],
|
| 217 |
+
ref_values={
|
| 218 |
+
p: _get_pseudo_value_by_region(p, region)
|
| 219 |
+
for p in PSEUDOPARAMS
|
| 220 |
+
if p not in _PSEUDOPARAMS_NON_REGION
|
| 221 |
+
},
|
| 222 |
+
)
|
| 223 |
+
|
| 224 |
+
@property
|
| 225 |
+
def refs(self):
|
| 226 |
+
pseudo_params = list(self.pseudo_parameters)
|
| 227 |
+
pseudo_params.sort()
|
| 228 |
+
return (
|
| 229 |
+
list(self.parameters.keys())
|
| 230 |
+
+ list(self.resources.keys())
|
| 231 |
+
+ pseudo_params
|
| 232 |
+
+ list(self.ref_values.keys())
|
| 233 |
+
)
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
def _get_pseudo_value(parameter: str) -> str | list[str] | None:
|
| 237 |
+
if parameter == "AWS::AccountId":
|
| 238 |
+
return "123456789012"
|
| 239 |
+
if parameter == "AWS::StackName":
|
| 240 |
+
return "teststack"
|
| 241 |
+
return None
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
def _get_pseudo_value_by_region(parameter: str, region: str) -> str | list[str]:
|
| 245 |
+
if parameter == "AWS::NotificationARNs":
|
| 246 |
+
return [f"arn:{_get_partition(region)}:sns:{region}:123456789012:notification"]
|
| 247 |
+
if parameter == "AWS::Partition":
|
| 248 |
+
return _get_partition(region)
|
| 249 |
+
if parameter == "AWS::Region":
|
| 250 |
+
return region
|
| 251 |
+
if parameter == "AWS::StackId":
|
| 252 |
+
return (
|
| 253 |
+
f"arn:{_get_partition(region)}:cloudformation:{region}"
|
| 254 |
+
":123456789012:stack/teststack/51af3dc0-da77-11e4-872e-1234567db123"
|
| 255 |
+
)
|
| 256 |
+
if region in ("cn-north-1", "cn-northwest-1"):
|
| 257 |
+
return "amazonaws.com.cn"
|
| 258 |
+
else:
|
| 259 |
+
return "amazonaws.com"
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
def _get_partition(region) -> str:
|
| 263 |
+
if region in ("us-gov-east-1", "us-gov-west-1"):
|
| 264 |
+
return "aws-us-gov"
|
| 265 |
+
if region in ("cn-north-1", "cn-northwest-1"):
|
| 266 |
+
return "aws-cn"
|
| 267 |
+
else:
|
| 268 |
+
return "aws"
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
class _Ref(ABC):
|
| 272 |
+
"""
|
| 273 |
+
Abstract class for all ref types
|
| 274 |
+
"""
|
| 275 |
+
|
| 276 |
+
@abstractmethod
|
| 277 |
+
def ref(self, context: Context) -> Iterator[Any]:
|
| 278 |
+
pass
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
def _strip(value: Any) -> Any:
|
| 282 |
+
if isinstance(value, str):
|
| 283 |
+
return value.strip()
|
| 284 |
+
return value
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
@dataclass
|
| 288 |
+
class Parameter(_Ref):
|
| 289 |
+
"""
|
| 290 |
+
This class holds a parameter and its attributes
|
| 291 |
+
"""
|
| 292 |
+
|
| 293 |
+
type: str = field(init=False)
|
| 294 |
+
default: Any = field(init=False)
|
| 295 |
+
allowed_values: Any = field(init=False)
|
| 296 |
+
description: str | None = field(init=False)
|
| 297 |
+
ssm_path: str | None = field(init=False, default=None)
|
| 298 |
+
|
| 299 |
+
parameter: InitVar[Any]
|
| 300 |
+
|
| 301 |
+
def __post_init__(self, parameter) -> None:
|
| 302 |
+
if not isinstance(parameter, dict):
|
| 303 |
+
raise ValueError("Parameter must be a object")
|
| 304 |
+
|
| 305 |
+
self.is_ssm_parameter = lru_cache()(self.is_ssm_parameter) # type: ignore
|
| 306 |
+
|
| 307 |
+
self.default = None
|
| 308 |
+
self.allowed_values = []
|
| 309 |
+
self.min_value = None
|
| 310 |
+
self.max_value = None
|
| 311 |
+
self.no_echo = False
|
| 312 |
+
|
| 313 |
+
t = parameter.get("Type")
|
| 314 |
+
if not isinstance(t, str):
|
| 315 |
+
raise ValueError("Type must be a string")
|
| 316 |
+
self.type = t
|
| 317 |
+
|
| 318 |
+
self.description = parameter.get("Description")
|
| 319 |
+
|
| 320 |
+
# SSM Parameter defaults and allowed values point to
|
| 321 |
+
# SSM paths not to the actual values
|
| 322 |
+
if self.is_ssm_parameter():
|
| 323 |
+
self.ssm_path = parameter.get("Default", "")
|
| 324 |
+
return
|
| 325 |
+
|
| 326 |
+
if self.type == "CommaDelimitedList" or self.type.startswith("List<"):
|
| 327 |
+
if "Default" in parameter:
|
| 328 |
+
default = parameter.get("Default", "")
|
| 329 |
+
if isinstance(default, str):
|
| 330 |
+
self.default = [_strip(value) for value in default.split(",")]
|
| 331 |
+
else:
|
| 332 |
+
self.default = [_strip(default)]
|
| 333 |
+
|
| 334 |
+
for allowed_value in parameter.get("AllowedValues", []):
|
| 335 |
+
if isinstance(allowed_value, str):
|
| 336 |
+
self.allowed_values.append(
|
| 337 |
+
[_strip(value) for value in allowed_value.split(",")]
|
| 338 |
+
)
|
| 339 |
+
else:
|
| 340 |
+
self.allowed_values.append([_strip(allowed_value)])
|
| 341 |
+
else:
|
| 342 |
+
self.default = parameter.get("Default")
|
| 343 |
+
self.allowed_values = parameter.get("AllowedValues")
|
| 344 |
+
|
| 345 |
+
self.min_value = parameter.get("MinValue")
|
| 346 |
+
self.max_value = parameter.get("MaxValue")
|
| 347 |
+
if parameter.get("NoEcho") in list(BOOLEAN_STRINGS_TRUE) + [True]:
|
| 348 |
+
self.no_echo = True
|
| 349 |
+
|
| 350 |
+
def ref(self, context: Context) -> Iterator[Tuple[Any, deque]]:
|
| 351 |
+
if self.allowed_values:
|
| 352 |
+
for i, allowed_value in enumerate(self.allowed_values):
|
| 353 |
+
if isinstance(allowed_value, list):
|
| 354 |
+
yield [str(x) for x in allowed_value], deque(["AllowedValues", i])
|
| 355 |
+
else:
|
| 356 |
+
yield str(allowed_value), deque(["AllowedValues", i])
|
| 357 |
+
# assume default is an allowed value so we skip it
|
| 358 |
+
return
|
| 359 |
+
|
| 360 |
+
if self.default is not None:
|
| 361 |
+
if isinstance(self.default, list):
|
| 362 |
+
yield [str(x) for x in self.default], deque(["Default"])
|
| 363 |
+
else:
|
| 364 |
+
yield str(self.default), deque(["Default"])
|
| 365 |
+
|
| 366 |
+
if self.min_value is not None:
|
| 367 |
+
yield str(self.min_value), deque(["MinValue"])
|
| 368 |
+
|
| 369 |
+
if self.max_value is not None:
|
| 370 |
+
yield str(self.max_value), deque(["MaxValue"])
|
| 371 |
+
|
| 372 |
+
def is_ssm_parameter(self) -> bool:
|
| 373 |
+
return self.type.startswith("AWS::SSM::Parameter::")
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
@dataclass
|
| 377 |
+
class Resource(_Ref):
|
| 378 |
+
"""
|
| 379 |
+
This class holds a resources and its type
|
| 380 |
+
"""
|
| 381 |
+
|
| 382 |
+
type: str = field(init=False)
|
| 383 |
+
condition: str | None = field(init=False, default=None)
|
| 384 |
+
resource: InitVar[Any]
|
| 385 |
+
|
| 386 |
+
def __post_init__(self, resource) -> None:
|
| 387 |
+
if not isinstance(resource, dict):
|
| 388 |
+
raise ValueError("Resource must be a object")
|
| 389 |
+
t = resource.get("Type")
|
| 390 |
+
if not isinstance(t, str):
|
| 391 |
+
raise ValueError("Type must be a string")
|
| 392 |
+
self.type = t
|
| 393 |
+
if self.type.startswith("Custom::"):
|
| 394 |
+
self.type = "AWS::CloudFormation::CustomResource"
|
| 395 |
+
|
| 396 |
+
c = resource.get("Condition")
|
| 397 |
+
if not isinstance(t, str):
|
| 398 |
+
raise ValueError("Condition must be a string")
|
| 399 |
+
self.condition = c
|
| 400 |
+
|
| 401 |
+
def get_atts(self, region: str = "us-east-1") -> AttributeDict:
|
| 402 |
+
return PROVIDER_SCHEMA_MANAGER.get_type_getatts(self.type, region)
|
| 403 |
+
|
| 404 |
+
def ref(self, context: Context) -> Iterator[Any]:
|
| 405 |
+
return
|
| 406 |
+
yield
|
| 407 |
+
|
| 408 |
+
|
| 409 |
+
def _init_parameters(parameters: Any) -> dict[str, Parameter]:
|
| 410 |
+
obj = {}
|
| 411 |
+
if not isinstance(parameters, dict):
|
| 412 |
+
raise ValueError("Parameters must be a object")
|
| 413 |
+
for k, v in parameters.items():
|
| 414 |
+
try:
|
| 415 |
+
obj[k] = Parameter(v)
|
| 416 |
+
except ValueError:
|
| 417 |
+
pass
|
| 418 |
+
|
| 419 |
+
return obj
|
| 420 |
+
|
| 421 |
+
|
| 422 |
+
def _init_resources(resources: Any) -> dict[str, Resource]:
|
| 423 |
+
obj = {}
|
| 424 |
+
if not isinstance(resources, dict):
|
| 425 |
+
raise ValueError("Resource must be a object")
|
| 426 |
+
for k, v in resources.items():
|
| 427 |
+
try:
|
| 428 |
+
obj[k] = Resource(v)
|
| 429 |
+
except ValueError:
|
| 430 |
+
pass
|
| 431 |
+
return obj
|
| 432 |
+
|
| 433 |
+
|
| 434 |
+
def _init_transforms(transforms: Any) -> Transforms:
|
| 435 |
+
if isinstance(transforms, (str, list)):
|
| 436 |
+
return Transforms(transforms)
|
| 437 |
+
return Transforms([])
|
| 438 |
+
|
| 439 |
+
|
| 440 |
+
def create_context_for_template(cfn):
|
| 441 |
+
parameters = {}
|
| 442 |
+
try:
|
| 443 |
+
parameters = _init_parameters(cfn.template.get("Parameters", {}))
|
| 444 |
+
except (ValueError, AttributeError):
|
| 445 |
+
pass
|
| 446 |
+
|
| 447 |
+
resources = {}
|
| 448 |
+
try:
|
| 449 |
+
resources = _init_resources(cfn.template.get("Resources", {}))
|
| 450 |
+
except (ValueError, AttributeError):
|
| 451 |
+
pass
|
| 452 |
+
|
| 453 |
+
transforms = _init_transforms(cfn.template.get("Transform", []))
|
| 454 |
+
|
| 455 |
+
try:
|
| 456 |
+
conditions = Conditions.create_from_instance(
|
| 457 |
+
cfn.template.get("Conditions", {}),
|
| 458 |
+
cfn.template.get("Rules", {}),
|
| 459 |
+
parameters,
|
| 460 |
+
)
|
| 461 |
+
except (ValueError, AttributeError):
|
| 462 |
+
conditions = Conditions.create_from_instance({}, {}, {})
|
| 463 |
+
|
| 464 |
+
mappings = Mappings.create_from_dict(cfn.template.get("Mappings", {}))
|
| 465 |
+
|
| 466 |
+
return Context(
|
| 467 |
+
parameters=parameters,
|
| 468 |
+
resources=resources,
|
| 469 |
+
conditions=conditions,
|
| 470 |
+
transforms=transforms,
|
| 471 |
+
mappings=mappings,
|
| 472 |
+
regions=cfn.regions,
|
| 473 |
+
path=Path(),
|
| 474 |
+
functions=["Fn::Transform"],
|
| 475 |
+
)
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/core.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import os
|
| 9 |
+
from typing import Sequence
|
| 10 |
+
|
| 11 |
+
from cfnlint.config import _DEFAULT_RULESDIR, ConfigMixIn, ManualArgs
|
| 12 |
+
from cfnlint.match import Match
|
| 13 |
+
from cfnlint.rules import RulesCollection
|
| 14 |
+
from cfnlint.runner import TemplateRunner, UnexpectedRuleException
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def get_rules(
|
| 18 |
+
append_rules: list[str],
|
| 19 |
+
ignore_rules: list[str],
|
| 20 |
+
include_rules: list[str],
|
| 21 |
+
configure_rules=None,
|
| 22 |
+
include_experimental: bool = False,
|
| 23 |
+
mandatory_rules: list[str] | None = None,
|
| 24 |
+
custom_rules: str | None = None,
|
| 25 |
+
) -> RulesCollection:
|
| 26 |
+
rules = RulesCollection(
|
| 27 |
+
ignore_rules,
|
| 28 |
+
include_rules,
|
| 29 |
+
configure_rules,
|
| 30 |
+
include_experimental,
|
| 31 |
+
mandatory_rules,
|
| 32 |
+
)
|
| 33 |
+
rules_paths: list[str] = [_DEFAULT_RULESDIR] + append_rules
|
| 34 |
+
try:
|
| 35 |
+
for rules_path in rules_paths:
|
| 36 |
+
if rules_path and os.path.isdir(os.path.expanduser(rules_path)):
|
| 37 |
+
rules.create_from_directory(rules_path)
|
| 38 |
+
else:
|
| 39 |
+
rules.create_from_module(rules_path)
|
| 40 |
+
|
| 41 |
+
rules.create_from_custom_rules_file(custom_rules)
|
| 42 |
+
except (OSError, ImportError) as e:
|
| 43 |
+
raise UnexpectedRuleException(
|
| 44 |
+
f"Tried to append rules but got an error: {str(e)}", 1
|
| 45 |
+
) from e
|
| 46 |
+
return rules
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def run_checks(
|
| 50 |
+
filename: str,
|
| 51 |
+
template: dict,
|
| 52 |
+
rules: RulesCollection | None,
|
| 53 |
+
regions: Sequence[str],
|
| 54 |
+
mandatory_rules: Sequence[str] | None = None,
|
| 55 |
+
) -> list[Match]:
|
| 56 |
+
"""Run Checks and Custom Rules against the template"""
|
| 57 |
+
|
| 58 |
+
config: ManualArgs = ManualArgs(
|
| 59 |
+
regions=list(regions),
|
| 60 |
+
mandatory_checks=list(mandatory_rules or []),
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
if not rules:
|
| 64 |
+
return []
|
| 65 |
+
|
| 66 |
+
config_mixin = ConfigMixIn(
|
| 67 |
+
[],
|
| 68 |
+
**config,
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
runner = TemplateRunner(
|
| 72 |
+
filename=filename,
|
| 73 |
+
template=template,
|
| 74 |
+
rules=rules, # type: ignore
|
| 75 |
+
config=config_mixin,
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
return list(runner.run())
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/custom_rules.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#Comments can be made with a '#' symbol at the start of the line
|
| 2 |
+
#Syntax: <Resource Type> <Property[*]> <Operator> <Value>
|
| 3 |
+
#Example: AWS::EC2::Instance InstanceType EQUALS "p3.2xlarge"
|
| 4 |
+
AWS::EC2::Instance ImageId EQUALS "SomethingItIsNotEqualTo"
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/__init__.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
| 3 |
+
SPDX-License-Identifier: MIT-0
|
| 4 |
+
"""
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Storage of all JSON schema files and their patches
|
| 3 |
+
"""
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_east_2/aws-quicksight-datasource.json
ADDED
|
@@ -0,0 +1,951 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/AwsAccountId",
|
| 5 |
+
"/properties/DataSourceId",
|
| 6 |
+
"/properties/Type"
|
| 7 |
+
],
|
| 8 |
+
"definitions": {
|
| 9 |
+
"AmazonElasticsearchParameters": {
|
| 10 |
+
"additionalProperties": false,
|
| 11 |
+
"properties": {
|
| 12 |
+
"Domain": {
|
| 13 |
+
"maxLength": 64,
|
| 14 |
+
"minLength": 1,
|
| 15 |
+
"type": "string"
|
| 16 |
+
}
|
| 17 |
+
},
|
| 18 |
+
"required": [
|
| 19 |
+
"Domain"
|
| 20 |
+
],
|
| 21 |
+
"type": "object"
|
| 22 |
+
},
|
| 23 |
+
"AmazonOpenSearchParameters": {
|
| 24 |
+
"additionalProperties": false,
|
| 25 |
+
"properties": {
|
| 26 |
+
"Domain": {
|
| 27 |
+
"maxLength": 64,
|
| 28 |
+
"minLength": 1,
|
| 29 |
+
"type": "string"
|
| 30 |
+
}
|
| 31 |
+
},
|
| 32 |
+
"required": [
|
| 33 |
+
"Domain"
|
| 34 |
+
],
|
| 35 |
+
"type": "object"
|
| 36 |
+
},
|
| 37 |
+
"AthenaParameters": {
|
| 38 |
+
"additionalProperties": false,
|
| 39 |
+
"properties": {
|
| 40 |
+
"RoleArn": {
|
| 41 |
+
"maxLength": 2048,
|
| 42 |
+
"minLength": 20,
|
| 43 |
+
"type": "string"
|
| 44 |
+
},
|
| 45 |
+
"WorkGroup": {
|
| 46 |
+
"maxLength": 128,
|
| 47 |
+
"minLength": 1,
|
| 48 |
+
"type": "string"
|
| 49 |
+
}
|
| 50 |
+
},
|
| 51 |
+
"type": "object"
|
| 52 |
+
},
|
| 53 |
+
"AuroraParameters": {
|
| 54 |
+
"additionalProperties": false,
|
| 55 |
+
"properties": {
|
| 56 |
+
"Database": {
|
| 57 |
+
"maxLength": 128,
|
| 58 |
+
"minLength": 1,
|
| 59 |
+
"type": "string"
|
| 60 |
+
},
|
| 61 |
+
"Host": {
|
| 62 |
+
"maxLength": 256,
|
| 63 |
+
"minLength": 1,
|
| 64 |
+
"type": "string"
|
| 65 |
+
},
|
| 66 |
+
"Port": {
|
| 67 |
+
"default": 0,
|
| 68 |
+
"maximum": 65535,
|
| 69 |
+
"minimum": 1,
|
| 70 |
+
"type": "number"
|
| 71 |
+
}
|
| 72 |
+
},
|
| 73 |
+
"required": [
|
| 74 |
+
"Database",
|
| 75 |
+
"Host",
|
| 76 |
+
"Port"
|
| 77 |
+
],
|
| 78 |
+
"type": "object"
|
| 79 |
+
},
|
| 80 |
+
"AuroraPostgreSqlParameters": {
|
| 81 |
+
"additionalProperties": false,
|
| 82 |
+
"properties": {
|
| 83 |
+
"Database": {
|
| 84 |
+
"maxLength": 128,
|
| 85 |
+
"minLength": 1,
|
| 86 |
+
"type": "string"
|
| 87 |
+
},
|
| 88 |
+
"Host": {
|
| 89 |
+
"maxLength": 256,
|
| 90 |
+
"minLength": 1,
|
| 91 |
+
"type": "string"
|
| 92 |
+
},
|
| 93 |
+
"Port": {
|
| 94 |
+
"default": 0,
|
| 95 |
+
"maximum": 65535,
|
| 96 |
+
"minimum": 1,
|
| 97 |
+
"type": "number"
|
| 98 |
+
}
|
| 99 |
+
},
|
| 100 |
+
"required": [
|
| 101 |
+
"Database",
|
| 102 |
+
"Host",
|
| 103 |
+
"Port"
|
| 104 |
+
],
|
| 105 |
+
"type": "object"
|
| 106 |
+
},
|
| 107 |
+
"AwsIotAnalyticsParameters": {
|
| 108 |
+
"additionalProperties": false,
|
| 109 |
+
"properties": {
|
| 110 |
+
"DataSetName": {
|
| 111 |
+
"maxLength": 128,
|
| 112 |
+
"minLength": 1,
|
| 113 |
+
"type": "string"
|
| 114 |
+
}
|
| 115 |
+
},
|
| 116 |
+
"required": [
|
| 117 |
+
"DataSetName"
|
| 118 |
+
],
|
| 119 |
+
"type": "object"
|
| 120 |
+
},
|
| 121 |
+
"CredentialPair": {
|
| 122 |
+
"additionalProperties": false,
|
| 123 |
+
"properties": {
|
| 124 |
+
"AlternateDataSourceParameters": {
|
| 125 |
+
"items": {
|
| 126 |
+
"$ref": "#/definitions/DataSourceParameters"
|
| 127 |
+
},
|
| 128 |
+
"maxItems": 50,
|
| 129 |
+
"minItems": 1,
|
| 130 |
+
"type": "array"
|
| 131 |
+
},
|
| 132 |
+
"Password": {
|
| 133 |
+
"maxLength": 1024,
|
| 134 |
+
"minLength": 1,
|
| 135 |
+
"type": "string"
|
| 136 |
+
},
|
| 137 |
+
"Username": {
|
| 138 |
+
"maxLength": 64,
|
| 139 |
+
"minLength": 1,
|
| 140 |
+
"type": "string"
|
| 141 |
+
}
|
| 142 |
+
},
|
| 143 |
+
"required": [
|
| 144 |
+
"Password",
|
| 145 |
+
"Username"
|
| 146 |
+
],
|
| 147 |
+
"type": "object"
|
| 148 |
+
},
|
| 149 |
+
"DataSourceCredentials": {
|
| 150 |
+
"additionalProperties": false,
|
| 151 |
+
"properties": {
|
| 152 |
+
"CopySourceArn": {
|
| 153 |
+
"pattern": "^arn:[-a-z0-9]*:quicksight:[-a-z0-9]*:[0-9]{12}:datasource/.+$",
|
| 154 |
+
"type": "string"
|
| 155 |
+
},
|
| 156 |
+
"CredentialPair": {
|
| 157 |
+
"$ref": "#/definitions/CredentialPair"
|
| 158 |
+
},
|
| 159 |
+
"SecretArn": {
|
| 160 |
+
"maxLength": 2048,
|
| 161 |
+
"minLength": 1,
|
| 162 |
+
"pattern": "^arn:[-a-z0-9]*:secretsmanager:[-a-z0-9]*:[0-9]{12}:secret:.+$",
|
| 163 |
+
"type": "string"
|
| 164 |
+
}
|
| 165 |
+
},
|
| 166 |
+
"type": "object"
|
| 167 |
+
},
|
| 168 |
+
"DataSourceErrorInfo": {
|
| 169 |
+
"additionalProperties": false,
|
| 170 |
+
"properties": {
|
| 171 |
+
"Message": {
|
| 172 |
+
"type": "string"
|
| 173 |
+
},
|
| 174 |
+
"Type": {
|
| 175 |
+
"$ref": "#/definitions/DataSourceErrorInfoType"
|
| 176 |
+
}
|
| 177 |
+
},
|
| 178 |
+
"type": "object"
|
| 179 |
+
},
|
| 180 |
+
"DataSourceErrorInfoType": {
|
| 181 |
+
"enum": [
|
| 182 |
+
"ACCESS_DENIED",
|
| 183 |
+
"COPY_SOURCE_NOT_FOUND",
|
| 184 |
+
"TIMEOUT",
|
| 185 |
+
"ENGINE_VERSION_NOT_SUPPORTED",
|
| 186 |
+
"UNKNOWN_HOST",
|
| 187 |
+
"GENERIC_SQL_FAILURE",
|
| 188 |
+
"CONFLICT",
|
| 189 |
+
"UNKNOWN"
|
| 190 |
+
],
|
| 191 |
+
"type": "string"
|
| 192 |
+
},
|
| 193 |
+
"DataSourceParameters": {
|
| 194 |
+
"additionalProperties": false,
|
| 195 |
+
"properties": {
|
| 196 |
+
"AmazonElasticsearchParameters": {
|
| 197 |
+
"$ref": "#/definitions/AmazonElasticsearchParameters"
|
| 198 |
+
},
|
| 199 |
+
"AmazonOpenSearchParameters": {
|
| 200 |
+
"$ref": "#/definitions/AmazonOpenSearchParameters"
|
| 201 |
+
},
|
| 202 |
+
"AthenaParameters": {
|
| 203 |
+
"$ref": "#/definitions/AthenaParameters"
|
| 204 |
+
},
|
| 205 |
+
"AuroraParameters": {
|
| 206 |
+
"$ref": "#/definitions/AuroraParameters"
|
| 207 |
+
},
|
| 208 |
+
"AuroraPostgreSqlParameters": {
|
| 209 |
+
"$ref": "#/definitions/AuroraPostgreSqlParameters"
|
| 210 |
+
},
|
| 211 |
+
"DatabricksParameters": {
|
| 212 |
+
"$ref": "#/definitions/DatabricksParameters"
|
| 213 |
+
},
|
| 214 |
+
"MariaDbParameters": {
|
| 215 |
+
"$ref": "#/definitions/MariaDbParameters"
|
| 216 |
+
},
|
| 217 |
+
"MySqlParameters": {
|
| 218 |
+
"$ref": "#/definitions/MySqlParameters"
|
| 219 |
+
},
|
| 220 |
+
"OracleParameters": {
|
| 221 |
+
"$ref": "#/definitions/OracleParameters"
|
| 222 |
+
},
|
| 223 |
+
"PostgreSqlParameters": {
|
| 224 |
+
"$ref": "#/definitions/PostgreSqlParameters"
|
| 225 |
+
},
|
| 226 |
+
"PrestoParameters": {
|
| 227 |
+
"$ref": "#/definitions/PrestoParameters"
|
| 228 |
+
},
|
| 229 |
+
"RdsParameters": {
|
| 230 |
+
"$ref": "#/definitions/RdsParameters"
|
| 231 |
+
},
|
| 232 |
+
"RedshiftParameters": {
|
| 233 |
+
"$ref": "#/definitions/RedshiftParameters"
|
| 234 |
+
},
|
| 235 |
+
"S3Parameters": {
|
| 236 |
+
"$ref": "#/definitions/S3Parameters"
|
| 237 |
+
},
|
| 238 |
+
"SnowflakeParameters": {
|
| 239 |
+
"$ref": "#/definitions/SnowflakeParameters"
|
| 240 |
+
},
|
| 241 |
+
"SparkParameters": {
|
| 242 |
+
"$ref": "#/definitions/SparkParameters"
|
| 243 |
+
},
|
| 244 |
+
"SqlServerParameters": {
|
| 245 |
+
"$ref": "#/definitions/SqlServerParameters"
|
| 246 |
+
},
|
| 247 |
+
"StarburstParameters": {
|
| 248 |
+
"$ref": "#/definitions/StarburstParameters"
|
| 249 |
+
},
|
| 250 |
+
"TeradataParameters": {
|
| 251 |
+
"$ref": "#/definitions/TeradataParameters"
|
| 252 |
+
},
|
| 253 |
+
"TrinoParameters": {
|
| 254 |
+
"$ref": "#/definitions/TrinoParameters"
|
| 255 |
+
}
|
| 256 |
+
},
|
| 257 |
+
"type": "object"
|
| 258 |
+
},
|
| 259 |
+
"DataSourceType": {
|
| 260 |
+
"enum": [
|
| 261 |
+
"ADOBE_ANALYTICS",
|
| 262 |
+
"AMAZON_ELASTICSEARCH",
|
| 263 |
+
"AMAZON_OPENSEARCH",
|
| 264 |
+
"ATHENA",
|
| 265 |
+
"AURORA",
|
| 266 |
+
"AURORA_POSTGRESQL",
|
| 267 |
+
"AWS_IOT_ANALYTICS",
|
| 268 |
+
"DATABRICKS",
|
| 269 |
+
"DENODO",
|
| 270 |
+
"DREMIO",
|
| 271 |
+
"DYNAMODB",
|
| 272 |
+
"SAPHANA",
|
| 273 |
+
"DB2_AS400",
|
| 274 |
+
"EXASOL",
|
| 275 |
+
"FILE",
|
| 276 |
+
"GITHUB",
|
| 277 |
+
"JIRA",
|
| 278 |
+
"MARIADB",
|
| 279 |
+
"MYSQL",
|
| 280 |
+
"ORACLE",
|
| 281 |
+
"POSTGRESQL",
|
| 282 |
+
"PRESTO",
|
| 283 |
+
"REDSHIFT",
|
| 284 |
+
"S3",
|
| 285 |
+
"S3_TABLES",
|
| 286 |
+
"SALESFORCE",
|
| 287 |
+
"SERVICENOW",
|
| 288 |
+
"SNOWFLAKE",
|
| 289 |
+
"SPARK",
|
| 290 |
+
"SQLSERVER",
|
| 291 |
+
"TERADATA",
|
| 292 |
+
"TIMESTREAM",
|
| 293 |
+
"TWITTER",
|
| 294 |
+
"BIGQUERY",
|
| 295 |
+
"GOOGLE_ANALYTICS",
|
| 296 |
+
"TRINO",
|
| 297 |
+
"STARBURST",
|
| 298 |
+
"MONGO",
|
| 299 |
+
"MONGO_ATLAS",
|
| 300 |
+
"DOCUMENTDB",
|
| 301 |
+
"APPFLOW",
|
| 302 |
+
"IMPALA",
|
| 303 |
+
"GLUE"
|
| 304 |
+
],
|
| 305 |
+
"type": "string"
|
| 306 |
+
},
|
| 307 |
+
"DatabricksParameters": {
|
| 308 |
+
"additionalProperties": false,
|
| 309 |
+
"properties": {
|
| 310 |
+
"Host": {
|
| 311 |
+
"maxLength": 256,
|
| 312 |
+
"minLength": 1,
|
| 313 |
+
"type": "string"
|
| 314 |
+
},
|
| 315 |
+
"Port": {
|
| 316 |
+
"default": 0,
|
| 317 |
+
"maximum": 65535,
|
| 318 |
+
"minimum": 1,
|
| 319 |
+
"type": "number"
|
| 320 |
+
},
|
| 321 |
+
"SqlEndpointPath": {
|
| 322 |
+
"maxLength": 4096,
|
| 323 |
+
"minLength": 1,
|
| 324 |
+
"type": "string"
|
| 325 |
+
}
|
| 326 |
+
},
|
| 327 |
+
"required": [
|
| 328 |
+
"Host",
|
| 329 |
+
"Port",
|
| 330 |
+
"SqlEndpointPath"
|
| 331 |
+
],
|
| 332 |
+
"type": "object"
|
| 333 |
+
},
|
| 334 |
+
"IdentityCenterConfiguration": {
|
| 335 |
+
"additionalProperties": false,
|
| 336 |
+
"properties": {
|
| 337 |
+
"EnableIdentityPropagation": {
|
| 338 |
+
"default": null,
|
| 339 |
+
"type": "boolean"
|
| 340 |
+
}
|
| 341 |
+
},
|
| 342 |
+
"type": "object"
|
| 343 |
+
},
|
| 344 |
+
"ManifestFileLocation": {
|
| 345 |
+
"additionalProperties": false,
|
| 346 |
+
"properties": {
|
| 347 |
+
"Bucket": {
|
| 348 |
+
"maxLength": 1024,
|
| 349 |
+
"minLength": 1,
|
| 350 |
+
"type": "string"
|
| 351 |
+
},
|
| 352 |
+
"Key": {
|
| 353 |
+
"maxLength": 1024,
|
| 354 |
+
"minLength": 1,
|
| 355 |
+
"type": "string"
|
| 356 |
+
}
|
| 357 |
+
},
|
| 358 |
+
"required": [
|
| 359 |
+
"Bucket",
|
| 360 |
+
"Key"
|
| 361 |
+
],
|
| 362 |
+
"type": "object"
|
| 363 |
+
},
|
| 364 |
+
"MariaDbParameters": {
|
| 365 |
+
"additionalProperties": false,
|
| 366 |
+
"properties": {
|
| 367 |
+
"Database": {
|
| 368 |
+
"maxLength": 128,
|
| 369 |
+
"minLength": 1,
|
| 370 |
+
"type": "string"
|
| 371 |
+
},
|
| 372 |
+
"Host": {
|
| 373 |
+
"maxLength": 256,
|
| 374 |
+
"minLength": 1,
|
| 375 |
+
"type": "string"
|
| 376 |
+
},
|
| 377 |
+
"Port": {
|
| 378 |
+
"default": 0,
|
| 379 |
+
"maximum": 65535,
|
| 380 |
+
"minimum": 1,
|
| 381 |
+
"type": "number"
|
| 382 |
+
}
|
| 383 |
+
},
|
| 384 |
+
"required": [
|
| 385 |
+
"Database",
|
| 386 |
+
"Host",
|
| 387 |
+
"Port"
|
| 388 |
+
],
|
| 389 |
+
"type": "object"
|
| 390 |
+
},
|
| 391 |
+
"MySqlParameters": {
|
| 392 |
+
"additionalProperties": false,
|
| 393 |
+
"properties": {
|
| 394 |
+
"Database": {
|
| 395 |
+
"maxLength": 128,
|
| 396 |
+
"minLength": 1,
|
| 397 |
+
"type": "string"
|
| 398 |
+
},
|
| 399 |
+
"Host": {
|
| 400 |
+
"maxLength": 256,
|
| 401 |
+
"minLength": 1,
|
| 402 |
+
"type": "string"
|
| 403 |
+
},
|
| 404 |
+
"Port": {
|
| 405 |
+
"default": 0,
|
| 406 |
+
"maximum": 65535,
|
| 407 |
+
"minimum": 1,
|
| 408 |
+
"type": "number"
|
| 409 |
+
}
|
| 410 |
+
},
|
| 411 |
+
"required": [
|
| 412 |
+
"Database",
|
| 413 |
+
"Host",
|
| 414 |
+
"Port"
|
| 415 |
+
],
|
| 416 |
+
"type": "object"
|
| 417 |
+
},
|
| 418 |
+
"OracleParameters": {
|
| 419 |
+
"additionalProperties": false,
|
| 420 |
+
"properties": {
|
| 421 |
+
"Database": {
|
| 422 |
+
"maxLength": 128,
|
| 423 |
+
"minLength": 1,
|
| 424 |
+
"type": "string"
|
| 425 |
+
},
|
| 426 |
+
"Host": {
|
| 427 |
+
"maxLength": 256,
|
| 428 |
+
"minLength": 1,
|
| 429 |
+
"type": "string"
|
| 430 |
+
},
|
| 431 |
+
"Port": {
|
| 432 |
+
"default": 0,
|
| 433 |
+
"maximum": 65535,
|
| 434 |
+
"minimum": 1,
|
| 435 |
+
"type": "number"
|
| 436 |
+
}
|
| 437 |
+
},
|
| 438 |
+
"required": [
|
| 439 |
+
"Database",
|
| 440 |
+
"Host",
|
| 441 |
+
"Port"
|
| 442 |
+
],
|
| 443 |
+
"type": "object"
|
| 444 |
+
},
|
| 445 |
+
"PostgreSqlParameters": {
|
| 446 |
+
"additionalProperties": false,
|
| 447 |
+
"properties": {
|
| 448 |
+
"Database": {
|
| 449 |
+
"maxLength": 128,
|
| 450 |
+
"minLength": 1,
|
| 451 |
+
"type": "string"
|
| 452 |
+
},
|
| 453 |
+
"Host": {
|
| 454 |
+
"maxLength": 256,
|
| 455 |
+
"minLength": 1,
|
| 456 |
+
"type": "string"
|
| 457 |
+
},
|
| 458 |
+
"Port": {
|
| 459 |
+
"default": 0,
|
| 460 |
+
"maximum": 65535,
|
| 461 |
+
"minimum": 1,
|
| 462 |
+
"type": "number"
|
| 463 |
+
}
|
| 464 |
+
},
|
| 465 |
+
"required": [
|
| 466 |
+
"Database",
|
| 467 |
+
"Host",
|
| 468 |
+
"Port"
|
| 469 |
+
],
|
| 470 |
+
"type": "object"
|
| 471 |
+
},
|
| 472 |
+
"PrestoParameters": {
|
| 473 |
+
"additionalProperties": false,
|
| 474 |
+
"properties": {
|
| 475 |
+
"Catalog": {
|
| 476 |
+
"maxLength": 128,
|
| 477 |
+
"minLength": 0,
|
| 478 |
+
"type": "string"
|
| 479 |
+
},
|
| 480 |
+
"Host": {
|
| 481 |
+
"maxLength": 256,
|
| 482 |
+
"minLength": 1,
|
| 483 |
+
"type": "string"
|
| 484 |
+
},
|
| 485 |
+
"Port": {
|
| 486 |
+
"default": 0,
|
| 487 |
+
"maximum": 65535,
|
| 488 |
+
"minimum": 1,
|
| 489 |
+
"type": "number"
|
| 490 |
+
}
|
| 491 |
+
},
|
| 492 |
+
"required": [
|
| 493 |
+
"Catalog",
|
| 494 |
+
"Host",
|
| 495 |
+
"Port"
|
| 496 |
+
],
|
| 497 |
+
"type": "object"
|
| 498 |
+
},
|
| 499 |
+
"RdsParameters": {
|
| 500 |
+
"additionalProperties": false,
|
| 501 |
+
"properties": {
|
| 502 |
+
"Database": {
|
| 503 |
+
"maxLength": 128,
|
| 504 |
+
"minLength": 1,
|
| 505 |
+
"type": "string"
|
| 506 |
+
},
|
| 507 |
+
"InstanceId": {
|
| 508 |
+
"maxLength": 64,
|
| 509 |
+
"minLength": 1,
|
| 510 |
+
"type": "string"
|
| 511 |
+
}
|
| 512 |
+
},
|
| 513 |
+
"required": [
|
| 514 |
+
"Database",
|
| 515 |
+
"InstanceId"
|
| 516 |
+
],
|
| 517 |
+
"type": "object"
|
| 518 |
+
},
|
| 519 |
+
"RedshiftIAMParameters": {
|
| 520 |
+
"additionalProperties": false,
|
| 521 |
+
"properties": {
|
| 522 |
+
"AutoCreateDatabaseUser": {
|
| 523 |
+
"default": false,
|
| 524 |
+
"type": "boolean"
|
| 525 |
+
},
|
| 526 |
+
"DatabaseGroups": {
|
| 527 |
+
"items": {
|
| 528 |
+
"maxLength": 64,
|
| 529 |
+
"minLength": 1,
|
| 530 |
+
"type": "string"
|
| 531 |
+
},
|
| 532 |
+
"maxItems": 50,
|
| 533 |
+
"minItems": 1,
|
| 534 |
+
"type": "array"
|
| 535 |
+
},
|
| 536 |
+
"DatabaseUser": {
|
| 537 |
+
"maxLength": 64,
|
| 538 |
+
"minLength": 1,
|
| 539 |
+
"type": "string"
|
| 540 |
+
},
|
| 541 |
+
"RoleArn": {
|
| 542 |
+
"maxLength": 2048,
|
| 543 |
+
"minLength": 20,
|
| 544 |
+
"type": "string"
|
| 545 |
+
}
|
| 546 |
+
},
|
| 547 |
+
"required": [
|
| 548 |
+
"RoleArn"
|
| 549 |
+
],
|
| 550 |
+
"type": "object"
|
| 551 |
+
},
|
| 552 |
+
"RedshiftParameters": {
|
| 553 |
+
"additionalProperties": false,
|
| 554 |
+
"properties": {
|
| 555 |
+
"ClusterId": {
|
| 556 |
+
"maxLength": 64,
|
| 557 |
+
"minLength": 1,
|
| 558 |
+
"type": "string"
|
| 559 |
+
},
|
| 560 |
+
"Database": {
|
| 561 |
+
"maxLength": 128,
|
| 562 |
+
"minLength": 1,
|
| 563 |
+
"type": "string"
|
| 564 |
+
},
|
| 565 |
+
"Host": {
|
| 566 |
+
"maxLength": 256,
|
| 567 |
+
"minLength": 1,
|
| 568 |
+
"type": "string"
|
| 569 |
+
},
|
| 570 |
+
"IAMParameters": {
|
| 571 |
+
"$ref": "#/definitions/RedshiftIAMParameters"
|
| 572 |
+
},
|
| 573 |
+
"IdentityCenterConfiguration": {
|
| 574 |
+
"$ref": "#/definitions/IdentityCenterConfiguration"
|
| 575 |
+
},
|
| 576 |
+
"Port": {
|
| 577 |
+
"default": 0,
|
| 578 |
+
"maximum": 65535,
|
| 579 |
+
"minimum": 0,
|
| 580 |
+
"type": "number"
|
| 581 |
+
}
|
| 582 |
+
},
|
| 583 |
+
"required": [
|
| 584 |
+
"Database"
|
| 585 |
+
],
|
| 586 |
+
"type": "object"
|
| 587 |
+
},
|
| 588 |
+
"ResourcePermission": {
|
| 589 |
+
"additionalProperties": false,
|
| 590 |
+
"properties": {
|
| 591 |
+
"Actions": {
|
| 592 |
+
"items": {
|
| 593 |
+
"type": "string"
|
| 594 |
+
},
|
| 595 |
+
"maxItems": 20,
|
| 596 |
+
"minItems": 1,
|
| 597 |
+
"type": "array"
|
| 598 |
+
},
|
| 599 |
+
"Principal": {
|
| 600 |
+
"maxLength": 256,
|
| 601 |
+
"minLength": 1,
|
| 602 |
+
"type": "string"
|
| 603 |
+
},
|
| 604 |
+
"Resource": {
|
| 605 |
+
"type": "string"
|
| 606 |
+
}
|
| 607 |
+
},
|
| 608 |
+
"required": [
|
| 609 |
+
"Actions",
|
| 610 |
+
"Principal"
|
| 611 |
+
],
|
| 612 |
+
"type": "object"
|
| 613 |
+
},
|
| 614 |
+
"ResourceStatus": {
|
| 615 |
+
"enum": [
|
| 616 |
+
"CREATION_IN_PROGRESS",
|
| 617 |
+
"CREATION_SUCCESSFUL",
|
| 618 |
+
"CREATION_FAILED",
|
| 619 |
+
"UPDATE_IN_PROGRESS",
|
| 620 |
+
"UPDATE_SUCCESSFUL",
|
| 621 |
+
"UPDATE_FAILED",
|
| 622 |
+
"DELETED"
|
| 623 |
+
],
|
| 624 |
+
"type": "string"
|
| 625 |
+
},
|
| 626 |
+
"S3Parameters": {
|
| 627 |
+
"additionalProperties": false,
|
| 628 |
+
"properties": {
|
| 629 |
+
"ManifestFileLocation": {
|
| 630 |
+
"$ref": "#/definitions/ManifestFileLocation"
|
| 631 |
+
},
|
| 632 |
+
"RoleArn": {
|
| 633 |
+
"maxLength": 2048,
|
| 634 |
+
"minLength": 20,
|
| 635 |
+
"type": "string"
|
| 636 |
+
}
|
| 637 |
+
},
|
| 638 |
+
"required": [
|
| 639 |
+
"ManifestFileLocation"
|
| 640 |
+
],
|
| 641 |
+
"type": "object"
|
| 642 |
+
},
|
| 643 |
+
"SnowflakeParameters": {
|
| 644 |
+
"additionalProperties": false,
|
| 645 |
+
"properties": {
|
| 646 |
+
"Database": {
|
| 647 |
+
"maxLength": 128,
|
| 648 |
+
"minLength": 1,
|
| 649 |
+
"type": "string"
|
| 650 |
+
},
|
| 651 |
+
"Host": {
|
| 652 |
+
"maxLength": 256,
|
| 653 |
+
"minLength": 1,
|
| 654 |
+
"type": "string"
|
| 655 |
+
},
|
| 656 |
+
"Warehouse": {
|
| 657 |
+
"maxLength": 128,
|
| 658 |
+
"minLength": 0,
|
| 659 |
+
"type": "string"
|
| 660 |
+
}
|
| 661 |
+
},
|
| 662 |
+
"required": [
|
| 663 |
+
"Database",
|
| 664 |
+
"Host",
|
| 665 |
+
"Warehouse"
|
| 666 |
+
],
|
| 667 |
+
"type": "object"
|
| 668 |
+
},
|
| 669 |
+
"SparkParameters": {
|
| 670 |
+
"additionalProperties": false,
|
| 671 |
+
"properties": {
|
| 672 |
+
"Host": {
|
| 673 |
+
"maxLength": 256,
|
| 674 |
+
"minLength": 1,
|
| 675 |
+
"type": "string"
|
| 676 |
+
},
|
| 677 |
+
"Port": {
|
| 678 |
+
"default": 0,
|
| 679 |
+
"maximum": 65535,
|
| 680 |
+
"minimum": 1,
|
| 681 |
+
"type": "number"
|
| 682 |
+
}
|
| 683 |
+
},
|
| 684 |
+
"required": [
|
| 685 |
+
"Host",
|
| 686 |
+
"Port"
|
| 687 |
+
],
|
| 688 |
+
"type": "object"
|
| 689 |
+
},
|
| 690 |
+
"SqlServerParameters": {
|
| 691 |
+
"additionalProperties": false,
|
| 692 |
+
"properties": {
|
| 693 |
+
"Database": {
|
| 694 |
+
"maxLength": 128,
|
| 695 |
+
"minLength": 1,
|
| 696 |
+
"type": "string"
|
| 697 |
+
},
|
| 698 |
+
"Host": {
|
| 699 |
+
"maxLength": 256,
|
| 700 |
+
"minLength": 1,
|
| 701 |
+
"type": "string"
|
| 702 |
+
},
|
| 703 |
+
"Port": {
|
| 704 |
+
"default": 0,
|
| 705 |
+
"maximum": 65535,
|
| 706 |
+
"minimum": 1,
|
| 707 |
+
"type": "number"
|
| 708 |
+
}
|
| 709 |
+
},
|
| 710 |
+
"required": [
|
| 711 |
+
"Database",
|
| 712 |
+
"Host",
|
| 713 |
+
"Port"
|
| 714 |
+
],
|
| 715 |
+
"type": "object"
|
| 716 |
+
},
|
| 717 |
+
"SslProperties": {
|
| 718 |
+
"additionalProperties": false,
|
| 719 |
+
"properties": {
|
| 720 |
+
"DisableSsl": {
|
| 721 |
+
"default": false,
|
| 722 |
+
"type": "boolean"
|
| 723 |
+
}
|
| 724 |
+
},
|
| 725 |
+
"type": "object"
|
| 726 |
+
},
|
| 727 |
+
"StarburstParameters": {
|
| 728 |
+
"additionalProperties": false,
|
| 729 |
+
"properties": {
|
| 730 |
+
"Catalog": {
|
| 731 |
+
"maxLength": 128,
|
| 732 |
+
"minLength": 0,
|
| 733 |
+
"type": "string"
|
| 734 |
+
},
|
| 735 |
+
"Host": {
|
| 736 |
+
"maxLength": 256,
|
| 737 |
+
"minLength": 1,
|
| 738 |
+
"type": "string"
|
| 739 |
+
},
|
| 740 |
+
"Port": {
|
| 741 |
+
"default": 0,
|
| 742 |
+
"maximum": 65535,
|
| 743 |
+
"minimum": 1,
|
| 744 |
+
"type": "number"
|
| 745 |
+
},
|
| 746 |
+
"ProductType": {
|
| 747 |
+
"$ref": "#/definitions/StarburstProductType"
|
| 748 |
+
}
|
| 749 |
+
},
|
| 750 |
+
"required": [
|
| 751 |
+
"Catalog",
|
| 752 |
+
"Host",
|
| 753 |
+
"Port"
|
| 754 |
+
],
|
| 755 |
+
"type": "object"
|
| 756 |
+
},
|
| 757 |
+
"StarburstProductType": {
|
| 758 |
+
"enum": [
|
| 759 |
+
"GALAXY",
|
| 760 |
+
"ENTERPRISE"
|
| 761 |
+
],
|
| 762 |
+
"type": "string"
|
| 763 |
+
},
|
| 764 |
+
"Tag": {
|
| 765 |
+
"additionalProperties": false,
|
| 766 |
+
"properties": {
|
| 767 |
+
"Key": {
|
| 768 |
+
"maxLength": 128,
|
| 769 |
+
"minLength": 1,
|
| 770 |
+
"type": "string"
|
| 771 |
+
},
|
| 772 |
+
"Value": {
|
| 773 |
+
"maxLength": 256,
|
| 774 |
+
"minLength": 1,
|
| 775 |
+
"type": "string"
|
| 776 |
+
}
|
| 777 |
+
},
|
| 778 |
+
"required": [
|
| 779 |
+
"Key",
|
| 780 |
+
"Value"
|
| 781 |
+
],
|
| 782 |
+
"type": "object"
|
| 783 |
+
},
|
| 784 |
+
"TeradataParameters": {
|
| 785 |
+
"additionalProperties": false,
|
| 786 |
+
"properties": {
|
| 787 |
+
"Database": {
|
| 788 |
+
"maxLength": 128,
|
| 789 |
+
"minLength": 1,
|
| 790 |
+
"type": "string"
|
| 791 |
+
},
|
| 792 |
+
"Host": {
|
| 793 |
+
"maxLength": 256,
|
| 794 |
+
"minLength": 1,
|
| 795 |
+
"type": "string"
|
| 796 |
+
},
|
| 797 |
+
"Port": {
|
| 798 |
+
"default": 0,
|
| 799 |
+
"maximum": 65535,
|
| 800 |
+
"minimum": 1,
|
| 801 |
+
"type": "number"
|
| 802 |
+
}
|
| 803 |
+
},
|
| 804 |
+
"required": [
|
| 805 |
+
"Database",
|
| 806 |
+
"Host",
|
| 807 |
+
"Port"
|
| 808 |
+
],
|
| 809 |
+
"type": "object"
|
| 810 |
+
},
|
| 811 |
+
"TrinoParameters": {
|
| 812 |
+
"additionalProperties": false,
|
| 813 |
+
"properties": {
|
| 814 |
+
"Catalog": {
|
| 815 |
+
"maxLength": 128,
|
| 816 |
+
"minLength": 0,
|
| 817 |
+
"type": "string"
|
| 818 |
+
},
|
| 819 |
+
"Host": {
|
| 820 |
+
"maxLength": 256,
|
| 821 |
+
"minLength": 1,
|
| 822 |
+
"type": "string"
|
| 823 |
+
},
|
| 824 |
+
"Port": {
|
| 825 |
+
"default": 0,
|
| 826 |
+
"maximum": 65535,
|
| 827 |
+
"minimum": 1,
|
| 828 |
+
"type": "number"
|
| 829 |
+
}
|
| 830 |
+
},
|
| 831 |
+
"required": [
|
| 832 |
+
"Catalog",
|
| 833 |
+
"Host",
|
| 834 |
+
"Port"
|
| 835 |
+
],
|
| 836 |
+
"type": "object"
|
| 837 |
+
},
|
| 838 |
+
"VpcConnectionProperties": {
|
| 839 |
+
"additionalProperties": false,
|
| 840 |
+
"properties": {
|
| 841 |
+
"VpcConnectionArn": {
|
| 842 |
+
"type": "string"
|
| 843 |
+
}
|
| 844 |
+
},
|
| 845 |
+
"required": [
|
| 846 |
+
"VpcConnectionArn"
|
| 847 |
+
],
|
| 848 |
+
"type": "object"
|
| 849 |
+
}
|
| 850 |
+
},
|
| 851 |
+
"primaryIdentifier": [
|
| 852 |
+
"/properties/AwsAccountId",
|
| 853 |
+
"/properties/DataSourceId"
|
| 854 |
+
],
|
| 855 |
+
"properties": {
|
| 856 |
+
"AlternateDataSourceParameters": {
|
| 857 |
+
"items": {
|
| 858 |
+
"$ref": "#/definitions/DataSourceParameters"
|
| 859 |
+
},
|
| 860 |
+
"maxItems": 50,
|
| 861 |
+
"minItems": 1,
|
| 862 |
+
"type": "array"
|
| 863 |
+
},
|
| 864 |
+
"Arn": {
|
| 865 |
+
"type": "string"
|
| 866 |
+
},
|
| 867 |
+
"AwsAccountId": {
|
| 868 |
+
"maxLength": 12,
|
| 869 |
+
"minLength": 12,
|
| 870 |
+
"pattern": "^[0-9]{12}$",
|
| 871 |
+
"type": "string"
|
| 872 |
+
},
|
| 873 |
+
"CreatedTime": {
|
| 874 |
+
"format": "date-time",
|
| 875 |
+
"type": "string"
|
| 876 |
+
},
|
| 877 |
+
"Credentials": {
|
| 878 |
+
"$ref": "#/definitions/DataSourceCredentials"
|
| 879 |
+
},
|
| 880 |
+
"DataSourceId": {
|
| 881 |
+
"type": "string"
|
| 882 |
+
},
|
| 883 |
+
"DataSourceParameters": {
|
| 884 |
+
"$ref": "#/definitions/DataSourceParameters"
|
| 885 |
+
},
|
| 886 |
+
"ErrorInfo": {
|
| 887 |
+
"$ref": "#/definitions/DataSourceErrorInfo"
|
| 888 |
+
},
|
| 889 |
+
"FolderArns": {
|
| 890 |
+
"items": {
|
| 891 |
+
"type": "string"
|
| 892 |
+
},
|
| 893 |
+
"maxItems": 10,
|
| 894 |
+
"minItems": 0,
|
| 895 |
+
"type": "array"
|
| 896 |
+
},
|
| 897 |
+
"LastUpdatedTime": {
|
| 898 |
+
"format": "date-time",
|
| 899 |
+
"type": "string"
|
| 900 |
+
},
|
| 901 |
+
"Name": {
|
| 902 |
+
"maxLength": 128,
|
| 903 |
+
"minLength": 1,
|
| 904 |
+
"type": "string"
|
| 905 |
+
},
|
| 906 |
+
"Permissions": {
|
| 907 |
+
"items": {
|
| 908 |
+
"$ref": "#/definitions/ResourcePermission"
|
| 909 |
+
},
|
| 910 |
+
"maxItems": 64,
|
| 911 |
+
"minItems": 1,
|
| 912 |
+
"type": "array"
|
| 913 |
+
},
|
| 914 |
+
"SslProperties": {
|
| 915 |
+
"$ref": "#/definitions/SslProperties"
|
| 916 |
+
},
|
| 917 |
+
"Status": {
|
| 918 |
+
"$ref": "#/definitions/ResourceStatus"
|
| 919 |
+
},
|
| 920 |
+
"Tags": {
|
| 921 |
+
"items": {
|
| 922 |
+
"$ref": "#/definitions/Tag"
|
| 923 |
+
},
|
| 924 |
+
"maxItems": 200,
|
| 925 |
+
"minItems": 1,
|
| 926 |
+
"type": "array"
|
| 927 |
+
},
|
| 928 |
+
"Type": {
|
| 929 |
+
"$ref": "#/definitions/DataSourceType"
|
| 930 |
+
},
|
| 931 |
+
"VpcConnectionProperties": {
|
| 932 |
+
"$ref": "#/definitions/VpcConnectionProperties"
|
| 933 |
+
}
|
| 934 |
+
},
|
| 935 |
+
"readOnlyProperties": [
|
| 936 |
+
"/properties/Arn",
|
| 937 |
+
"/properties/CreatedTime",
|
| 938 |
+
"/properties/LastUpdatedTime",
|
| 939 |
+
"/properties/Status"
|
| 940 |
+
],
|
| 941 |
+
"required": [
|
| 942 |
+
"Name",
|
| 943 |
+
"Type"
|
| 944 |
+
],
|
| 945 |
+
"sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-quicksight",
|
| 946 |
+
"typeName": "AWS::QuickSight::DataSource",
|
| 947 |
+
"writeOnlyProperties": [
|
| 948 |
+
"/properties/Credentials",
|
| 949 |
+
"/properties/FolderArns"
|
| 950 |
+
]
|
| 951 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-amazonmq-configuration.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/EngineType",
|
| 5 |
+
"/properties/Name",
|
| 6 |
+
"/properties/AuthenticationStrategy",
|
| 7 |
+
"/properties/EngineVersion"
|
| 8 |
+
],
|
| 9 |
+
"definitions": {
|
| 10 |
+
"TagsEntry": {
|
| 11 |
+
"additionalProperties": false,
|
| 12 |
+
"properties": {
|
| 13 |
+
"Key": {
|
| 14 |
+
"type": "string"
|
| 15 |
+
},
|
| 16 |
+
"Value": {
|
| 17 |
+
"type": "string"
|
| 18 |
+
}
|
| 19 |
+
},
|
| 20 |
+
"required": [
|
| 21 |
+
"Value",
|
| 22 |
+
"Key"
|
| 23 |
+
],
|
| 24 |
+
"type": "object"
|
| 25 |
+
}
|
| 26 |
+
},
|
| 27 |
+
"primaryIdentifier": [
|
| 28 |
+
"/properties/Id"
|
| 29 |
+
],
|
| 30 |
+
"properties": {
|
| 31 |
+
"Arn": {
|
| 32 |
+
"type": "string"
|
| 33 |
+
},
|
| 34 |
+
"AuthenticationStrategy": {
|
| 35 |
+
"enum": [
|
| 36 |
+
"LDAP",
|
| 37 |
+
"SIMPLE"
|
| 38 |
+
],
|
| 39 |
+
"type": "string"
|
| 40 |
+
},
|
| 41 |
+
"Data": {
|
| 42 |
+
"type": "string"
|
| 43 |
+
},
|
| 44 |
+
"Description": {
|
| 45 |
+
"type": "string"
|
| 46 |
+
},
|
| 47 |
+
"EngineType": {
|
| 48 |
+
"enum": [
|
| 49 |
+
"ACTIVEMQ",
|
| 50 |
+
"RABBITMQ"
|
| 51 |
+
],
|
| 52 |
+
"type": "string"
|
| 53 |
+
},
|
| 54 |
+
"EngineVersion": {
|
| 55 |
+
"type": "string"
|
| 56 |
+
},
|
| 57 |
+
"Id": {
|
| 58 |
+
"type": "string"
|
| 59 |
+
},
|
| 60 |
+
"Name": {
|
| 61 |
+
"type": "string"
|
| 62 |
+
},
|
| 63 |
+
"Revision": {
|
| 64 |
+
"type": "integer"
|
| 65 |
+
},
|
| 66 |
+
"Tags": {
|
| 67 |
+
"items": {
|
| 68 |
+
"$ref": "#/definitions/TagsEntry"
|
| 69 |
+
},
|
| 70 |
+
"type": "array",
|
| 71 |
+
"uniqueItems": false
|
| 72 |
+
}
|
| 73 |
+
},
|
| 74 |
+
"readOnlyProperties": [
|
| 75 |
+
"/properties/Revision",
|
| 76 |
+
"/properties/Id",
|
| 77 |
+
"/properties/Arn"
|
| 78 |
+
],
|
| 79 |
+
"required": [
|
| 80 |
+
"EngineType",
|
| 81 |
+
"Data",
|
| 82 |
+
"Name"
|
| 83 |
+
],
|
| 84 |
+
"typeName": "AWS::AmazonMQ::Configuration"
|
| 85 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-amazonmq-configurationassociation.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/Broker"
|
| 5 |
+
],
|
| 6 |
+
"definitions": {
|
| 7 |
+
"ConfigurationId": {
|
| 8 |
+
"additionalProperties": false,
|
| 9 |
+
"properties": {
|
| 10 |
+
"Id": {
|
| 11 |
+
"type": "string"
|
| 12 |
+
},
|
| 13 |
+
"Revision": {
|
| 14 |
+
"type": "integer"
|
| 15 |
+
}
|
| 16 |
+
},
|
| 17 |
+
"required": [
|
| 18 |
+
"Revision",
|
| 19 |
+
"Id"
|
| 20 |
+
],
|
| 21 |
+
"type": "object"
|
| 22 |
+
}
|
| 23 |
+
},
|
| 24 |
+
"primaryIdentifier": [
|
| 25 |
+
"/properties/Id"
|
| 26 |
+
],
|
| 27 |
+
"properties": {
|
| 28 |
+
"Broker": {
|
| 29 |
+
"type": "string"
|
| 30 |
+
},
|
| 31 |
+
"Configuration": {
|
| 32 |
+
"$ref": "#/definitions/ConfigurationId"
|
| 33 |
+
},
|
| 34 |
+
"Id": {
|
| 35 |
+
"type": "string"
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
"readOnlyProperties": [
|
| 39 |
+
"/properties/Id"
|
| 40 |
+
],
|
| 41 |
+
"required": [
|
| 42 |
+
"Broker",
|
| 43 |
+
"Configuration"
|
| 44 |
+
],
|
| 45 |
+
"typeName": "AWS::AmazonMQ::ConfigurationAssociation"
|
| 46 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-api.json
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/ProtocolType"
|
| 5 |
+
],
|
| 6 |
+
"definitions": {
|
| 7 |
+
"BodyS3Location": {
|
| 8 |
+
"additionalProperties": false,
|
| 9 |
+
"properties": {
|
| 10 |
+
"Bucket": {
|
| 11 |
+
"type": "string"
|
| 12 |
+
},
|
| 13 |
+
"Etag": {
|
| 14 |
+
"type": "string"
|
| 15 |
+
},
|
| 16 |
+
"Key": {
|
| 17 |
+
"type": "string"
|
| 18 |
+
},
|
| 19 |
+
"Version": {
|
| 20 |
+
"type": "string"
|
| 21 |
+
}
|
| 22 |
+
},
|
| 23 |
+
"type": "object"
|
| 24 |
+
},
|
| 25 |
+
"Cors": {
|
| 26 |
+
"additionalProperties": false,
|
| 27 |
+
"properties": {
|
| 28 |
+
"AllowCredentials": {
|
| 29 |
+
"type": "boolean"
|
| 30 |
+
},
|
| 31 |
+
"AllowHeaders": {
|
| 32 |
+
"items": {
|
| 33 |
+
"type": "string"
|
| 34 |
+
},
|
| 35 |
+
"type": "array",
|
| 36 |
+
"uniqueItems": false
|
| 37 |
+
},
|
| 38 |
+
"AllowMethods": {
|
| 39 |
+
"items": {
|
| 40 |
+
"type": "string"
|
| 41 |
+
},
|
| 42 |
+
"type": "array",
|
| 43 |
+
"uniqueItems": false
|
| 44 |
+
},
|
| 45 |
+
"AllowOrigins": {
|
| 46 |
+
"items": {
|
| 47 |
+
"type": "string"
|
| 48 |
+
},
|
| 49 |
+
"type": "array",
|
| 50 |
+
"uniqueItems": false
|
| 51 |
+
},
|
| 52 |
+
"ExposeHeaders": {
|
| 53 |
+
"items": {
|
| 54 |
+
"type": "string"
|
| 55 |
+
},
|
| 56 |
+
"type": "array",
|
| 57 |
+
"uniqueItems": false
|
| 58 |
+
},
|
| 59 |
+
"MaxAge": {
|
| 60 |
+
"type": "integer"
|
| 61 |
+
}
|
| 62 |
+
},
|
| 63 |
+
"type": "object"
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
"primaryIdentifier": [
|
| 67 |
+
"/properties/Id"
|
| 68 |
+
],
|
| 69 |
+
"properties": {
|
| 70 |
+
"ApiEndpoint": {
|
| 71 |
+
"type": "string"
|
| 72 |
+
},
|
| 73 |
+
"ApiKeySelectionExpression": {
|
| 74 |
+
"type": "string"
|
| 75 |
+
},
|
| 76 |
+
"BasePath": {
|
| 77 |
+
"type": "string"
|
| 78 |
+
},
|
| 79 |
+
"Body": {
|
| 80 |
+
"format": "json",
|
| 81 |
+
"type": [
|
| 82 |
+
"object",
|
| 83 |
+
"string"
|
| 84 |
+
]
|
| 85 |
+
},
|
| 86 |
+
"BodyS3Location": {
|
| 87 |
+
"$ref": "#/definitions/BodyS3Location"
|
| 88 |
+
},
|
| 89 |
+
"CorsConfiguration": {
|
| 90 |
+
"$ref": "#/definitions/Cors"
|
| 91 |
+
},
|
| 92 |
+
"CredentialsArn": {
|
| 93 |
+
"type": "string"
|
| 94 |
+
},
|
| 95 |
+
"Description": {
|
| 96 |
+
"type": "string"
|
| 97 |
+
},
|
| 98 |
+
"DisableExecuteApiEndpoint": {
|
| 99 |
+
"type": "boolean"
|
| 100 |
+
},
|
| 101 |
+
"DisableSchemaValidation": {
|
| 102 |
+
"type": "boolean"
|
| 103 |
+
},
|
| 104 |
+
"FailOnWarnings": {
|
| 105 |
+
"type": "boolean"
|
| 106 |
+
},
|
| 107 |
+
"Id": {
|
| 108 |
+
"type": "string"
|
| 109 |
+
},
|
| 110 |
+
"Name": {
|
| 111 |
+
"type": "string"
|
| 112 |
+
},
|
| 113 |
+
"ProtocolType": {
|
| 114 |
+
"type": "string"
|
| 115 |
+
},
|
| 116 |
+
"RouteKey": {
|
| 117 |
+
"type": "string"
|
| 118 |
+
},
|
| 119 |
+
"RouteSelectionExpression": {
|
| 120 |
+
"type": "string"
|
| 121 |
+
},
|
| 122 |
+
"Tags": {
|
| 123 |
+
"additionalProperties": false,
|
| 124 |
+
"patternProperties": {
|
| 125 |
+
".*": {
|
| 126 |
+
"type": "string"
|
| 127 |
+
}
|
| 128 |
+
},
|
| 129 |
+
"type": "object"
|
| 130 |
+
},
|
| 131 |
+
"Target": {
|
| 132 |
+
"type": "string"
|
| 133 |
+
},
|
| 134 |
+
"Version": {
|
| 135 |
+
"type": "string"
|
| 136 |
+
}
|
| 137 |
+
},
|
| 138 |
+
"readOnlyProperties": [
|
| 139 |
+
"/properties/Id",
|
| 140 |
+
"/properties/ApiEndpoint"
|
| 141 |
+
],
|
| 142 |
+
"typeName": "AWS::ApiGatewayV2::Api"
|
| 143 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-authorizer.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/ApiId"
|
| 5 |
+
],
|
| 6 |
+
"definitions": {
|
| 7 |
+
"JWTConfiguration": {
|
| 8 |
+
"additionalProperties": false,
|
| 9 |
+
"properties": {
|
| 10 |
+
"Audience": {
|
| 11 |
+
"items": {
|
| 12 |
+
"type": "string"
|
| 13 |
+
},
|
| 14 |
+
"type": "array",
|
| 15 |
+
"uniqueItems": false
|
| 16 |
+
},
|
| 17 |
+
"Issuer": {
|
| 18 |
+
"type": "string"
|
| 19 |
+
}
|
| 20 |
+
},
|
| 21 |
+
"type": "object"
|
| 22 |
+
}
|
| 23 |
+
},
|
| 24 |
+
"primaryIdentifier": [
|
| 25 |
+
"/properties/Id"
|
| 26 |
+
],
|
| 27 |
+
"properties": {
|
| 28 |
+
"ApiId": {
|
| 29 |
+
"type": "string"
|
| 30 |
+
},
|
| 31 |
+
"AuthorizerCredentialsArn": {
|
| 32 |
+
"type": "string"
|
| 33 |
+
},
|
| 34 |
+
"AuthorizerPayloadFormatVersion": {
|
| 35 |
+
"type": "string"
|
| 36 |
+
},
|
| 37 |
+
"AuthorizerResultTtlInSeconds": {
|
| 38 |
+
"type": "integer"
|
| 39 |
+
},
|
| 40 |
+
"AuthorizerType": {
|
| 41 |
+
"type": "string"
|
| 42 |
+
},
|
| 43 |
+
"AuthorizerUri": {
|
| 44 |
+
"type": "string"
|
| 45 |
+
},
|
| 46 |
+
"EnableSimpleResponses": {
|
| 47 |
+
"type": "boolean"
|
| 48 |
+
},
|
| 49 |
+
"Id": {
|
| 50 |
+
"type": "string"
|
| 51 |
+
},
|
| 52 |
+
"IdentitySource": {
|
| 53 |
+
"items": {
|
| 54 |
+
"type": "string"
|
| 55 |
+
},
|
| 56 |
+
"type": "array",
|
| 57 |
+
"uniqueItems": false
|
| 58 |
+
},
|
| 59 |
+
"IdentityValidationExpression": {
|
| 60 |
+
"type": "string"
|
| 61 |
+
},
|
| 62 |
+
"JwtConfiguration": {
|
| 63 |
+
"$ref": "#/definitions/JWTConfiguration"
|
| 64 |
+
},
|
| 65 |
+
"Name": {
|
| 66 |
+
"type": "string"
|
| 67 |
+
}
|
| 68 |
+
},
|
| 69 |
+
"readOnlyProperties": [
|
| 70 |
+
"/properties/Id"
|
| 71 |
+
],
|
| 72 |
+
"required": [
|
| 73 |
+
"AuthorizerType",
|
| 74 |
+
"ApiId",
|
| 75 |
+
"Name"
|
| 76 |
+
],
|
| 77 |
+
"typeName": "AWS::ApiGatewayV2::Authorizer"
|
| 78 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-deployment.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/ApiId"
|
| 5 |
+
],
|
| 6 |
+
"primaryIdentifier": [
|
| 7 |
+
"/properties/Id"
|
| 8 |
+
],
|
| 9 |
+
"properties": {
|
| 10 |
+
"ApiId": {
|
| 11 |
+
"type": "string"
|
| 12 |
+
},
|
| 13 |
+
"Description": {
|
| 14 |
+
"type": "string"
|
| 15 |
+
},
|
| 16 |
+
"Id": {
|
| 17 |
+
"type": "string"
|
| 18 |
+
},
|
| 19 |
+
"StageName": {
|
| 20 |
+
"type": "string"
|
| 21 |
+
}
|
| 22 |
+
},
|
| 23 |
+
"readOnlyProperties": [
|
| 24 |
+
"/properties/Id"
|
| 25 |
+
],
|
| 26 |
+
"required": [
|
| 27 |
+
"ApiId"
|
| 28 |
+
],
|
| 29 |
+
"typeName": "AWS::ApiGatewayV2::Deployment"
|
| 30 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-integrationresponse.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"primaryIdentifier": [
|
| 4 |
+
"/properties/Id"
|
| 5 |
+
],
|
| 6 |
+
"properties": {
|
| 7 |
+
"ApiId": {
|
| 8 |
+
"type": "string"
|
| 9 |
+
},
|
| 10 |
+
"ContentHandlingStrategy": {
|
| 11 |
+
"type": "string"
|
| 12 |
+
},
|
| 13 |
+
"Id": {
|
| 14 |
+
"type": "string"
|
| 15 |
+
},
|
| 16 |
+
"IntegrationId": {
|
| 17 |
+
"type": "string"
|
| 18 |
+
},
|
| 19 |
+
"IntegrationResponseKey": {
|
| 20 |
+
"type": "string"
|
| 21 |
+
},
|
| 22 |
+
"ResponseParameters": {
|
| 23 |
+
"format": "json",
|
| 24 |
+
"type": [
|
| 25 |
+
"object",
|
| 26 |
+
"string"
|
| 27 |
+
]
|
| 28 |
+
},
|
| 29 |
+
"ResponseTemplates": {
|
| 30 |
+
"format": "json",
|
| 31 |
+
"type": [
|
| 32 |
+
"object",
|
| 33 |
+
"string"
|
| 34 |
+
]
|
| 35 |
+
},
|
| 36 |
+
"TemplateSelectionExpression": {
|
| 37 |
+
"type": "string"
|
| 38 |
+
}
|
| 39 |
+
},
|
| 40 |
+
"readOnlyProperties": [
|
| 41 |
+
"/properties/Id"
|
| 42 |
+
],
|
| 43 |
+
"required": [
|
| 44 |
+
"IntegrationId",
|
| 45 |
+
"IntegrationResponseKey",
|
| 46 |
+
"ApiId"
|
| 47 |
+
],
|
| 48 |
+
"typeName": "AWS::ApiGatewayV2::IntegrationResponse"
|
| 49 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-model.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/ApiId"
|
| 5 |
+
],
|
| 6 |
+
"primaryIdentifier": [
|
| 7 |
+
"/properties/Id"
|
| 8 |
+
],
|
| 9 |
+
"properties": {
|
| 10 |
+
"ApiId": {
|
| 11 |
+
"type": "string"
|
| 12 |
+
},
|
| 13 |
+
"ContentType": {
|
| 14 |
+
"type": "string"
|
| 15 |
+
},
|
| 16 |
+
"Description": {
|
| 17 |
+
"type": "string"
|
| 18 |
+
},
|
| 19 |
+
"Id": {
|
| 20 |
+
"type": "string"
|
| 21 |
+
},
|
| 22 |
+
"Name": {
|
| 23 |
+
"type": "string"
|
| 24 |
+
},
|
| 25 |
+
"Schema": {
|
| 26 |
+
"format": "json",
|
| 27 |
+
"type": [
|
| 28 |
+
"object",
|
| 29 |
+
"string"
|
| 30 |
+
]
|
| 31 |
+
}
|
| 32 |
+
},
|
| 33 |
+
"readOnlyProperties": [
|
| 34 |
+
"/properties/Id"
|
| 35 |
+
],
|
| 36 |
+
"required": [
|
| 37 |
+
"ApiId",
|
| 38 |
+
"Schema",
|
| 39 |
+
"Name"
|
| 40 |
+
],
|
| 41 |
+
"typeName": "AWS::ApiGatewayV2::Model"
|
| 42 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-route.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/ApiId"
|
| 5 |
+
],
|
| 6 |
+
"primaryIdentifier": [
|
| 7 |
+
"/properties/Id"
|
| 8 |
+
],
|
| 9 |
+
"properties": {
|
| 10 |
+
"ApiId": {
|
| 11 |
+
"type": "string"
|
| 12 |
+
},
|
| 13 |
+
"ApiKeyRequired": {
|
| 14 |
+
"type": "boolean"
|
| 15 |
+
},
|
| 16 |
+
"AuthorizationScopes": {
|
| 17 |
+
"items": {
|
| 18 |
+
"type": "string"
|
| 19 |
+
},
|
| 20 |
+
"type": "array",
|
| 21 |
+
"uniqueItems": false
|
| 22 |
+
},
|
| 23 |
+
"AuthorizationType": {
|
| 24 |
+
"type": "string"
|
| 25 |
+
},
|
| 26 |
+
"AuthorizerId": {
|
| 27 |
+
"type": "string"
|
| 28 |
+
},
|
| 29 |
+
"Id": {
|
| 30 |
+
"type": "string"
|
| 31 |
+
},
|
| 32 |
+
"ModelSelectionExpression": {
|
| 33 |
+
"type": "string"
|
| 34 |
+
},
|
| 35 |
+
"OperationName": {
|
| 36 |
+
"type": "string"
|
| 37 |
+
},
|
| 38 |
+
"RequestModels": {
|
| 39 |
+
"format": "json",
|
| 40 |
+
"type": [
|
| 41 |
+
"object",
|
| 42 |
+
"string"
|
| 43 |
+
]
|
| 44 |
+
},
|
| 45 |
+
"RequestParameters": {
|
| 46 |
+
"format": "json",
|
| 47 |
+
"type": [
|
| 48 |
+
"object",
|
| 49 |
+
"string"
|
| 50 |
+
]
|
| 51 |
+
},
|
| 52 |
+
"RouteKey": {
|
| 53 |
+
"type": "string"
|
| 54 |
+
},
|
| 55 |
+
"RouteResponseSelectionExpression": {
|
| 56 |
+
"type": "string"
|
| 57 |
+
},
|
| 58 |
+
"Target": {
|
| 59 |
+
"type": "string"
|
| 60 |
+
}
|
| 61 |
+
},
|
| 62 |
+
"readOnlyProperties": [
|
| 63 |
+
"/properties/Id"
|
| 64 |
+
],
|
| 65 |
+
"required": [
|
| 66 |
+
"RouteKey",
|
| 67 |
+
"ApiId"
|
| 68 |
+
],
|
| 69 |
+
"typeName": "AWS::ApiGatewayV2::Route"
|
| 70 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-routeresponse.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/ApiId",
|
| 5 |
+
"/properties/RouteId"
|
| 6 |
+
],
|
| 7 |
+
"primaryIdentifier": [
|
| 8 |
+
"/properties/Id"
|
| 9 |
+
],
|
| 10 |
+
"properties": {
|
| 11 |
+
"ApiId": {
|
| 12 |
+
"type": "string"
|
| 13 |
+
},
|
| 14 |
+
"Id": {
|
| 15 |
+
"type": "string"
|
| 16 |
+
},
|
| 17 |
+
"ModelSelectionExpression": {
|
| 18 |
+
"type": "string"
|
| 19 |
+
},
|
| 20 |
+
"ResponseModels": {
|
| 21 |
+
"format": "json",
|
| 22 |
+
"type": [
|
| 23 |
+
"object",
|
| 24 |
+
"string"
|
| 25 |
+
]
|
| 26 |
+
},
|
| 27 |
+
"ResponseParameters": {
|
| 28 |
+
"format": "json",
|
| 29 |
+
"type": [
|
| 30 |
+
"object",
|
| 31 |
+
"string"
|
| 32 |
+
]
|
| 33 |
+
},
|
| 34 |
+
"RouteId": {
|
| 35 |
+
"type": "string"
|
| 36 |
+
},
|
| 37 |
+
"RouteResponseKey": {
|
| 38 |
+
"type": "string"
|
| 39 |
+
}
|
| 40 |
+
},
|
| 41 |
+
"readOnlyProperties": [
|
| 42 |
+
"/properties/Id"
|
| 43 |
+
],
|
| 44 |
+
"required": [
|
| 45 |
+
"RouteResponseKey",
|
| 46 |
+
"RouteId",
|
| 47 |
+
"ApiId"
|
| 48 |
+
],
|
| 49 |
+
"typeName": "AWS::ApiGatewayV2::RouteResponse"
|
| 50 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-apigatewayv2-vpclink.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/SecurityGroupIds",
|
| 5 |
+
"/properties/SubnetIds"
|
| 6 |
+
],
|
| 7 |
+
"primaryIdentifier": [
|
| 8 |
+
"/properties/Id"
|
| 9 |
+
],
|
| 10 |
+
"properties": {
|
| 11 |
+
"Id": {
|
| 12 |
+
"type": "string"
|
| 13 |
+
},
|
| 14 |
+
"Name": {
|
| 15 |
+
"type": "string"
|
| 16 |
+
},
|
| 17 |
+
"SecurityGroupIds": {
|
| 18 |
+
"format": "AWS::EC2::SecurityGroup.Ids",
|
| 19 |
+
"items": {
|
| 20 |
+
"format": "AWS::EC2::SecurityGroup.GroupId",
|
| 21 |
+
"type": "string"
|
| 22 |
+
},
|
| 23 |
+
"type": "array",
|
| 24 |
+
"uniqueItems": false
|
| 25 |
+
},
|
| 26 |
+
"SubnetIds": {
|
| 27 |
+
"items": {
|
| 28 |
+
"type": "string"
|
| 29 |
+
},
|
| 30 |
+
"type": "array",
|
| 31 |
+
"uniqueItems": false
|
| 32 |
+
},
|
| 33 |
+
"Tags": {
|
| 34 |
+
"additionalProperties": false,
|
| 35 |
+
"patternProperties": {
|
| 36 |
+
".*": {
|
| 37 |
+
"type": "string"
|
| 38 |
+
}
|
| 39 |
+
},
|
| 40 |
+
"type": "object"
|
| 41 |
+
}
|
| 42 |
+
},
|
| 43 |
+
"readOnlyProperties": [
|
| 44 |
+
"/properties/Id"
|
| 45 |
+
],
|
| 46 |
+
"required": [
|
| 47 |
+
"SubnetIds",
|
| 48 |
+
"Name"
|
| 49 |
+
],
|
| 50 |
+
"typeName": "AWS::ApiGatewayV2::VpcLink"
|
| 51 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-applicationautoscaling-scalabletarget.json
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/ResourceId",
|
| 5 |
+
"/properties/ScalableDimension",
|
| 6 |
+
"/properties/ServiceNamespace"
|
| 7 |
+
],
|
| 8 |
+
"definitions": {
|
| 9 |
+
"ScalableTargetAction": {
|
| 10 |
+
"additionalProperties": false,
|
| 11 |
+
"properties": {
|
| 12 |
+
"MaxCapacity": {
|
| 13 |
+
"type": "integer"
|
| 14 |
+
},
|
| 15 |
+
"MinCapacity": {
|
| 16 |
+
"type": "integer"
|
| 17 |
+
}
|
| 18 |
+
},
|
| 19 |
+
"type": "object"
|
| 20 |
+
},
|
| 21 |
+
"ScheduledAction": {
|
| 22 |
+
"additionalProperties": false,
|
| 23 |
+
"properties": {
|
| 24 |
+
"EndTime": {
|
| 25 |
+
"type": "string"
|
| 26 |
+
},
|
| 27 |
+
"ScalableTargetAction": {
|
| 28 |
+
"$ref": "#/definitions/ScalableTargetAction"
|
| 29 |
+
},
|
| 30 |
+
"Schedule": {
|
| 31 |
+
"type": "string"
|
| 32 |
+
},
|
| 33 |
+
"ScheduledActionName": {
|
| 34 |
+
"type": "string"
|
| 35 |
+
},
|
| 36 |
+
"StartTime": {
|
| 37 |
+
"type": "string"
|
| 38 |
+
},
|
| 39 |
+
"Timezone": {
|
| 40 |
+
"type": "string"
|
| 41 |
+
}
|
| 42 |
+
},
|
| 43 |
+
"required": [
|
| 44 |
+
"ScheduledActionName",
|
| 45 |
+
"Schedule"
|
| 46 |
+
],
|
| 47 |
+
"type": "object"
|
| 48 |
+
},
|
| 49 |
+
"SuspendedState": {
|
| 50 |
+
"additionalProperties": false,
|
| 51 |
+
"properties": {
|
| 52 |
+
"DynamicScalingInSuspended": {
|
| 53 |
+
"type": "boolean"
|
| 54 |
+
},
|
| 55 |
+
"DynamicScalingOutSuspended": {
|
| 56 |
+
"type": "boolean"
|
| 57 |
+
},
|
| 58 |
+
"ScheduledScalingSuspended": {
|
| 59 |
+
"type": "boolean"
|
| 60 |
+
}
|
| 61 |
+
},
|
| 62 |
+
"type": "object"
|
| 63 |
+
}
|
| 64 |
+
},
|
| 65 |
+
"primaryIdentifier": [
|
| 66 |
+
"/properties/Id"
|
| 67 |
+
],
|
| 68 |
+
"properties": {
|
| 69 |
+
"Id": {
|
| 70 |
+
"type": "string"
|
| 71 |
+
},
|
| 72 |
+
"MaxCapacity": {
|
| 73 |
+
"type": "integer"
|
| 74 |
+
},
|
| 75 |
+
"MinCapacity": {
|
| 76 |
+
"type": "integer"
|
| 77 |
+
},
|
| 78 |
+
"ResourceId": {
|
| 79 |
+
"type": "string"
|
| 80 |
+
},
|
| 81 |
+
"RoleARN": {
|
| 82 |
+
"type": "string"
|
| 83 |
+
},
|
| 84 |
+
"ScalableDimension": {
|
| 85 |
+
"enum": [
|
| 86 |
+
"appstream:fleet:DesiredCapacity",
|
| 87 |
+
"cassandra:table:ReadCapacityUnits",
|
| 88 |
+
"cassandra:table:WriteCapacityUnits",
|
| 89 |
+
"comprehend:document-classifier-endpoint:DesiredInferenceUnits",
|
| 90 |
+
"comprehend:entity-recognizer-endpoint:DesiredInferenceUnits",
|
| 91 |
+
"custom-resource:ResourceType:Property",
|
| 92 |
+
"dynamodb:index:ReadCapacityUnits",
|
| 93 |
+
"dynamodb:index:WriteCapacityUnits",
|
| 94 |
+
"dynamodb:table:ReadCapacityUnits",
|
| 95 |
+
"dynamodb:table:WriteCapacityUnits",
|
| 96 |
+
"ec2:spot-fleet-request:TargetCapacity",
|
| 97 |
+
"ecs:service:DesiredCount",
|
| 98 |
+
"elasticache:replication-group:NodeGroups",
|
| 99 |
+
"elasticache:replication-group:Replicas",
|
| 100 |
+
"elasticmapreduce:instancegroup:InstanceCount",
|
| 101 |
+
"kafka:broker-storage:VolumeSize",
|
| 102 |
+
"lambda:function:ProvisionedConcurrency",
|
| 103 |
+
"neptune:cluster:ReadReplicaCount",
|
| 104 |
+
"rds:cluster:ReadReplicaCount",
|
| 105 |
+
"sagemaker:inference-component:DesiredCopyCount",
|
| 106 |
+
"sagemaker:variant:DesiredInstanceCount",
|
| 107 |
+
"sagemaker:variant:DesiredProvisionedConcurrency",
|
| 108 |
+
"workspaces:workspacespool:DesiredUserSessions"
|
| 109 |
+
],
|
| 110 |
+
"type": "string"
|
| 111 |
+
},
|
| 112 |
+
"ScheduledActions": {
|
| 113 |
+
"items": {
|
| 114 |
+
"$ref": "#/definitions/ScheduledAction"
|
| 115 |
+
},
|
| 116 |
+
"type": "array",
|
| 117 |
+
"uniqueItems": true
|
| 118 |
+
},
|
| 119 |
+
"ServiceNamespace": {
|
| 120 |
+
"enum": [
|
| 121 |
+
"appstream",
|
| 122 |
+
"cassandra",
|
| 123 |
+
"comprehend",
|
| 124 |
+
"custom-resource",
|
| 125 |
+
"dynamodb",
|
| 126 |
+
"ec2",
|
| 127 |
+
"ecs",
|
| 128 |
+
"elasticache",
|
| 129 |
+
"elasticmapreduce",
|
| 130 |
+
"kafka",
|
| 131 |
+
"lambda",
|
| 132 |
+
"neptune",
|
| 133 |
+
"rds",
|
| 134 |
+
"sagemaker",
|
| 135 |
+
"workspaces"
|
| 136 |
+
],
|
| 137 |
+
"type": "string"
|
| 138 |
+
},
|
| 139 |
+
"SuspendedState": {
|
| 140 |
+
"$ref": "#/definitions/SuspendedState"
|
| 141 |
+
}
|
| 142 |
+
},
|
| 143 |
+
"readOnlyProperties": [
|
| 144 |
+
"/properties/Id"
|
| 145 |
+
],
|
| 146 |
+
"required": [
|
| 147 |
+
"ResourceId",
|
| 148 |
+
"ServiceNamespace",
|
| 149 |
+
"ScalableDimension",
|
| 150 |
+
"MinCapacity",
|
| 151 |
+
"RoleARN",
|
| 152 |
+
"MaxCapacity"
|
| 153 |
+
],
|
| 154 |
+
"typeName": "AWS::ApplicationAutoScaling::ScalableTarget"
|
| 155 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-autoscaling-launchconfiguration.json
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/RamDiskId",
|
| 5 |
+
"/properties/InstanceType",
|
| 6 |
+
"/properties/InstanceMonitoring",
|
| 7 |
+
"/properties/ImageId",
|
| 8 |
+
"/properties/BlockDeviceMappings",
|
| 9 |
+
"/properties/SpotPrice",
|
| 10 |
+
"/properties/ClassicLinkVPCId",
|
| 11 |
+
"/properties/InstanceId",
|
| 12 |
+
"/properties/KeyName",
|
| 13 |
+
"/properties/PlacementTenancy",
|
| 14 |
+
"/properties/LaunchConfigurationName",
|
| 15 |
+
"/properties/IamInstanceProfile",
|
| 16 |
+
"/properties/UserData",
|
| 17 |
+
"/properties/AssociatePublicIpAddress",
|
| 18 |
+
"/properties/KernelId",
|
| 19 |
+
"/properties/EbsOptimized",
|
| 20 |
+
"/properties/SecurityGroups",
|
| 21 |
+
"/properties/MetadataOptions",
|
| 22 |
+
"/properties/ClassicLinkVPCSecurityGroups"
|
| 23 |
+
],
|
| 24 |
+
"definitions": {
|
| 25 |
+
"BlockDevice": {
|
| 26 |
+
"additionalProperties": false,
|
| 27 |
+
"properties": {
|
| 28 |
+
"DeleteOnTermination": {
|
| 29 |
+
"type": "boolean"
|
| 30 |
+
},
|
| 31 |
+
"Encrypted": {
|
| 32 |
+
"type": "boolean"
|
| 33 |
+
},
|
| 34 |
+
"Iops": {
|
| 35 |
+
"type": "integer"
|
| 36 |
+
},
|
| 37 |
+
"SnapshotId": {
|
| 38 |
+
"type": "string"
|
| 39 |
+
},
|
| 40 |
+
"Throughput": {
|
| 41 |
+
"type": "integer"
|
| 42 |
+
},
|
| 43 |
+
"VolumeSize": {
|
| 44 |
+
"type": "integer"
|
| 45 |
+
},
|
| 46 |
+
"VolumeType": {
|
| 47 |
+
"enum": [
|
| 48 |
+
"gp2",
|
| 49 |
+
"gp3",
|
| 50 |
+
"io1",
|
| 51 |
+
"io2",
|
| 52 |
+
"sc1",
|
| 53 |
+
"st1",
|
| 54 |
+
"standard"
|
| 55 |
+
],
|
| 56 |
+
"type": "string"
|
| 57 |
+
}
|
| 58 |
+
},
|
| 59 |
+
"type": "object"
|
| 60 |
+
},
|
| 61 |
+
"BlockDeviceMapping": {
|
| 62 |
+
"additionalProperties": false,
|
| 63 |
+
"properties": {
|
| 64 |
+
"DeviceName": {
|
| 65 |
+
"type": "string"
|
| 66 |
+
},
|
| 67 |
+
"Ebs": {
|
| 68 |
+
"$ref": "#/definitions/BlockDevice"
|
| 69 |
+
},
|
| 70 |
+
"NoDevice": {
|
| 71 |
+
"type": "boolean"
|
| 72 |
+
},
|
| 73 |
+
"VirtualName": {
|
| 74 |
+
"type": "string"
|
| 75 |
+
}
|
| 76 |
+
},
|
| 77 |
+
"required": [
|
| 78 |
+
"DeviceName"
|
| 79 |
+
],
|
| 80 |
+
"requiredXor": [
|
| 81 |
+
"VirtualName",
|
| 82 |
+
"Ebs",
|
| 83 |
+
"NoDevice"
|
| 84 |
+
],
|
| 85 |
+
"type": "object"
|
| 86 |
+
},
|
| 87 |
+
"MetadataOptions": {
|
| 88 |
+
"additionalProperties": false,
|
| 89 |
+
"properties": {
|
| 90 |
+
"HttpEndpoint": {
|
| 91 |
+
"enum": [
|
| 92 |
+
"disabled",
|
| 93 |
+
"enabled"
|
| 94 |
+
],
|
| 95 |
+
"type": "string"
|
| 96 |
+
},
|
| 97 |
+
"HttpPutResponseHopLimit": {
|
| 98 |
+
"type": "integer"
|
| 99 |
+
},
|
| 100 |
+
"HttpTokens": {
|
| 101 |
+
"enum": [
|
| 102 |
+
"optional",
|
| 103 |
+
"required"
|
| 104 |
+
],
|
| 105 |
+
"type": "string"
|
| 106 |
+
}
|
| 107 |
+
},
|
| 108 |
+
"type": "object"
|
| 109 |
+
}
|
| 110 |
+
},
|
| 111 |
+
"primaryIdentifier": [
|
| 112 |
+
"/properties/Id"
|
| 113 |
+
],
|
| 114 |
+
"properties": {
|
| 115 |
+
"AssociatePublicIpAddress": {
|
| 116 |
+
"type": "boolean"
|
| 117 |
+
},
|
| 118 |
+
"BlockDeviceMappings": {
|
| 119 |
+
"items": {
|
| 120 |
+
"$ref": "#/definitions/BlockDeviceMapping"
|
| 121 |
+
},
|
| 122 |
+
"type": "array",
|
| 123 |
+
"uniqueItems": true
|
| 124 |
+
},
|
| 125 |
+
"ClassicLinkVPCId": {
|
| 126 |
+
"type": "string"
|
| 127 |
+
},
|
| 128 |
+
"ClassicLinkVPCSecurityGroups": {
|
| 129 |
+
"items": {
|
| 130 |
+
"type": "string"
|
| 131 |
+
},
|
| 132 |
+
"type": "array",
|
| 133 |
+
"uniqueItems": true
|
| 134 |
+
},
|
| 135 |
+
"EbsOptimized": {
|
| 136 |
+
"type": "boolean"
|
| 137 |
+
},
|
| 138 |
+
"IamInstanceProfile": {
|
| 139 |
+
"type": "string"
|
| 140 |
+
},
|
| 141 |
+
"Id": {
|
| 142 |
+
"type": "string"
|
| 143 |
+
},
|
| 144 |
+
"ImageId": {
|
| 145 |
+
"format": "AWS::EC2::Image.Id",
|
| 146 |
+
"type": "string"
|
| 147 |
+
},
|
| 148 |
+
"InstanceId": {
|
| 149 |
+
"type": "string"
|
| 150 |
+
},
|
| 151 |
+
"InstanceMonitoring": {
|
| 152 |
+
"type": "boolean"
|
| 153 |
+
},
|
| 154 |
+
"InstanceType": {
|
| 155 |
+
"type": "string"
|
| 156 |
+
},
|
| 157 |
+
"KernelId": {
|
| 158 |
+
"type": "string"
|
| 159 |
+
},
|
| 160 |
+
"KeyName": {
|
| 161 |
+
"type": "string"
|
| 162 |
+
},
|
| 163 |
+
"LaunchConfigurationName": {
|
| 164 |
+
"type": "string"
|
| 165 |
+
},
|
| 166 |
+
"MetadataOptions": {
|
| 167 |
+
"$ref": "#/definitions/MetadataOptions"
|
| 168 |
+
},
|
| 169 |
+
"PlacementTenancy": {
|
| 170 |
+
"type": "string"
|
| 171 |
+
},
|
| 172 |
+
"RamDiskId": {
|
| 173 |
+
"type": "string"
|
| 174 |
+
},
|
| 175 |
+
"SecurityGroups": {
|
| 176 |
+
"format": "AWS::EC2::SecurityGroup.Ids",
|
| 177 |
+
"items": {
|
| 178 |
+
"format": "AWS::EC2::SecurityGroup.GroupId",
|
| 179 |
+
"type": "string"
|
| 180 |
+
},
|
| 181 |
+
"type": "array",
|
| 182 |
+
"uniqueItems": true
|
| 183 |
+
},
|
| 184 |
+
"SpotPrice": {
|
| 185 |
+
"type": "string"
|
| 186 |
+
},
|
| 187 |
+
"UserData": {
|
| 188 |
+
"type": "string"
|
| 189 |
+
}
|
| 190 |
+
},
|
| 191 |
+
"readOnlyProperties": [
|
| 192 |
+
"/properties/Id"
|
| 193 |
+
],
|
| 194 |
+
"required": [
|
| 195 |
+
"ImageId",
|
| 196 |
+
"InstanceType"
|
| 197 |
+
],
|
| 198 |
+
"typeName": "A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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"definitions": {
|
| 4 |
+
"CustomizedMetricSpecification": {
|
| 5 |
+
"additionalProperties": false,
|
| 6 |
+
"properties": {
|
| 7 |
+
"Dimensions": {
|
| 8 |
+
"items": {
|
| 9 |
+
"$ref": "#/definitions/MetricDimension"
|
| 10 |
+
},
|
| 11 |
+
"type": "array",
|
| 12 |
+
"uniqueItems": true
|
| 13 |
+
},
|
| 14 |
+
"MetricName": {
|
| 15 |
+
"type": "string"
|
| 16 |
+
},
|
| 17 |
+
"Namespace": {
|
| 18 |
+
"type": "string"
|
| 19 |
+
},
|
| 20 |
+
"Statistic": {
|
| 21 |
+
"enum": [
|
| 22 |
+
"Average",
|
| 23 |
+
"Maximum",
|
| 24 |
+
"Minimum",
|
| 25 |
+
"SampleCount",
|
| 26 |
+
"Sum"
|
| 27 |
+
],
|
| 28 |
+
"type": "string"
|
| 29 |
+
},
|
| 30 |
+
"Unit": {
|
| 31 |
+
"type": "string"
|
| 32 |
+
}
|
| 33 |
+
},
|
| 34 |
+
"required": [
|
| 35 |
+
"MetricName",
|
| 36 |
+
"Statistic",
|
| 37 |
+
"Namespace"
|
| 38 |
+
],
|
| 39 |
+
"type": "object"
|
| 40 |
+
},
|
| 41 |
+
"Metric": {
|
| 42 |
+
"additionalProperties": false,
|
| 43 |
+
"properties": {
|
| 44 |
+
"Dimensions": {
|
| 45 |
+
"items": {
|
| 46 |
+
"$ref": "#/definitions/MetricDimension"
|
| 47 |
+
},
|
| 48 |
+
"type": "array",
|
| 49 |
+
"uniqueItems": true
|
| 50 |
+
},
|
| 51 |
+
"MetricName": {
|
| 52 |
+
"type": "string"
|
| 53 |
+
},
|
| 54 |
+
"Namespace": {
|
| 55 |
+
"type": "string"
|
| 56 |
+
}
|
| 57 |
+
},
|
| 58 |
+
"required": [
|
| 59 |
+
"MetricName",
|
| 60 |
+
"Namespace"
|
| 61 |
+
],
|
| 62 |
+
"type": "object"
|
| 63 |
+
},
|
| 64 |
+
"MetricDataQuery": {
|
| 65 |
+
"additionalProperties": false,
|
| 66 |
+
"properties": {
|
| 67 |
+
"Expression": {
|
| 68 |
+
"type": "string"
|
| 69 |
+
},
|
| 70 |
+
"Id": {
|
| 71 |
+
"type": "string"
|
| 72 |
+
},
|
| 73 |
+
"Label": {
|
| 74 |
+
"type": "string"
|
| 75 |
+
},
|
| 76 |
+
"MetricStat": {
|
| 77 |
+
"$ref": "#/definitions/MetricStat"
|
| 78 |
+
},
|
| 79 |
+
"ReturnData": {
|
| 80 |
+
"type": "boolean"
|
| 81 |
+
}
|
| 82 |
+
},
|
| 83 |
+
"required": [
|
| 84 |
+
"Id"
|
| 85 |
+
],
|
| 86 |
+
"type": "object"
|
| 87 |
+
},
|
| 88 |
+
"MetricDimension": {
|
| 89 |
+
"additionalProperties": false,
|
| 90 |
+
"properties": {
|
| 91 |
+
"Name": {
|
| 92 |
+
"type": "string"
|
| 93 |
+
},
|
| 94 |
+
"Value": {
|
| 95 |
+
"type": "string"
|
| 96 |
+
}
|
| 97 |
+
},
|
| 98 |
+
"required": [
|
| 99 |
+
"Value",
|
| 100 |
+
"Name"
|
| 101 |
+
],
|
| 102 |
+
"type": "object"
|
| 103 |
+
},
|
| 104 |
+
"MetricStat": {
|
| 105 |
+
"additionalProperties": false,
|
| 106 |
+
"properties": {
|
| 107 |
+
"Metric": {
|
| 108 |
+
"$ref": "#/definitions/Metric"
|
| 109 |
+
},
|
| 110 |
+
"Stat": {
|
| 111 |
+
"type": "string"
|
| 112 |
+
},
|
| 113 |
+
"Unit": {
|
| 114 |
+
"type": "string"
|
| 115 |
+
}
|
| 116 |
+
},
|
| 117 |
+
"required": [
|
| 118 |
+
"Stat",
|
| 119 |
+
"Metric"
|
| 120 |
+
],
|
| 121 |
+
"type": "object"
|
| 122 |
+
},
|
| 123 |
+
"PredefinedMetricSpecification": {
|
| 124 |
+
"additionalProperties": false,
|
| 125 |
+
"properties": {
|
| 126 |
+
"PredefinedMetricType": {
|
| 127 |
+
"enum": [
|
| 128 |
+
"ALBRequestCountPerTarget",
|
| 129 |
+
"ASGAverageCPUUtilization",
|
| 130 |
+
"ASGAverageNetworkIn",
|
| 131 |
+
"ASGAverageNetworkOut"
|
| 132 |
+
],
|
| 133 |
+
"type": "string"
|
| 134 |
+
},
|
| 135 |
+
"ResourceLabel": {
|
| 136 |
+
"type": "string"
|
| 137 |
+
}
|
| 138 |
+
},
|
| 139 |
+
"required": [
|
| 140 |
+
"PredefinedMetricType"
|
| 141 |
+
],
|
| 142 |
+
"type": "object"
|
| 143 |
+
},
|
| 144 |
+
"PredictiveScalingConfiguration": {
|
| 145 |
+
"additionalProperties": false,
|
| 146 |
+
"properties": {
|
| 147 |
+
"MaxCapacityBreachBehavior": {
|
| 148 |
+
"enum": [
|
| 149 |
+
"HonorMaxCapacity",
|
| 150 |
+
"IncreaseMaxCapacity"
|
| 151 |
+
],
|
| 152 |
+
"type": "string"
|
| 153 |
+
},
|
| 154 |
+
"MaxCapacityBuffer": {
|
| 155 |
+
"type": "integer"
|
| 156 |
+
},
|
| 157 |
+
"MetricSpecifications": {
|
| 158 |
+
"items": {
|
| 159 |
+
"$ref": "#/definitions/PredictiveScalingMetricSpecification"
|
| 160 |
+
},
|
| 161 |
+
"type": "array",
|
| 162 |
+
"uniqueItems": true
|
| 163 |
+
},
|
| 164 |
+
"Mode": {
|
| 165 |
+
"enum": [
|
| 166 |
+
"ForecastAndScale",
|
| 167 |
+
"ForecastOnly"
|
| 168 |
+
],
|
| 169 |
+
"type": "string"
|
| 170 |
+
},
|
| 171 |
+
"SchedulingBufferTime": {
|
| 172 |
+
"type": "integer"
|
| 173 |
+
}
|
| 174 |
+
},
|
| 175 |
+
"required": [
|
| 176 |
+
"MetricSpecifications"
|
| 177 |
+
],
|
| 178 |
+
"type": "object"
|
| 179 |
+
},
|
| 180 |
+
"PredictiveScalingCustomizedCapacityMetric": {
|
| 181 |
+
"additionalProperties": false,
|
| 182 |
+
"properties": {
|
| 183 |
+
"MetricDataQueries": {
|
| 184 |
+
"items": {
|
| 185 |
+
"$ref": "#/definitions/MetricDataQuery"
|
| 186 |
+
},
|
| 187 |
+
"type": "array",
|
| 188 |
+
"uniqueItems": true
|
| 189 |
+
}
|
| 190 |
+
},
|
| 191 |
+
"required": [
|
| 192 |
+
"MetricDataQueries"
|
| 193 |
+
],
|
| 194 |
+
"type": "object"
|
| 195 |
+
},
|
| 196 |
+
"PredictiveScalingCustomizedLoadMetric": {
|
| 197 |
+
"additionalProperties": false,
|
| 198 |
+
"properties": {
|
| 199 |
+
"MetricDataQueries": {
|
| 200 |
+
"items": {
|
| 201 |
+
"$ref": "#/definitions/MetricDataQuery"
|
| 202 |
+
},
|
| 203 |
+
"type": "array",
|
| 204 |
+
"uniqueItems": true
|
| 205 |
+
}
|
| 206 |
+
},
|
| 207 |
+
"required": [
|
| 208 |
+
"MetricDataQueries"
|
| 209 |
+
],
|
| 210 |
+
"type": "object"
|
| 211 |
+
},
|
| 212 |
+
"PredictiveScalingCustomizedScalingMetric": {
|
| 213 |
+
"additionalProperties": false,
|
| 214 |
+
"properties": {
|
| 215 |
+
"MetricDataQueries": {
|
| 216 |
+
"items": {
|
| 217 |
+
"$ref": "#/definitions/MetricDataQuery"
|
| 218 |
+
},
|
| 219 |
+
"type": "array",
|
| 220 |
+
"uniqueItems": true
|
| 221 |
+
}
|
| 222 |
+
},
|
| 223 |
+
"required": [
|
| 224 |
+
"MetricDataQueries"
|
| 225 |
+
],
|
| 226 |
+
"type": "object"
|
| 227 |
+
},
|
| 228 |
+
"PredictiveScalingMetricSpecification": {
|
| 229 |
+
"additionalProperties": false,
|
| 230 |
+
"properties": {
|
| 231 |
+
"CustomizedCapacityMetricSpecification": {
|
| 232 |
+
"$ref": "#/definitions/PredictiveScalingCustomizedCapacityMetric"
|
| 233 |
+
},
|
| 234 |
+
"CustomizedLoadMetricSpecification": {
|
| 235 |
+
"$ref": "#/definitions/PredictiveScalingCustomizedLoadMetric"
|
| 236 |
+
},
|
| 237 |
+
"CustomizedScalingMetricSpecification": {
|
| 238 |
+
"$ref": "#/definitions/PredictiveScalingCustomizedScalingMetric"
|
| 239 |
+
},
|
| 240 |
+
"PredefinedLoadMetricSpecification": {
|
| 241 |
+
"$ref": "#/definitions/PredictiveScalingPredefinedLoadMetric"
|
| 242 |
+
},
|
| 243 |
+
"PredefinedMetricPairSpecification": {
|
| 244 |
+
"$ref": "#/definitions/PredictiveScalingPredefinedMetricPair"
|
| 245 |
+
},
|
| 246 |
+
"PredefinedScalingMetricSpecification": {
|
| 247 |
+
"$ref": "#/definitions/PredictiveScalingPredefinedScalingMetric"
|
| 248 |
+
},
|
| 249 |
+
"TargetValue": {
|
| 250 |
+
"type": "number"
|
| 251 |
+
}
|
| 252 |
+
},
|
| 253 |
+
"required": [
|
| 254 |
+
"TargetValue"
|
| 255 |
+
],
|
| 256 |
+
"type": "object"
|
| 257 |
+
},
|
| 258 |
+
"PredictiveScalingPredefinedLoadMetric": {
|
| 259 |
+
"additionalProperties": false,
|
| 260 |
+
"properties": {
|
| 261 |
+
"PredefinedMetricType": {
|
| 262 |
+
"enum": [
|
| 263 |
+
"ALBTargetGroupRequestCount",
|
| 264 |
+
"ASGTotalCPUUtilization",
|
| 265 |
+
"ASGTotalNetworkIn",
|
| 266 |
+
"ASGTotalNetworkOut"
|
| 267 |
+
],
|
| 268 |
+
"type": "string"
|
| 269 |
+
},
|
| 270 |
+
"ResourceLabel": {
|
| 271 |
+
"type": "string"
|
| 272 |
+
}
|
| 273 |
+
},
|
| 274 |
+
"required": [
|
| 275 |
+
"PredefinedMetricType"
|
| 276 |
+
],
|
| 277 |
+
"type": "object"
|
| 278 |
+
},
|
| 279 |
+
"PredictiveScalingPredefinedMetricPair": {
|
| 280 |
+
"additionalProperties": false,
|
| 281 |
+
"properties": {
|
| 282 |
+
"PredefinedMetricType": {
|
| 283 |
+
"enum": [
|
| 284 |
+
"ALBRequestCount",
|
| 285 |
+
"ASGCPUUtilization",
|
| 286 |
+
"ASGNetworkIn",
|
| 287 |
+
"ASGNetworkOut"
|
| 288 |
+
],
|
| 289 |
+
"type": "string"
|
| 290 |
+
},
|
| 291 |
+
"ResourceLabel": {
|
| 292 |
+
"type": "string"
|
| 293 |
+
}
|
| 294 |
+
},
|
| 295 |
+
"required": [
|
| 296 |
+
"PredefinedMetricType"
|
| 297 |
+
],
|
| 298 |
+
"type": "object"
|
| 299 |
+
},
|
| 300 |
+
"PredictiveScalingPredefinedScalingMetric": {
|
| 301 |
+
"additionalProperties": false,
|
| 302 |
+
"properties": {
|
| 303 |
+
"PredefinedMetricType": {
|
| 304 |
+
"enum": [
|
| 305 |
+
"ALBRequestCountPerTarget",
|
| 306 |
+
"ASGAverageCPUUtilization",
|
| 307 |
+
"ASGAverageNetworkIn",
|
| 308 |
+
"ASGAverageNetworkOut"
|
| 309 |
+
],
|
| 310 |
+
"type": "string"
|
| 311 |
+
},
|
| 312 |
+
"ResourceLabel": {
|
| 313 |
+
"type": "string"
|
| 314 |
+
}
|
| 315 |
+
},
|
| 316 |
+
"required": [
|
| 317 |
+
"PredefinedMetricType"
|
| 318 |
+
],
|
| 319 |
+
"type": "object"
|
| 320 |
+
},
|
| 321 |
+
"StepAdjustment": {
|
| 322 |
+
"additionalProperties": false,
|
| 323 |
+
"properties": {
|
| 324 |
+
"MetricIntervalLowerBound": {
|
| 325 |
+
"type": "number"
|
| 326 |
+
},
|
| 327 |
+
"MetricIntervalUpperBound": {
|
| 328 |
+
"type": "number"
|
| 329 |
+
},
|
| 330 |
+
"ScalingAdjustment": {
|
| 331 |
+
"type": "integer"
|
| 332 |
+
}
|
| 333 |
+
},
|
| 334 |
+
"required": [
|
| 335 |
+
"ScalingAdjustment"
|
| 336 |
+
],
|
| 337 |
+
"type": "object"
|
| 338 |
+
},
|
| 339 |
+
"TargetTrackingConfiguration": {
|
| 340 |
+
"additionalProperties": false,
|
| 341 |
+
"properties": {
|
| 342 |
+
"CustomizedMetricSpecification": {
|
| 343 |
+
"$ref": "#/definitions/CustomizedMetricSpecification"
|
| 344 |
+
},
|
| 345 |
+
"DisableScaleIn": {
|
| 346 |
+
"type": "boolean"
|
| 347 |
+
},
|
| 348 |
+
"PredefinedMetricSpecification": {
|
| 349 |
+
"$ref": "#/definitions/PredefinedMetricSpecification"
|
| 350 |
+
},
|
| 351 |
+
"TargetValue": {
|
| 352 |
+
"type": "number"
|
| 353 |
+
}
|
| 354 |
+
},
|
| 355 |
+
"required": [
|
| 356 |
+
"TargetValue"
|
| 357 |
+
],
|
| 358 |
+
"type": "object"
|
| 359 |
+
}
|
| 360 |
+
},
|
| 361 |
+
"primaryIdentifier": [
|
| 362 |
+
"/properties/Id"
|
| 363 |
+
],
|
| 364 |
+
"properties": {
|
| 365 |
+
"AdjustmentType": {
|
| 366 |
+
"enum": [
|
| 367 |
+
"ChangeInCapacity",
|
| 368 |
+
"ExactCapacity",
|
| 369 |
+
"PercentChangeInCapacity"
|
| 370 |
+
],
|
| 371 |
+
"type": "string"
|
| 372 |
+
},
|
| 373 |
+
"AutoScalingGroupName": {
|
| 374 |
+
"type": "string"
|
| 375 |
+
},
|
| 376 |
+
"Cooldown": {
|
| 377 |
+
"type": "string"
|
| 378 |
+
},
|
| 379 |
+
"EstimatedInstanceWarmup": {
|
| 380 |
+
"type": "integer"
|
| 381 |
+
},
|
| 382 |
+
"Id": {
|
| 383 |
+
"type": "string"
|
| 384 |
+
},
|
| 385 |
+
"MetricAggregationType": {
|
| 386 |
+
"enum": [
|
| 387 |
+
"Average",
|
| 388 |
+
"Maximum",
|
| 389 |
+
"Minimum"
|
| 390 |
+
],
|
| 391 |
+
"type": "string"
|
| 392 |
+
},
|
| 393 |
+
"MinAdjustmentMagnitude": {
|
| 394 |
+
"type": "integer"
|
| 395 |
+
},
|
| 396 |
+
"PolicyType": {
|
| 397 |
+
"enum": [
|
| 398 |
+
"PredictiveScaling",
|
| 399 |
+
"SimpleScaling",
|
| 400 |
+
"StepScaling",
|
| 401 |
+
"TargetTrackingScaling"
|
| 402 |
+
],
|
| 403 |
+
"type": "string"
|
| 404 |
+
},
|
| 405 |
+
"PredictiveScalingConfiguration": {
|
| 406 |
+
"$ref": "#/definitions/PredictiveScalingConfiguration"
|
| 407 |
+
},
|
| 408 |
+
"ScalingAdjustment": {
|
| 409 |
+
"type": "integer"
|
| 410 |
+
},
|
| 411 |
+
"StepAdjustments": {
|
| 412 |
+
"items": {
|
| 413 |
+
"$ref": "#/definitions/StepAdjustment"
|
| 414 |
+
},
|
| 415 |
+
"type": "array",
|
| 416 |
+
"uniqueItems": true
|
| 417 |
+
},
|
| 418 |
+
"TargetTrackingConfiguration": {
|
| 419 |
+
"$ref": "#/definitions/TargetTrackingConfiguration"
|
| 420 |
+
}
|
| 421 |
+
},
|
| 422 |
+
"readOnlyProperties": [
|
| 423 |
+
"/properties/Id"
|
| 424 |
+
],
|
| 425 |
+
"required": [
|
| 426 |
+
"AutoScalingGroupName"
|
| 427 |
+
],
|
| 428 |
+
"typeName": "AWS::AutoScaling::ScalingPolicy"
|
| 429 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-cassandra-keyspace.json
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/ReplicationSpecification",
|
| 5 |
+
"/properties/KeyspaceName"
|
| 6 |
+
],
|
| 7 |
+
"definitions": {
|
| 8 |
+
"RegionList": {
|
| 9 |
+
"insertionOrder": false,
|
| 10 |
+
"items": {
|
| 11 |
+
"enum": [
|
| 12 |
+
"ap-northeast-1",
|
| 13 |
+
"ap-northeast-2",
|
| 14 |
+
"ap-south-1",
|
| 15 |
+
"ap-southeast-1",
|
| 16 |
+
"ap-southeast-2",
|
| 17 |
+
"ca-central-1",
|
| 18 |
+
"eu-central-1",
|
| 19 |
+
"eu-north-1",
|
| 20 |
+
"eu-west-1",
|
| 21 |
+
"eu-west-2",
|
| 22 |
+
"eu-west-3",
|
| 23 |
+
"sa-east-1",
|
| 24 |
+
"us-east-1",
|
| 25 |
+
"us-east-2",
|
| 26 |
+
"us-west-1",
|
| 27 |
+
"us-west-2"
|
| 28 |
+
],
|
| 29 |
+
"type": "string"
|
| 30 |
+
},
|
| 31 |
+
"maxItems": 6,
|
| 32 |
+
"minItems": 2,
|
| 33 |
+
"type": "array",
|
| 34 |
+
"uniqueItems": true
|
| 35 |
+
},
|
| 36 |
+
"ReplicationSpecification": {
|
| 37 |
+
"additionalProperties": false,
|
| 38 |
+
"default": {
|
| 39 |
+
"properties": {
|
| 40 |
+
"ReplicationStrategy": {
|
| 41 |
+
"const": "SINGLE_REGION",
|
| 42 |
+
"type": "string"
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
},
|
| 46 |
+
"dependencies": {
|
| 47 |
+
"RegionList": [
|
| 48 |
+
"ReplicationStrategy"
|
| 49 |
+
]
|
| 50 |
+
},
|
| 51 |
+
"properties": {
|
| 52 |
+
"RegionList": {
|
| 53 |
+
"$ref": "#/definitions/RegionList"
|
| 54 |
+
},
|
| 55 |
+
"ReplicationStrategy": {
|
| 56 |
+
"enum": [
|
| 57 |
+
"SINGLE_REGION",
|
| 58 |
+
"MULTI_REGION"
|
| 59 |
+
],
|
| 60 |
+
"type": "string"
|
| 61 |
+
}
|
| 62 |
+
},
|
| 63 |
+
"type": "object"
|
| 64 |
+
},
|
| 65 |
+
"Tag": {
|
| 66 |
+
"additionalProperties": false,
|
| 67 |
+
"properties": {
|
| 68 |
+
"Key": {
|
| 69 |
+
"maxLength": 128,
|
| 70 |
+
"minLength": 1,
|
| 71 |
+
"type": "string"
|
| 72 |
+
},
|
| 73 |
+
"Value": {
|
| 74 |
+
"maxLength": 256,
|
| 75 |
+
"minLength": 1,
|
| 76 |
+
"type": "string"
|
| 77 |
+
}
|
| 78 |
+
},
|
| 79 |
+
"required": [
|
| 80 |
+
"Value",
|
| 81 |
+
"Key"
|
| 82 |
+
],
|
| 83 |
+
"type": "object"
|
| 84 |
+
}
|
| 85 |
+
},
|
| 86 |
+
"primaryIdentifier": [
|
| 87 |
+
"/properties/KeyspaceName"
|
| 88 |
+
],
|
| 89 |
+
"properties": {
|
| 90 |
+
"ClientSideTimestampsEnabled": {
|
| 91 |
+
"type": "boolean"
|
| 92 |
+
},
|
| 93 |
+
"KeyspaceName": {
|
| 94 |
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9_]{1,47}$",
|
| 95 |
+
"type": "string"
|
| 96 |
+
},
|
| 97 |
+
"ReplicationSpecification": {
|
| 98 |
+
"$ref": "#/definitions/ReplicationSpecification"
|
| 99 |
+
},
|
| 100 |
+
"Tags": {
|
| 101 |
+
"items": {
|
| 102 |
+
"$ref": "#/definitions/Tag"
|
| 103 |
+
},
|
| 104 |
+
"maxItems": 50,
|
| 105 |
+
"minItems": 0,
|
| 106 |
+
"type": "array",
|
| 107 |
+
"uniqueItems": true
|
| 108 |
+
}
|
| 109 |
+
},
|
| 110 |
+
"required": [],
|
| 111 |
+
"tagging": {
|
| 112 |
+
"cloudFormationSystemTags": true,
|
| 113 |
+
"tagOnCreate": true,
|
| 114 |
+
"tagProperty": "/properties/Tags",
|
| 115 |
+
"tagUpdatable": true,
|
| 116 |
+
"taggable": true
|
| 117 |
+
},
|
| 118 |
+
"typeName": "AWS::Cassandra::Keyspace"
|
| 119 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-cloudformation-stack.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"definitions": {
|
| 4 |
+
"Tag": {
|
| 5 |
+
"additionalProperties": false,
|
| 6 |
+
"properties": {
|
| 7 |
+
"Key": {
|
| 8 |
+
"type": "string"
|
| 9 |
+
},
|
| 10 |
+
"Value": {
|
| 11 |
+
"type": "string"
|
| 12 |
+
}
|
| 13 |
+
},
|
| 14 |
+
"required": [
|
| 15 |
+
"Value",
|
| 16 |
+
"Key"
|
| 17 |
+
],
|
| 18 |
+
"type": "object"
|
| 19 |
+
}
|
| 20 |
+
},
|
| 21 |
+
"primaryIdentifier": [
|
| 22 |
+
"/properties/Id"
|
| 23 |
+
],
|
| 24 |
+
"properties": {
|
| 25 |
+
"Id": {
|
| 26 |
+
"type": "string"
|
| 27 |
+
},
|
| 28 |
+
"NotificationARNs": {
|
| 29 |
+
"items": {
|
| 30 |
+
"type": "string"
|
| 31 |
+
},
|
| 32 |
+
"type": "array",
|
| 33 |
+
"uniqueItems": true
|
| 34 |
+
},
|
| 35 |
+
"Parameters": {
|
| 36 |
+
"patternProperties": {
|
| 37 |
+
"[a-zA-Z0-9]+": {
|
| 38 |
+
"type": [
|
| 39 |
+
"string",
|
| 40 |
+
"number",
|
| 41 |
+
"integer",
|
| 42 |
+
"object",
|
| 43 |
+
"array",
|
| 44 |
+
"boolean"
|
| 45 |
+
]
|
| 46 |
+
}
|
| 47 |
+
},
|
| 48 |
+
"type": "object"
|
| 49 |
+
},
|
| 50 |
+
"Tags": {
|
| 51 |
+
"items": {
|
| 52 |
+
"$ref": "#/definitions/Tag"
|
| 53 |
+
},
|
| 54 |
+
"type": "array",
|
| 55 |
+
"uniqueItems": false
|
| 56 |
+
},
|
| 57 |
+
"TemplateURL": {
|
| 58 |
+
"type": "string"
|
| 59 |
+
},
|
| 60 |
+
"TimeoutInMinutes": {
|
| 61 |
+
"type": "integer"
|
| 62 |
+
}
|
| 63 |
+
},
|
| 64 |
+
"readOnlyProperties": [
|
| 65 |
+
"/properties/Id"
|
| 66 |
+
],
|
| 67 |
+
"required": [
|
| 68 |
+
"TemplateURL"
|
| 69 |
+
],
|
| 70 |
+
"typeName": "AWS::CloudFormation::Stack"
|
| 71 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-codebuild-project.json
ADDED
|
@@ -0,0 +1,596 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/Name"
|
| 5 |
+
],
|
| 6 |
+
"definitions": {
|
| 7 |
+
"Artifacts": {
|
| 8 |
+
"additionalProperties": false,
|
| 9 |
+
"properties": {
|
| 10 |
+
"ArtifactIdentifier": {
|
| 11 |
+
"type": "string"
|
| 12 |
+
},
|
| 13 |
+
"EncryptionDisabled": {
|
| 14 |
+
"type": "boolean"
|
| 15 |
+
},
|
| 16 |
+
"Location": {
|
| 17 |
+
"type": "string"
|
| 18 |
+
},
|
| 19 |
+
"Name": {
|
| 20 |
+
"type": "string"
|
| 21 |
+
},
|
| 22 |
+
"NamespaceType": {
|
| 23 |
+
"type": "string"
|
| 24 |
+
},
|
| 25 |
+
"OverrideArtifactName": {
|
| 26 |
+
"type": "boolean"
|
| 27 |
+
},
|
| 28 |
+
"Packaging": {
|
| 29 |
+
"enum": [
|
| 30 |
+
"NONE",
|
| 31 |
+
"ZIP"
|
| 32 |
+
],
|
| 33 |
+
"type": "string"
|
| 34 |
+
},
|
| 35 |
+
"Path": {
|
| 36 |
+
"type": "string"
|
| 37 |
+
},
|
| 38 |
+
"Type": {
|
| 39 |
+
"enum": [
|
| 40 |
+
"CODEPIPELINE",
|
| 41 |
+
"NO_ARTIFACTS",
|
| 42 |
+
"S3"
|
| 43 |
+
],
|
| 44 |
+
"type": "string"
|
| 45 |
+
}
|
| 46 |
+
},
|
| 47 |
+
"required": [
|
| 48 |
+
"Type"
|
| 49 |
+
],
|
| 50 |
+
"type": "object"
|
| 51 |
+
},
|
| 52 |
+
"BatchRestrictions": {
|
| 53 |
+
"additionalProperties": false,
|
| 54 |
+
"properties": {
|
| 55 |
+
"ComputeTypesAllowed": {
|
| 56 |
+
"items": {
|
| 57 |
+
"type": "string"
|
| 58 |
+
},
|
| 59 |
+
"type": "array",
|
| 60 |
+
"uniqueItems": false
|
| 61 |
+
},
|
| 62 |
+
"MaximumBuildsAllowed": {
|
| 63 |
+
"type": "integer"
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
"type": "object"
|
| 67 |
+
},
|
| 68 |
+
"BuildStatusConfig": {
|
| 69 |
+
"additionalProperties": false,
|
| 70 |
+
"properties": {
|
| 71 |
+
"Context": {
|
| 72 |
+
"type": "string"
|
| 73 |
+
},
|
| 74 |
+
"TargetUrl": {
|
| 75 |
+
"type": "string"
|
| 76 |
+
}
|
| 77 |
+
},
|
| 78 |
+
"type": "object"
|
| 79 |
+
},
|
| 80 |
+
"CloudWatchLogsConfig": {
|
| 81 |
+
"additionalProperties": false,
|
| 82 |
+
"properties": {
|
| 83 |
+
"GroupName": {
|
| 84 |
+
"type": "string"
|
| 85 |
+
},
|
| 86 |
+
"Status": {
|
| 87 |
+
"type": "string"
|
| 88 |
+
},
|
| 89 |
+
"StreamName": {
|
| 90 |
+
"type": "string"
|
| 91 |
+
}
|
| 92 |
+
},
|
| 93 |
+
"required": [
|
| 94 |
+
"Status"
|
| 95 |
+
],
|
| 96 |
+
"type": "object"
|
| 97 |
+
},
|
| 98 |
+
"Environment": {
|
| 99 |
+
"additionalProperties": false,
|
| 100 |
+
"properties": {
|
| 101 |
+
"Certificate": {
|
| 102 |
+
"type": "string"
|
| 103 |
+
},
|
| 104 |
+
"ComputeType": {
|
| 105 |
+
"enum": [
|
| 106 |
+
"ATTRIBUTE_BASED_COMPUTE",
|
| 107 |
+
"BUILD_GENERAL1_2XLARGE",
|
| 108 |
+
"BUILD_GENERAL1_LARGE",
|
| 109 |
+
"BUILD_GENERAL1_MEDIUM",
|
| 110 |
+
"BUILD_GENERAL1_SMALL",
|
| 111 |
+
"BUILD_GENERAL1_XLARGE",
|
| 112 |
+
"BUILD_LAMBDA_10GB",
|
| 113 |
+
"BUILD_LAMBDA_1GB",
|
| 114 |
+
"BUILD_LAMBDA_2GB",
|
| 115 |
+
"BUILD_LAMBDA_4GB",
|
| 116 |
+
"BUILD_LAMBDA_8GB"
|
| 117 |
+
],
|
| 118 |
+
"type": "string"
|
| 119 |
+
},
|
| 120 |
+
"EnvironmentVariables": {
|
| 121 |
+
"items": {
|
| 122 |
+
"$ref": "#/definitions/EnvironmentVariable"
|
| 123 |
+
},
|
| 124 |
+
"type": "array",
|
| 125 |
+
"uniqueItems": false
|
| 126 |
+
},
|
| 127 |
+
"Fleet": {
|
| 128 |
+
"$ref": "#/definitions/ProjectFleet"
|
| 129 |
+
},
|
| 130 |
+
"Image": {
|
| 131 |
+
"type": "string"
|
| 132 |
+
},
|
| 133 |
+
"ImagePullCredentialsType": {
|
| 134 |
+
"enum": [
|
| 135 |
+
"CODEBUILD",
|
| 136 |
+
"SERVICE_ROLE"
|
| 137 |
+
],
|
| 138 |
+
"type": "string"
|
| 139 |
+
},
|
| 140 |
+
"PrivilegedMode": {
|
| 141 |
+
"type": "boolean"
|
| 142 |
+
},
|
| 143 |
+
"RegistryCredential": {
|
| 144 |
+
"$ref": "#/definitions/RegistryCredential"
|
| 145 |
+
},
|
| 146 |
+
"Type": {
|
| 147 |
+
"enum": [
|
| 148 |
+
"ARM_CONTAINER",
|
| 149 |
+
"ARM_LAMBDA_CONTAINER",
|
| 150 |
+
"LINUX_CONTAINER",
|
| 151 |
+
"LINUX_GPU_CONTAINER",
|
| 152 |
+
"LINUX_LAMBDA_CONTAINER",
|
| 153 |
+
"MAC_ARM",
|
| 154 |
+
"WINDOWS_CONTAINER",
|
| 155 |
+
"WINDOWS_SERVER_2019_CONTAINER"
|
| 156 |
+
],
|
| 157 |
+
"type": "string"
|
| 158 |
+
}
|
| 159 |
+
},
|
| 160 |
+
"required": [
|
| 161 |
+
"Type",
|
| 162 |
+
"Image",
|
| 163 |
+
"ComputeType"
|
| 164 |
+
],
|
| 165 |
+
"type": "object"
|
| 166 |
+
},
|
| 167 |
+
"EnvironmentVariable": {
|
| 168 |
+
"additionalProperties": false,
|
| 169 |
+
"properties": {
|
| 170 |
+
"Name": {
|
| 171 |
+
"type": "string"
|
| 172 |
+
},
|
| 173 |
+
"Type": {
|
| 174 |
+
"type": "string"
|
| 175 |
+
},
|
| 176 |
+
"Value": {
|
| 177 |
+
"type": "string"
|
| 178 |
+
}
|
| 179 |
+
},
|
| 180 |
+
"required": [
|
| 181 |
+
"Value",
|
| 182 |
+
"Name"
|
| 183 |
+
],
|
| 184 |
+
"type": "object"
|
| 185 |
+
},
|
| 186 |
+
"FilterGroup": {
|
| 187 |
+
"type": "array"
|
| 188 |
+
},
|
| 189 |
+
"GitSubmodulesConfig": {
|
| 190 |
+
"additionalProperties": false,
|
| 191 |
+
"properties": {
|
| 192 |
+
"FetchSubmodules": {
|
| 193 |
+
"type": "boolean"
|
| 194 |
+
}
|
| 195 |
+
},
|
| 196 |
+
"required": [
|
| 197 |
+
"FetchSubmodules"
|
| 198 |
+
],
|
| 199 |
+
"type": "object"
|
| 200 |
+
},
|
| 201 |
+
"LogsConfig": {
|
| 202 |
+
"additionalProperties": false,
|
| 203 |
+
"properties": {
|
| 204 |
+
"CloudWatchLogs": {
|
| 205 |
+
"$ref": "#/definitions/CloudWatchLogsConfig"
|
| 206 |
+
},
|
| 207 |
+
"S3Logs": {
|
| 208 |
+
"$ref": "#/definitions/S3LogsConfig"
|
| 209 |
+
}
|
| 210 |
+
},
|
| 211 |
+
"type": "object"
|
| 212 |
+
},
|
| 213 |
+
"ProjectBuildBatchConfig": {
|
| 214 |
+
"additionalProperties": false,
|
| 215 |
+
"properties": {
|
| 216 |
+
"BatchReportMode": {
|
| 217 |
+
"type": "string"
|
| 218 |
+
},
|
| 219 |
+
"CombineArtifacts": {
|
| 220 |
+
"type": "boolean"
|
| 221 |
+
},
|
| 222 |
+
"Restrictions": {
|
| 223 |
+
"$ref": "#/definitions/BatchRestrictions"
|
| 224 |
+
},
|
| 225 |
+
"ServiceRole": {
|
| 226 |
+
"type": "string"
|
| 227 |
+
},
|
| 228 |
+
"TimeoutInMins": {
|
| 229 |
+
"type": "integer"
|
| 230 |
+
}
|
| 231 |
+
},
|
| 232 |
+
"type": "object"
|
| 233 |
+
},
|
| 234 |
+
"ProjectCache": {
|
| 235 |
+
"additionalProperties": false,
|
| 236 |
+
"properties": {
|
| 237 |
+
"Location": {
|
| 238 |
+
"type": "string"
|
| 239 |
+
},
|
| 240 |
+
"Modes": {
|
| 241 |
+
"items": {
|
| 242 |
+
"type": "string"
|
| 243 |
+
},
|
| 244 |
+
"type": "array",
|
| 245 |
+
"uniqueItems": false
|
| 246 |
+
},
|
| 247 |
+
"Type": {
|
| 248 |
+
"enum": [
|
| 249 |
+
"LOCAL",
|
| 250 |
+
"NO_CACHE",
|
| 251 |
+
"S3"
|
| 252 |
+
],
|
| 253 |
+
"type": "string"
|
| 254 |
+
}
|
| 255 |
+
},
|
| 256 |
+
"required": [
|
| 257 |
+
"Type"
|
| 258 |
+
],
|
| 259 |
+
"type": "object"
|
| 260 |
+
},
|
| 261 |
+
"ProjectFileSystemLocation": {
|
| 262 |
+
"additionalProperties": false,
|
| 263 |
+
"properties": {
|
| 264 |
+
"Identifier": {
|
| 265 |
+
"type": "string"
|
| 266 |
+
},
|
| 267 |
+
"Location": {
|
| 268 |
+
"type": "string"
|
| 269 |
+
},
|
| 270 |
+
"MountOptions": {
|
| 271 |
+
"type": "string"
|
| 272 |
+
},
|
| 273 |
+
"MountPoint": {
|
| 274 |
+
"type": "string"
|
| 275 |
+
},
|
| 276 |
+
"Type": {
|
| 277 |
+
"type": "string"
|
| 278 |
+
}
|
| 279 |
+
},
|
| 280 |
+
"required": [
|
| 281 |
+
"MountPoint",
|
| 282 |
+
"Type",
|
| 283 |
+
"Identifier",
|
| 284 |
+
"Location"
|
| 285 |
+
],
|
| 286 |
+
"type": "object"
|
| 287 |
+
},
|
| 288 |
+
"ProjectFleet": {
|
| 289 |
+
"additionalProperties": false,
|
| 290 |
+
"properties": {
|
| 291 |
+
"FleetArn": {
|
| 292 |
+
"type": "string"
|
| 293 |
+
}
|
| 294 |
+
},
|
| 295 |
+
"type": "object"
|
| 296 |
+
},
|
| 297 |
+
"ProjectSourceVersion": {
|
| 298 |
+
"additionalProperties": false,
|
| 299 |
+
"properties": {
|
| 300 |
+
"SourceIdentifier": {
|
| 301 |
+
"type": "string"
|
| 302 |
+
},
|
| 303 |
+
"SourceVersion": {
|
| 304 |
+
"type": "string"
|
| 305 |
+
}
|
| 306 |
+
},
|
| 307 |
+
"required": [
|
| 308 |
+
"SourceIdentifier"
|
| 309 |
+
],
|
| 310 |
+
"type": "object"
|
| 311 |
+
},
|
| 312 |
+
"ProjectTriggers": {
|
| 313 |
+
"additionalProperties": false,
|
| 314 |
+
"properties": {
|
| 315 |
+
"BuildType": {
|
| 316 |
+
"type": "string"
|
| 317 |
+
},
|
| 318 |
+
"FilterGroups": {
|
| 319 |
+
"items": {
|
| 320 |
+
"$ref": "#/definitions/FilterGroup"
|
| 321 |
+
},
|
| 322 |
+
"type": "array",
|
| 323 |
+
"uniqueItems": false
|
| 324 |
+
},
|
| 325 |
+
"Webhook": {
|
| 326 |
+
"type": "boolean"
|
| 327 |
+
}
|
| 328 |
+
},
|
| 329 |
+
"type": "object"
|
| 330 |
+
},
|
| 331 |
+
"RegistryCredential": {
|
| 332 |
+
"additionalProperties": false,
|
| 333 |
+
"properties": {
|
| 334 |
+
"Credential": {
|
| 335 |
+
"type": "string"
|
| 336 |
+
},
|
| 337 |
+
"CredentialProvider": {
|
| 338 |
+
"type": "string"
|
| 339 |
+
}
|
| 340 |
+
},
|
| 341 |
+
"required": [
|
| 342 |
+
"Credential",
|
| 343 |
+
"CredentialProvider"
|
| 344 |
+
],
|
| 345 |
+
"type": "object"
|
| 346 |
+
},
|
| 347 |
+
"S3LogsConfig": {
|
| 348 |
+
"additionalProperties": false,
|
| 349 |
+
"properties": {
|
| 350 |
+
"EncryptionDisabled": {
|
| 351 |
+
"type": "boolean"
|
| 352 |
+
},
|
| 353 |
+
"Location": {
|
| 354 |
+
"type": "string"
|
| 355 |
+
},
|
| 356 |
+
"Status": {
|
| 357 |
+
"type": "string"
|
| 358 |
+
}
|
| 359 |
+
},
|
| 360 |
+
"required": [
|
| 361 |
+
"Status"
|
| 362 |
+
],
|
| 363 |
+
"type": "object"
|
| 364 |
+
},
|
| 365 |
+
"Source": {
|
| 366 |
+
"additionalProperties": false,
|
| 367 |
+
"properties": {
|
| 368 |
+
"Auth": {
|
| 369 |
+
"$ref": "#/definitions/SourceAuth"
|
| 370 |
+
},
|
| 371 |
+
"BuildSpec": {
|
| 372 |
+
"type": "string"
|
| 373 |
+
},
|
| 374 |
+
"BuildStatusConfig": {
|
| 375 |
+
"$ref": "#/definitions/BuildStatusConfig"
|
| 376 |
+
},
|
| 377 |
+
"GitCloneDepth": {
|
| 378 |
+
"type": "integer"
|
| 379 |
+
},
|
| 380 |
+
"GitSubmodulesConfig": {
|
| 381 |
+
"$ref": "#/definitions/GitSubmodulesConfig"
|
| 382 |
+
},
|
| 383 |
+
"InsecureSsl": {
|
| 384 |
+
"type": "boolean"
|
| 385 |
+
},
|
| 386 |
+
"Location": {
|
| 387 |
+
"type": "string"
|
| 388 |
+
},
|
| 389 |
+
"ReportBuildStatus": {
|
| 390 |
+
"type": "boolean"
|
| 391 |
+
},
|
| 392 |
+
"SourceIdentifier": {
|
| 393 |
+
"type": "string"
|
| 394 |
+
},
|
| 395 |
+
"Type": {
|
| 396 |
+
"enum": [
|
| 397 |
+
"BITBUCKET",
|
| 398 |
+
"CODECOMMIT",
|
| 399 |
+
"CODEPIPELINE",
|
| 400 |
+
"GITHUB",
|
| 401 |
+
"GITHUB_ENTERPRISE",
|
| 402 |
+
"GITLAB",
|
| 403 |
+
"GITLAB_SELF_MANAGED",
|
| 404 |
+
"NO_SOURCE",
|
| 405 |
+
"S3"
|
| 406 |
+
],
|
| 407 |
+
"type": "string"
|
| 408 |
+
}
|
| 409 |
+
},
|
| 410 |
+
"required": [
|
| 411 |
+
"Type"
|
| 412 |
+
],
|
| 413 |
+
"type": "object"
|
| 414 |
+
},
|
| 415 |
+
"SourceAuth": {
|
| 416 |
+
"additionalProperties": false,
|
| 417 |
+
"properties": {
|
| 418 |
+
"Resource": {
|
| 419 |
+
"type": "string"
|
| 420 |
+
},
|
| 421 |
+
"Type": {
|
| 422 |
+
"type": "string"
|
| 423 |
+
}
|
| 424 |
+
},
|
| 425 |
+
"required": [
|
| 426 |
+
"Type"
|
| 427 |
+
],
|
| 428 |
+
"type": "object"
|
| 429 |
+
},
|
| 430 |
+
"Tag": {
|
| 431 |
+
"additionalProperties": false,
|
| 432 |
+
"properties": {
|
| 433 |
+
"Key": {
|
| 434 |
+
"type": "string"
|
| 435 |
+
},
|
| 436 |
+
"Value": {
|
| 437 |
+
"type": "string"
|
| 438 |
+
}
|
| 439 |
+
},
|
| 440 |
+
"required": [
|
| 441 |
+
"Value",
|
| 442 |
+
"Key"
|
| 443 |
+
],
|
| 444 |
+
"type": "object"
|
| 445 |
+
},
|
| 446 |
+
"VpcConfig": {
|
| 447 |
+
"additionalProperties": false,
|
| 448 |
+
"properties": {
|
| 449 |
+
"SecurityGroupIds": {
|
| 450 |
+
"format": "AWS::EC2::SecurityGroup.Ids",
|
| 451 |
+
"items": {
|
| 452 |
+
"format": "AWS::EC2::SecurityGroup.GroupId",
|
| 453 |
+
"type": "string"
|
| 454 |
+
},
|
| 455 |
+
"type": "array",
|
| 456 |
+
"uniqueItems": false
|
| 457 |
+
},
|
| 458 |
+
"Subnets": {
|
| 459 |
+
"format": "AWS::EC2::Subnet.Ids",
|
| 460 |
+
"items": {
|
| 461 |
+
"format": "AWS::EC2::Subnet.Id",
|
| 462 |
+
"type": "string"
|
| 463 |
+
},
|
| 464 |
+
"type": "array",
|
| 465 |
+
"uniqueItems": false
|
| 466 |
+
},
|
| 467 |
+
"VpcId": {
|
| 468 |
+
"format": "AWS::EC2::VPC.Id",
|
| 469 |
+
"type": "string"
|
| 470 |
+
}
|
| 471 |
+
},
|
| 472 |
+
"type": "object"
|
| 473 |
+
}
|
| 474 |
+
},
|
| 475 |
+
"primaryIdentifier": [
|
| 476 |
+
"/properties/Id"
|
| 477 |
+
],
|
| 478 |
+
"properties": {
|
| 479 |
+
"Arn": {
|
| 480 |
+
"type": "string"
|
| 481 |
+
},
|
| 482 |
+
"Artifacts": {
|
| 483 |
+
"$ref": "#/definitions/Artifacts"
|
| 484 |
+
},
|
| 485 |
+
"AutoRetryLimit": {
|
| 486 |
+
"type": "number"
|
| 487 |
+
},
|
| 488 |
+
"BadgeEnabled": {
|
| 489 |
+
"type": "boolean"
|
| 490 |
+
},
|
| 491 |
+
"BuildBatchConfig": {
|
| 492 |
+
"$ref": "#/definitions/ProjectBuildBatchConfig"
|
| 493 |
+
},
|
| 494 |
+
"Cache": {
|
| 495 |
+
"$ref": "#/definitions/ProjectCache"
|
| 496 |
+
},
|
| 497 |
+
"ConcurrentBuildLimit": {
|
| 498 |
+
"type": "integer"
|
| 499 |
+
},
|
| 500 |
+
"Description": {
|
| 501 |
+
"type": "string"
|
| 502 |
+
},
|
| 503 |
+
"EncryptionKey": {
|
| 504 |
+
"type": "string"
|
| 505 |
+
},
|
| 506 |
+
"Environment": {
|
| 507 |
+
"$ref": "#/definitions/Environment"
|
| 508 |
+
},
|
| 509 |
+
"FileSystemLocations": {
|
| 510 |
+
"items": {
|
| 511 |
+
"$ref": "#/definitions/ProjectFileSystemLocation"
|
| 512 |
+
},
|
| 513 |
+
"type": "array",
|
| 514 |
+
"uniqueItems": false
|
| 515 |
+
},
|
| 516 |
+
"Id": {
|
| 517 |
+
"type": "string"
|
| 518 |
+
},
|
| 519 |
+
"LogsConfig": {
|
| 520 |
+
"$ref": "#/definitions/LogsConfig"
|
| 521 |
+
},
|
| 522 |
+
"Name": {
|
| 523 |
+
"type": "string"
|
| 524 |
+
},
|
| 525 |
+
"QueuedTimeoutInMinutes": {
|
| 526 |
+
"maximum": 480,
|
| 527 |
+
"minimum": 5,
|
| 528 |
+
"type": "integer"
|
| 529 |
+
},
|
| 530 |
+
"ResourceAccessRole": {
|
| 531 |
+
"type": "string"
|
| 532 |
+
},
|
| 533 |
+
"SecondaryArtifacts": {
|
| 534 |
+
"items": {
|
| 535 |
+
"$ref": "#/definitions/Artifacts"
|
| 536 |
+
},
|
| 537 |
+
"type": "array",
|
| 538 |
+
"uniqueItems": false
|
| 539 |
+
},
|
| 540 |
+
"SecondarySourceVersions": {
|
| 541 |
+
"items": {
|
| 542 |
+
"$ref": "#/definitions/ProjectSourceVersion"
|
| 543 |
+
},
|
| 544 |
+
"type": "array",
|
| 545 |
+
"uniqueItems": false
|
| 546 |
+
},
|
| 547 |
+
"SecondarySources": {
|
| 548 |
+
"items": {
|
| 549 |
+
"$ref": "#/definitions/Source"
|
| 550 |
+
},
|
| 551 |
+
"type": "array",
|
| 552 |
+
"uniqueItems": false
|
| 553 |
+
},
|
| 554 |
+
"ServiceRole": {
|
| 555 |
+
"type": "string"
|
| 556 |
+
},
|
| 557 |
+
"Source": {
|
| 558 |
+
"$ref": "#/definitions/Source"
|
| 559 |
+
},
|
| 560 |
+
"SourceVersion": {
|
| 561 |
+
"type": "string"
|
| 562 |
+
},
|
| 563 |
+
"Tags": {
|
| 564 |
+
"items": {
|
| 565 |
+
"$ref": "#/definitions/Tag"
|
| 566 |
+
},
|
| 567 |
+
"type": "array",
|
| 568 |
+
"uniqueItems": false
|
| 569 |
+
},
|
| 570 |
+
"TimeoutInMinutes": {
|
| 571 |
+
"maximum": 480,
|
| 572 |
+
"minimum": 5,
|
| 573 |
+
"type": "integer"
|
| 574 |
+
},
|
| 575 |
+
"Triggers": {
|
| 576 |
+
"$ref": "#/definitions/ProjectTriggers"
|
| 577 |
+
},
|
| 578 |
+
"Visibility": {
|
| 579 |
+
"type": "string"
|
| 580 |
+
},
|
| 581 |
+
"VpcConfig": {
|
| 582 |
+
"$ref": "#/definitions/VpcConfig"
|
| 583 |
+
}
|
| 584 |
+
},
|
| 585 |
+
"readOnlyProperties": [
|
| 586 |
+
"/properties/Id",
|
| 587 |
+
"/properties/Arn"
|
| 588 |
+
],
|
| 589 |
+
"required": [
|
| 590 |
+
"Artifacts",
|
| 591 |
+
"ServiceRole",
|
| 592 |
+
"Environment",
|
| 593 |
+
"Source"
|
| 594 |
+
],
|
| 595 |
+
"typeName": "AWS::CodeBuild::Project"
|
| 596 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-codepipeline-customactiontype.json
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/ConfigurationProperties",
|
| 5 |
+
"/properties/Version",
|
| 6 |
+
"/properties/OutputArtifactDetails",
|
| 7 |
+
"/properties/InputArtifactDetails",
|
| 8 |
+
"/properties/Settings",
|
| 9 |
+
"/properties/Provider",
|
| 10 |
+
"/properties/Category"
|
| 11 |
+
],
|
| 12 |
+
"definitions": {
|
| 13 |
+
"ArtifactDetails": {
|
| 14 |
+
"additionalProperties": false,
|
| 15 |
+
"properties": {
|
| 16 |
+
"MaximumCount": {
|
| 17 |
+
"type": "integer"
|
| 18 |
+
},
|
| 19 |
+
"MinimumCount": {
|
| 20 |
+
"type": "integer"
|
| 21 |
+
}
|
| 22 |
+
},
|
| 23 |
+
"required": [
|
| 24 |
+
"MinimumCount",
|
| 25 |
+
"MaximumCount"
|
| 26 |
+
],
|
| 27 |
+
"type": "object"
|
| 28 |
+
},
|
| 29 |
+
"ConfigurationProperties": {
|
| 30 |
+
"additionalProperties": false,
|
| 31 |
+
"properties": {
|
| 32 |
+
"Description": {
|
| 33 |
+
"type": "string"
|
| 34 |
+
},
|
| 35 |
+
"Key": {
|
| 36 |
+
"type": "boolean"
|
| 37 |
+
},
|
| 38 |
+
"Name": {
|
| 39 |
+
"type": "string"
|
| 40 |
+
},
|
| 41 |
+
"Queryable": {
|
| 42 |
+
"type": "boolean"
|
| 43 |
+
},
|
| 44 |
+
"Required": {
|
| 45 |
+
"type": "boolean"
|
| 46 |
+
},
|
| 47 |
+
"Secret": {
|
| 48 |
+
"type": "boolean"
|
| 49 |
+
},
|
| 50 |
+
"Type": {
|
| 51 |
+
"enum": [
|
| 52 |
+
"Boolean",
|
| 53 |
+
"Number",
|
| 54 |
+
"String"
|
| 55 |
+
],
|
| 56 |
+
"type": "string"
|
| 57 |
+
}
|
| 58 |
+
},
|
| 59 |
+
"required": [
|
| 60 |
+
"Secret",
|
| 61 |
+
"Required",
|
| 62 |
+
"Key",
|
| 63 |
+
"Name"
|
| 64 |
+
],
|
| 65 |
+
"type": "object"
|
| 66 |
+
},
|
| 67 |
+
"Settings": {
|
| 68 |
+
"additionalProperties": false,
|
| 69 |
+
"properties": {
|
| 70 |
+
"EntityUrlTemplate": {
|
| 71 |
+
"type": "string"
|
| 72 |
+
},
|
| 73 |
+
"ExecutionUrlTemplate": {
|
| 74 |
+
"type": "string"
|
| 75 |
+
},
|
| 76 |
+
"RevisionUrlTemplate": {
|
| 77 |
+
"type": "string"
|
| 78 |
+
},
|
| 79 |
+
"ThirdPartyConfigurationUrl": {
|
| 80 |
+
"type": "string"
|
| 81 |
+
}
|
| 82 |
+
},
|
| 83 |
+
"type": "object"
|
| 84 |
+
}
|
| 85 |
+
},
|
| 86 |
+
"primaryIdentifier": [
|
| 87 |
+
"/properties/Id"
|
| 88 |
+
],
|
| 89 |
+
"properties": {
|
| 90 |
+
"Category": {
|
| 91 |
+
"enum": [
|
| 92 |
+
"Approval",
|
| 93 |
+
"Build",
|
| 94 |
+
"Compute",
|
| 95 |
+
"Deploy",
|
| 96 |
+
"Invoke",
|
| 97 |
+
"Source",
|
| 98 |
+
"Test"
|
| 99 |
+
],
|
| 100 |
+
"type": "string"
|
| 101 |
+
},
|
| 102 |
+
"ConfigurationProperties": {
|
| 103 |
+
"items": {
|
| 104 |
+
"$ref": "#/definitions/ConfigurationProperties"
|
| 105 |
+
},
|
| 106 |
+
"type": "array",
|
| 107 |
+
"uniqueItems": false
|
| 108 |
+
},
|
| 109 |
+
"Id": {
|
| 110 |
+
"type": "string"
|
| 111 |
+
},
|
| 112 |
+
"InputArtifactDetails": {
|
| 113 |
+
"$ref": "#/definitions/ArtifactDetails"
|
| 114 |
+
},
|
| 115 |
+
"OutputArtifactDetails": {
|
| 116 |
+
"$ref": "#/definitions/ArtifactDetails"
|
| 117 |
+
},
|
| 118 |
+
"Provider": {
|
| 119 |
+
"pattern": "[0-9A-Za-z_-]+",
|
| 120 |
+
"type": "string"
|
| 121 |
+
},
|
| 122 |
+
"Settings": {
|
| 123 |
+
"$ref": "#/definitions/Settings"
|
| 124 |
+
},
|
| 125 |
+
"Version": {
|
| 126 |
+
"pattern": "[0-9A-Za-z_-]+",
|
| 127 |
+
"type": "string"
|
| 128 |
+
}
|
| 129 |
+
},
|
| 130 |
+
"readOnlyProperties": [
|
| 131 |
+
"/properties/Id"
|
| 132 |
+
],
|
| 133 |
+
"required": [
|
| 134 |
+
"Category",
|
| 135 |
+
"InputArtifactDetails",
|
| 136 |
+
"OutputArtifactDetails",
|
| 137 |
+
"Provider"
|
| 138 |
+
],
|
| 139 |
+
"typeName": "AWS::CodePipeline::CustomActionType"
|
| 140 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-config-aggregationauthorization.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/AuthorizedAwsRegion",
|
| 5 |
+
"/properties/AuthorizedAccountId"
|
| 6 |
+
],
|
| 7 |
+
"definitions": {
|
| 8 |
+
"Tag": {
|
| 9 |
+
"additionalProperties": false,
|
| 10 |
+
"properties": {
|
| 11 |
+
"Key": {
|
| 12 |
+
"type": "string"
|
| 13 |
+
},
|
| 14 |
+
"Value": {
|
| 15 |
+
"type": "string"
|
| 16 |
+
}
|
| 17 |
+
},
|
| 18 |
+
"required": [
|
| 19 |
+
"Value",
|
| 20 |
+
"Key"
|
| 21 |
+
],
|
| 22 |
+
"type": "object"
|
| 23 |
+
}
|
| 24 |
+
},
|
| 25 |
+
"primaryIdentifier": [
|
| 26 |
+
"/properties/Id"
|
| 27 |
+
],
|
| 28 |
+
"properties": {
|
| 29 |
+
"AuthorizedAccountId": {
|
| 30 |
+
"type": "string"
|
| 31 |
+
},
|
| 32 |
+
"AuthorizedAwsRegion": {
|
| 33 |
+
"type": "string"
|
| 34 |
+
},
|
| 35 |
+
"Id": {
|
| 36 |
+
"type": "string"
|
| 37 |
+
},
|
| 38 |
+
"Tags": {
|
| 39 |
+
"items": {
|
| 40 |
+
"$ref": "#/definitions/Tag"
|
| 41 |
+
},
|
| 42 |
+
"type": "array",
|
| 43 |
+
"uniqueItems": false
|
| 44 |
+
}
|
| 45 |
+
},
|
| 46 |
+
"readOnlyProperties": [
|
| 47 |
+
"/properties/Id"
|
| 48 |
+
],
|
| 49 |
+
"required": [
|
| 50 |
+
"AuthorizedAccountId",
|
| 51 |
+
"AuthorizedAwsRegion"
|
| 52 |
+
],
|
| 53 |
+
"typeName": "AWS::Config::AggregationAuthorization"
|
| 54 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-config-configrule.json
ADDED
|
@@ -0,0 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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/ConfigRuleName"
|
| 5 |
+
],
|
| 6 |
+
"definitions": {
|
| 7 |
+
"CustomPolicyDetails": {
|
| 8 |
+
"additionalProperties": false,
|
| 9 |
+
"properties": {
|
| 10 |
+
"EnableDebugLogDelivery": {
|
| 11 |
+
"type": "boolean"
|
| 12 |
+
},
|
| 13 |
+
"PolicyRuntime": {
|
| 14 |
+
"type": "string"
|
| 15 |
+
},
|
| 16 |
+
"PolicyText": {
|
| 17 |
+
"type": "string"
|
| 18 |
+
}
|
| 19 |
+
},
|
| 20 |
+
"type": "object"
|
| 21 |
+
},
|
| 22 |
+
"EvaluationModeConfiguration": {
|
| 23 |
+
"additionalProperties": false,
|
| 24 |
+
"properties": {
|
| 25 |
+
"Mode": {
|
| 26 |
+
"type": "string"
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"type": "object"
|
| 30 |
+
},
|
| 31 |
+
"Scope": {
|
| 32 |
+
"additionalProperties": false,
|
| 33 |
+
"properties": {
|
| 34 |
+
"ComplianceResourceId": {
|
| 35 |
+
"type": "string"
|
| 36 |
+
},
|
| 37 |
+
"ComplianceResourceTypes": {
|
| 38 |
+
"items": {
|
| 39 |
+
"type": "string"
|
| 40 |
+
},
|
| 41 |
+
"type": "array",
|
| 42 |
+
"uniqueItems": true
|
| 43 |
+
},
|
| 44 |
+
"TagKey": {
|
| 45 |
+
"type": "string"
|
| 46 |
+
},
|
| 47 |
+
"TagValue": {
|
| 48 |
+
"type": "string"
|
| 49 |
+
}
|
| 50 |
+
},
|
| 51 |
+
"type": "object"
|
| 52 |
+
},
|
| 53 |
+
"Source": {
|
| 54 |
+
"additionalProperties": false,
|
| 55 |
+
"properties": {
|
| 56 |
+
"CustomPolicyDetails": {
|
| 57 |
+
"$ref": "#/definitions/CustomPolicyDetails"
|
| 58 |
+
},
|
| 59 |
+
"Owner": {
|
| 60 |
+
"enum": [
|
| 61 |
+
"AWS",
|
| 62 |
+
"CUSTOM_LAMBDA",
|
| 63 |
+
"CUSTOM_POLICY"
|
| 64 |
+
],
|
| 65 |
+
"type": "string"
|
| 66 |
+
},
|
| 67 |
+
"SourceDetails": {
|
| 68 |
+
"items": {
|
| 69 |
+
"$ref": "#/definitions/SourceDetail"
|
| 70 |
+
},
|
| 71 |
+
"type": "array",
|
| 72 |
+
"uniqueItems": true
|
| 73 |
+
},
|
| 74 |
+
"SourceIdentifier": {
|
| 75 |
+
"type": "string"
|
| 76 |
+
}
|
| 77 |
+
},
|
| 78 |
+
"required": [
|
| 79 |
+
"Owner"
|
| 80 |
+
],
|
| 81 |
+
"type": "object"
|
| 82 |
+
},
|
| 83 |
+
"SourceDetail": {
|
| 84 |
+
"additionalProperties": false,
|
| 85 |
+
"properties": {
|
| 86 |
+
"EventSource": {
|
| 87 |
+
"enum": [
|
| 88 |
+
"aws.config"
|
| 89 |
+
],
|
| 90 |
+
"type": "string"
|
| 91 |
+
},
|
| 92 |
+
"MaximumExecutionFrequency": {
|
| 93 |
+
"enum": [
|
| 94 |
+
"One_Hour",
|
| 95 |
+
"Six_Hours",
|
| 96 |
+
"Three_Hours",
|
| 97 |
+
"Twelve_Hours",
|
| 98 |
+
"TwentyFour_Hours"
|
| 99 |
+
],
|
| 100 |
+
"type": "string"
|
| 101 |
+
},
|
| 102 |
+
"MessageType": {
|
| 103 |
+
"enum": [
|
| 104 |
+
"ConfigurationItemChangeNotification",
|
| 105 |
+
"ConfigurationSnapshotDeliveryCompleted",
|
| 106 |
+
"OversizedConfigurationItemChangeNotification",
|
| 107 |
+
"ScheduledNotification"
|
| 108 |
+
],
|
| 109 |
+
"type": "string"
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"required": [
|
| 113 |
+
"EventSource",
|
| 114 |
+
"MessageType"
|
| 115 |
+
],
|
| 116 |
+
"type": "object"
|
| 117 |
+
}
|
| 118 |
+
},
|
| 119 |
+
"primaryIdentifier": [
|
| 120 |
+
"/properties/ConfigRuleId"
|
| 121 |
+
],
|
| 122 |
+
"properties": {
|
| 123 |
+
"Arn": {
|
| 124 |
+
"type": "string"
|
| 125 |
+
},
|
| 126 |
+
"Compliance": {
|
| 127 |
+
"properties": {
|
| 128 |
+
"Type": {
|
| 129 |
+
"type": "string"
|
| 130 |
+
}
|
| 131 |
+
},
|
| 132 |
+
"type": "object"
|
| 133 |
+
},
|
| 134 |
+
"ConfigRuleId": {
|
| 135 |
+
"type": "string"
|
| 136 |
+
},
|
| 137 |
+
"ConfigRuleName": {
|
| 138 |
+
"type": "string"
|
| 139 |
+
},
|
| 140 |
+
"Description": {
|
| 141 |
+
"maxLength": 256,
|
| 142 |
+
"minLength": 1,
|
| 143 |
+
"type": "string"
|
| 144 |
+
},
|
| 145 |
+
"EvaluationModes": {
|
| 146 |
+
"items": {
|
| 147 |
+
"$ref": "#/definitions/EvaluationModeConfiguration"
|
| 148 |
+
},
|
| 149 |
+
"type": "array",
|
| 150 |
+
"uniqueItems": true
|
| 151 |
+
},
|
| 152 |
+
"InputParameters": {
|
| 153 |
+
"format": "json",
|
| 154 |
+
"type": [
|
| 155 |
+
"object",
|
| 156 |
+
"string"
|
| 157 |
+
]
|
| 158 |
+
},
|
| 159 |
+
"MaximumExecutionFrequency": {
|
| 160 |
+
"type": "string"
|
| 161 |
+
},
|
| 162 |
+
"Scope": {
|
| 163 |
+
"$ref": "#/definitions/Scope"
|
| 164 |
+
},
|
| 165 |
+
"Source": {
|
| 166 |
+
"$ref": "#/definitions/Source"
|
| 167 |
+
}
|
| 168 |
+
},
|
| 169 |
+
"readOnlyProperties": [
|
| 170 |
+
"/properties/ConfigRuleId",
|
| 171 |
+
"/properties/Compliance/Type",
|
| 172 |
+
"/properties/Arn"
|
| 173 |
+
],
|
| 174 |
+
"required": [
|
| 175 |
+
"Source"
|
| 176 |
+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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/Name",
|
| 5 |
+
"/properties/Description"
|
| 6 |
+
],
|
| 7 |
+
"definitions": {
|
| 8 |
+
"Field": {
|
| 9 |
+
"additionalProperties": false,
|
| 10 |
+
"properties": {
|
| 11 |
+
"Key": {
|
| 12 |
+
"type": "string"
|
| 13 |
+
},
|
| 14 |
+
"RefValue": {
|
| 15 |
+
"type": "string"
|
| 16 |
+
},
|
| 17 |
+
"StringValue": {
|
| 18 |
+
"type": "string"
|
| 19 |
+
}
|
| 20 |
+
},
|
| 21 |
+
"required": [
|
| 22 |
+
"Key"
|
| 23 |
+
],
|
| 24 |
+
"type": "object"
|
| 25 |
+
},
|
| 26 |
+
"ParameterAttribute": {
|
| 27 |
+
"additionalProperties": false,
|
| 28 |
+
"properties": {
|
| 29 |
+
"Key": {
|
| 30 |
+
"type": "string"
|
| 31 |
+
},
|
| 32 |
+
"StringValue": {
|
| 33 |
+
"type": "string"
|
| 34 |
+
}
|
| 35 |
+
},
|
| 36 |
+
"required": [
|
| 37 |
+
"StringValue",
|
| 38 |
+
"Key"
|
| 39 |
+
],
|
| 40 |
+
"type": "object"
|
| 41 |
+
},
|
| 42 |
+
"ParameterObject": {
|
| 43 |
+
"additionalProperties": false,
|
| 44 |
+
"properties": {
|
| 45 |
+
"Attributes": {
|
| 46 |
+
"items": {
|
| 47 |
+
"$ref": "#/definitions/ParameterAttribute"
|
| 48 |
+
},
|
| 49 |
+
"type": "array",
|
| 50 |
+
"uniqueItems": false
|
| 51 |
+
},
|
| 52 |
+
"Id": {
|
| 53 |
+
"type": "string"
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"required": [
|
| 57 |
+
"Attributes",
|
| 58 |
+
"Id"
|
| 59 |
+
],
|
| 60 |
+
"type": "object"
|
| 61 |
+
},
|
| 62 |
+
"ParameterValue": {
|
| 63 |
+
"additionalProperties": false,
|
| 64 |
+
"properties": {
|
| 65 |
+
"Id": {
|
| 66 |
+
"type": "string"
|
| 67 |
+
},
|
| 68 |
+
"StringValue": {
|
| 69 |
+
"type": "string"
|
| 70 |
+
}
|
| 71 |
+
},
|
| 72 |
+
"required": [
|
| 73 |
+
"Id",
|
| 74 |
+
"StringValue"
|
| 75 |
+
],
|
| 76 |
+
"type": "object"
|
| 77 |
+
},
|
| 78 |
+
"PipelineObject": {
|
| 79 |
+
"additionalProperties": false,
|
| 80 |
+
"properties": {
|
| 81 |
+
"Fields": {
|
| 82 |
+
"items": {
|
| 83 |
+
"$ref": "#/definitions/Field"
|
| 84 |
+
},
|
| 85 |
+
"type": "array",
|
| 86 |
+
"uniqueItems": false
|
| 87 |
+
},
|
| 88 |
+
"Id": {
|
| 89 |
+
"type": "string"
|
| 90 |
+
},
|
| 91 |
+
"Name": {
|
| 92 |
+
"type": "string"
|
| 93 |
+
}
|
| 94 |
+
},
|
| 95 |
+
"required": [
|
| 96 |
+
"Fields",
|
| 97 |
+
"Id",
|
| 98 |
+
"Name"
|
| 99 |
+
],
|
| 100 |
+
"type": "object"
|
| 101 |
+
},
|
| 102 |
+
"PipelineTag": {
|
| 103 |
+
"additionalProperties": false,
|
| 104 |
+
"properties": {
|
| 105 |
+
"Key": {
|
| 106 |
+
"type": "string"
|
| 107 |
+
},
|
| 108 |
+
"Value": {
|
| 109 |
+
"type": "string"
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"required": [
|
| 113 |
+
"Value",
|
| 114 |
+
"Key"
|
| 115 |
+
],
|
| 116 |
+
"type": "object"
|
| 117 |
+
}
|
| 118 |
+
},
|
| 119 |
+
"primaryIdentifier": [
|
| 120 |
+
"/properties/Id"
|
| 121 |
+
],
|
| 122 |
+
"properties": {
|
| 123 |
+
"Activate": {
|
| 124 |
+
"type": "boolean"
|
| 125 |
+
},
|
| 126 |
+
"Description": {
|
| 127 |
+
"type": "string"
|
| 128 |
+
},
|
| 129 |
+
"Id": {
|
| 130 |
+
"type": "string"
|
| 131 |
+
},
|
| 132 |
+
"Name": {
|
| 133 |
+
"type": "string"
|
| 134 |
+
},
|
| 135 |
+
"ParameterObjects": {
|
| 136 |
+
"items": {
|
| 137 |
+
"$ref": "#/definitions/ParameterObject"
|
| 138 |
+
},
|
| 139 |
+
"type": "array",
|
| 140 |
+
"uniqueItems": false
|
| 141 |
+
},
|
| 142 |
+
"ParameterValues": {
|
| 143 |
+
"items": {
|
| 144 |
+
"$ref": "#/definitions/ParameterValue"
|
| 145 |
+
},
|
| 146 |
+
"type": "array",
|
| 147 |
+
"uniqueItems": false
|
| 148 |
+
},
|
| 149 |
+
"PipelineObjects": {
|
| 150 |
+
"items": {
|
| 151 |
+
"$ref": "#/definitions/PipelineObject"
|
| 152 |
+
},
|
| 153 |
+
"type": "array",
|
| 154 |
+
"uniqueItems": false
|
| 155 |
+
},
|
| 156 |
+
"PipelineTags": {
|
| 157 |
+
"items": {
|
| 158 |
+
"$ref": "#/definitions/PipelineTag"
|
| 159 |
+
},
|
| 160 |
+
"type": "array",
|
| 161 |
+
"uniqueItems": false
|
| 162 |
+
}
|
| 163 |
+
},
|
| 164 |
+
"readOnlyProperties": [
|
| 165 |
+
"/properties/Id"
|
| 166 |
+
],
|
| 167 |
+
"required": [
|
| 168 |
+
"ParameterObjects",
|
| 169 |
+
"Name"
|
| 170 |
+
],
|
| 171 |
+
"typeName": "AWS::DataPipeline::Pipeline"
|
| 172 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-directoryservice-simplead.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/Size",
|
| 5 |
+
"/properties/VpcSettings",
|
| 6 |
+
"/properties/Name",
|
| 7 |
+
"/properties/Password",
|
| 8 |
+
"/properties/ShortName",
|
| 9 |
+
"/properties/Description",
|
| 10 |
+
"/properties/CreateAlias"
|
| 11 |
+
],
|
| 12 |
+
"definitions": {
|
| 13 |
+
"VpcSettings": {
|
| 14 |
+
"additionalProperties": false,
|
| 15 |
+
"properties": {
|
| 16 |
+
"SubnetIds": {
|
| 17 |
+
"items": {
|
| 18 |
+
"pattern": "^(subnet-[0-9a-f]{8}|subnet-[0-9a-f]{17})$",
|
| 19 |
+
"type": "string"
|
| 20 |
+
},
|
| 21 |
+
"type": "array",
|
| 22 |
+
"uniqueItems": true
|
| 23 |
+
},
|
| 24 |
+
"VpcId": {
|
| 25 |
+
"format": "AWS::EC2::VPC.Id",
|
| 26 |
+
"pattern": "^(vpc-[0-9a-f]{8}|vpc-[0-9a-f]{17})$",
|
| 27 |
+
"type": "string"
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"required": [
|
| 31 |
+
"VpcId",
|
| 32 |
+
"SubnetIds"
|
| 33 |
+
],
|
| 34 |
+
"type": "object"
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
"primaryIdentifier": [
|
| 38 |
+
"/properties/Id"
|
| 39 |
+
],
|
| 40 |
+
"properties": {
|
| 41 |
+
"Alias": {
|
| 42 |
+
"type": "string"
|
| 43 |
+
},
|
| 44 |
+
"CreateAlias": {
|
| 45 |
+
"type": "boolean"
|
| 46 |
+
},
|
| 47 |
+
"Description": {
|
| 48 |
+
"pattern": "^([a-zA-Z0-9_])[\\\\a-zA-Z0-9_@#%*+=:?./!\\s-]*$",
|
| 49 |
+
"type": "string"
|
| 50 |
+
},
|
| 51 |
+
"DnsIpAddresses": {
|
| 52 |
+
"items": {
|
| 53 |
+
"type": "string"
|
| 54 |
+
},
|
| 55 |
+
"type": "array",
|
| 56 |
+
"uniqueItems": false
|
| 57 |
+
},
|
| 58 |
+
"EnableSso": {
|
| 59 |
+
"type": "boolean"
|
| 60 |
+
},
|
| 61 |
+
"Id": {
|
| 62 |
+
"type": "string"
|
| 63 |
+
},
|
| 64 |
+
"Name": {
|
| 65 |
+
"pattern": "^([a-zA-Z0-9]+[\\\\.-])+([a-zA-Z0-9])+$",
|
| 66 |
+
"type": "string"
|
| 67 |
+
},
|
| 68 |
+
"Password": {
|
| 69 |
+
"pattern": "(?=^.{8,64}$)((?=.*\\d)(?=.*[A-Z])(?=.*[a-z])|(?=.*\\d)(?=.*[^A-Za-z0-9\\s])(?=.*[a-z])|(?=.*[^A-Za-z0-9\\s])(?=.*[A-Z])(?=.*[a-z])|(?=.*\\d)(?=.*[A-Z])(?=.*[^A-Za-z0-9\\s]))^.*",
|
| 70 |
+
"type": "string"
|
| 71 |
+
},
|
| 72 |
+
"ShortName": {
|
| 73 |
+
"pattern": "^[^\\\\/:*?\"<>|.]+[^\\\\/:*?\"<>|]*$",
|
| 74 |
+
"type": "string"
|
| 75 |
+
},
|
| 76 |
+
"Size": {
|
| 77 |
+
"enum": [
|
| 78 |
+
"Large",
|
| 79 |
+
"Small"
|
| 80 |
+
],
|
| 81 |
+
"type": "string"
|
| 82 |
+
},
|
| 83 |
+
"VpcSettings": {
|
| 84 |
+
"$ref": "#/definitions/VpcSettings"
|
| 85 |
+
}
|
| 86 |
+
},
|
| 87 |
+
"readOnlyProperties": [
|
| 88 |
+
"/properties/Alias",
|
| 89 |
+
"/properties/DnsIpAddresses",
|
| 90 |
+
"/properties/Id"
|
| 91 |
+
],
|
| 92 |
+
"required": [
|
| 93 |
+
"VpcSettings",
|
| 94 |
+
"Size",
|
| 95 |
+
"Name",
|
| 96 |
+
"Password"
|
| 97 |
+
],
|
| 98 |
+
"typeName": "AWS::DirectoryService::SimpleAD"
|
| 99 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-docdb-dbclusterparametergroup.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/Family",
|
| 5 |
+
"/properties/Name",
|
| 6 |
+
"/properties/Description"
|
| 7 |
+
],
|
| 8 |
+
"definitions": {
|
| 9 |
+
"Tag": {
|
| 10 |
+
"additionalProperties": false,
|
| 11 |
+
"properties": {
|
| 12 |
+
"Key": {
|
| 13 |
+
"type": "string"
|
| 14 |
+
},
|
| 15 |
+
"Value": {
|
| 16 |
+
"type": "string"
|
| 17 |
+
}
|
| 18 |
+
},
|
| 19 |
+
"required": [
|
| 20 |
+
"Value",
|
| 21 |
+
"Key"
|
| 22 |
+
],
|
| 23 |
+
"type": "object"
|
| 24 |
+
}
|
| 25 |
+
},
|
| 26 |
+
"primaryIdentifier": [
|
| 27 |
+
"/properties/Id"
|
| 28 |
+
],
|
| 29 |
+
"properties": {
|
| 30 |
+
"Description": {
|
| 31 |
+
"type": "string"
|
| 32 |
+
},
|
| 33 |
+
"Family": {
|
| 34 |
+
"type": "string"
|
| 35 |
+
},
|
| 36 |
+
"Id": {
|
| 37 |
+
"type": "string"
|
| 38 |
+
},
|
| 39 |
+
"Name": {
|
| 40 |
+
"type": "string"
|
| 41 |
+
},
|
| 42 |
+
"Parameters": {
|
| 43 |
+
"format": "json",
|
| 44 |
+
"type": [
|
| 45 |
+
"object",
|
| 46 |
+
"string"
|
| 47 |
+
]
|
| 48 |
+
},
|
| 49 |
+
"Tags": {
|
| 50 |
+
"items": {
|
| 51 |
+
"$ref": "#/definitions/Tag"
|
| 52 |
+
},
|
| 53 |
+
"type": "array",
|
| 54 |
+
"uniqueItems": false
|
| 55 |
+
}
|
| 56 |
+
},
|
| 57 |
+
"readOnlyProperties": [
|
| 58 |
+
"/properties/Id"
|
| 59 |
+
],
|
| 60 |
+
"required": [
|
| 61 |
+
"Description",
|
| 62 |
+
"Parameters",
|
| 63 |
+
"Family"
|
| 64 |
+
],
|
| 65 |
+
"typeName": "AWS::DocDB::DBClusterParameterGroup"
|
| 66 |
+
}
|
testbed/aws-cloudformation__cfn-lint/src/cfnlint/data/schemas/providers/us_gov_east_1/aws-ec2-clientvpnauthorizationrule.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additionalProperties": false,
|
| 3 |
+
"createOnlyProperties": [
|
| 4 |
+
"/properties/ClientVpnEndpointId",
|
| 5 |
+
"/properties/AccessGroupId",
|
| 6 |
+
"/properties/TargetNetworkCidr",
|
| 7 |
+
"/properties/AuthorizeAllGroups",
|
| 8 |
+
"/properties/Description"
|
| 9 |
+
],
|
| 10 |
+
"primaryIdentifier": [
|
| 11 |
+
"/properties/Id"
|
| 12 |
+
],
|
| 13 |
+
"properties": {
|
| 14 |
+
"AccessGroupId": {
|
| 15 |
+
"type": "string"
|
| 16 |
+
},
|
| 17 |
+
"AuthorizeAllGroups": {
|
| 18 |
+
"type": "boolean"
|
| 19 |
+
},
|
| 20 |
+
"ClientVpnEndpointId": {
|
| 21 |
+
"type": "string"
|
| 22 |
+
},
|
| 23 |
+
"Description": {
|
| 24 |
+
"type": "string"
|
| 25 |
+
},
|
| 26 |
+
"Id": {
|
| 27 |
+
"type": "string"
|
| 28 |
+
},
|
| 29 |
+
"TargetNetworkCidr": {
|
| 30 |
+
"type": "string"
|
| 31 |
+
}
|
| 32 |
+
},
|
| 33 |
+
"readOnlyProperties": [
|
| 34 |
+
"/properties/Id"
|
| 35 |
+
],
|
| 36 |
+
"required": [
|
| 37 |
+
"ClientVpnEndpointId",
|
| 38 |
+
"TargetNetworkCidr"
|
| 39 |
+
],
|
| 40 |
+
"typeName": "AWS::EC2::ClientVpnAuthorizationRule"
|
| 41 |
+
}
|