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 2017/04/13 06:24:29 UTC
camel git commit: [CAMEL-11141] Add support for VPC instances
Repository: camel
Updated Branches:
refs/heads/master a2d861e1d -> bb2d1fc71
[CAMEL-11141] Add support for VPC instances
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bb2d1fc7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bb2d1fc7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bb2d1fc7
Branch: refs/heads/master
Commit: bb2d1fc71211494d507c52279e0e0914344c2df6
Parents: a2d861e
Author: Thomas Diesler <th...@jboss.com>
Authored: Wed Apr 12 18:56:24 2017 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Thu Apr 13 08:21:47 2017 +0200
----------------------------------------------------------------------
.../camel/component/aws/ec2/EC2Constants.java | 1 +
.../camel/component/aws/ec2/EC2Producer.java | 31 ++++++++------------
2 files changed, 14 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/bb2d1fc7/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Constants.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Constants.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Constants.java
index c7dfa65..dd927e5 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Constants.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Constants.java
@@ -36,4 +36,5 @@ public interface EC2Constants {
String INSTANCES_CLIENT_TOKEN = "CamelAwsEC2InstancesClientToken";
String INSTANCES_PLACEMENT = "CamelAwsEC2InstancesPlacement";
String INSTANCES_TAGS = "CamelAwsEC2InstancesTags";
+ String SUBNET_ID = "CamelAwsEC2SubnetId";
}
http://git-wip-us.apache.org/repos/asf/camel/blob/bb2d1fc7/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Producer.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Producer.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Producer.java
index 3c3450c..8053c16 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Producer.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Producer.java
@@ -138,15 +138,6 @@ public class EC2Producer extends DefaultProducer {
private void createAndRunInstance(AmazonEC2Client ec2Client, Exchange exchange) {
String ami;
InstanceType instanceType;
- int minCount;
- int maxCount;
- boolean monitoring;
- String kernelId;
- boolean ebsOptimized;
- Collection securityGroups;
- String keyName;
- String clientToken;
- Placement placement;
RunInstancesRequest request = new RunInstancesRequest();
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.IMAGE_ID))) {
ami = exchange.getIn().getHeader(EC2Constants.IMAGE_ID, String.class);
@@ -161,45 +152,49 @@ public class EC2Producer extends DefaultProducer {
throw new IllegalArgumentException("Instance Type must be specified");
}
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCE_MIN_COUNT))) {
- minCount = exchange.getIn().getHeader(EC2Constants.INSTANCE_MIN_COUNT, Integer.class);
+ int minCount = exchange.getIn().getHeader(EC2Constants.INSTANCE_MIN_COUNT, Integer.class);
request.withMinCount(minCount);
} else {
throw new IllegalArgumentException("Min instances count must be specified");
}
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCE_MAX_COUNT))) {
- maxCount = exchange.getIn().getHeader(EC2Constants.INSTANCE_MAX_COUNT, Integer.class);
+ int maxCount = exchange.getIn().getHeader(EC2Constants.INSTANCE_MAX_COUNT, Integer.class);
request.withMaxCount(maxCount);
} else {
throw new IllegalArgumentException("Max instances count must be specified");
}
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCE_MONITORING))) {
- monitoring = exchange.getIn().getHeader(EC2Constants.INSTANCE_MONITORING, Boolean.class);
+ boolean monitoring = exchange.getIn().getHeader(EC2Constants.INSTANCE_MONITORING, Boolean.class);
request.withMonitoring(monitoring);
}
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCE_KERNEL_ID))) {
- kernelId = exchange.getIn().getHeader(EC2Constants.INSTANCE_KERNEL_ID, String.class);
+ String kernelId = exchange.getIn().getHeader(EC2Constants.INSTANCE_KERNEL_ID, String.class);
request.withKernelId(kernelId);
}
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCE_EBS_OPTIMIZED))) {
- ebsOptimized = exchange.getIn().getHeader(EC2Constants.INSTANCE_EBS_OPTIMIZED, Boolean.class);
+ boolean ebsOptimized = exchange.getIn().getHeader(EC2Constants.INSTANCE_EBS_OPTIMIZED, Boolean.class);
request.withEbsOptimized(ebsOptimized);
}
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCE_SECURITY_GROUPS))) {
- securityGroups = exchange.getIn().getHeader(EC2Constants.INSTANCE_SECURITY_GROUPS, Collection.class);
+ Collection securityGroups = exchange.getIn().getHeader(EC2Constants.INSTANCE_SECURITY_GROUPS, Collection.class);
request.withSecurityGroups(securityGroups);
}
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCES_KEY_PAIR))) {
- keyName = exchange.getIn().getHeader(EC2Constants.INSTANCES_KEY_PAIR, String.class);
+ String keyName = exchange.getIn().getHeader(EC2Constants.INSTANCES_KEY_PAIR, String.class);
request.withKeyName(keyName);
}
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCES_CLIENT_TOKEN))) {
- clientToken = exchange.getIn().getHeader(EC2Constants.INSTANCES_CLIENT_TOKEN, String.class);
+ String clientToken = exchange.getIn().getHeader(EC2Constants.INSTANCES_CLIENT_TOKEN, String.class);
request.withClientToken(clientToken);
}
if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCES_PLACEMENT))) {
- placement = exchange.getIn().getHeader(EC2Constants.INSTANCES_PLACEMENT, Placement.class);
+ Placement placement = exchange.getIn().getHeader(EC2Constants.INSTANCES_PLACEMENT, Placement.class);
request.withPlacement(placement);
}
+ if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.SUBNET_ID))) {
+ String subnetId = exchange.getIn().getHeader(EC2Constants.SUBNET_ID, String.class);
+ request.withSubnetId(subnetId);
+ }
RunInstancesResult result;
try {
result = ec2Client.runInstances(request);