You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ap...@apache.org on 2021/07/30 07:54:37 UTC

[pinot] 01/01: add cli args for auth tokens and user/password to ingestion job command

This is an automated email from the ASF dual-hosted git repository.

apucher pushed a commit to branch ingestion-job-cli-auth-tokens
in repository https://gitbox.apache.org/repos/asf/pinot.git

commit c34582bf9eebf800dafd4a6272ce0146d56668ea
Author: Alexander Pucher <al...@alexpucher.com>
AuthorDate: Fri Jul 30 00:54:12 2021 -0700

    add cli args for auth tokens and user/password to ingestion job command
---
 .../tools/admin/command/LaunchDataIngestionJobCommand.java    | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchDataIngestionJobCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchDataIngestionJobCommand.java
index 62347e6..6f1fe3c 100644
--- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchDataIngestionJobCommand.java
+++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchDataIngestionJobCommand.java
@@ -20,6 +20,7 @@ package org.apache.pinot.tools.admin.command;
 
 import java.util.Arrays;
 import java.util.List;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.pinot.core.util.TlsUtils;
 import org.apache.pinot.spi.ingestion.batch.IngestionJobLauncher;
 import org.apache.pinot.spi.ingestion.batch.spec.SegmentGenerationJobSpec;
@@ -49,6 +50,12 @@ public class LaunchDataIngestionJobCommand extends AbstractBaseAdminCommand impl
   private List<String> _values;
   @Option(name = "-propertyFile", required = false, metaVar = "<template context file>", usage = "A property file contains context values to set the job spec template")
   private String _propertyFile;
+  @Option(name = "-user", required = false, metaVar = "<String>", usage = "Username for basic auth.")
+  private String _user;
+  @Option(name = "-password", required = false, metaVar = "<String>", usage = "Password for basic auth.")
+  private String _password;
+  @Option(name = "-authToken", required = false, metaVar = "<String>", usage = "Http auth token.")
+  private String _authToken;
 
   public static void main(String[] args) {
     PluginManager.get().init();
@@ -128,6 +135,10 @@ public class LaunchDataIngestionJobCommand extends AbstractBaseAdminCommand impl
           tlsSpec.getTrustStorePath(), tlsSpec.getTrustStorePassword());
     }
 
+    if (StringUtils.isBlank(spec.getAuthToken())) {
+      spec.setAuthToken(makeAuthToken(_authToken, _user, _password));
+    }
+
     try {
       IngestionJobLauncher.runIngestionJob(spec);
     } catch (Exception e) {

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org