class CheckForApiGatewayProtected extends BaseRule {

    @Override
    public RuleResult execute(Map<String, String> ruleParam,
            Map<String, String> resourceAttributes) {
        logger.debug("========CheckForApiGatewayProtected started=========");

        Annotation annotation = null;
        String roleIdentifyingString = ruleParam
                .get(PacmanSdkConstants.Role_IDENTIFYING_STRING);
        String resourceId = ruleParam.get(PacmanSdkConstants.RESOURCE_ID);
        String authType = ruleParam.get(PacmanRuleConstants.AUTH_TYPE);
        String tagsSplitter = ruleParam.get(PacmanSdkConstants.SPLITTER_CHAR);

        String severity = ruleParam.get(PacmanRuleConstants.SEVERITY);
        String category = ruleParam.get(PacmanRuleConstants.CATEGORY);

        MDC.put("executionId", ruleParam.get("executionId"));
        // this is the logback Mapped Diagnostic Contex
        MDC.put("ruleId", ruleParam.get(PacmanSdkConstants.RULE_ID)); 
        // this is the logback Mapped Diagnostic Contex

        Gson gson = new Gson();
        List<LinkedHashMap<String, Object>> issueList = new ArrayList<>();
        LinkedHashMap<String, Object> issue = new LinkedHashMap<>();
        Map<String, Object> authTypeMap = new HashMap<>();
        if (!PacmanUtils.doesAllHaveValue(authType, tagsSplitter, severity,
                category)) {
            logger.info(PacmanRuleConstants.MISSING_CONFIGURATION);
            throw new InvalidInputException(PacmanRuleConstants.MISSING_CONFIGURATION);
        }
        AmazonApiGatewayClient apiGatewayClient = getClient(
                roleIdentifyingString, ruleParam);

        List<String> authTypeList = PacmanUtils.splitStringToAList(authType,
                tagsSplitter);
        try {
            for (Resource resource : getResourceList(resourceId,
                    apiGatewayClient)) {
                Map<String, Method> httpMethodMap = resource
                        .getResourceMethods();

                if (httpMethodMap != null) {
                    for (Map.Entry<String, Method> httpMethod : httpMethodMap
                            .entrySet()) {
                        GetMethodResult methodResult = getGetMethodResult(
                                resource, resourceId, httpMethod,
                                apiGatewayClient);
                        String authorisationType = methodResult
                                .getAuthorizationType();
                        boolean isApiKeyRequired = methodResult
                                .getApiKeyRequired();
                        boolean isAuthType = false;
                        logger.info("========Checking is auth type true=========");
                        for (String authorType : authTypeList) {
                            if (authorisationType.equalsIgnoreCase(authorType)) {
                                isAuthType = true;
                            } else {
                                authTypeMap.put(authorType, "Not found");
                            }
                        }
                        if (!(isAuthType || isApiKeyRequired)) {

                            // create annotations now
                            if (annotation == null) { 
                                // annotation will build for first method only for 2nd method it just adds method details.
                                annotation = Annotation.buildAnnotation(
                                        ruleParam, Annotation.Type.ISSUE);
                                annotation.put(PacmanRuleConstants.SEVERITY,
                                        severity);
                                annotation.put(PacmanRuleConstants.CATEGORY,
                                        category);
                            }

                            formateAPIMethodDetails(resource.getPath(),
                                    httpMethod.getKey(),
                                    String.valueOf(isApiKeyRequired));
                        }
                    }
                }
            }

        } catch (Exception exception) {
            logger.error("error: ", exception);
            throw new RuleExecutionFailedExeption(exception.getMessage());
        }
        if (annotation == null) {
            logger.debug("========CheckForApiGatewayProtected ended=========");
            return new RuleResult(PacmanSdkConstants.STATUS_SUCCESS,
                    PacmanRuleConstants.SUCCESS_MESSAGE);
        } else {
            annotation.put("APIMethods", apiMethodsDes);
            annotation.put(PacmanSdkConstants.DESCRIPTION,
                    "API gateway is not protected.And the API methods description are "
                            + apiMethodsDes);

            issue.put(PacmanRuleConstants.VIOLATION_REASON,
                    "API gateway is not protected");
            issue.put("apiMethods", apiMethodsDes);
            issue.put("authType", gson.toJson(authTypeMap));
            issueList.add(issue);
            annotation.put("issueDetails", issueList.toString());

            apiMethodsDes = null; // clear api description
            logger.debug("========CheckForApiGatewayProtected ended with annotation : {}=========",annotation);
            return new RuleResult(PacmanSdkConstants.STATUS_FAILURE,
                    PacmanRuleConstants.FAILURE_MESSAGE, annotation);
        }
    }

}