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 2018/10/05 08:59:57 UTC
[camel] branch master updated: CAMEL-12860 - Camel-AWS IAM: The
accessKey delete operation need to specify an AccessKey Id instead of a
username
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
The following commit(s) were added to refs/heads/master by this push:
new 0980dcd CAMEL-12860 - Camel-AWS IAM: The accessKey delete operation need to specify an AccessKey Id instead of a username
0980dcd is described below
commit 0980dcd66025c0345f1eb14a78ae3335d2c62ccb
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Oct 5 10:58:55 2018 +0200
CAMEL-12860 - Camel-AWS IAM: The accessKey delete operation need to specify an AccessKey Id instead of a username
---
.../main/java/org/apache/camel/component/aws/iam/IAMProducer.java | 6 ++++++
.../org/apache/camel/component/aws/iam/IAMProducerSpringTest.java | 1 +
.../java/org/apache/camel/component/aws/iam/IAMProducerTest.java | 1 +
3 files changed, 8 insertions(+)
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMProducer.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMProducer.java
index 62b2ff2..ffe9b61 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMProducer.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/iam/IAMProducer.java
@@ -209,6 +209,12 @@ public class IAMProducer extends DefaultProducer {
private void deleteAccessKey(AmazonIdentityManagement iamClient, Exchange exchange) {
DeleteAccessKeyRequest request = new DeleteAccessKeyRequest();
+ if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.ACCESS_KEY_ID))) {
+ String accessKeyId = exchange.getIn().getHeader(IAMConstants.ACCESS_KEY_ID, String.class);
+ request.withAccessKeyId(accessKeyId);
+ } else {
+ throw new IllegalArgumentException("Key Id must be specified");
+ }
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.USERNAME))) {
String userName = exchange.getIn().getHeader(IAMConstants.USERNAME, String.class);
request.withUserName(userName);
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerSpringTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerSpringTest.java
index 3cc7def..413223f 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerSpringTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerSpringTest.java
@@ -139,6 +139,7 @@ public class IAMProducerSpringTest extends CamelSpringTestSupport {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(IAMConstants.OPERATION, IAMOperations.deleteAccessKey);
exchange.getIn().setHeader(IAMConstants.USERNAME, "test");
+ exchange.getIn().setHeader(IAMConstants.ACCESS_KEY_ID, "1");
}
});
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerTest.java
index ecd8336..e523c31 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/iam/IAMProducerTest.java
@@ -158,6 +158,7 @@ public class IAMProducerTest extends CamelTestSupport {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(IAMConstants.OPERATION, IAMOperations.deleteAccessKey);
exchange.getIn().setHeader(IAMConstants.USERNAME, "test");
+ exchange.getIn().setHeader(IAMConstants.ACCESS_KEY_ID, "1");
}
});