Skip to content

Commit 67603ea

Browse files
sgathiliammokhov
andauthored
Add classifiers to setup.py (#23)
* Add classifiers to setup.py * Modified Docs --------- Co-authored-by: Anton Mokhovikov <ammokhov@amazon.com>
1 parent 6301dae commit 67603ea

File tree

10 files changed

+159
-43
lines changed

10 files changed

+159
-43
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,11 @@ pre-commit run --all-files
7070
## License
7171

7272
This project is licensed under the Apache-2.0 License.
73+
74+
## Community
75+
76+
Join us on Discord! Connect & interact with CloudFormation developers &
77+
experts, find channels to discuss and get help for our CLI, cfn-lint, CloudFormation registry, StackSets,
78+
Guard and more:
79+
80+
[![Join our Discord](https://discordapp.com/api/guilds/981586120448020580/widget.png?style=banner3)](https://discord.gg/9zpd7TTRwq)

docs/BASIC_LINTING.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,65 @@
11
# CloudFormation - Resource Schema Guard Rail
22
## Basic Linting
3+
### Library
4+
#### Arn Related
5+
| Rule Name | Check Id | Message |
6+
|----------|-------------|------|
7+
| `ensure_arn_properties_type_string` | `ARN001` | `"arn related property MUST have pattern specified"` |
8+
| `ensure_arn_properties_contain_pattern` | `ARN002` | `"arn related property MUST have pattern specified"` |
39

4-
// TODO
10+
#### Property Related CloudFormation Construct
11+
| Rule Name | Check Id | Message |
12+
|----------|-------------|------|
13+
| `ensure_primary_identifier_exists_and_not_empty` | `PID001` | `"primaryIdentifier MUST exist"` |
14+
| | `PID002` | `"primaryIdentifier MUST contain values"` |
15+
| `ensure_primary_identifier_is_read_or_create_only` | `PID003` | `"primaryIdentifier MUST be either readOnly or createOnly"` |
16+
| `ensure_create_and_read_only_intersection_is_empty` | `PR001` | `"read/createOnlyProperties MUST NOT have common properties"` |
17+
| | `PR002` | `"create/readOnlyProperties MUST NOT have common properties"` |
18+
| `ensure_write_and_read_only_intersection_is_empty` | `PR003` | `"read/writeOnlyProperties MUST NOT have common properties"` |
19+
| | `PR004` | `"write/readOnlyProperties MUST NOT have common properties"` |
20+
21+
#### Combiners
22+
| Rule Name | Check Id | Message |
23+
|----------|-------------|------|
24+
| `ensure_properties_do_not_support_multitype` | `COM001` | `"each property MUST specify type"` |
25+
| | `COM002` | `"type MUST NOT have combined types` |
26+
| | `COM003` | `"property array MUST be modeled via items` |
27+
| | `COM004` | `"property array MUST NOT specify items via anyOf` |
28+
| | `COM005` | `"property array MUST NOT specify items via allOf` |
29+
| | `COM006` | `"property array MUST NOT specify items via oneOf` |
30+
31+
#### Tagging
32+
| Rule Name | Check Id | Message |
33+
|----------|-------------|------|
34+
| `check_if_taggable_is_used` | `TAG001` | `"'taggable' is deprecated, please used 'tagging' property"` |
35+
| `ensure_tagging_is_specified` | `TAG002` | `"'tagging' MUST be specified"` |
36+
| `ensure_taggable_and_tagging_do_not_coexist` | `TAG003` | `"'taggable' and 'tagging' MUST NOT coexist"` |
37+
| `ensure_property_tags_exists_v1` | `TAG004` | `"Resource MUST implement Tags property if 'taggable' is true"` |
38+
| `ensure_property_tags_exists_v2` | `TAG005` | `"'tagging' MUST BE a struct"` |
39+
| | `TAG006` | `"'taggable' MUST BE specified when 'tagging' is provided"` |
40+
| | `TAG007` | `"Resource MUST provide 'tagOnCreate' {true\|false} if 'tagging.taggable' is true"` |
41+
| | `TAG008` | `"Resource MUST provide 'tagUpdatable' {true\|false} if 'tagging.taggable' is true"` |
42+
| | `TAG009` | `"Resource MUST provide 'cloudFormationSystemTags' {true\|false} if 'tagging.taggable' is true"` |
43+
| | `TAG010` | `"Resource MUST provide 'tagProperty' {/properties/Tags} if 'tagging.taggable' is true"` |
44+
| | `TAG011` | `"Resource MUST implement Tags property if 'tagging.taggable' is true"` |
45+
46+
#### Permissions
47+
| Rule Name | Check Id | Message |
48+
|----------|-------------|------|
49+
| `ensure_resource_create_handler_exists_and_have_permissions` | `PER001` | `"Resource MUST implement create handler"` |
50+
| | `PER002` | `"Resource MUST NOT specify wildcard permissions for create handler"` |
51+
| `ensure_resource_read_handler_exists_and_have_permissions` | `PER003` | `"Resource MUST implement read handler"` |
52+
| | `PER004` | `"Resource MUST NOT specify wildcard permissions for read handler"` |
53+
| `ensure_resource_update_handler_exists_and_have_permissions` | `PER005` | `"Resource MUST implement update handler"` |
54+
| | `PER006` | `"Resource MUST NOT specify wildcard permissions for update handler"` |
55+
| `ensure_resource_delete_handler_exists_and_have_permissions` | `PER007` | `"Resource MUST implement delete handler"` |
56+
| | `PER008` | `"Resource MUST NOT specify wildcard permissions for delete handler"` |
57+
| `ensure_resource_list_handler_exists_and_have_permissions` | `PER009` | `"Resource MUST implement list handler"` |
58+
| | `PER010` | `"Resource MUST NOT specify wildcard permissions for list handler"` |
59+
60+
#### Other Checks
61+
| Rule Name | Check Id | Message |
62+
|----------|-------------|------|
63+
| `ensure_description_is_descriptive` | `GN001` | `"description should start with 'Resource Type definition for ...'"` |
64+
| `ensure_sourceUrl_uses_https` | `GN002` | `"sourceUrl should use https protocol"` |
65+
| `ensure_default_replacementStrategy` | `GN003` | `"replacement strategy should not implement create_then_delete"` |

docs/BREAKING_CHANGE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
***
2828
#### Type
2929
| Rule Name | Check Id | Message |
30-
|----------|-------------|------|------|
30+
|----------|-------------|------|
3131
|`ensure_property_type_not_changed`|`TP001`|`"Only NEWLY ADDED properties can have new type added"`|
3232
||`TP002`|`"cannot remove TYPE from a property"`|
3333
||`TP003`|`"cannot change TYPE of a property"`|

setup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,14 @@ def read_requirements(req):
5252
"guard-rail = cli:main",
5353
]
5454
},
55+
license="Apache License 2.0",
5556
classifiers=[
56-
"Programming Language :: Python :: 3.7",
57-
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
57+
"Development Status :: 4 - Beta",
58+
"Programming Language :: Python :: 3.8",
59+
"Programming Language :: Python :: 3.9",
60+
"Programming Language :: Python :: 3.10",
61+
"Intended Audience :: Developers",
62+
"License :: OSI Approved :: Apache Software License",
63+
"Natural Language :: English",
5864
],
5965
)

src/rpdk/guard_rail/rule_library/combiners/schema-linter-combiner-rules.guard

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ rule ensure_properties_do_not_support_multitype {
99
<<
1010
{
1111
"result": "NON_COMPLIANT",
12-
"check_id": "COM_1",
12+
"check_id": "COM001",
1313
"message": "each property MUST specify type"
1414
}
1515
>>
1616
type !is_list
1717
<<
1818
{
1919
"result": "NON_COMPLIANT",
20-
"check_id": "COM_2",
20+
"check_id": "COM002",
2121
"message": "type MUST NOT have combined definition"
2222
}
2323
>>
@@ -33,7 +33,7 @@ rule ensure_array_doesnt_use_anyof when %arrays !empty {
3333
<<
3434
{
3535
"result": "NON_COMPLIANT",
36-
"check_id": "COM_3",
36+
"check_id": "COM003",
3737
"message": "property array MUST be modeled via items"
3838
}
3939
>>
@@ -42,9 +42,29 @@ rule ensure_array_doesnt_use_anyof when %arrays !empty {
4242
<<
4343
{
4444
"result": "NON_COMPLIANT",
45-
"check_id": "COM_4",
45+
"check_id": "COM004",
4646
"message": "property array MUST NOT specify items via anyOf"
4747
}
4848
>>
49+
50+
51+
items.allOf not exists
52+
<<
53+
{
54+
"result": "NON_COMPLIANT",
55+
"check_id": "COM005",
56+
"message": "property array MUST NOT specify items via allOf"
57+
}
58+
>>
59+
60+
61+
items.oneOf not exists
62+
<<
63+
{
64+
"result": "NON_COMPLIANT",
65+
"check_id": "COM006",
66+
"message": "property array MUST NOT specify items via oneOf"
67+
}
68+
>>
4969
}
5070
}

src/rpdk/guard_rail/rule_library/core/schema-linter-core-arn-rules.guard

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ rule ensure_arn_properties_type_string when %props !empty {
44
<<
55
{
66
"result": "NON_COMPLIANT",
7-
"check_id": "ARN_1",
7+
"check_id": "ARN001",
88
"message": "arn related property MUST have pattern specified"
99
}
1010
>>
@@ -15,7 +15,7 @@ rule ensure_arn_properties_contain_pattern when %props !empty {
1515
<<
1616
{
1717
"result": "NON_COMPLIANT",
18-
"check_id": "ARN_2",
18+
"check_id": "ARN002",
1919
"message": "arn related property MUST have pattern specified"
2020
}
2121
>>

src/rpdk/guard_rail/rule_library/core/schema-linter-core-rules.guard

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ rule ensure_primary_identifier_exists_and_not_empty
1111
<<
1212
{
1313
"result": "NON_COMPLIANT",
14-
"check_id": "P_ID_1",
14+
"check_id": "PID001",
1515
"message": "primaryIdentifier MUST exist"
1616
}
1717
>>
1818
primaryIdentifier not empty
1919
<<
2020
{
2121
"result": "NON_COMPLIANT",
22-
"check_id": "P_ID_2",
22+
"check_id": "PID002",
2323
"message": "primaryIdentifier MUST contain values"
2424
}
2525
>>
@@ -33,7 +33,7 @@ rule ensure_primary_identifier_is_read_or_create_only when ensure_primary_identi
3333
<<
3434
{
3535
"result": "NON_COMPLIANT",
36-
"check_id": "P_ID_2",
36+
"check_id": "PID003",
3737
"message": "primaryIdentifier MUST be either readOnly or createOnly"
3838
}
3939
>>
@@ -49,7 +49,7 @@ rule ensure_create_and_read_only_intersection_is_empty
4949
<<
5050
{
5151
"result": "NON_COMPLIANT",
52-
"check_id": "RO_PR_1",
52+
"check_id": "PR001",
5353
"message": "read/createOnlyProperties MUST NOT have common properties"
5454
}
5555
>>
@@ -60,7 +60,7 @@ rule ensure_create_and_read_only_intersection_is_empty
6060
<<
6161
{
6262
"result": "NON_COMPLIANT",
63-
"check_id": "CO_PR_1",
63+
"check_id": "PR002",
6464
"message": "create/readOnlyProperties MUST NOT have common properties"
6565
}
6666
>>
@@ -74,7 +74,7 @@ rule ensure_write_and_read_only_intersection_is_empty
7474
<<
7575
{
7676
"result": "NON_COMPLIANT",
77-
"check_id": "RO_PR_2",
77+
"check_id": "PR003",
7878
"message": "read/writeOnlyProperties MUST NOT have common properties"
7979
}
8080
>>
@@ -84,7 +84,7 @@ rule ensure_write_and_read_only_intersection_is_empty
8484
<<
8585
{
8686
"result": "NON_COMPLIANT",
87-
"check_id": "WO_PR_1",
87+
"check_id": "PR004",
8888
"message": "write/readOnlyProperties MUST NOT have common properties"
8989
}
9090
>>
@@ -95,13 +95,34 @@ rule ensure_write_and_read_only_intersection_is_empty
9595

9696
rule ensure_description_is_descriptive {
9797
description != /^Resource Type definition for/
98+
<<
99+
{
100+
"result": "WARNING",
101+
"check_id": "GN001",
102+
"message": "description should start with `Resource Type definition for ...`"
103+
}
104+
>>
98105
}
99106

100107
# URLs should use https
101108
rule ensure_sourceUrl_uses_https when sourceUrl exists {
102109
sourceUrl == /^https:/
110+
<<
111+
{
112+
"result": "NON_COMPLIANT",
113+
"check_id": "GN002",
114+
"message": "sourceUrl should use https protocol"
115+
}
116+
>>
103117
}
104118

105119
rule ensure_default_replacementStrategy when replacementStrategy exists {
106120
replacementStrategy == 'create_then_delete'
121+
<<
122+
{
123+
"result": "WARNING",
124+
"check_id": "GN003",
125+
"message": "replacement strategy should not implement create_then_delete"
126+
}
127+
>>
107128
}

src/rpdk/guard_rail/rule_library/permissions/schema-linter-core-permission-rules.guard

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ rule ensure_resource_create_handler_exists_and_have_permissions {
77
<<
88
{
99
"result": "NON_COMPLIANT",
10-
"check_id": "PER_1",
10+
"check_id": "PER001",
1111
"message": "Resource MUST implement create handler"
1212
}
1313
>>
@@ -17,7 +17,7 @@ rule ensure_resource_create_handler_exists_and_have_permissions {
1717
<<
1818
{
1919
"result": "NON_COMPLIANT",
20-
"check_id": "PER_2",
20+
"check_id": "PER002",
2121
"message": "Resource MUST NOT specify wildcard permissions for create handler"
2222
}
2323
>>
@@ -29,7 +29,7 @@ rule ensure_resource_read_handler_exists_and_have_permissions {
2929
<<
3030
{
3131
"result": "NON_COMPLIANT",
32-
"check_id": "PER_3",
32+
"check_id": "PER003",
3333
"message": "Resource MUST implement read handler"
3434
}
3535
>>
@@ -39,7 +39,7 @@ rule ensure_resource_read_handler_exists_and_have_permissions {
3939
<<
4040
{
4141
"result": "NON_COMPLIANT",
42-
"check_id": "PER_4",
42+
"check_id": "PER004",
4343
"message": "Resource MUST NOT specify wildcard permissions for read handler"
4444
}
4545
>>
@@ -51,7 +51,7 @@ rule ensure_resource_update_handler_exists_and_have_permissions {
5151
<<
5252
{
5353
"result": "NON_COMPLIANT",
54-
"check_id": "PER_5",
54+
"check_id": "PER005",
5555
"message": "Resource MUST implement update handler"
5656
}
5757
>>
@@ -61,7 +61,7 @@ rule ensure_resource_update_handler_exists_and_have_permissions {
6161
<<
6262
{
6363
"result": "NON_COMPLIANT",
64-
"check_id": "PER_6",
64+
"check_id": "PER006",
6565
"message": "Resource MUST NOT specify wildcard permissions for update handler"
6666
}
6767
>>
@@ -73,7 +73,7 @@ rule ensure_resource_delete_handler_exists_and_have_permissions {
7373
<<
7474
{
7575
"result": "NON_COMPLIANT",
76-
"check_id": "PER_7",
76+
"check_id": "PER007",
7777
"message": "Resource MUST implement delete handler"
7878
}
7979
>>
@@ -83,7 +83,7 @@ rule ensure_resource_delete_handler_exists_and_have_permissions {
8383
<<
8484
{
8585
"result": "NON_COMPLIANT",
86-
"check_id": "PER_8",
86+
"check_id": "PER008",
8787
"message": "Resource MUST NOT specify wildcard permissions for delete handler"
8888
}
8989
>>
@@ -95,7 +95,7 @@ rule ensure_resource_list_handler_exists_and_have_permissions {
9595
<<
9696
{
9797
"result": "NON_COMPLIANT",
98-
"check_id": "PER_9",
98+
"check_id": "PER009",
9999
"message": "Resource MUST implement list handler"
100100
}
101101
>>
@@ -105,7 +105,7 @@ rule ensure_resource_list_handler_exists_and_have_permissions {
105105
<<
106106
{
107107
"result": "NON_COMPLIANT",
108-
"check_id": "PER_10",
108+
"check_id": "PER010",
109109
"message": "Resource MUST NOT specify wildcard permissions for list handler"
110110
}
111111
>>

0 commit comments

Comments
 (0)