xiangfu0 commented on code in PR #16890: URL: https://github.com/apache/pinot/pull/16890#discussion_r2462179279
########## pinot-common/src/main/java/org/apache/pinot/common/utils/SegmentApiClient.java: ########## @@ -0,0 +1,256 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pinot.common.utils; + +import java.io.Closeable; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import javax.annotation.Nullable; +import javax.net.ssl.SSLContext; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.Header; +import org.apache.http.HttpVersion; +import org.apache.http.NameValuePair; +import org.apache.http.StatusLine; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.client.methods.RequestBuilder; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.ssl.SSLContexts; +import org.apache.http.util.EntityUtils; +import org.apache.pinot.common.exception.HttpErrorStatusException; +import org.apache.pinot.spi.utils.CommonConstants; +import org.apache.pinot.spi.utils.JsonUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * The <code>SegmentApiClient</code> class provides a http client for invoking segment rest apis. + */ +public class SegmentApiClient implements Closeable { + private static final Logger LOGGER = LoggerFactory.getLogger(SegmentApiClient.class); + + /** + * optional default SSL context for SegmentApiClient operations + */ + public static SSLContext _defaultSSLContext; + + public static class QueryParameters { Review Comment: I think we can leverage this Pinot Admin client PR once its merged: https://github.com/apache/pinot/pull/17040 ########## pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchDataIngestionJobCommand.java: ########## @@ -44,13 +44,13 @@ public class LaunchDataIngestionJobCommand extends AbstractBaseAdminCommand impl private static final Logger LOGGER = LoggerFactory.getLogger(LaunchDataIngestionJobCommand.class); @CommandLine.Option(names = {"-jobSpecFile", "-jobSpec"}, required = true, description = "Ingestion job spec file") - private String _jobSpecFile; + protected String _jobSpecFile; @CommandLine.Option(names = {"-values"}, required = false, arity = "1..*", description = "Context values set to the job spec template") - private List<String> _values; + protected List<String> _values; @CommandLine.Option(names = {"-propertyFile"}, required = false, description = "A property file contains context values to set the job spec template") - private String _propertyFile; + protected String _propertyFile; @CommandLine.Option(names = {"-user"}, required = false, description = "Username for basic auth.") private String _user; Review Comment: I think we need to expose those auth related options as well. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
