public IValidator launchValidator()

in validator/src/main/java/com/amazon/aoc/validators/ValidatorFactory.java [39:110]


  public IValidator launchValidator(ValidationConfig validationConfig) throws Exception {
    // get validator
    IValidator validator;
    FileConfig expectedData = null;
    switch (validationConfig.getValidationType()) {
      case "trace":
        validator = new TraceValidator();
        expectedData = validationConfig.getExpectedTraceTemplate();
        break;
      case "cw-metric":
        validator = new CWMetricValidator();
        expectedData = validationConfig.getExpectedMetricTemplate();
        break;
      case "prom-static-metric":
        validator = new PrometheusStaticMetricValidator();
        expectedData = validationConfig.getExpectedMetricTemplate();
        break;
      case "prom-metric":
        validator = new PrometheusMetricValidator();
        expectedData = validationConfig.getExpectedMetricTemplate();
        break;
      case "alarm-pulling":
        validator = new AlarmPullingValidator();
        break;
      case "mocked-server":
        validator = new MockedServerValidator();
        break;
      case "performance":
        validator = new PerformanceValidator();
        break;
      case "container-insight-eks-prometheus-metrics":
      case "container-insight-ecs-prometheus-metrics":
        validator = new ContainerInsightPrometheusMetricsValidator();
        expectedData = validationConfig.getExpectedMetricTemplate();
        break;
      case "container-insight-eks-prometheus-logs":
        validator = new ContainerInsightPrometheusStructuredLogValidator();
        expectedData = validationConfig.getExpectedLogStructureTemplate();
        break;
      case "container-insight-eks-logs":
        validator = new ContainerInsightStructuredLogValidator();
        expectedData = validationConfig.getExpectedLogStructureTemplate();
        break;
      case "container-insight-ecs-logs":
        validator = new ConatinerInsightECSStructuredLogValidator();
        expectedData = validationConfig.getExpectedLogStructureTemplate();
        break;
      case "container-insight-ecs-prometheus-logs":
        validator = new ContainerIInsightECSPrometheusStructuredLogValidator();
        expectedData = validationConfig.getExpectedLogStructureTemplate();
        break;
      default:
        throw new BaseException(ExceptionCode.VALIDATION_TYPE_NOT_EXISTED);
    }

    // get caller
    ICaller caller;
    switch (validationConfig.getCallingType()) {
      case "http":
        caller = new HttpCaller(context.getEndpoint(), validationConfig.getHttpPath());
        break;
      case "none":
        caller = null;
        break;
      default:
        throw new BaseException(ExceptionCode.CALLER_TYPE_NOT_EXISTED);
    }

    // init validator
    validator.init(this.context, validationConfig, caller, expectedData);
    return validator;
  }