-
Notifications
You must be signed in to change notification settings - Fork 20
/
api_gw_endpoint_type_check.guard
40 lines (38 loc) · 1.37 KB
/
api_gw_endpoint_type_check.guard
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#
#####################################
## Gherkin ##
#####################################
# Rule Identifier:
# API_GW_ENDPOINT_TYPE_CHECK
#
# Description:
# Checks if Amazon API Gateway APIs are of the type specified in the rule parameter endpointConfigurationType
#
# Reports on:
# AWS::ApiGateway::DomainName
#
# Evaluates:
# AWS CloudFormation
#
# Rule Parameters:
# NA
#
# Scenarios:
# a) SKIP: when there are no API GW present
# b) PASS: when all API GW have endpoint configuration set to "REGIONAL", "PRIVATE", and/or "EDGE"
# c) FAIL: when all API GW does not have endpoint configuration set to "REGIONAL", "PRIVATE", and/or "EDGE"
# d) SKIP: when metadata includes the suppression for rule API_GW_ENDPOINT_TYPE_CHECK
#
# Select all API GW Method resources from incoming template (payload)
#
let api_gw_resources_type_check = Resources.*[ Type == 'AWS::ApiGateway::DomainName'
Metadata.guard.SuppressedRules not exists or
Metadata.guard.SuppressedRules.* != "API_GW_ENDPOINT_TYPE_CHECK"
]
rule API_GW_ENDPOINT_TYPE_CHECK when %api_gw_resources_type_check !empty {
some %api_gw_resources_type_check.Properties.EndpointConfiguration.Types IN ["REGIONAL", "PRIVATE", "EDGE"]
<<
Violation: EndpointConfiguration must contain "REGIONAL", "PRIVATE", and/or "EDGE"
Fix: Set EndpointConfiguration Type to "REGIONAL", "PRIVATE", and/or "EDGE"
>>
}