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 cc0f768 CAMEL-13148 - Camel-AWS IAM: Make the operations more robust
cc0f768 is described below
commit cc0f7686376e330bc869a91f97d5315de76bf5e0
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Jan 31 15:09:04 2019 +0100
CAMEL-13148 - Camel-AWS IAM: Make the operations more robust
---
.../camel/component/aws/iam/IAMProducer.java | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
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 b5bc330..4e6558e 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
@@ -152,6 +152,8 @@ public class IAMProducer extends DefaultProducer {
if
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.USERNAME))) {
String userName =
exchange.getIn().getHeader(IAMConstants.USERNAME, String.class);
request.withUserName(userName);
+ } else {
+ throw new IllegalArgumentException("User Name must be specified");
}
CreateUserResult result;
try {
@@ -169,6 +171,8 @@ public class IAMProducer extends DefaultProducer {
if
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.USERNAME))) {
String userName =
exchange.getIn().getHeader(IAMConstants.USERNAME, String.class);
request.withUserName(userName);
+ } else {
+ throw new IllegalArgumentException("User Name must be specified");
}
DeleteUserResult result;
try {
@@ -186,6 +190,8 @@ public class IAMProducer extends DefaultProducer {
if
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.USERNAME))) {
String userName =
exchange.getIn().getHeader(IAMConstants.USERNAME, String.class);
request.withUserName(userName);
+ } else {
+ throw new IllegalArgumentException("User Name must be specified");
}
GetUserResult result;
try {
@@ -215,7 +221,7 @@ public class IAMProducer extends DefaultProducer {
if
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.USERNAME))) {
String userName =
exchange.getIn().getHeader(IAMConstants.USERNAME, String.class);
request.withUserName(userName);
- }
+ }
CreateAccessKeyResult result;
try {
result = iamClient.createAccessKey(request);
@@ -284,11 +290,13 @@ public class IAMProducer extends DefaultProducer {
if
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.GROUP_NAME))) {
String groupName =
exchange.getIn().getHeader(IAMConstants.GROUP_NAME, String.class);
request.withGroupName(groupName);
+ } else {
+ throw new IllegalArgumentException("Group Name must be specified");
}
if
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.GROUP_PATH))) {
String groupPath =
exchange.getIn().getHeader(IAMConstants.GROUP_PATH, String.class);
request.withPath(groupPath);
- }
+ }
CreateGroupResult result;
try {
result = iamClient.createGroup(request);
@@ -305,6 +313,8 @@ public class IAMProducer extends DefaultProducer {
if
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.GROUP_NAME))) {
String groupName =
exchange.getIn().getHeader(IAMConstants.GROUP_NAME, String.class);
request.withGroupName(groupName);
+ } else {
+ throw new IllegalArgumentException("Group Name must be specified");
}
DeleteGroupResult result;
try {
@@ -334,10 +344,14 @@ public class IAMProducer extends DefaultProducer {
if
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.GROUP_NAME))) {
String groupName =
exchange.getIn().getHeader(IAMConstants.GROUP_NAME, String.class);
request.withGroupName(groupName);
+ } else {
+ throw new IllegalArgumentException("Group Name must be specified");
}
if
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.USERNAME))) {
String userName =
exchange.getIn().getHeader(IAMConstants.USERNAME, String.class);
request.withUserName(userName);
+ } else {
+ throw new IllegalArgumentException("User Name must be specified");
}
AddUserToGroupResult result;
try {
@@ -355,10 +369,14 @@ public class IAMProducer extends DefaultProducer {
if
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.GROUP_NAME))) {
String groupName =
exchange.getIn().getHeader(IAMConstants.GROUP_NAME, String.class);
request.withGroupName(groupName);
+ } else {
+ throw new IllegalArgumentException("Group Name must be specified");
}
if
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(IAMConstants.USERNAME))) {
String userName =
exchange.getIn().getHeader(IAMConstants.USERNAME, String.class);
request.withUserName(userName);
+ } else {
+ throw new IllegalArgumentException("User Name must be specified");
}
RemoveUserFromGroupResult result;
try {