You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/01/19 07:25:41 UTC
[camel] 01/05: CAMEL-16054 - Camel-AWS2-Kinesis Firehose: Support
endpoint override like we have for S3
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 4c857be02d23da8066644e0fd5bd03aed94bf512
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Jan 19 08:09:35 2021 +0100
CAMEL-16054 - Camel-AWS2-Kinesis Firehose: Support endpoint override like we have for S3
---
.../firehose/KinesisFirehose2Configuration.java | 29 ++++++++++++++++++----
.../aws2/firehose/KinesisFirehose2Endpoint.java | 3 +++
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/components/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/firehose/KinesisFirehose2Configuration.java b/components/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/firehose/KinesisFirehose2Configuration.java
index c4ce939..e5f249f 100644
--- a/components/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/firehose/KinesisFirehose2Configuration.java
+++ b/components/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/firehose/KinesisFirehose2Configuration.java
@@ -40,8 +40,7 @@ public class KinesisFirehose2Configuration implements Cloneable {
@UriParam(description = "Amazon Kinesis Firehose client to use for all requests for this endpoint")
@Metadata(autowired = true)
private FirehoseClient amazonKinesisFirehoseClient;
- @UriParam(enums = "HTTP,HTTPS", defaultValue = "HTTPS",
- description = "To define a proxy protocol when instantiating the Kinesis Firehose client")
+ @UriParam(enums = "HTTP,HTTPS", defaultValue = "HTTPS", description = "To define a proxy protocol when instantiating the Kinesis Firehose client")
private Protocol proxyProtocol = Protocol.HTTPS;
@UriParam(description = "To define a proxy host when instantiating the Kinesis Firehose client")
private String proxyHost;
@@ -51,9 +50,13 @@ public class KinesisFirehose2Configuration implements Cloneable {
private KinesisFirehose2Operations operation;
@UriParam(defaultValue = "false", description = "If we want to trust all certificates in case of overriding the endpoint")
private boolean trustAllCertificates;
- @UriParam(label = "common", defaultValue = "true",
- description = "This option will set the CBOR_ENABLED property during the execution")
+ @UriParam(label = "common", defaultValue = "true", description = "This option will set the CBOR_ENABLED property during the execution")
private boolean cborEnabled = true;
+ @UriParam(label = "common", defaultValue = "false", description = "Set the need for overidding the endpoint. This option needs to be used in combination with uriEndpointOverride"
+ + " option")
+ private boolean overrideEndpoint;
+ @UriParam(label = "common", description = "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option")
+ private String uriEndpointOverride;
public void setAmazonKinesisFirehoseClient(FirehoseClient client) {
this.amazonKinesisFirehoseClient = client;
@@ -142,6 +145,22 @@ public class KinesisFirehose2Configuration implements Cloneable {
public void setCborEnabled(boolean cborEnabled) {
this.cborEnabled = cborEnabled;
}
+
+ public boolean isOverrideEndpoint() {
+ return overrideEndpoint;
+ }
+
+ public void setOverrideEndpoint(boolean overrideEndpoint) {
+ this.overrideEndpoint = overrideEndpoint;
+ }
+
+ public String getUriEndpointOverride() {
+ return uriEndpointOverride;
+ }
+
+ public void setUriEndpointOverride(String uriEndpointOverride) {
+ this.uriEndpointOverride = uriEndpointOverride;
+ }
// *************************************************
//
@@ -149,7 +168,7 @@ public class KinesisFirehose2Configuration implements Cloneable {
public KinesisFirehose2Configuration copy() {
try {
- return (KinesisFirehose2Configuration) super.clone();
+ return (KinesisFirehose2Configuration)super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeCamelException(e);
}
diff --git a/components/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/firehose/KinesisFirehose2Endpoint.java b/components/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/firehose/KinesisFirehose2Endpoint.java
index 07545be..08bdef0 100644
--- a/components/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/firehose/KinesisFirehose2Endpoint.java
+++ b/components/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/firehose/KinesisFirehose2Endpoint.java
@@ -123,6 +123,9 @@ public class KinesisFirehose2Endpoint extends DefaultEndpoint {
if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
clientBuilder = clientBuilder.region(Region.of(configuration.getRegion()));
}
+ if (configuration.isOverrideEndpoint()) {
+ clientBuilder.endpointOverride(URI.create(configuration.getUriEndpointOverride()));
+ }
if (configuration.isTrustAllCertificates()) {
SdkHttpClient ahc = ApacheHttpClient.builder().buildWithDefaults(AttributeMap
.builder()