def apply()

in auditlog/src/main/scala/com/gerritforge/analytics/auditlog/model/CommandLineArguments.scala [24:72]


  def apply(args: Array[String]): Option[AuditLogETLConfig] = {

    val parser: OptionParser[AuditLogETLConfig] =
      new scopt.OptionParser[AuditLogETLConfig]("spark-submit") {
        head("spark-submit")
        opt[String]('u', "gerritUrl") required () action { (input, c) =>
          c.copy(gerritUrl = Some(input))
        } text "gerrit server URL (Required)"

        opt[String]("username") optional () action { (input, c) =>
          c.copy(gerritUsername = Some(input))
        } text "Gerrit API Username (Optional)"

        opt[String]("password") optional () action { (input, c) =>
          c.copy(gerritPassword = Some(input))
        } text "Gerrit API Password (Optional)"

        opt[String]('i', "elasticSearchIndex") required () action { (input, c) =>
          c.copy(elasticSearchIndex = Some(input))
        } text "elasticSearch index to persist data into (Required)"

        opt[String]('p', "eventsPath") required () action { (input, c) =>
          c.copy(eventsPath = Some(input))
        } text "path to a directory (or a file) containing auditLogs events. Supports also '.gz' files. (Required)"

        opt[String]('a', "additionalUserInfoPath") optional () action { (input, c) =>
          c.copy(additionalUserInfoPath = Some(input))
        } text "path to a CSV file containing additional user information (Optional)\n\t\t\t\tCSV must have an header. Example:\n\t\t\t\tid,type\n\t\t\t\t123456,'bot'\n\t\t\t\t678876,'human'"

        opt[String]('e', "eventsTimeAggregation") optional () action { (input, c) =>
          c.copy(eventsTimeAggregation = Some(input))
        } text "Events of the same type, produced by the same user will be aggregated with this time granularity: " +
          "'second', 'minute', 'hour', 'week', 'month', 'quarter'. (Optional) - Default: 'hour'"

        opt[Boolean]('k', "ignoreSSLCert") optional () action { (input, c) =>
          c.copy(ignoreSSLCert = Some(input))
        } text "Ignore SSL certificate validation (Optional) - Default: false"

        opt[LocalDate]('s', "since") optional () action { (input, c) =>
          c.copy(since = Some(input))
        } text "process only auditLogs occurred after (and including) this date, expressed as 'yyyy-MM-dd' (Optional)"

        opt[LocalDate]('u', "until") optional () action { (input, c) =>
          c.copy(until = Some(input))
        } text "process only auditLogs occurred before (and including) this date, expressed as 'yyyy-MM-dd' (Optional)"
      }

    parser.parse(args, AuditLogETLConfig())
  }