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) {
|
protected TransportOptions getTransportOptions(ProcessContext context) {
|
||||||
final ProxyConfiguration proxyConfiguration = ProxyConfiguration.getConfiguration(context, () -> {
|
final ProxyConfiguration proxyConfiguration = ProxyConfiguration.getConfiguration(context, () -> {
|
||||||
final String proxyHost = context.getProperty(PROXY_HOST).evaluateAttributeExpressions().getValue();
|
if (context.getProperty(PROXY_HOST).isSet() && context.getProperty(PROXY_PORT).isSet()) {
|
||||||
final Integer proxyPort = context.getProperty(PROXY_PORT).evaluateAttributeExpressions().asInteger();
|
final String proxyHost = context.getProperty(PROXY_HOST).evaluateAttributeExpressions().getValue();
|
||||||
if (proxyHost != null && proxyPort != null && proxyPort > 0) {
|
final Integer proxyPort = context.getProperty(PROXY_PORT).evaluateAttributeExpressions().asInteger();
|
||||||
final ProxyConfiguration componentProxyConfig = new ProxyConfiguration();
|
if (proxyHost != null && proxyPort != null && proxyPort > 0) {
|
||||||
final String proxyUser = context.getProperty(HTTP_PROXY_USERNAME).evaluateAttributeExpressions().getValue();
|
final ProxyConfiguration componentProxyConfig = new ProxyConfiguration();
|
||||||
final String proxyPassword = context.getProperty(HTTP_PROXY_PASSWORD).evaluateAttributeExpressions().getValue();
|
final String proxyUser = context.getProperty(HTTP_PROXY_USERNAME).evaluateAttributeExpressions().getValue();
|
||||||
componentProxyConfig.setProxyType(Proxy.Type.HTTP);
|
final String proxyPassword = context.getProperty(HTTP_PROXY_PASSWORD).evaluateAttributeExpressions().getValue();
|
||||||
componentProxyConfig.setProxyServerHost(proxyHost);
|
componentProxyConfig.setProxyType(Proxy.Type.HTTP);
|
||||||
componentProxyConfig.setProxyServerPort(proxyPort);
|
componentProxyConfig.setProxyServerHost(proxyHost);
|
||||||
componentProxyConfig.setProxyUserName(proxyUser);
|
componentProxyConfig.setProxyServerPort(proxyPort);
|
||||||
componentProxyConfig.setProxyUserPassword(proxyPassword);
|
componentProxyConfig.setProxyUserName(proxyUser);
|
||||||
return componentProxyConfig;
|
componentProxyConfig.setProxyUserPassword(proxyPassword);
|
||||||
|
return componentProxyConfig;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ProxyConfiguration.DIRECT_CONFIGURATION;
|
return ProxyConfiguration.DIRECT_CONFIGURATION;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
|
|
||||||
package org.apache.nifi.processors.gcp.bigquery;
|
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.ApiFuture;
|
||||||
import com.google.api.core.ApiFutureCallback;
|
import com.google.api.core.ApiFutureCallback;
|
||||||
import com.google.api.core.ApiFutures;
|
import com.google.api.core.ApiFutures;
|
||||||
|
@ -42,6 +45,7 @@ import com.google.protobuf.Descriptors;
|
||||||
import com.google.protobuf.DynamicMessage;
|
import com.google.protobuf.DynamicMessage;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import org.apache.nifi.annotation.behavior.EventDriven;
|
import org.apache.nifi.annotation.behavior.EventDriven;
|
||||||
import org.apache.nifi.annotation.behavior.InputRequirement;
|
import org.apache.nifi.annotation.behavior.InputRequirement;
|
||||||
import org.apache.nifi.annotation.behavior.TriggerSerially;
|
import org.apache.nifi.annotation.behavior.TriggerSerially;
|
||||||
|
@ -119,6 +123,11 @@ public class PutBigQuery extends AbstractBigQueryProcessor {
|
||||||
private int recordBatchCount;
|
private int recordBatchCount;
|
||||||
private boolean skipInvalidRows;
|
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()
|
static final PropertyDescriptor TRANSFER_TYPE = new PropertyDescriptor.Builder()
|
||||||
.name(TRANSFER_TYPE_NAME)
|
.name(TRANSFER_TYPE_NAME)
|
||||||
.displayName("Transfer Type")
|
.displayName("Transfer Type")
|
||||||
|
@ -155,16 +164,21 @@ public class PutBigQuery extends AbstractBigQueryProcessor {
|
||||||
.defaultValue("false")
|
.defaultValue("false")
|
||||||
.build();
|
.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
|
@Override
|
||||||
public List<PropertyDescriptor> getSupportedPropertyDescriptors() {
|
public List<PropertyDescriptor> getSupportedPropertyDescriptors() {
|
||||||
List<PropertyDescriptor> descriptors = new ArrayList<>(super.getSupportedPropertyDescriptors());
|
return DESCRIPTORS;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue