mirror of https://github.com/apache/nifi.git
NIFI-10693 Remove proxy configuration properties from PutBigQuery
This closes #6580. Signed-off-by: Peter Turcsanyi <turcsanyi@apache.org>
This commit is contained in:
parent
ef0793c8fc
commit
ac7306f582
|
@ -212,19 +212,22 @@ public abstract class AbstractGCPProcessor<
|
|||
*/
|
||||
protected TransportOptions getTransportOptions(ProcessContext context) {
|
||||
final ProxyConfiguration proxyConfiguration = ProxyConfiguration.getConfiguration(context, () -> {
|
||||
final String proxyHost = context.getProperty(PROXY_HOST).evaluateAttributeExpressions().getValue();
|
||||
final Integer proxyPort = context.getProperty(PROXY_PORT).evaluateAttributeExpressions().asInteger();
|
||||
if (proxyHost != null && proxyPort != null && proxyPort > 0) {
|
||||
final ProxyConfiguration componentProxyConfig = new ProxyConfiguration();
|
||||
final String proxyUser = context.getProperty(HTTP_PROXY_USERNAME).evaluateAttributeExpressions().getValue();
|
||||
final String proxyPassword = context.getProperty(HTTP_PROXY_PASSWORD).evaluateAttributeExpressions().getValue();
|
||||
componentProxyConfig.setProxyType(Proxy.Type.HTTP);
|
||||
componentProxyConfig.setProxyServerHost(proxyHost);
|
||||
componentProxyConfig.setProxyServerPort(proxyPort);
|
||||
componentProxyConfig.setProxyUserName(proxyUser);
|
||||
componentProxyConfig.setProxyUserPassword(proxyPassword);
|
||||
return componentProxyConfig;
|
||||
if (context.getProperty(PROXY_HOST).isSet() && context.getProperty(PROXY_PORT).isSet()) {
|
||||
final String proxyHost = context.getProperty(PROXY_HOST).evaluateAttributeExpressions().getValue();
|
||||
final Integer proxyPort = context.getProperty(PROXY_PORT).evaluateAttributeExpressions().asInteger();
|
||||
if (proxyHost != null && proxyPort != null && proxyPort > 0) {
|
||||
final ProxyConfiguration componentProxyConfig = new ProxyConfiguration();
|
||||
final String proxyUser = context.getProperty(HTTP_PROXY_USERNAME).evaluateAttributeExpressions().getValue();
|
||||
final String proxyPassword = context.getProperty(HTTP_PROXY_PASSWORD).evaluateAttributeExpressions().getValue();
|
||||
componentProxyConfig.setProxyType(Proxy.Type.HTTP);
|
||||
componentProxyConfig.setProxyServerHost(proxyHost);
|
||||
componentProxyConfig.setProxyServerPort(proxyPort);
|
||||
componentProxyConfig.setProxyUserName(proxyUser);
|
||||
componentProxyConfig.setProxyUserPassword(proxyPassword);
|
||||
return componentProxyConfig;
|
||||
}
|
||||
}
|
||||
|
||||
return ProxyConfiguration.DIRECT_CONFIGURATION;
|
||||
});
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
package org.apache.nifi.processors.gcp.bigquery;
|
||||
|
||||
import static java.util.stream.Collectors.collectingAndThen;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
import com.google.api.core.ApiFuture;
|
||||
import com.google.api.core.ApiFutureCallback;
|
||||
import com.google.api.core.ApiFutures;
|
||||
|
@ -42,6 +45,7 @@ import com.google.protobuf.Descriptors;
|
|||
import com.google.protobuf.DynamicMessage;
|
||||
import io.grpc.Status;
|
||||
import java.time.LocalTime;
|
||||
import java.util.stream.Stream;
|
||||
import org.apache.nifi.annotation.behavior.EventDriven;
|
||||
import org.apache.nifi.annotation.behavior.InputRequirement;
|
||||
import org.apache.nifi.annotation.behavior.TriggerSerially;
|
||||
|
@ -119,6 +123,11 @@ public class PutBigQuery extends AbstractBigQueryProcessor {
|
|||
private int recordBatchCount;
|
||||
private boolean skipInvalidRows;
|
||||
|
||||
public static final PropertyDescriptor PROJECT_ID = new PropertyDescriptor.Builder()
|
||||
.fromPropertyDescriptor(AbstractBigQueryProcessor.PROJECT_ID)
|
||||
.required(true)
|
||||
.build();
|
||||
|
||||
static final PropertyDescriptor TRANSFER_TYPE = new PropertyDescriptor.Builder()
|
||||
.name(TRANSFER_TYPE_NAME)
|
||||
.displayName("Transfer Type")
|
||||
|
@ -155,16 +164,21 @@ public class PutBigQuery extends AbstractBigQueryProcessor {
|
|||
.defaultValue("false")
|
||||
.build();
|
||||
|
||||
private static final List<PropertyDescriptor> DESCRIPTORS = Stream.of(
|
||||
GCP_CREDENTIALS_PROVIDER_SERVICE,
|
||||
PROJECT_ID,
|
||||
DATASET,
|
||||
TABLE_NAME,
|
||||
RECORD_READER,
|
||||
TRANSFER_TYPE,
|
||||
APPEND_RECORD_COUNT,
|
||||
RETRY_COUNT,
|
||||
SKIP_INVALID_ROWS
|
||||
).collect(collectingAndThen(toList(), Collections::unmodifiableList));
|
||||
|
||||
@Override
|
||||
public List<PropertyDescriptor> getSupportedPropertyDescriptors() {
|
||||
List<PropertyDescriptor> descriptors = new ArrayList<>(super.getSupportedPropertyDescriptors());
|
||||
descriptors.add(TRANSFER_TYPE);
|
||||
descriptors.add(RECORD_READER);
|
||||
descriptors.add(APPEND_RECORD_COUNT);
|
||||
descriptors.add(SKIP_INVALID_ROWS);
|
||||
descriptors.remove(IGNORE_UNKNOWN);
|
||||
|
||||
return Collections.unmodifiableList(descriptors);
|
||||
return DESCRIPTORS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue