mirror of https://github.com/apache/jclouds.git
Issue 358: changed to enum.UNRECOGNIZED for all values that could arrive from a server
This commit is contained in:
parent
3d5bfa7422
commit
e94ee94cd4
|
@ -21,14 +21,18 @@ package org.jclouds.atmosonline.saas.domain;
|
|||
|
||||
public enum FileType {
|
||||
|
||||
DIRECTORY, REGULAR;
|
||||
DIRECTORY, REGULAR, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public static FileType fromValue(String v) {
|
||||
return valueOf(v.toUpperCase());
|
||||
try {
|
||||
return valueOf(v.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.google.common.base.CaseFormat;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public enum StandardUnit {
|
||||
SECONDS, PERCENT, BYTES, BITS, COUNT, BITS_PER_SECOND, COUNT_PER_SECOND, NONE;
|
||||
SECONDS, PERCENT, BYTES, BITS, COUNT, BITS_PER_SECOND, COUNT_PER_SECOND, NONE, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name().replace("_PER_", "/")));
|
||||
|
@ -41,7 +41,11 @@ public enum StandardUnit {
|
|||
}
|
||||
|
||||
public static StandardUnit fromValue(String state) {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state").replace("/",
|
||||
"_PER_")));
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state").replace(
|
||||
"/", "_PER_")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,8 @@ public class RunningInstanceToNodeMetadata implements Function<RunningInstance,
|
|||
.put(InstanceState.PENDING, NodeState.PENDING).put(InstanceState.RUNNING, NodeState.RUNNING).put(
|
||||
InstanceState.SHUTTING_DOWN, NodeState.PENDING)
|
||||
.put(InstanceState.TERMINATED, NodeState.TERMINATED).put(InstanceState.STOPPING, NodeState.PENDING).put(
|
||||
InstanceState.STOPPED, NodeState.SUSPENDED).build();
|
||||
InstanceState.STOPPED, NodeState.SUSPENDED)
|
||||
.put(InstanceState.UNRECOGNIZED, NodeState.UNRECOGNIZED).build();
|
||||
|
||||
private final EC2Client client;
|
||||
private final Map<RegionAndName, KeyPair> credentialsMap;
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Date;
|
|||
*/
|
||||
public class Attachment implements Comparable<Attachment> {
|
||||
public static enum Status {
|
||||
ATTACHING, ATTACHED, DETACHING, DETACHED, BUSY;
|
||||
ATTACHING, ATTACHED, DETACHING, DETACHED, BUSY, UNRECOGNIZED;
|
||||
public String value() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
@ -43,7 +43,11 @@ public class Attachment implements Comparable<Attachment> {
|
|||
}
|
||||
|
||||
public static Status fromValue(String status) {
|
||||
return valueOf(checkNotNull(status, "status").toUpperCase());
|
||||
try {
|
||||
return valueOf(checkNotNull(status, "status").toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,8 +58,7 @@ public class Attachment implements Comparable<Attachment> {
|
|||
private final Status status;
|
||||
private final Date attachTime;
|
||||
|
||||
public Attachment(String region, String volumeId, String instanceId, String device,
|
||||
Status status, Date attachTime) {
|
||||
public Attachment(String region, String volumeId, String instanceId, String device, Status status, Date attachTime) {
|
||||
this.region = checkNotNull(region, "region");
|
||||
this.volumeId = volumeId;
|
||||
this.instanceId = instanceId;
|
||||
|
@ -164,9 +167,8 @@ public class Attachment implements Comparable<Attachment> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Attachment [region=" + region + ", volumeId=" + volumeId + ", instanceId="
|
||||
+ instanceId + ", device=" + device + ", attachTime=" + attachTime + ", status="
|
||||
+ status + "]";
|
||||
return "Attachment [region=" + region + ", volumeId=" + volumeId + ", instanceId=" + instanceId + ", device="
|
||||
+ device + ", attachTime=" + attachTime + ", status=" + status + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,22 +59,18 @@ public class Image implements Comparable<Image> {
|
|||
private final RootDeviceType rootDeviceType;
|
||||
@Nullable
|
||||
private final String rootDeviceName;
|
||||
private final Map<String, EbsBlockDevice> ebsBlockDevices = Maps
|
||||
.newHashMap();
|
||||
private final Map<String, EbsBlockDevice> ebsBlockDevices = Maps.newHashMap();
|
||||
private final String virtualizationType;
|
||||
|
||||
public String getVirtualizationType() {
|
||||
return virtualizationType;
|
||||
}
|
||||
|
||||
public Image(String region, Architecture architecture,
|
||||
@Nullable String name, @Nullable String description, String imageId,
|
||||
String imageLocation, String imageOwnerId, ImageState imageState,
|
||||
ImageType imageType, boolean isPublic, Iterable<String> productCodes,
|
||||
@Nullable String kernelId, @Nullable String platform,
|
||||
@Nullable String ramdiskId, RootDeviceType rootDeviceType,
|
||||
@Nullable String rootDeviceName,
|
||||
Map<String, EbsBlockDevice> ebsBlockDevices, String virtualizationType) {
|
||||
public Image(String region, Architecture architecture, @Nullable String name, @Nullable String description,
|
||||
String imageId, String imageLocation, String imageOwnerId, ImageState imageState, ImageType imageType,
|
||||
boolean isPublic, Iterable<String> productCodes, @Nullable String kernelId, @Nullable String platform,
|
||||
@Nullable String ramdiskId, RootDeviceType rootDeviceType, @Nullable String rootDeviceName,
|
||||
Map<String, EbsBlockDevice> ebsBlockDevices, String virtualizationType) {
|
||||
this.region = checkNotNull(region, "region");
|
||||
this.architecture = checkNotNull(architecture, "architecture");
|
||||
this.imageId = checkNotNull(imageId, "imageId");
|
||||
|
@ -88,14 +84,11 @@ public class Image implements Comparable<Image> {
|
|||
this.isPublic = isPublic;
|
||||
this.kernelId = kernelId;
|
||||
this.platform = platform;
|
||||
Iterables.addAll(this.productCodes, checkNotNull(productCodes,
|
||||
"productCodes"));
|
||||
Iterables.addAll(this.productCodes, checkNotNull(productCodes, "productCodes"));
|
||||
this.ramdiskId = ramdiskId;
|
||||
this.rootDeviceType = checkNotNull(rootDeviceType, "rootDeviceType");
|
||||
this.ebsBlockDevices.putAll(checkNotNull(ebsBlockDevices,
|
||||
"ebsBlockDevices"));
|
||||
this.virtualizationType = checkNotNull(virtualizationType,
|
||||
"virtualizationType");
|
||||
this.ebsBlockDevices.putAll(checkNotNull(ebsBlockDevices, "ebsBlockDevices"));
|
||||
this.virtualizationType = checkNotNull(virtualizationType, "virtualizationType");
|
||||
}
|
||||
|
||||
/** The serialVersionUID */
|
||||
|
@ -109,36 +102,48 @@ public class Image implements Comparable<Image> {
|
|||
/**
|
||||
* the image is deregistered and no longer available for launching
|
||||
*/
|
||||
DEREGISTERED;
|
||||
DEREGISTERED, UNRECOGNIZED;
|
||||
public String value() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public static ImageState fromValue(String v) {
|
||||
return valueOf(v.toUpperCase());
|
||||
try {
|
||||
return valueOf(v.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Architecture {
|
||||
I386, X86_64;
|
||||
I386, X86_64, UNRECOGNIZED;
|
||||
public String value() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public static Architecture fromValue(String v) {
|
||||
return valueOf(v.toUpperCase());
|
||||
try {
|
||||
return valueOf(v.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum ImageType {
|
||||
|
||||
MACHINE, KERNEL, RAMDISK;
|
||||
MACHINE, KERNEL, RAMDISK, UNRECOGNIZED;
|
||||
public String value() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public static ImageType fromValue(String v) {
|
||||
return valueOf(v.toUpperCase());
|
||||
try {
|
||||
return valueOf(v.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -149,8 +154,7 @@ public class Image implements Comparable<Image> {
|
|||
private final long volumeSize;
|
||||
private final boolean deleteOnTermination;
|
||||
|
||||
public EbsBlockDevice(@Nullable String snapshotId, long volumeSize,
|
||||
boolean deleteOnTermination) {
|
||||
public EbsBlockDevice(@Nullable String snapshotId, long volumeSize, boolean deleteOnTermination) {
|
||||
this.snapshotId = snapshotId;
|
||||
this.volumeSize = volumeSize;
|
||||
this.deleteOnTermination = deleteOnTermination;
|
||||
|
@ -173,8 +177,7 @@ public class Image implements Comparable<Image> {
|
|||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (deleteOnTermination ? 1231 : 1237);
|
||||
result = prime * result
|
||||
+ ((snapshotId == null) ? 0 : snapshotId.hashCode());
|
||||
result = prime * result + ((snapshotId == null) ? 0 : snapshotId.hashCode());
|
||||
result = prime * result + (int) (volumeSize ^ (volumeSize >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
@ -202,9 +205,8 @@ public class Image implements Comparable<Image> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EbsBlockDevice [deleteOnTermination=" + deleteOnTermination
|
||||
+ ", snapshotId=" + snapshotId + ", volumeSize=" + volumeSize
|
||||
+ "]";
|
||||
return "EbsBlockDevice [deleteOnTermination=" + deleteOnTermination + ", snapshotId=" + snapshotId
|
||||
+ ", volumeSize=" + volumeSize + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -246,10 +248,9 @@ public class Image implements Comparable<Image> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Current state of the AMI. If the operation returns available, the image is
|
||||
* successfully registered and avail able for launching. If the operation
|
||||
* returns deregistered, the image is deregistered and no longer available
|
||||
* for launching.
|
||||
* Current state of the AMI. If the operation returns available, the image is successfully
|
||||
* registered and avail able for launching. If the operation returns deregistered, the image is
|
||||
* deregistered and no longer available for launching.
|
||||
*/
|
||||
public ImageState getImageState() {
|
||||
return imageState;
|
||||
|
@ -263,16 +264,15 @@ public class Image implements Comparable<Image> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if this image has public launch permissions. Returns false if
|
||||
* it only has implicit and explicit launch permissions.
|
||||
* Returns true if this image has public launch permissions. Returns false if it only has
|
||||
* implicit and explicit launch permissions.
|
||||
*/
|
||||
public boolean isPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
/**
|
||||
* The kernel associated with the image, if any. Only applicable for machine
|
||||
* images.
|
||||
* The kernel associated with the image, if any. Only applicable for machine images.
|
||||
*/
|
||||
public String getKernelId() {
|
||||
return kernelId;
|
||||
|
@ -293,8 +293,7 @@ public class Image implements Comparable<Image> {
|
|||
}
|
||||
|
||||
/**
|
||||
* The RAM disk associated with the image, if any. Only applicable for
|
||||
* machine images.
|
||||
* The RAM disk associated with the image, if any. Only applicable for machine images.
|
||||
*/
|
||||
public String getRamdiskId() {
|
||||
return ramdiskId;
|
||||
|
@ -309,8 +308,8 @@ public class Image implements Comparable<Image> {
|
|||
|
||||
/**
|
||||
*
|
||||
* @return The root device type used by the AMI. The AMI can use an Amazon
|
||||
* EBS or instance store root device.
|
||||
* @return The root device type used by the AMI. The AMI can use an Amazon EBS or instance store
|
||||
* root device.
|
||||
*/
|
||||
public RootDeviceType getRootDeviceType() {
|
||||
return rootDeviceType;
|
||||
|
@ -336,37 +335,24 @@ public class Image implements Comparable<Image> {
|
|||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((architecture == null) ? 0 : architecture.hashCode());
|
||||
result = prime * result
|
||||
+ ((description == null) ? 0 : description.hashCode());
|
||||
result = prime * result
|
||||
+ ((ebsBlockDevices == null) ? 0 : ebsBlockDevices.hashCode());
|
||||
result = prime * result + ((architecture == null) ? 0 : architecture.hashCode());
|
||||
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
||||
result = prime * result + ((ebsBlockDevices == null) ? 0 : ebsBlockDevices.hashCode());
|
||||
result = prime * result + ((imageId == null) ? 0 : imageId.hashCode());
|
||||
result = prime * result
|
||||
+ ((imageLocation == null) ? 0 : imageLocation.hashCode());
|
||||
result = prime * result
|
||||
+ ((imageOwnerId == null) ? 0 : imageOwnerId.hashCode());
|
||||
result = prime * result
|
||||
+ ((imageState == null) ? 0 : imageState.hashCode());
|
||||
result = prime * result
|
||||
+ ((imageType == null) ? 0 : imageType.hashCode());
|
||||
result = prime * result + ((imageLocation == null) ? 0 : imageLocation.hashCode());
|
||||
result = prime * result + ((imageOwnerId == null) ? 0 : imageOwnerId.hashCode());
|
||||
result = prime * result + ((imageState == null) ? 0 : imageState.hashCode());
|
||||
result = prime * result + ((imageType == null) ? 0 : imageType.hashCode());
|
||||
result = prime * result + (isPublic ? 1231 : 1237);
|
||||
result = prime * result + ((kernelId == null) ? 0 : kernelId.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((platform == null) ? 0 : platform.hashCode());
|
||||
result = prime * result
|
||||
+ ((productCodes == null) ? 0 : productCodes.hashCode());
|
||||
result = prime * result
|
||||
+ ((ramdiskId == null) ? 0 : ramdiskId.hashCode());
|
||||
result = prime * result + ((productCodes == null) ? 0 : productCodes.hashCode());
|
||||
result = prime * result + ((ramdiskId == null) ? 0 : ramdiskId.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
|
||||
+ ((virtualizationType == null) ? 0 : virtualizationType.hashCode());
|
||||
result = prime * result + ((rootDeviceName == null) ? 0 : rootDeviceName.hashCode());
|
||||
result = prime * result + ((rootDeviceType == null) ? 0 : rootDeviceType.hashCode());
|
||||
result = prime * result + ((virtualizationType == null) ? 0 : virtualizationType.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -471,16 +457,13 @@ public class Image implements Comparable<Image> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Image [architecture=" + architecture + ", description="
|
||||
+ description + ", ebsBlockDevices=" + ebsBlockDevices
|
||||
+ ", imageId=" + imageId + ", imageLocation=" + imageLocation
|
||||
+ ", imageOwnerId=" + imageOwnerId + ", imageState=" + imageState
|
||||
+ ", imageType=" + imageType + ", isPublic=" + isPublic
|
||||
+ ", kernelId=" + kernelId + ", name=" + name + ", platform="
|
||||
+ platform + ", productCodes=" + productCodes + ", ramdiskId="
|
||||
+ ramdiskId + ", region=" + region + ", rootDeviceName="
|
||||
+ rootDeviceName + ", rootDeviceType=" + rootDeviceType
|
||||
+ ", virtualizationType=" + virtualizationType + "]";
|
||||
return "Image [architecture=" + architecture + ", description=" + description + ", ebsBlockDevices="
|
||||
+ ebsBlockDevices + ", imageId=" + imageId + ", imageLocation=" + imageLocation + ", imageOwnerId="
|
||||
+ imageOwnerId + ", imageState=" + imageState + ", imageType=" + imageType + ", isPublic=" + isPublic
|
||||
+ ", kernelId=" + kernelId + ", name=" + name + ", platform=" + platform + ", productCodes="
|
||||
+ productCodes + ", ramdiskId=" + ramdiskId + ", region=" + region + ", rootDeviceName="
|
||||
+ rootDeviceName + ", rootDeviceType=" + rootDeviceType + ", virtualizationType=" + virtualizationType
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -58,7 +58,7 @@ public enum ImageAttribute {
|
|||
/**
|
||||
* the mapping that defines native device names to use when exposing virtual devices.
|
||||
*/
|
||||
BLOCK_DEVICE_MAPPING;
|
||||
BLOCK_DEVICE_MAPPING, UNRECOGNIZED;
|
||||
public String value() {
|
||||
switch (this) {
|
||||
case PRODUCT_CODES:
|
||||
|
@ -97,7 +97,7 @@ public enum ImageAttribute {
|
|||
else if ("blockDeviceMapping".equals(attribute))
|
||||
return BLOCK_DEVICE_MAPPING;
|
||||
else
|
||||
throw new IllegalArgumentException("unmapped attribute: " + attribute);
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
|
||||
}
|
|
@ -62,7 +62,7 @@ public enum InstanceState {
|
|||
/**
|
||||
* the instance is stopped
|
||||
*/
|
||||
STOPPED;
|
||||
STOPPED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()));
|
||||
|
@ -74,8 +74,11 @@ public enum InstanceState {
|
|||
}
|
||||
|
||||
public static InstanceState fromValue(String state) {
|
||||
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state,
|
||||
"state")));
|
||||
try {
|
||||
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
public static InstanceState fromValue(int v) {
|
||||
|
@ -93,7 +96,7 @@ public enum InstanceState {
|
|||
case 80:
|
||||
return STOPPED;
|
||||
default:
|
||||
throw new IllegalArgumentException("invalid state:" + v);
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,7 +27,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
*/
|
||||
public enum IpProtocol {
|
||||
|
||||
TCP, UDP, ICMP;
|
||||
TCP, UDP, ICMP, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return name().toLowerCase();
|
||||
|
@ -39,7 +39,11 @@ public enum IpProtocol {
|
|||
}
|
||||
|
||||
public static IpProtocol fromValue(String protocol) {
|
||||
return valueOf(checkNotNull(protocol, "protocol").toUpperCase());
|
||||
try {
|
||||
return valueOf(checkNotNull(protocol, "protocol").toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -35,7 +35,7 @@ import org.jclouds.aws.ec2.services.MonitoringClient;
|
|||
*/
|
||||
public enum MonitoringState {
|
||||
|
||||
PENDING, ENABLED, DISABLING, DISABLED;
|
||||
PENDING, ENABLED, DISABLING, DISABLED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return name().toLowerCase();
|
||||
|
@ -54,6 +54,10 @@ public enum MonitoringState {
|
|||
return DISABLED;
|
||||
if ("true".endsWith(state))
|
||||
return ENABLED;
|
||||
return valueOf(checkNotNull(state, "state").toUpperCase());
|
||||
try {
|
||||
return valueOf(checkNotNull(state, "state").toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,7 +41,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
*/
|
||||
public class PlacementGroup implements Comparable<PlacementGroup> {
|
||||
public static enum State {
|
||||
PENDING, AVAILABLE, DELETING, DELETED;
|
||||
PENDING, AVAILABLE, DELETING, DELETED, UNRECOGNIZED;
|
||||
public String value() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
@ -52,7 +52,11 @@ public class PlacementGroup implements Comparable<PlacementGroup> {
|
|||
}
|
||||
|
||||
public static State fromValue(String state) {
|
||||
return valueOf(checkNotNull(state, "state").toUpperCase());
|
||||
try {
|
||||
return valueOf(checkNotNull(state, "state").toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,8 +150,7 @@ public class PlacementGroup implements Comparable<PlacementGroup> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[name=" + name + ", region=" + region + ", state=" + state + ", strategy=" + strategy
|
||||
+ "]";
|
||||
return "[name=" + name + ", region=" + region + ", state=" + state + ", strategy=" + strategy + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public enum RootDeviceType {
|
|||
|
||||
INSTANCE_STORE,
|
||||
|
||||
EBS;
|
||||
EBS, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||
|
@ -42,6 +42,10 @@ public enum RootDeviceType {
|
|||
}
|
||||
|
||||
public static RootDeviceType fromValue(String v) {
|
||||
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v));
|
||||
try {
|
||||
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,7 +31,7 @@ import java.util.Date;
|
|||
*/
|
||||
public class Snapshot implements Comparable<Snapshot> {
|
||||
public static enum Status {
|
||||
PENDING, COMPLETED, ERROR;
|
||||
PENDING, COMPLETED, ERROR, UNRECOGNIZED;
|
||||
public String value() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
@ -42,7 +42,11 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||
}
|
||||
|
||||
public static Status fromValue(String status) {
|
||||
return valueOf(checkNotNull(status, "status").toUpperCase());
|
||||
try {
|
||||
return valueOf(checkNotNull(status, "status").toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,8 +61,8 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||
private final String description;
|
||||
private final String ownerAlias;
|
||||
|
||||
public Snapshot(String region, String id, String volumeId, int volumeSize, Status status,
|
||||
Date startTime, int progress, String ownerId, String description, String ownerAlias) {
|
||||
public Snapshot(String region, String id, String volumeId, int volumeSize, Status status, Date startTime,
|
||||
int progress, String ownerId, String description, String ownerAlias) {
|
||||
this.region = checkNotNull(region, "region");
|
||||
this.id = id;
|
||||
this.volumeId = volumeId;
|
||||
|
@ -135,8 +139,8 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||
}
|
||||
|
||||
/**
|
||||
* The AWS identity alias (e.g., "amazon", "redhat", "self", etc.) or AWS identity ID that owns the
|
||||
* AMI.
|
||||
* The AWS identity alias (e.g., "amazon", "redhat", "self", etc.) or AWS identity ID that owns
|
||||
* the AMI.
|
||||
*/
|
||||
public String getOwnerAlias() {
|
||||
return ownerAlias;
|
||||
|
@ -217,10 +221,9 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Snapshot [description=" + description + ", id=" + id + ", ownerAlias=" + ownerAlias
|
||||
+ ", ownerId=" + ownerId + ", progress=" + progress + ", startTime=" + startTime
|
||||
+ ", status=" + status + ", volumeId=" + volumeId + ", volumeSize=" + volumeSize
|
||||
+ "]";
|
||||
return "Snapshot [description=" + description + ", id=" + id + ", ownerAlias=" + ownerAlias + ", ownerId="
|
||||
+ ownerId + ", progress=" + progress + ", startTime=" + startTime + ", status=" + status + ", volumeId="
|
||||
+ volumeId + ", volumeSize=" + volumeSize + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,7 +46,7 @@ public class Volume implements Comparable<Volume> {
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public static enum InstanceInitiatedShutdownBehavior {
|
||||
STOP, TERMINATE;
|
||||
STOP, TERMINATE, UNRECOGNIZED;
|
||||
public String value() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
@ -57,12 +57,16 @@ public class Volume implements Comparable<Volume> {
|
|||
}
|
||||
|
||||
public static InstanceInitiatedShutdownBehavior fromValue(String status) {
|
||||
return valueOf(checkNotNull(status, "status").toUpperCase());
|
||||
try {
|
||||
return valueOf(checkNotNull(status, "status").toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Status {
|
||||
CREATING, AVAILABLE, IN_USE, DELETING;
|
||||
CREATING, AVAILABLE, IN_USE, DELETING, UNRECOGNIZED;
|
||||
public String value() {
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||
}
|
||||
|
@ -73,8 +77,11 @@ public class Volume implements Comparable<Volume> {
|
|||
}
|
||||
|
||||
public static Status fromValue(String status) {
|
||||
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(
|
||||
status, "status")));
|
||||
try {
|
||||
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(status, "status")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,9 +95,8 @@ public class Volume implements Comparable<Volume> {
|
|||
private final Date createTime;
|
||||
private final Set<Attachment> attachments = Sets.newLinkedHashSet();
|
||||
|
||||
public Volume(String region, String id, int size, String snapshotId,
|
||||
String availabilityZone, Volume.Status status, Date createTime,
|
||||
Iterable<Attachment> attachments) {
|
||||
public Volume(String region, String id, int size, String snapshotId, String availabilityZone, Volume.Status status,
|
||||
Date createTime, Iterable<Attachment> attachments) {
|
||||
this.region = checkNotNull(region, "region");
|
||||
this.id = id;
|
||||
this.size = size;
|
||||
|
@ -208,8 +214,8 @@ public class Volume implements Comparable<Volume> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Volume [attachments=" + attachments + ", availabilityZone=" + availabilityZone
|
||||
+ ", createTime=" + createTime + ", id=" + id + ", region=" + region + ", size="
|
||||
+ size + ", snapshotId=" + snapshotId + ", status=" + status + "]";
|
||||
return "Volume [attachments=" + attachments + ", availabilityZone=" + availabilityZone + ", createTime="
|
||||
+ createTime + ", id=" + id + ", region=" + region + ", size=" + size + ", snapshotId=" + snapshotId
|
||||
+ ", status=" + status + "]";
|
||||
}
|
||||
}
|
|
@ -61,13 +61,17 @@ import com.google.common.base.CaseFormat;
|
|||
* "http://docs.amazonwebservices.com/AmazonS3/latest/index.html?RESTrequestPaymentGET.html" />
|
||||
*/
|
||||
public enum Payer {
|
||||
REQUESTER, BUCKET_OWNER;
|
||||
REQUESTER, BUCKET_OWNER, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
public static Payer fromValue(String payer) {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, payer));
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, payer));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class LocationConstraintHandler extends ParseSax.HandlerWithResult<String
|
|||
return Region.US_WEST_1;
|
||||
else if (v.equals(Region.AP_SOUTHEAST_1))
|
||||
return Region.AP_SOUTHEAST_1;
|
||||
throw new IllegalStateException("unimplemented location: " + v);
|
||||
return v;
|
||||
}
|
||||
|
||||
public void characters(char ch[], int start, int length) {
|
||||
|
|
|
@ -217,7 +217,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
|||
assertEquals(image.getOperatingSystem().getArch(), "paravirtual");
|
||||
assertEquals(image.getOperatingSystem().getDescription(),
|
||||
"vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml");
|
||||
assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UNKNOWN);
|
||||
assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UNRECOGNIZED);
|
||||
assertEquals(image.getUserMetadata(), ImmutableMap.<String, String> of("owner", "133804938231", "rootDeviceType",
|
||||
"instance-store"));
|
||||
assertEquals(image.getVersion(), "5622");
|
||||
|
|
|
@ -27,7 +27,7 @@ import com.google.common.base.CaseFormat;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public enum BlobType {
|
||||
BLOCK_BLOB, PAGE_BLOB;
|
||||
BLOCK_BLOB, PAGE_BLOB, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
|
@ -39,7 +39,10 @@ public enum BlobType {
|
|||
}
|
||||
|
||||
public static BlobType fromValue(String type) {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type,
|
||||
"type")));
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,7 +27,7 @@ import com.google.common.base.CaseFormat;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public enum LeaseStatus {
|
||||
LOCKED, UNLOCKED;
|
||||
LOCKED, UNLOCKED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
|
@ -39,7 +39,10 @@ public enum LeaseStatus {
|
|||
}
|
||||
|
||||
public static LeaseStatus fromValue(String type) {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type,
|
||||
"type")));
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -287,10 +287,10 @@ See http://code.google.com/p/jclouds for details."
|
|||
[#^NodeMetadata node]
|
||||
(state-predicate node ERROR))
|
||||
|
||||
(defn unknown-state?
|
||||
"Predicate for the node being in an unknown state."
|
||||
(defn unrecognized-state?
|
||||
"Predicate for the node being in an unrecognized state."
|
||||
[#^NodeMetadata node]
|
||||
(state-predicate node UNKNOWN))
|
||||
(state-predicate node UNRECOGNIZED))
|
||||
|
||||
(defn public-ips
|
||||
"Returns the node's public ips"
|
||||
|
|
|
@ -46,8 +46,8 @@ public enum NodeState {
|
|||
*/
|
||||
ERROR,
|
||||
/**
|
||||
* The state of the node is unknown.
|
||||
* The state of the node is unrecognized.
|
||||
*/
|
||||
UNKNOWN;
|
||||
UNRECOGNIZED;
|
||||
|
||||
}
|
|
@ -30,7 +30,7 @@ import com.google.common.base.CaseFormat;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public enum OsFamily {
|
||||
UNKNOWN, AIX, ARCH, CENTOS, DARWIN, DEBIAN, ESX, FEDORA, FREEBSD, GENTOO, HPUX, LINUX,
|
||||
UNRECOGNIZED, AIX, ARCH, CENTOS, DARWIN, DEBIAN, ESX, FEDORA, FREEBSD, GENTOO, HPUX, LINUX,
|
||||
/**
|
||||
* @see <a href="http://aws.amazon.com/amazon-linux-ami/">amazon linux ami</a>
|
||||
*/
|
||||
|
@ -53,7 +53,7 @@ public enum OsFamily {
|
|||
try {
|
||||
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(osFamily, "osFamily")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNKNOWN;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,8 +28,7 @@ import com.google.common.annotations.Beta;
|
|||
* Operating system based on DMTF CIM model.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @see <a href="http://dmtf.org/standards/cim/cim_schema_v2260">DMTF CIM
|
||||
* model</a>
|
||||
* @see <a href="http://dmtf.org/standards/cim/cim_schema_v2260">DMTF CIM model</a>
|
||||
*/
|
||||
@Beta
|
||||
public class CIMOperatingSystem extends OperatingSystem {
|
||||
|
@ -38,7 +37,7 @@ public class CIMOperatingSystem extends OperatingSystem {
|
|||
/**
|
||||
* Other
|
||||
*/
|
||||
OTHER(1, "Other", OsFamily.UNKNOWN, false),
|
||||
OTHER(1, "Other", OsFamily.UNRECOGNIZED, false),
|
||||
/**
|
||||
* MACOS
|
||||
*/
|
||||
|
@ -66,7 +65,7 @@ public class CIMOperatingSystem extends OperatingSystem {
|
|||
/**
|
||||
* Not Applicable
|
||||
*/
|
||||
NOT_APPLICABLE(66, "Not Applicable", OsFamily.UNKNOWN, false),
|
||||
NOT_APPLICABLE(66, "Not Applicable", OsFamily.UNRECOGNIZED, false),
|
||||
/**
|
||||
* Microsoft Windows Server 2003
|
||||
*/
|
||||
|
@ -174,7 +173,7 @@ public class CIMOperatingSystem extends OperatingSystem {
|
|||
/**
|
||||
* Other 64-Bit
|
||||
*/
|
||||
OTHER_64(102, "Other 64-Bit", OsFamily.UNKNOWN, true),
|
||||
OTHER_64(102, "Other 64-Bit", OsFamily.UNRECOGNIZED, true),
|
||||
/**
|
||||
* Microsoft Windows Server 2008 R2
|
||||
*/
|
||||
|
@ -202,7 +201,8 @@ public class CIMOperatingSystem extends OperatingSystem {
|
|||
/**
|
||||
* Oracle Enterprise Linux 64-bit
|
||||
*/
|
||||
ORACLE_ENTERPRISE_LINUX_64(109, "Oracle Enterprise Linux 64-bit", OsFamily.OEL, true);
|
||||
ORACLE_ENTERPRISE_LINUX_64(109, "Oracle Enterprise Linux 64-bit", OsFamily.OEL, true), UNRECOGNIZED(
|
||||
Integer.MAX_VALUE, "UNRECOGNIZED", null, true);
|
||||
|
||||
private final int code;
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class CIMOperatingSystem extends OperatingSystem {
|
|||
if (type.code == code)
|
||||
return type;
|
||||
}
|
||||
return OTHER;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -253,6 +253,7 @@ public class CIMOperatingSystem extends OperatingSystem {
|
|||
super(osType.getFamily(), osType.getValue(), version, arch, description, osType.is64Bit());
|
||||
this.osType = osType;
|
||||
}
|
||||
|
||||
/**
|
||||
* CIM OSType of the image
|
||||
*/
|
||||
|
@ -288,6 +289,6 @@ public class CIMOperatingSystem extends OperatingSystem {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[osType=" + osType + ", version=" + getVersion() + ", arch=" + getArch() + ", description="
|
||||
+ getDescription() + "]";
|
||||
+ getDescription() + "]";
|
||||
}
|
||||
}
|
|
@ -114,6 +114,7 @@ public class GoGridComputeServiceContextModule extends BaseComputeServiceContext
|
|||
.put(ServerState.STOPPING, NodeState.PENDING)//
|
||||
.put(ServerState.RESTARTING, NodeState.PENDING)//
|
||||
.put(ServerState.SAVING, NodeState.PENDING)//
|
||||
.put(ServerState.UNRECOGNIZED, NodeState.UNRECOGNIZED)//
|
||||
.put(ServerState.RESTORING, NodeState.PENDING)//
|
||||
.put(ServerState.UPDATING, NodeState.PENDING).build();
|
||||
|
||||
|
|
|
@ -27,13 +27,17 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
* @author Oleksiy Yarmula
|
||||
*/
|
||||
public enum IpState {
|
||||
UNASSIGNED, ASSIGNED;
|
||||
UNASSIGNED, ASSIGNED, UNRECOGNIZED;
|
||||
|
||||
public String toString() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
}
|
||||
public String toString() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
}
|
||||
|
||||
public static IpState fromValue(String state) {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
|
||||
}
|
||||
public static IpState fromValue(String state) {
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public enum JobState {
|
|||
"Change request has succeeded."), FAILED("Failed", "Change request has failed."), CANCELED(
|
||||
"Canceled", "Change request has been canceled."), FATAL("Fatal",
|
||||
"Change request had Fatal or Unrecoverable Failure"), CREATED("Created",
|
||||
"Change request is created but not queued yet"), UNKNOWN("Unknown",
|
||||
"Change request is created but not queued yet"), UNRECOGNIZED("Unknown",
|
||||
"The state is unknown to JClouds");
|
||||
|
||||
String name;
|
||||
|
@ -52,7 +52,7 @@ public enum JobState {
|
|||
if (jobState.name.equals(checkNotNull(state)))
|
||||
return jobState;
|
||||
}
|
||||
return UNKNOWN;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,13 +27,13 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
public enum LoadBalancerOs {
|
||||
|
||||
F5,
|
||||
UNKNOWN;
|
||||
UNRECOGNIZED;
|
||||
|
||||
public static LoadBalancerOs fromValue(String value) {
|
||||
try {
|
||||
return valueOf(checkNotNull(value));
|
||||
} catch(IllegalArgumentException e) {
|
||||
return UNKNOWN;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
*/
|
||||
public enum LoadBalancerPersistenceType {
|
||||
|
||||
NONE("None"), SSL_STICKY("SSL Sticky"), SOURCE_ADDRESS("Source Address"), UNKNOWN("Unknown");
|
||||
NONE("None"), SSL_STICKY("SSL Sticky"), SOURCE_ADDRESS("Source Address"), UNRECOGNIZED("Unknown");
|
||||
|
||||
String type;
|
||||
|
||||
|
@ -44,6 +44,6 @@ public enum LoadBalancerPersistenceType {
|
|||
if (persistenceType.type.equals(checkNotNull(type)))
|
||||
return persistenceType;
|
||||
}
|
||||
return UNKNOWN;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public enum LoadBalancerState {
|
|||
ON,
|
||||
OFF,
|
||||
UNAVAILABLE,
|
||||
UNKNOWN;
|
||||
UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
|
@ -46,7 +46,7 @@ public enum LoadBalancerState {
|
|||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
|
||||
} catch(IllegalArgumentException e) {
|
||||
return UNKNOWN;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public enum LoadBalancerType {
|
|||
|
||||
ROUND_ROBIN("Round Robin"),
|
||||
LEAST_CONNECTED("Least Connect"),
|
||||
UNKNOWN("Unknown");
|
||||
UNRECOGNIZED("Unknown");
|
||||
|
||||
String type;
|
||||
LoadBalancerType(String type) {
|
||||
|
@ -44,7 +44,7 @@ public enum LoadBalancerType {
|
|||
for(LoadBalancerType persistenceType : values()) {
|
||||
if(persistenceType.type.equals(checkNotNull(type))) return persistenceType;
|
||||
}
|
||||
return UNKNOWN;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public enum ObjectType {
|
|||
STORAGE_DNS,
|
||||
SERVER_IMAGE,
|
||||
DEDICATED_SERVER,
|
||||
UNKNOWN;
|
||||
UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
|
@ -50,7 +50,7 @@ public enum ObjectType {
|
|||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type")));
|
||||
} catch(IllegalArgumentException e) {
|
||||
return UNKNOWN;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public enum ServerImageState {
|
|||
|
||||
AVAILABLE("Available"),
|
||||
SAVING("Saving"),
|
||||
UNKNOWN("Unknown");
|
||||
UNRECOGNIZED("Unknown");
|
||||
|
||||
String type;
|
||||
ServerImageState(String type) {
|
||||
|
@ -44,6 +44,6 @@ public enum ServerImageState {
|
|||
for(ServerImageState serverImageState : values()) {
|
||||
if(serverImageState.type.equals(checkNotNull(type))) return serverImageState;
|
||||
}
|
||||
return UNKNOWN;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public enum ServerImageType {
|
|||
|
||||
WEB_APPLICATION_SERVER("Web Server"),
|
||||
DATABASE_SERVER("Database Server"),
|
||||
UNKNOWN("Unknown");
|
||||
UNRECOGNIZED("Unknown");
|
||||
|
||||
String type;
|
||||
ServerImageType(String type) {
|
||||
|
@ -44,6 +44,6 @@ public enum ServerImageType {
|
|||
for(ServerImageType serverImageType : values()) {
|
||||
if(serverImageType.type.equals(checkNotNull(type))) return serverImageType;
|
||||
}
|
||||
return UNKNOWN;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import com.google.common.base.CaseFormat;
|
|||
*/
|
||||
public enum ServerState {
|
||||
|
||||
ON, STARTING, OFF, STOPPING, RESTARTING, SAVING, RESTORING, UPDATING;
|
||||
ON, STARTING, OFF, STOPPING, RESTARTING, SAVING, RESTORING, UPDATING, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
|
@ -40,6 +40,10 @@ public enum ServerState {
|
|||
}
|
||||
|
||||
public static ServerState fromValue(String state) {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -125,7 +125,7 @@ public class CloudServersComputeServiceContextModule extends BaseComputeServiceC
|
|||
.put(ServerStatus.SHARE_IP, NodeState.PENDING)//
|
||||
.put(ServerStatus.REBOOT, NodeState.PENDING)//
|
||||
.put(ServerStatus.HARD_REBOOT, NodeState.PENDING)//
|
||||
.put(ServerStatus.UNKNOWN, NodeState.UNKNOWN).build();
|
||||
.put(ServerStatus.UNRECOGNIZED, NodeState.UNRECOGNIZED).build();
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
|
|
|
@ -21,26 +21,18 @@ package org.jclouds.rackspace.cloudservers.domain;
|
|||
|
||||
public enum DailyBackup {
|
||||
|
||||
DISABLED,
|
||||
H_0000_0200,
|
||||
H_0200_0400,
|
||||
H_0400_0600,
|
||||
H_0600_0800,
|
||||
H_0800_1000,
|
||||
H_1000_1200,
|
||||
H_1200_1400,
|
||||
H_1400_1600,
|
||||
H_1600_1800,
|
||||
H_1800_2000,
|
||||
H_2000_2200,
|
||||
H_2200_0000;
|
||||
DISABLED, H_0000_0200, H_0200_0400, H_0400_0600, H_0600_0800, H_0800_1000, H_1000_1200, H_1200_1400, H_1400_1600, H_1600_1800, H_1800_2000, H_2000_2200, H_2200_0000, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return name();
|
||||
}
|
||||
public String value() {
|
||||
return name();
|
||||
}
|
||||
|
||||
public static DailyBackup fromValue(String v) {
|
||||
return valueOf(v);
|
||||
}
|
||||
public static DailyBackup fromValue(String v) {
|
||||
try {
|
||||
return valueOf(v);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,14 +29,18 @@ package org.jclouds.rackspace.cloudservers.domain;
|
|||
*/
|
||||
public enum ImageStatus {
|
||||
|
||||
UNKNOWN, ACTIVE, SAVING, PREPARING, QUEUED, FAILED;
|
||||
UNRECOGNIZED, ACTIVE, SAVING, PREPARING, QUEUED, FAILED;
|
||||
|
||||
public String value() {
|
||||
return name();
|
||||
}
|
||||
|
||||
public static ImageStatus fromValue(String v) {
|
||||
return valueOf(v);
|
||||
try {
|
||||
return valueOf(v);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,14 +21,18 @@ package org.jclouds.rackspace.cloudservers.domain;
|
|||
|
||||
public enum RateLimitUnit {
|
||||
|
||||
MINUTE, HOUR, DAY;
|
||||
MINUTE, HOUR, DAY, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return name();
|
||||
}
|
||||
|
||||
public static RateLimitUnit fromValue(String v) {
|
||||
return valueOf(v);
|
||||
try {
|
||||
return valueOf(v);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,21 +29,27 @@ package org.jclouds.rackspace.cloudservers.domain;
|
|||
* available. The 'ACTIVE' label is really misleading in the fact that it just means the system
|
||||
* doesn't have any activity going on related to it's configuration.
|
||||
* <p/>
|
||||
* Processes such as ssh will not be available until 5-10 seconds following the phase ACTIVE
|
||||
* <ul><li>[Web Hosting #119335]</li></ul>
|
||||
* Processes such as ssh will not be available until 5-10 seconds following the phase ACTIVE
|
||||
* <ul>
|
||||
* <li>[Web Hosting #119335]</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public enum ServerStatus {
|
||||
|
||||
ACTIVE, SUSPENDED, DELETED, QUEUE_RESIZE, PREP_RESIZE, RESIZE, VERIFY_RESIZE, QUEUE_MOVE, PREP_MOVE, MOVE, VERIFY_MOVE, RESCUE, ERROR, BUILD, RESTORING, PASSWORD, REBUILD, DELETE_IP, SHARE_IP_NO_CONFIG, SHARE_IP, REBOOT, HARD_REBOOT, UNKNOWN;
|
||||
ACTIVE, SUSPENDED, DELETED, QUEUE_RESIZE, PREP_RESIZE, RESIZE, VERIFY_RESIZE, QUEUE_MOVE, PREP_MOVE, MOVE, VERIFY_MOVE, RESCUE, ERROR, BUILD, RESTORING, PASSWORD, REBUILD, DELETE_IP, SHARE_IP_NO_CONFIG, SHARE_IP, REBOOT, HARD_REBOOT, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return name();
|
||||
}
|
||||
|
||||
public static ServerStatus fromValue(String v) {
|
||||
return valueOf(v);
|
||||
try {
|
||||
return valueOf(v);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,14 +21,18 @@ package org.jclouds.rackspace.cloudservers.domain;
|
|||
|
||||
public enum VersionStatus {
|
||||
|
||||
BETA, CURRENT, DEPRECATED;
|
||||
BETA, CURRENT, DEPRECATED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return name();
|
||||
}
|
||||
|
||||
public static VersionStatus fromValue(String v) {
|
||||
return valueOf(v);
|
||||
try {
|
||||
return valueOf(v);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,14 +21,18 @@ package org.jclouds.rackspace.cloudservers.domain;
|
|||
|
||||
public enum WeeklyBackup {
|
||||
|
||||
DISABLED, SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY;
|
||||
DISABLED, SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return name();
|
||||
}
|
||||
|
||||
public static WeeklyBackup fromValue(String v) {
|
||||
return valueOf(v);
|
||||
try {
|
||||
return valueOf(v);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,10 +31,10 @@ import org.jclouds.compute.ComputeServiceContext;
|
|||
import org.jclouds.compute.LoadBalancerService;
|
||||
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
||||
import org.jclouds.compute.config.ComputeServiceTimeoutsModule;
|
||||
import org.jclouds.compute.domain.Hardware;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.compute.domain.Hardware;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
||||
import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
|
||||
|
@ -53,9 +53,9 @@ import org.jclouds.rimuhosting.miro.compute.strategy.RimuHostingDestroyNodeStrat
|
|||
import org.jclouds.rimuhosting.miro.compute.strategy.RimuHostingGetNodeMetadataStrategy;
|
||||
import org.jclouds.rimuhosting.miro.compute.strategy.RimuHostingListNodesStrategy;
|
||||
import org.jclouds.rimuhosting.miro.compute.strategy.RimuHostingRebootNodeStrategy;
|
||||
import org.jclouds.rimuhosting.miro.compute.suppliers.RimuHostingHardwareSupplier;
|
||||
import org.jclouds.rimuhosting.miro.compute.suppliers.RimuHostingImageSupplier;
|
||||
import org.jclouds.rimuhosting.miro.compute.suppliers.RimuHostingLocationSupplier;
|
||||
import org.jclouds.rimuhosting.miro.compute.suppliers.RimuHostingHardwareSupplier;
|
||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
||||
import org.jclouds.rimuhosting.miro.domain.internal.RunningState;
|
||||
|
||||
|
@ -116,6 +116,7 @@ public class RimuHostingComputeServiceContextModule extends BaseComputeServiceCo
|
|||
.put(RunningState.NOTRUNNING, NodeState.SUSPENDED)//
|
||||
.put(RunningState.POWERCYCLING, NodeState.PENDING)//
|
||||
.put(RunningState.RESTARTING, NodeState.PENDING)//
|
||||
.put(RunningState.UNRECOGNIZED, NodeState.UNRECOGNIZED)//
|
||||
.build();
|
||||
|
||||
@Singleton
|
||||
|
|
|
@ -19,11 +19,21 @@
|
|||
|
||||
package org.jclouds.rimuhosting.miro.domain.internal;
|
||||
|
||||
|
||||
/**
|
||||
* States an instance can be in.
|
||||
*
|
||||
* @author Ivan Meredith
|
||||
*/
|
||||
public enum RunningState {
|
||||
RUNNING, NOTRUNNING, RESTARTING, POWERCYCLING
|
||||
RUNNING, NOTRUNNING, RESTARTING, POWERCYCLING, UNRECOGNIZED;
|
||||
|
||||
public static RunningState fromValue(String v) {
|
||||
try {
|
||||
return valueOf(v);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,10 +30,10 @@ import org.jclouds.compute.ComputeServiceContext;
|
|||
import org.jclouds.compute.LoadBalancerService;
|
||||
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
||||
import org.jclouds.compute.config.ComputeServiceTimeoutsModule;
|
||||
import org.jclouds.compute.domain.Hardware;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.compute.domain.Hardware;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.compute.internal.BaseComputeService;
|
||||
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
||||
|
@ -56,8 +56,8 @@ import org.jclouds.slicehost.compute.strategy.SlicehostDestroyNodeStrategy;
|
|||
import org.jclouds.slicehost.compute.strategy.SlicehostGetNodeMetadataStrategy;
|
||||
import org.jclouds.slicehost.compute.strategy.SlicehostListNodesStrategy;
|
||||
import org.jclouds.slicehost.compute.strategy.SlicehostRebootNodeStrategy;
|
||||
import org.jclouds.slicehost.compute.suppliers.SlicehostImageSupplier;
|
||||
import org.jclouds.slicehost.compute.suppliers.SlicehostHardwareSupplier;
|
||||
import org.jclouds.slicehost.compute.suppliers.SlicehostImageSupplier;
|
||||
import org.jclouds.slicehost.domain.Slice;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
@ -109,6 +109,7 @@ public class SlicehostComputeServiceContextModule extends BaseComputeServiceCont
|
|||
.put(Slice.Status.REBOOT, NodeState.PENDING)//
|
||||
.put(Slice.Status.HARD_REBOOT, NodeState.PENDING)//
|
||||
.put(Slice.Status.TERMINATED, NodeState.TERMINATED)//
|
||||
.put(Slice.Status.UNRECOGNIZED, NodeState.UNRECOGNIZED)//
|
||||
.build();
|
||||
|
||||
@Singleton
|
||||
|
|
|
@ -28,8 +28,8 @@ import javax.annotation.Nullable;
|
|||
import com.google.common.base.CaseFormat;
|
||||
|
||||
/**
|
||||
* A slice is a virtual machine instance in the Slicehost system. Flavor and
|
||||
* image are requisite elements when creating a slice.
|
||||
* A slice is a virtual machine instance in the Slicehost system. Flavor and image are requisite
|
||||
* elements when creating a slice.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
|
@ -40,7 +40,7 @@ public class Slice {
|
|||
*/
|
||||
public enum Status {
|
||||
|
||||
ACTIVE, BUILD, REBOOT, HARD_REBOOT, TERMINATED;
|
||||
ACTIVE, BUILD, REBOOT, HARD_REBOOT, TERMINATED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_UNDERSCORE, name()));
|
||||
|
@ -52,7 +52,11 @@ public class Slice {
|
|||
}
|
||||
|
||||
public static Status fromValue(String state) {
|
||||
return valueOf(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
|
||||
try {
|
||||
return valueOf(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,8 +77,8 @@ public class Slice {
|
|||
private final String rootPassword;
|
||||
|
||||
public Slice(int id, String name, int flavorId, @Nullable Integer imageId, @Nullable Integer backupId,
|
||||
Status status, @Nullable Integer progress, float bandwidthIn, float bandwidthOut, Set<String> addresses,
|
||||
@Nullable String rootPassword) {
|
||||
Status status, @Nullable Integer progress, float bandwidthIn, float bandwidthOut, Set<String> addresses,
|
||||
@Nullable String rootPassword) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.flavorId = flavorId;
|
||||
|
@ -145,8 +149,7 @@ public class Slice {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return an array of strings representing the Slice's IPs, including
|
||||
* private IPs
|
||||
* @return an array of strings representing the Slice's IPs, including private IPs
|
||||
*/
|
||||
public Set<String> getAddresses() {
|
||||
return addresses;
|
||||
|
@ -242,9 +245,9 @@ public class Slice {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[id=" + id + ", name=" + name + ", flavorId=" + flavorId + ", imageId=" + imageId + ", backupId="
|
||||
+ backupId + ", status=" + status + ", progress=" + progress + ", bandwidthIn=" + bandwidthIn
|
||||
+ ", bandwidthOut=" + bandwidthOut + ", addresses=" + addresses + ", rootPassword="
|
||||
+ (rootPassword != null) + "]";
|
||||
+ backupId + ", status=" + status + ", progress=" + progress + ", bandwidthIn=" + bandwidthIn
|
||||
+ ", bandwidthOut=" + bandwidthOut + ", addresses=" + addresses + ", rootPassword="
|
||||
+ (rootPassword != null) + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,9 +27,9 @@ import javax.inject.Singleton;
|
|||
import org.jclouds.compute.LoadBalancerService;
|
||||
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
||||
import org.jclouds.compute.config.ComputeServiceTimeoutsModule;
|
||||
import org.jclouds.compute.domain.Hardware;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.compute.domain.Hardware;
|
||||
import org.jclouds.compute.strategy.RunNodesAndAddToSetStrategy;
|
||||
import org.jclouds.compute.strategy.impl.EncodeTagIntoNameRunNodesAndAddToSetStrategy;
|
||||
import org.jclouds.domain.Location;
|
||||
|
@ -56,9 +56,9 @@ public abstract class CommonVCloudComputeServiceContextModule extends BaseComput
|
|||
@VisibleForTesting
|
||||
static final Map<Status, NodeState> vAppStatusToNodeState = ImmutableMap.<Status, NodeState> builder().put(
|
||||
Status.OFF, NodeState.SUSPENDED).put(Status.ON, NodeState.RUNNING).put(Status.RESOLVED, NodeState.PENDING)
|
||||
.put(Status.ERROR, NodeState.ERROR).put(Status.UNRECOGNIZED, NodeState.UNKNOWN).put(Status.DEPLOYED,
|
||||
.put(Status.ERROR, NodeState.ERROR).put(Status.UNRECOGNIZED, NodeState.UNRECOGNIZED).put(Status.DEPLOYED,
|
||||
NodeState.PENDING).put(Status.INCONSISTENT, NodeState.PENDING).put(Status.UNKNOWN,
|
||||
NodeState.UNKNOWN).put(Status.MIXED, NodeState.PENDING).put(Status.WAITING_FOR_INPUT,
|
||||
NodeState.UNRECOGNIZED).put(Status.MIXED, NodeState.PENDING).put(Status.WAITING_FOR_INPUT,
|
||||
NodeState.PENDING).put(Status.SUSPENDED, NodeState.SUSPENDED).put(Status.UNRESOLVED,
|
||||
NodeState.PENDING).build();
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public enum AllocationModel {
|
|||
/**
|
||||
* The VCloud API returned a model unsupported in the version 1.0 spec.
|
||||
*/
|
||||
UNRECOGNIZED_MODEL;
|
||||
UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
switch (this) {
|
||||
|
@ -64,6 +64,10 @@ public enum AllocationModel {
|
|||
}
|
||||
|
||||
public static AllocationModel fromValue(String model) {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(model, "model")));
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(model, "model")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@ public enum MappingMode {
|
|||
/**
|
||||
* the external IP address is assigned automatically
|
||||
*/
|
||||
AUTOMATIC;
|
||||
AUTOMATIC, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
|
||||
|
@ -47,7 +47,11 @@ public enum MappingMode {
|
|||
}
|
||||
|
||||
public static MappingMode fromValue(String mode) {
|
||||
return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(mode, "mode")));
|
||||
try {
|
||||
return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(mode, "mode")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -175,12 +175,16 @@ public enum Status {
|
|||
case QUARANTINE_EXPIRED:
|
||||
return "15";
|
||||
default:
|
||||
throw new IllegalArgumentException("invalid status:" + this);
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
public static Status fromValue(String status) {
|
||||
return fromValue(Integer.parseInt(checkNotNull(status, "status")));
|
||||
try {
|
||||
return fromValue(Integer.parseInt(checkNotNull(status, "status")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
public static Status fromValue(int v) {
|
||||
|
@ -218,7 +222,7 @@ public enum Status {
|
|||
case 15:
|
||||
return QUARANTINE_EXPIRED;
|
||||
default:
|
||||
throw new IllegalArgumentException("invalid status:" + v);
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,9 @@ public interface VAppTemplate extends ReferenceType {
|
|||
/**
|
||||
* description of the predefined vApp internal networks in this template
|
||||
*
|
||||
* @return null if the vAppTemplate is still copying
|
||||
* @since vcloud api 1.0
|
||||
*/
|
||||
@Nullable
|
||||
VCloudNetworkSection getNetworkSection();
|
||||
}
|
|
@ -26,7 +26,7 @@ package org.jclouds.vcloud.domain;
|
|||
*/
|
||||
public enum VDCStatus {
|
||||
|
||||
CREATION_FAILED, NOT_READY, READY, UNKNOWN, UNRECOGNIZED_STATUS;
|
||||
CREATION_FAILED, NOT_READY, READY, UNKNOWN, UNRECOGNIZED;
|
||||
|
||||
public int value() {
|
||||
switch (this) {
|
||||
|
@ -54,7 +54,7 @@ public enum VDCStatus {
|
|||
case 2:
|
||||
return UNKNOWN;
|
||||
default:
|
||||
return UNRECOGNIZED_STATUS;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -54,11 +54,13 @@ public class VAppTemplateImpl extends ReferenceTypeImpl implements VAppTemplate
|
|||
private final boolean ovfDescriptorUploaded;
|
||||
private final String vAppScopedLocalId;
|
||||
private final Set<Vm> children = Sets.newLinkedHashSet();
|
||||
@Nullable
|
||||
private final VCloudNetworkSection networkSection;
|
||||
|
||||
public VAppTemplateImpl(String name, String type, URI id, Status status, ReferenceType vdc,
|
||||
@Nullable String description, Iterable<Task> tasks, boolean ovfDescriptorUploaded,
|
||||
@Nullable String vAppScopedLocalId, Iterable<? extends Vm> children, VCloudNetworkSection networkSection) {
|
||||
@Nullable String vAppScopedLocalId, Iterable<? extends Vm> children,
|
||||
@Nullable VCloudNetworkSection networkSection) {
|
||||
super(name, type, id);
|
||||
this.status = checkNotNull(status, "status");
|
||||
this.vdc = vdc;// TODO: once <1.0 is killed check not null
|
||||
|
@ -67,7 +69,7 @@ public class VAppTemplateImpl extends ReferenceTypeImpl implements VAppTemplate
|
|||
this.vAppScopedLocalId = vAppScopedLocalId;
|
||||
this.ovfDescriptorUploaded = ovfDescriptorUploaded;
|
||||
Iterables.addAll(this.children, checkNotNull(children, "children"));
|
||||
this.networkSection = checkNotNull(networkSection, "networkSection");
|
||||
this.networkSection = networkSection; // can be null when copying
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -51,7 +51,7 @@ public enum FenceMode {
|
|||
*
|
||||
* @since vcloud api 0.8
|
||||
*/
|
||||
NAT_ROUTED;
|
||||
NAT_ROUTED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
|
||||
|
@ -63,7 +63,11 @@ public enum FenceMode {
|
|||
}
|
||||
|
||||
public static FenceMode fromValue(String fenceMode) {
|
||||
return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(fenceMode, "fenceMode")));
|
||||
try {
|
||||
return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(fenceMode, "fenceMode")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -35,7 +35,7 @@ public enum FirewallPolicy {
|
|||
/**
|
||||
* allow packets of this type to pass through the firewall
|
||||
*/
|
||||
ALLOW;
|
||||
ALLOW, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
|
||||
|
@ -50,7 +50,7 @@ public enum FirewallPolicy {
|
|||
try {
|
||||
return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(policy, "policy")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return DROP;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public enum NatPolicy {
|
|||
/**
|
||||
* only inbound packets of this type pass through the firewall
|
||||
*/
|
||||
ALLOW_TRAFFIC_IN;
|
||||
ALLOW_TRAFFIC_IN, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
|
||||
|
@ -50,7 +50,7 @@ public enum NatPolicy {
|
|||
try {
|
||||
return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(policy, "policy")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return ALLOW_TRAFFIC_IN;
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public enum NatType {
|
|||
*
|
||||
* @since vcloud api 0.9
|
||||
*/
|
||||
PORT_FORWARDING;
|
||||
PORT_FORWARDING, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
|
||||
|
@ -55,6 +55,10 @@ public enum NatType {
|
|||
}
|
||||
|
||||
public static NatType fromValue(String natType) {
|
||||
return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(natType, "natType")));
|
||||
try {
|
||||
return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(natType, "natType")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ import org.jclouds.vcloud.VCloudExpressAsyncClient;
|
|||
*
|
||||
*/
|
||||
public enum ResourceType {
|
||||
OTHER, PROCESSOR, MEMORY, IDE_CONTROLLER, SCSI_CONTROLLER, ETHERNET_ADAPTER, FLOPPY_DRIVE, CD_DRIVE, DVD_DRIVE, DISK_DRIVE, USB_CONTROLLER;
|
||||
OTHER, PROCESSOR, MEMORY, IDE_CONTROLLER, SCSI_CONTROLLER, ETHERNET_ADAPTER, FLOPPY_DRIVE, CD_DRIVE, DVD_DRIVE, DISK_DRIVE, USB_CONTROLLER, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
switch (this) {
|
||||
|
@ -65,7 +65,11 @@ public enum ResourceType {
|
|||
}
|
||||
|
||||
public static ResourceType fromValue(String type) {
|
||||
return fromValue(Integer.parseInt(checkNotNull(type, "type")));
|
||||
try {
|
||||
return fromValue(Integer.parseInt(checkNotNull(type, "type")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
public static ResourceType fromValue(int v) {
|
||||
|
@ -93,7 +97,7 @@ public enum ResourceType {
|
|||
case 23:
|
||||
return USB_CONTROLLER;
|
||||
default:
|
||||
throw new IllegalArgumentException("invalid type:" + v);
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,10 +22,10 @@ package org.jclouds.vcloud.util;
|
|||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jclouds.vcloud.domain.Error;
|
||||
import org.jclouds.vcloud.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.domain.Task;
|
||||
import org.jclouds.vcloud.domain.internal.ErrorImpl;
|
||||
import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
|
||||
import org.jclouds.vcloud.domain.internal.TaskImpl.ErrorImpl;
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
@ -57,7 +57,11 @@ public class Utils {
|
|||
return newReferenceType(attributes, null);
|
||||
}
|
||||
|
||||
public static Task.Error newError(Map<String, String> attributes) {
|
||||
/**
|
||||
* note that vCloud 0.9+ the error isn't attributes, it is a nested object. see
|
||||
* {@link ErrorHandler}
|
||||
*/
|
||||
public static Error newError(Map<String, String> attributes) {
|
||||
String minorErrorCode = attributes.get("minorErrorCode");
|
||||
String vendorSpecificErrorCode = attributes.get("vendorSpecificErrorCode");
|
||||
int errorCode;
|
||||
|
|
|
@ -110,7 +110,9 @@ public class VAppTemplateHandler extends ParseSax.HandlerWithResult<VAppTemplate
|
|||
public void endElement(String uri, String name, String qName) {
|
||||
if (qName.endsWith("Children")) {
|
||||
inChildren = false;
|
||||
this.children.add(vmHandler.getResult());
|
||||
Vm vm = vmHandler.getResult();
|
||||
if (vm != null)
|
||||
this.children.add(vmHandler.getResult());
|
||||
} else if (qName.endsWith("Tasks")) {
|
||||
inTasks = false;
|
||||
this.tasks.add(taskHandler.getResult());
|
||||
|
|
|
@ -61,7 +61,7 @@ public class VDCHandler extends ParseSax.HandlerWithResult<VDC> {
|
|||
protected ReferenceType org;
|
||||
protected String description;
|
||||
protected List<Task> tasks = Lists.newArrayList();
|
||||
protected AllocationModel allocationModel = AllocationModel.UNRECOGNIZED_MODEL;
|
||||
protected AllocationModel allocationModel = AllocationModel.UNRECOGNIZED;
|
||||
|
||||
protected Capacity storageCapacity;
|
||||
protected Capacity cpuCapacity;
|
||||
|
|
|
@ -86,8 +86,8 @@ public class VmHandler extends ParseSax.HandlerWithResult<Vm> {
|
|||
private boolean inGuestCustomization;
|
||||
|
||||
public Vm getResult() {
|
||||
return new VmImpl(vm.getName(), vm.getType(), vm.getHref(), status, vdc, description, tasks, hardware, os,
|
||||
networkConnectionSection, guestCustomization, vAppScopedLocalId);
|
||||
return vm == null ? null : new VmImpl(vm.getName(), vm.getType(), vm.getHref(), status, vdc, description, tasks,
|
||||
hardware, os, networkConnectionSection, guestCustomization, vAppScopedLocalId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,15 +24,18 @@ import static org.testng.Assert.assertEquals;
|
|||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.date.DateService;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ParseSax.Factory;
|
||||
import org.jclouds.http.functions.config.SaxParserModule;
|
||||
import org.jclouds.vcloud.VCloudMediaType;
|
||||
import org.jclouds.vcloud.domain.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.domain.Status;
|
||||
import org.jclouds.vcloud.domain.TaskStatus;
|
||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.domain.Vm;
|
||||
import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
|
||||
import org.jclouds.vcloud.domain.internal.TaskImpl;
|
||||
import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
|
||||
import org.jclouds.vcloud.domain.ovf.network.Network;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -50,6 +53,7 @@ import com.google.inject.Injector;
|
|||
*/
|
||||
@Test(groups = "unit", testName = "vcloud.VAppTemplateHandlerTest")
|
||||
public class VAppTemplateHandlerTest {
|
||||
|
||||
public void testUbuntuTemplate() {
|
||||
InputStream is = getClass().getResourceAsStream("/vAppTemplate.xml");
|
||||
Injector injector = Guice.createInjector(new SaxParserModule());
|
||||
|
@ -115,4 +119,34 @@ public class VAppTemplateHandlerTest {
|
|||
|
||||
}
|
||||
|
||||
public void testCopyingTemplate() {
|
||||
InputStream is = getClass().getResourceAsStream("/vAppTemplate-copying.xml");
|
||||
Injector injector = Guice.createInjector(new SaxParserModule());
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
DateService dateService = injector.getInstance(DateService.class);
|
||||
|
||||
VAppTemplate result = factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
|
||||
assertEquals(result.getName(), "Ubuntu10.04_v2");
|
||||
assertEquals(result.getHref(), URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881"));
|
||||
assertEquals(result.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml");
|
||||
assertEquals(result.getStatus(), Status.UNRESOLVED);
|
||||
assertEquals(result.getVDC(), new ReferenceTypeImpl(null, VCloudMediaType.VDC_XML, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/105186609")));
|
||||
assertEquals(result.getDescription(), null);
|
||||
assertEquals(result.getTasks(), ImmutableList.of(new TaskImpl(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/task/q62gxhi32xgd9yrqvr"),
|
||||
"Copying Virtual Application Template Ubuntu10.04_v2(699683881)", TaskStatus.RUNNING, dateService
|
||||
.iso8601DateParse("2010-09-17T23:20:46.039-04:00"), dateService
|
||||
.iso8601DateParse("9999-12-31T23:59:59.999-05:00"), dateService
|
||||
.iso8601DateParse("2010-12-16T23:20:46.039-05:00"), new ReferenceTypeImpl("Ubuntu10.04_v2",
|
||||
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
||||
URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881")),
|
||||
null)));
|
||||
assertEquals(result.getVAppScopedLocalId(), null);
|
||||
assert result.isOvfDescriptorUploaded();
|
||||
assertEquals(result.getChildren(), ImmutableList.of());
|
||||
assertEquals(result.getNetworkSection(), null);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import com.google.common.base.CaseFormat;
|
|||
public class IpAddress implements Comparable<IpAddress> {
|
||||
|
||||
public static enum Status {
|
||||
AVAILABLE, ASSIGNED;
|
||||
AVAILABLE, ASSIGNED, UNRECOGNIZED;
|
||||
public String value() {
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
@ -42,8 +42,11 @@ public class IpAddress implements Comparable<IpAddress> {
|
|||
}
|
||||
|
||||
public static Status fromValue(String status) {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(status,
|
||||
"status")));
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(status, "status")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -706,7 +706,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest<Terrem
|
|||
|
||||
ImmutableMap.<String, org.jclouds.vcloud.domain.VDC> of("vdc", new TerremarkVDCImpl("vdc", null, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), VDCStatus.READY, null, "description",
|
||||
ImmutableSet.<Task> of(), AllocationModel.UNRECOGNIZED_MODEL, new Capacity("MB", 0, 0, 0, 0),
|
||||
ImmutableSet.<Task> of(), AllocationModel.UNRECOGNIZED, new Capacity("MB", 0, 0, 0, 0),
|
||||
new Capacity("MB", 0, 0, 0, 0), new Capacity("MB", 0, 0, 0, 0),
|
||||
ImmutableMap.<String, ReferenceType> of("vapp", new ReferenceTypeImpl("vapp",
|
||||
"application/vnd.vmware.vcloud.vApp+xml", URI
|
||||
|
|
|
@ -84,7 +84,7 @@ public class TerremarkECloudComputeServiceLiveTest extends VCloudExpressComputeS
|
|||
@Override
|
||||
protected void checkOsMatchesTemplate(NodeMetadata node) {
|
||||
if (node.getOperatingSystem() != null)
|
||||
assertEquals(node.getOperatingSystem().getFamily(), OsFamily.UNKNOWN);
|
||||
assertEquals(node.getOperatingSystem().getFamily(), OsFamily.UNRECOGNIZED);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -84,7 +84,7 @@ public class TerremarkVCloudExpressComputeServiceLiveTest extends VCloudExpressC
|
|||
@Override
|
||||
protected void checkOsMatchesTemplate(NodeMetadata node) {
|
||||
if (node.getOperatingSystem() != null)
|
||||
assertEquals(node.getOperatingSystem().getFamily(), OsFamily.UNKNOWN);
|
||||
assertEquals(node.getOperatingSystem().getFamily(), OsFamily.UNRECOGNIZED);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue