class RuleServiceImpl implements RuleService {

	@Override
	public String enableDisableRule(final String ruleId, final String action, final String userId) throws PacManException {
		if(ruleRepository.existsById(ruleId)) {
			Rule existingRule = ruleRepository.findById(ruleId).get();
			if(action.equalsIgnoreCase("enable")) {
				return enableCloudWatchRule(existingRule, userId, RuleState.ENABLED);
			} else {
				return disableCloudWatchRule(existingRule, userId, RuleState.DISABLED);
			}
		} else {
			throw new PacManException(String.format(AdminConstants.RULE_ID_NOT_EXITS, ruleId));
		}
	}

}