mirror of https://github.com/apache/jclouds.git
Issue 308: added spotInstanceRequestId to ec2 runninginstance
This commit is contained in:
parent
03fe0f3670
commit
f4f714a2f4
|
@ -152,6 +152,8 @@ public class RunningInstance implements Comparable<RunningInstance> {
|
|||
@Nullable
|
||||
private final String subnetId;
|
||||
@Nullable
|
||||
private final String spotInstanceRequestId;
|
||||
@Nullable
|
||||
private final String vpcId;
|
||||
private final RootDeviceType rootDeviceType;
|
||||
@Nullable
|
||||
|
@ -168,8 +170,9 @@ public class RunningInstance implements Comparable<RunningInstance> {
|
|||
Date launchTime, MonitoringState monitoringState, String availabilityZone, @Nullable String placementGroup,
|
||||
String virtualizationType, @Nullable String platform, @Nullable String privateDnsName,
|
||||
@Nullable String privateIpAddress, Set<String> productCodes, @Nullable String ramdiskId,
|
||||
@Nullable String reason, @Nullable String subnetId, @Nullable String vpcId, RootDeviceType rootDeviceType,
|
||||
@Nullable String rootDeviceName, Map<String, EbsBlockDevice> ebsBlockDevices) {
|
||||
@Nullable String reason, @Nullable String subnetId, @Nullable String spotInstanceRequestId,
|
||||
@Nullable String vpcId, RootDeviceType rootDeviceType, @Nullable String rootDeviceName,
|
||||
Map<String, EbsBlockDevice> ebsBlockDevices) {
|
||||
Iterables.addAll(this.groupIds, checkNotNull(groupIds, "groupIds"));
|
||||
this.region = checkNotNull(region, "region");
|
||||
this.amiLaunchIndex = amiLaunchIndex; // nullable on runinstances.
|
||||
|
@ -193,6 +196,7 @@ public class RunningInstance implements Comparable<RunningInstance> {
|
|||
this.ramdiskId = ramdiskId;
|
||||
this.reason = reason;
|
||||
this.subnetId = subnetId;
|
||||
this.spotInstanceRequestId = spotInstanceRequestId;
|
||||
this.vpcId = vpcId;
|
||||
this.rootDeviceType = checkNotNull(rootDeviceType, "rootDeviceType");
|
||||
this.rootDeviceName = rootDeviceName;
|
||||
|
@ -352,6 +356,13 @@ public class RunningInstance implements Comparable<RunningInstance> {
|
|||
return reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* The ID of the Spot Instance request
|
||||
*/
|
||||
public String getSpotInstanceRequestId() {
|
||||
return spotInstanceRequestId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the subnet ID in which the instance is running (Amazon Virtual Private Cloud).
|
||||
*/
|
||||
|
@ -394,20 +405,18 @@ public class RunningInstance implements Comparable<RunningInstance> {
|
|||
int result = 1;
|
||||
result = prime * result + ((amiLaunchIndex == null) ? 0 : amiLaunchIndex.hashCode());
|
||||
result = prime * result + ((availabilityZone == null) ? 0 : availabilityZone.hashCode());
|
||||
result = prime * result + ((placementGroup == null) ? 0 : placementGroup.hashCode());
|
||||
result = prime * result + ((virtualizationType == null) ? 0 : virtualizationType.hashCode());
|
||||
result = prime * result + ((dnsName == null) ? 0 : dnsName.hashCode());
|
||||
result = prime * result + ((ebsBlockDevices == null) ? 0 : ebsBlockDevices.hashCode());
|
||||
result = prime * result + ((groupIds == null) ? 0 : groupIds.hashCode());
|
||||
result = prime * result + ((imageId == null) ? 0 : imageId.hashCode());
|
||||
result = prime * result + ((instanceId == null) ? 0 : instanceId.hashCode());
|
||||
result = prime * result + ((instanceState == null) ? 0 : instanceState.hashCode());
|
||||
result = prime * result + ((instanceType == null) ? 0 : instanceType.hashCode());
|
||||
result = prime * result + ((ipAddress == null) ? 0 : ipAddress.hashCode());
|
||||
result = prime * result + ((kernelId == null) ? 0 : kernelId.hashCode());
|
||||
result = prime * result + ((keyName == null) ? 0 : keyName.hashCode());
|
||||
result = prime * result + ((launchTime == null) ? 0 : launchTime.hashCode());
|
||||
result = prime * result + ((monitoringState == null) ? 0 : monitoringState.hashCode());
|
||||
result = prime * result + ((placementGroup == null) ? 0 : placementGroup.hashCode());
|
||||
result = prime * result + ((platform == null) ? 0 : platform.hashCode());
|
||||
result = prime * result + ((privateDnsName == null) ? 0 : privateDnsName.hashCode());
|
||||
result = prime * result + ((privateIpAddress == null) ? 0 : privateIpAddress.hashCode());
|
||||
|
@ -415,7 +424,11 @@ public class RunningInstance implements Comparable<RunningInstance> {
|
|||
result = prime * result + ((ramdiskId == null) ? 0 : ramdiskId.hashCode());
|
||||
result = prime * result + ((reason == null) ? 0 : reason.hashCode());
|
||||
result = prime * result + ((region == null) ? 0 : region.hashCode());
|
||||
result = prime * result + ((rootDeviceName == null) ? 0 : rootDeviceName.hashCode());
|
||||
result = prime * result + ((rootDeviceType == null) ? 0 : rootDeviceType.hashCode());
|
||||
result = prime * result + ((spotInstanceRequestId == null) ? 0 : spotInstanceRequestId.hashCode());
|
||||
result = prime * result + ((subnetId == null) ? 0 : subnetId.hashCode());
|
||||
result = prime * result + ((virtualizationType == null) ? 0 : virtualizationType.hashCode());
|
||||
result = prime * result + ((vpcId == null) ? 0 : vpcId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
@ -439,16 +452,6 @@ public class RunningInstance implements Comparable<RunningInstance> {
|
|||
return false;
|
||||
} else if (!availabilityZone.equals(other.availabilityZone))
|
||||
return false;
|
||||
if (placementGroup == null) {
|
||||
if (other.placementGroup != null)
|
||||
return false;
|
||||
} else if (!placementGroup.equals(other.placementGroup))
|
||||
return false;
|
||||
if (virtualizationType == null) {
|
||||
if (other.virtualizationType != null)
|
||||
return false;
|
||||
} else if (!virtualizationType.equals(other.virtualizationType))
|
||||
return false;
|
||||
if (dnsName == null) {
|
||||
if (other.dnsName != null)
|
||||
return false;
|
||||
|
@ -474,11 +477,6 @@ public class RunningInstance implements Comparable<RunningInstance> {
|
|||
return false;
|
||||
} else if (!instanceId.equals(other.instanceId))
|
||||
return false;
|
||||
if (instanceState == null) {
|
||||
if (other.instanceState != null)
|
||||
return false;
|
||||
} else if (!instanceState.equals(other.instanceState))
|
||||
return false;
|
||||
if (instanceType == null) {
|
||||
if (other.instanceType != null)
|
||||
return false;
|
||||
|
@ -509,6 +507,11 @@ public class RunningInstance implements Comparable<RunningInstance> {
|
|||
return false;
|
||||
} else if (!monitoringState.equals(other.monitoringState))
|
||||
return false;
|
||||
if (placementGroup == null) {
|
||||
if (other.placementGroup != null)
|
||||
return false;
|
||||
} else if (!placementGroup.equals(other.placementGroup))
|
||||
return false;
|
||||
if (platform == null) {
|
||||
if (other.platform != null)
|
||||
return false;
|
||||
|
@ -544,11 +547,31 @@ public class RunningInstance implements Comparable<RunningInstance> {
|
|||
return false;
|
||||
} else if (!region.equals(other.region))
|
||||
return false;
|
||||
if (rootDeviceName == null) {
|
||||
if (other.rootDeviceName != null)
|
||||
return false;
|
||||
} else if (!rootDeviceName.equals(other.rootDeviceName))
|
||||
return false;
|
||||
if (rootDeviceType == null) {
|
||||
if (other.rootDeviceType != null)
|
||||
return false;
|
||||
} else if (!rootDeviceType.equals(other.rootDeviceType))
|
||||
return false;
|
||||
if (spotInstanceRequestId == null) {
|
||||
if (other.spotInstanceRequestId != null)
|
||||
return false;
|
||||
} else if (!spotInstanceRequestId.equals(other.spotInstanceRequestId))
|
||||
return false;
|
||||
if (subnetId == null) {
|
||||
if (other.subnetId != null)
|
||||
return false;
|
||||
} else if (!subnetId.equals(other.subnetId))
|
||||
return false;
|
||||
if (virtualizationType == null) {
|
||||
if (other.virtualizationType != null)
|
||||
return false;
|
||||
} else if (!virtualizationType.equals(other.virtualizationType))
|
||||
return false;
|
||||
if (vpcId == null) {
|
||||
if (other.vpcId != null)
|
||||
return false;
|
||||
|
@ -567,8 +590,8 @@ public class RunningInstance implements Comparable<RunningInstance> {
|
|||
+ launchTime + ", monitoringState=" + monitoringState + ", platform=" + platform + ", privateDnsName="
|
||||
+ privateDnsName + ", privateIpAddress=" + privateIpAddress + ", productCodes=" + productCodes
|
||||
+ ", ramdiskId=" + ramdiskId + ", reason=" + reason + ", region=" + region + ", rootDeviceName="
|
||||
+ rootDeviceName + ", rootDeviceType=" + rootDeviceType + ", subnetId=" + subnetId + ", vpcId=" + vpcId
|
||||
+ "]";
|
||||
+ rootDeviceName + ", rootDeviceType=" + rootDeviceType + ", spotInstanceRequestId="
|
||||
+ spotInstanceRequestId + ", subnetId=" + subnetId + ", vpcId=" + vpcId + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -86,6 +86,7 @@ public abstract class BaseReservationHandler<T> extends HandlerForGeneratedReque
|
|||
private Set<String> productCodes = Sets.newHashSet();
|
||||
private String ramdiskId;
|
||||
private String reason;
|
||||
private String spotInstanceRequestId;
|
||||
private String subnetId;
|
||||
private String vpcId;
|
||||
protected boolean inInstances;
|
||||
|
@ -183,6 +184,8 @@ public abstract class BaseReservationHandler<T> extends HandlerForGeneratedReque
|
|||
reason = currentOrNull();
|
||||
} else if (qName.equals("subnetId")) {
|
||||
subnetId = currentOrNull();
|
||||
} else if (qName.equals("spotInstanceRequestId")) {
|
||||
spotInstanceRequestId = currentOrNull();
|
||||
} else if (qName.equals("vpcId")) {
|
||||
vpcId = currentOrNull();
|
||||
} else if (qName.equals("productCode")) {
|
||||
|
@ -244,7 +247,8 @@ public abstract class BaseReservationHandler<T> extends HandlerForGeneratedReque
|
|||
instances.add(new RunningInstance(region, groupIds, amiLaunchIndex, dnsName, imageId, instanceId,
|
||||
instanceState, instanceType, ipAddress, kernelId, keyName, launchTime, monitoringState,
|
||||
availabilityZone, placementGroup, virtualizationType, platform, privateDnsName, privateIpAddress,
|
||||
productCodes, ramdiskId, reason, subnetId, vpcId, rootDeviceType, rootDeviceName, ebsBlockDevices));
|
||||
productCodes, ramdiskId, reason, subnetId, spotInstanceRequestId, vpcId, rootDeviceType,
|
||||
rootDeviceName, ebsBlockDevices));
|
||||
this.amiLaunchIndex = null;
|
||||
this.dnsName = null;
|
||||
this.imageId = null;
|
||||
|
@ -266,6 +270,7 @@ public abstract class BaseReservationHandler<T> extends HandlerForGeneratedReque
|
|||
this.ramdiskId = null;
|
||||
this.reason = null;
|
||||
this.subnetId = null;
|
||||
this.spotInstanceRequestId = null;
|
||||
this.vpcId = null;
|
||||
this.rootDeviceType = RootDeviceType.INSTANCE_STORE;
|
||||
this.rootDeviceName = null;
|
||||
|
|
|
@ -77,7 +77,7 @@ public class DescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest {
|
|||
"adriancole.ec21", dateService.iso8601DateParse("2009-11-09T03:00:34.000Z"),
|
||||
MonitoringState.DISABLED, AvailabilityZone.US_EAST_1C, null, "paravirtual", null,
|
||||
"ip-10-243-42-70.ec2.internal", "10.243.42.70", ImmutableSet.<String> of(), "ari-a51cf9cc",
|
||||
null, null, null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap
|
||||
null, null, null, null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap
|
||||
.<String, EbsBlockDevice> of())), "993194456877", null, "r-a3c508cb"));
|
||||
|
||||
Set<Reservation<? extends RunningInstance>> result = getReservations(is);
|
||||
|
@ -96,14 +96,14 @@ public class DescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest {
|
|||
InstanceType.M1_LARGE, (String) null, "aki-ba3adfd3", "example-key-name", dateService
|
||||
.iso8601DateParse("2007-08-07T11:54:42.000Z"), MonitoringState.DISABLED,
|
||||
AvailabilityZone.US_EAST_1B, null, "paravirtual", null, "10-251-50-132.ec2.internal", null,
|
||||
ImmutableSet.of("774F4FF8"), "ari-badbad00", null, null, null, RootDeviceType.INSTANCE_STORE,
|
||||
ImmutableSet.of("774F4FF8"), "ari-badbad00", null, null, null, null, RootDeviceType.INSTANCE_STORE,
|
||||
null, ImmutableMap.<String, EbsBlockDevice> of()), new RunningInstance(defaultRegion,
|
||||
ImmutableSet.of("default"), "23", "ec2-72-44-33-6.compute-1.amazonaws.com", "ami-6ea54007",
|
||||
"i-28a64435", InstanceState.RUNNING, InstanceType.M1_LARGE, (String) null, "aki-ba3adfd3",
|
||||
"example-key-name", dateService.iso8601DateParse("2007-08-07T11:54:42.000Z"),
|
||||
MonitoringState.DISABLED, AvailabilityZone.US_EAST_1B, null, "paravirtual", null,
|
||||
"10-251-50-134.ec2.internal", null, ImmutableSet.of("774F4FF8"), "ari-badbad00", null, null,
|
||||
null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of())),
|
||||
null, null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of())),
|
||||
"UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM", null, "r-44a5402d"));
|
||||
|
||||
Set<Reservation<? extends RunningInstance>> result = getReservations(is);
|
||||
|
@ -123,7 +123,7 @@ public class DescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest {
|
|||
"i-3FFA0762", InstanceState.SHUTTING_DOWN, InstanceType.M1_LARGE, null, "eki-6CBD12F2",
|
||||
"jclouds#euc-17", dateService.iso8601DateParse("2010-06-16T03:06:19.000Z"),
|
||||
MonitoringState.DISABLED, "open", null, "paravirtual", null, "10.7.0.179", null, ImmutableSet
|
||||
.<String> of(), "eri-A97113E4", null, null, null, RootDeviceType.INSTANCE_STORE, null,
|
||||
.<String> of(), "eri-A97113E4", null, null, null, null, RootDeviceType.INSTANCE_STORE, null,
|
||||
ImmutableMap.<String, EbsBlockDevice> of())), "jclouds", null, "r-4D2A08AD"));
|
||||
|
||||
Set<Reservation<? extends RunningInstance>> result = getReservations(is);
|
||||
|
@ -143,7 +143,7 @@ public class DescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest {
|
|||
"adriancole.ec2ebs1", dateService.iso8601DateParse("2009-12-30T04:06:23.000Z"),
|
||||
MonitoringState.DISABLED, AvailabilityZone.US_EAST_1B, "placement", "hvm", null,
|
||||
"domU-12-31-39-09-CE-53.compute-1.internal", "10.210.209.157", ImmutableSet.<String> of(),
|
||||
"ari-a51cf9cc", null, null, null, RootDeviceType.EBS, "/dev/sda1", ImmutableMap
|
||||
"ari-a51cf9cc", null, null, null, null, RootDeviceType.EBS, "/dev/sda1", ImmutableMap
|
||||
.<String, EbsBlockDevice> of("/dev/sda1", new EbsBlockDevice("vol-dc6ca8b5",
|
||||
Attachment.Status.ATTACHED, dateService
|
||||
.iso8601DateParse("2009-12-30T04:06:29.000Z"), true)))),
|
||||
|
|
|
@ -71,17 +71,17 @@ public class RunInstancesResponseHandlerTest extends BaseEC2HandlerTest {
|
|||
null, "ami-60a54009", "i-2ba64342", InstanceState.PENDING, InstanceType.M1_SMALL, (String) null, null,
|
||||
"example-key-name", dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"), MonitoringState.ENABLED,
|
||||
AvailabilityZone.US_EAST_1B, null, "paravirtual", null, (String) null, null, Sets
|
||||
.<String> newLinkedHashSet(), null, null, null, null, RootDeviceType.INSTANCE_STORE, null,
|
||||
ImmutableMap.<String, EbsBlockDevice> of()), new RunningInstance(defaultRegion, ImmutableSet
|
||||
.<String> newLinkedHashSet(), null, null, null, null, null, RootDeviceType.INSTANCE_STORE,
|
||||
null, ImmutableMap.<String, EbsBlockDevice> of()), new RunningInstance(defaultRegion, ImmutableSet
|
||||
.of("default"), "1", null, "ami-60a54009", "i-2bc64242", InstanceState.PENDING, InstanceType.M1_SMALL,
|
||||
(String) null, null, "example-key-name", dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"),
|
||||
MonitoringState.ENABLED, AvailabilityZone.US_EAST_1B, null, "paravirtual", null, (String) null, null,
|
||||
Sets.<String> newLinkedHashSet(), null, null, null, null, RootDeviceType.INSTANCE_STORE, null,
|
||||
Sets.<String> newLinkedHashSet(), null, null, null, null, null, RootDeviceType.INSTANCE_STORE, null,
|
||||
ImmutableMap.<String, EbsBlockDevice> of()), new RunningInstance(defaultRegion, ImmutableSet
|
||||
.of("default"), "2", null, "ami-60a54009", "i-2be64332", InstanceState.PENDING, InstanceType.M1_SMALL,
|
||||
(String) null, null, "example-key-name", dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"),
|
||||
MonitoringState.ENABLED, AvailabilityZone.US_EAST_1B, null, "paravirtual", null, (String) null, null,
|
||||
Sets.<String> newLinkedHashSet(), null, null, null, null, RootDeviceType.INSTANCE_STORE, null,
|
||||
Sets.<String> newLinkedHashSet(), null, null, null, null, null, RootDeviceType.INSTANCE_STORE, null,
|
||||
ImmutableMap.<String, EbsBlockDevice> of())
|
||||
|
||||
), "AIDADH4IGTRXXKCD", null, "r-47a5402e");
|
||||
|
|
Loading…
Reference in New Issue