diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Account.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Account.java index 1ffe0e682b..16be1e802e 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Account.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Account.java @@ -18,21 +18,19 @@ */ package org.jclouds.cloudstack.domain; -import static com.google.common.base.Preconditions.checkNotNull; - +import javax.annotation.Nullable; import java.util.Map; import java.util.Set; -import javax.annotation.Nullable; - +import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.CaseFormat; import com.google.common.base.Function; import com.google.common.collect.ForwardingSet; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; +import com.google.gson.annotations.SerializedName; /** - * * @author Adrian Cole */ public class Account extends ForwardingSet implements Comparable { @@ -44,6 +42,7 @@ public class Account extends ForwardingSet implements Comparable public static class Builder { private long id; private Type type; + private String networkDomain; private String domain; private long domainId; private Long IPsAvailable; @@ -80,6 +79,11 @@ public class Account extends ForwardingSet implements Comparable return this; } + public Builder networkDomain(String networkDomain) { + this.networkDomain = networkDomain; + return this; + } + public Builder domain(String domain) { this.domain = domain; return this; @@ -206,7 +210,7 @@ public class Account extends ForwardingSet implements Comparable } public Account build() { - return new Account(id, type, domain, domainId, IPsAvailable, IPLimit, IPs, cleanupRequired, name, + return new Account(id, type, networkDomain, domain, domainId, IPsAvailable, IPLimit, IPs, cleanupRequired, name, receivedBytes, sentBytes, snapshotsAvailable, snapshotLimit, snapshots, state, templatesAvailable, templateLimit, templates, VMsAvailable, VMLimit, VMsRunning, VMsStopped, VMs, volumesAvailable, volumeLimit, volumes, users); @@ -216,6 +220,7 @@ public class Account extends ForwardingSet implements Comparable public static enum State { ENABLED, DISABLED, LOCKED, UNRECOGNIZED; + @Override public String toString() { return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()); @@ -278,40 +283,65 @@ public class Account extends ForwardingSet implements Comparable } private long id; + @SerializedName("accounttype") private Type type; + @SerializedName("networkdomain") + private String networkDomain; private String domain; + @SerializedName("domainId") private long domainId; + @SerializedName("ipsavailable") private Long IPsAvailable; + @SerializedName("iplimit") private Long IPLimit; + @SerializedName("iptotal") private long IPs; + @SerializedName("iscleanuprequired") private boolean cleanupRequired; private String name; + @SerializedName("receivedbytes") private long receivedBytes; + @SerializedName("sentbytes") private long sentBytes; + @SerializedName("snapshotavailable") private Long snapshotsAvailable; + @SerializedName("snapshotLimit") private Long snapshotLimit; + @SerializedName("snapshottotal") private long snapshots; private State state; + @SerializedName("templateavailable") private Long templatesAvailable; + @SerializedName("templatelimit") private Long templateLimit; + @SerializedName("templatetotal") private long templates; + @SerializedName("vmavailable") private Long VMsAvailable; + @SerializedName("vmlimit") private Long VMLimit; + @SerializedName("vmrunning") private long VMsRunning; + @SerializedName("vmstopped") private long VMsStopped; + @SerializedName("vmtotal") private long VMs; + @SerializedName("volumeavailable") private Long volumesAvailable; + @SerializedName("volumelimit") private Long volumeLimit; + @SerializedName("volumetotal") private long volumes; private Set users; - public Account(long id, Type type, String domain, long domainId, Long IPsAvailable, Long IPLimit, long iPs, - boolean cleanupRequired, String name, long receivedBytes, long sentBytes, Long snapshotsAvailable, - Long snapshotLimit, long snapshots, org.jclouds.cloudstack.domain.Account.State state, - Long templatesAvailable, Long templateLimit, long templates, Long VMsAvailable, Long VMLimit, long vMsRunning, - long vMsStopped, long vMs, Long volumesAvailable, Long volumeLimit, long volumes, Set users) { + public Account(long id, Type type, String networkDomain, String domain, long domainId, Long IPsAvailable, Long IPLimit, long iPs, + boolean cleanupRequired, String name, long receivedBytes, long sentBytes, Long snapshotsAvailable, + Long snapshotLimit, long snapshots, org.jclouds.cloudstack.domain.Account.State state, + Long templatesAvailable, Long templateLimit, long templates, Long VMsAvailable, Long VMLimit, long vMsRunning, + long vMsStopped, long vMs, Long volumesAvailable, Long volumeLimit, long volumes, Set users) { this.id = id; this.type = type; + this.networkDomain = networkDomain; this.domain = domain; this.domainId = domainId; this.IPsAvailable = IPsAvailable; @@ -341,14 +371,12 @@ public class Account extends ForwardingSet implements Comparable /** * present only for serializer - * */ Account() { } /** - * * @return the id of the account */ public long getId() { @@ -356,7 +384,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the name of the account */ @@ -365,7 +392,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return account type (admin, domain-admin, user) */ public Type getType() { @@ -373,7 +399,13 @@ public class Account extends ForwardingSet implements Comparable } /** - * + * @return the network domain + */ + public String getNetworkDomain() { + return networkDomain; + } + + /** * @return name of the Domain the account belongs to */ public String getDomain() { @@ -381,7 +413,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return id of the Domain the account belongs to */ public long getDomainId() { @@ -389,7 +420,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return true if the account requires cleanup */ public boolean isCleanupRequired() { @@ -397,7 +427,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the list of users associated with account */ public Set getUsers() { @@ -405,7 +434,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of public ip addresses available for this account * to acquire, or null if unlimited */ @@ -415,7 +443,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of public ip addresses this account can acquire, * or null if unlimited */ @@ -425,7 +452,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of public ip addresses allocated for this account */ public long getIPs() { @@ -433,7 +459,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of network traffic bytes received */ public long getReceivedBytes() { @@ -441,7 +466,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of network traffic bytes sent */ public long getSentBytes() { @@ -449,7 +473,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of snapshots available for this account, or null * if unlimited */ @@ -459,7 +482,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of snapshots which can be stored by this account, * or null if unlimited */ @@ -469,7 +491,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of snapshots stored by this account */ public long getSnapshots() { @@ -477,7 +498,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the state of the account */ public State getState() { @@ -485,7 +505,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of templates available to be created by this * account, or null if unlimited */ @@ -495,7 +514,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of templates which can be created by this * account, or null if unlimited */ @@ -505,7 +523,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of templates which have been created by this * account */ @@ -514,7 +531,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of virtual machines available for this account to * acquire, or null if unlimited */ @@ -524,7 +540,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of virtual machines that can be deployed by this * account, or null if unlimited */ @@ -534,7 +549,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of virtual machines running for this account */ public long getVMsRunning() { @@ -542,7 +556,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of virtual machines stopped for this account */ public long getVMsStopped() { @@ -550,7 +563,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total number of virtual machines deployed by this account */ public long getVMs() { @@ -558,7 +570,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total volume available for this account, or null if unlimited */ @Nullable @@ -567,7 +578,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total volume which can be used by this account, or null if * unlimited */ @@ -577,7 +587,6 @@ public class Account extends ForwardingSet implements Comparable } /** - * * @return the total volume being used by this account */ public long getVolumes() { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISO.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISO.java index 62e0494e53..2d32c34740 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISO.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISO.java @@ -18,11 +18,10 @@ */ package org.jclouds.cloudstack.domain; -import com.google.gson.annotations.SerializedName; - import java.util.Date; import static com.google.common.base.Preconditions.checkNotNull; +import com.google.gson.annotations.SerializedName; /** * @author Richard Downer @@ -344,7 +343,6 @@ public class ISO implements Comparable { private long hostId; @SerializedName("hostname") private String hostName; - @SerializedName("") private String hypervisor; @SerializedName("isextractable") private boolean isExtractable; @@ -692,39 +690,39 @@ public class ISO implements Comparable { @Override public String toString() { return "[" + - "id=" + id + - ", account='" + account + '\'' + - ", accountId=" + accountId + - ", bootable=" + bootable + - ", checksum='" + checksum + '\'' + - ", created=" + created + - ", crossZones=" + crossZones + - ", displayText='" + displayText + '\'' + - ", domain='" + domain + '\'' + - ", domainid=" + domainid + - ", format='" + format + '\'' + - ", hostId=" + hostId + - ", hostName='" + hostName + '\'' + - ", hypervisor='" + hypervisor + '\'' + - ", isExtractable=" + isExtractable + - ", isFeatured=" + isFeatured + - ", isPublic=" + isPublic + - ", isReady=" + isReady + - ", jobId=" + jobId + - ", jobStatus='" + jobStatus + '\'' + - ", name='" + name + '\'' + - ", osTypeId=" + osTypeId + - ", osTypeName='" + osTypeName + '\'' + - ", passwordEnabled=" + passwordEnabled + - ", removed=" + removed + - ", size=" + size + - ", sourceTemplateId=" + sourceTemplateId + - ", status='" + status + '\'' + - ", templateTag='" + templateTag + '\'' + - ", templateType='" + templateType + '\'' + - ", zoneId=" + zoneId + - ", zoneName='" + zoneName + '\'' + - ']'; + "id=" + id + + ", account='" + account + '\'' + + ", accountId=" + accountId + + ", bootable=" + bootable + + ", checksum='" + checksum + '\'' + + ", created=" + created + + ", crossZones=" + crossZones + + ", displayText='" + displayText + '\'' + + ", domain='" + domain + '\'' + + ", domainid=" + domainid + + ", format='" + format + '\'' + + ", hostId=" + hostId + + ", hostName='" + hostName + '\'' + + ", hypervisor='" + hypervisor + '\'' + + ", isExtractable=" + isExtractable + + ", isFeatured=" + isFeatured + + ", isPublic=" + isPublic + + ", isReady=" + isReady + + ", jobId=" + jobId + + ", jobStatus='" + jobStatus + '\'' + + ", name='" + name + '\'' + + ", osTypeId=" + osTypeId + + ", osTypeName='" + osTypeName + '\'' + + ", passwordEnabled=" + passwordEnabled + + ", removed=" + removed + + ", size=" + size + + ", sourceTemplateId=" + sourceTemplateId + + ", status='" + status + '\'' + + ", templateTag='" + templateTag + '\'' + + ", templateType='" + templateType + '\'' + + ", zoneId=" + zoneId + + ", zoneName='" + zoneName + '\'' + + ']'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NIC.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NIC.java index b196df46dd..246fbc4947 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NIC.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NIC.java @@ -23,7 +23,7 @@ import java.net.URI; import com.google.gson.annotations.SerializedName; /** - * + * * @author Adrian Cole */ public class NIC { @@ -39,6 +39,7 @@ public class NIC { private boolean isDefault; private URI isolationURI; private String netmask; + private String macAddress; private long networkId; private TrafficType trafficType; private GuestIPType guestIPType; @@ -78,6 +79,11 @@ public class NIC { return this; } + public Builder macAddress(String macAddress) { + this.macAddress = macAddress; + return this; + } + public Builder networkId(long networkId) { this.networkId = networkId; return this; @@ -94,8 +100,8 @@ public class NIC { } public NIC build() { - return new NIC(id, broadcastURI, gateway, IPAddress, isDefault, isolationURI, netmask, networkId, trafficType, - guestIPType); + return new NIC(id, broadcastURI, gateway, IPAddress, isDefault, isolationURI, netmask, macAddress, networkId, + trafficType, guestIPType); } } @@ -111,6 +117,8 @@ public class NIC { @SerializedName("isolationuri") private URI isolationURI; private String netmask; + @SerializedName("macaddress") + private String macAddress; @SerializedName("networkid") private long networkId; @SerializedName("traffictype") @@ -120,14 +128,13 @@ public class NIC { /** * present only for serializer - * */ NIC() { } public NIC(long id, URI broadcastURI, String gateway, String iPAddress, boolean isDefault, URI isolationURI, - String netmask, long networkId, TrafficType trafficType, GuestIPType guestIPType) { + String netmask, String macAddress, long networkId, TrafficType trafficType, GuestIPType guestIPType) { this.id = id; this.broadcastURI = broadcastURI; this.gateway = gateway; @@ -135,6 +142,7 @@ public class NIC { this.isDefault = isDefault; this.isolationURI = isolationURI; this.netmask = netmask; + this.macAddress = macAddress; this.networkId = networkId; this.trafficType = trafficType; this.guestIPType = guestIPType; @@ -189,6 +197,13 @@ public class NIC { return netmask; } + /** + * the MAC Address of the NIC + */ + public String getMacAddress() { + return macAddress; + } + /** * the ID of the corresponding network */ @@ -222,6 +237,7 @@ public class NIC { result = prime * result + (isDefault ? 1231 : 1237); result = prime * result + ((isolationURI == null) ? 0 : isolationURI.hashCode()); result = prime * result + ((netmask == null) ? 0 : netmask.hashCode()); + result = prime * result + ((macAddress == null) ? 0 : macAddress.hashCode()); result = prime * result + (int) (networkId ^ (networkId >>> 32)); result = prime * result + ((trafficType == null) ? 0 : trafficType.hashCode()); return result; @@ -267,6 +283,11 @@ public class NIC { return false; } else if (!netmask.equals(other.netmask)) return false; + if (macAddress == null) { + if (other.macAddress != null) + return false; + } else if (!macAddress.equals(other.macAddress)) + return false; if (networkId != other.networkId) return false; if (trafficType != other.trafficType) @@ -277,8 +298,8 @@ public class NIC { @Override public String toString() { return "[id=" + id + ", broadcastURI=" + broadcastURI + ", gateway=" + gateway + ", IPAddress=" + IPAddress - + ", isDefault=" + isDefault + ", isolationURI=" + isolationURI + ", netmask=" + netmask + ", networkId=" - + networkId + ", trafficType=" + trafficType + ", guestIPType=" + guestIPType + "]"; + + ", isDefault=" + isDefault + ", isolationURI=" + isolationURI + ", netmask=" + netmask + ", MACAddress=" + + macAddress + ", networkId=" + networkId + ", trafficType=" + trafficType + ", guestIPType=" + guestIPType + "]"; } } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PublicIPAddress.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PublicIPAddress.java index 9bd88dac72..90edc0ee34 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PublicIPAddress.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PublicIPAddress.java @@ -18,15 +18,14 @@ */ package org.jclouds.cloudstack.domain; -import static com.google.common.base.Preconditions.checkNotNull; - +import javax.annotation.Nullable; import java.util.Date; +import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.CaseFormat; import com.google.gson.annotations.SerializedName; /** - * * @author Adrian Cole */ public class PublicIPAddress implements Comparable { @@ -55,6 +54,8 @@ public class PublicIPAddress implements Comparable { private String VLANName; private long zoneId; private String zoneName; + private Long jobId; + private Integer jobStatus; public Builder id(long id) { this.id = id; @@ -151,10 +152,20 @@ public class PublicIPAddress implements Comparable { return this; } + public Builder jobId(Long jobId) { + this.jobId = jobId; + return this; + } + + public Builder jobStatus(int jobStatus) { + this.jobStatus = jobStatus; + return this; + } + public PublicIPAddress build() { return new PublicIPAddress(id, account, allocated, associatedNetworkId, domain, domainId, usesVirtualNetwork, IPAddress, isSourceNAT, isStaticNAT, networkId, state, virtualMachineDisplayName, virtualMachineId, - virtualMachineName, VLANId, VLANName, zoneId, zoneName); + virtualMachineName, VLANId, VLANName, zoneId, zoneName, jobId, jobStatus); } } @@ -191,9 +202,16 @@ public class PublicIPAddress implements Comparable { private long zoneId; @SerializedName("zonename") private String zoneName; + @SerializedName("jobid") + @Nullable + private Long jobId; + @SerializedName("jobstatus") + @Nullable + private Integer jobStatus; public static enum State { ALLOCATING, ALLOCATED, RELEASING, UNRECOGNIZED; + @Override public String toString() { return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); @@ -215,9 +233,10 @@ public class PublicIPAddress implements Comparable { } public PublicIPAddress(long id, String account, Date allocated, long associatedNetworkId, String domain, - long domainId, boolean usesVirtualNetwork, String iPAddress, boolean isSourceNAT, boolean isStaticNAT, - long networkId, State state, String virtualMachineDisplayName, long virtualMachineId, - String virtualMachineName, long VLANId, String VLANName, long zoneId, String zoneName) { + long domainId, boolean usesVirtualNetwork, String iPAddress, boolean isSourceNAT, boolean isStaticNAT, + long networkId, State state, String virtualMachineDisplayName, long virtualMachineId, + String virtualMachineName, long VLANId, String VLANName, long zoneId, String zoneName, Long jobId, + Integer jobStatus) { this.id = id; this.account = account; this.allocated = allocated; @@ -237,6 +256,9 @@ public class PublicIPAddress implements Comparable { this.VLANName = VLANName; this.zoneId = zoneId; this.zoneName = zoneName; + this.jobId = jobId; + this.jobStatus = jobStatus; + } @Override @@ -245,7 +267,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return public IP address id */ public long getId() { @@ -253,7 +274,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return the account the public IP address is associated with */ public String getAccount() { @@ -261,7 +281,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return date the public IP address was acquired */ public Date getAllocated() { @@ -269,7 +288,25 @@ public class PublicIPAddress implements Comparable { } /** - * + * @return shows the current pending asynchronous job ID. This tag is not + * returned if no current pending jobs are acting on the virtual + * machine + */ + @Nullable + public Long getJobId() { + return jobId; + } + + /** + * @return shows the current pending asynchronous job status + */ + @Nullable + public Integer getJobStatus() { + return jobStatus; + } + + + /** * @return the ID of the Network associated with the IP address */ public long getAssociatedNetworkId() { @@ -277,7 +314,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return the domain the public IP address is associated with */ public String getDomain() { @@ -285,7 +321,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return the domain ID the public IP address is associated with */ public long getDomainId() { @@ -300,7 +335,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return public IP address */ public String getIPAddress() { @@ -308,7 +342,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return true if the IP address is a source nat address, false otherwise */ public boolean isSourceNAT() { @@ -316,7 +349,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return true if this ip is for static nat, false otherwise */ public boolean isStaticNAT() { @@ -324,7 +356,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return the ID of the Network where ip belongs to */ public long getNetworkId() { @@ -332,7 +363,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return State of the ip address. Can be: Allocating, Allocated and * Releasing */ @@ -341,7 +371,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return virtual machine display name the ip address is assigned to (not * null only for static nat Ip) */ @@ -350,7 +379,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return virtual machine id the ip address is assigned to (not null only * for static nat Ip) */ @@ -359,7 +387,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return virtual machine name the ip address is assigned to (not null only * for static nat Ip) */ @@ -368,7 +395,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return the ID of the VLAN associated with the IP address */ public long getVLANId() { @@ -376,7 +402,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return the VLAN associated with the IP address */ public String getVLANName() { @@ -384,7 +409,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return the ID of the zone the public IP address belongs to */ public long getZoneId() { @@ -392,7 +416,6 @@ public class PublicIPAddress implements Comparable { } /** - * * @return the name of the zone the public IP address belongs to */ public String getZoneName() { @@ -422,6 +445,7 @@ public class PublicIPAddress implements Comparable { result = prime * result + ((virtualMachineName == null) ? 0 : virtualMachineName.hashCode()); result = prime * result + (int) (zoneId ^ (zoneId >>> 32)); result = prime * result + ((zoneName == null) ? 0 : zoneName.hashCode()); + result = prime * result + ((jobStatus == null) ? 0 : jobStatus.hashCode()); return result; } @@ -499,6 +523,16 @@ public class PublicIPAddress implements Comparable { return false; } else if (!zoneName.equals(other.zoneName)) return false; + if (jobId == null) { + if (other.jobId != null) + return false; + } else if (!jobId.equals(other.jobId)) + return false; + if (jobStatus == null) { + if (other.jobStatus != null) + return false; + } else if (!jobStatus.equals(other.jobStatus)) + return false; return true; } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SecurityGroup.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SecurityGroup.java index b123f12162..a33a5f10a7 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SecurityGroup.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SecurityGroup.java @@ -18,17 +18,16 @@ */ package org.jclouds.cloudstack.domain; -import static com.google.common.base.Preconditions.checkNotNull; - +import javax.annotation.Nullable; import java.util.Set; import java.util.SortedSet; +import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSortedSet; import com.google.gson.annotations.SerializedName; /** - * * @author Adrian Cole */ public class SecurityGroup implements Comparable { @@ -43,6 +42,9 @@ public class SecurityGroup implements Comparable { private String description; private String domain; private long domainId; + private Long jobId; + private Integer jobStatus; + private Set ingressRules = ImmutableSet.of(); public Builder id(long id) { @@ -75,13 +77,23 @@ public class SecurityGroup implements Comparable { return this; } + public Builder jobId(Long jobId) { + this.jobId = jobId; + return this; + } + + public Builder jobStatus(int jobStatus) { + this.jobStatus = jobStatus; + return this; + } + public Builder ingressRules(Set ingressRules) { this.ingressRules = ImmutableSet.copyOf(checkNotNull(ingressRules, "ingressRules")); return this; } public SecurityGroup build() { - return new SecurityGroup(id, account, name, description, domain, domainId, ingressRules); + return new SecurityGroup(id, account, name, description, domain, domainId, jobId, jobStatus, ingressRules); } } @@ -92,31 +104,37 @@ public class SecurityGroup implements Comparable { private String domain; @SerializedName("domainid") private long domainId; + @SerializedName("jobid") + @Nullable + private Long jobId; + @SerializedName("jobstatus") + @Nullable + private Integer jobStatus; @SerializedName("ingressrule") // so that tests and serialization come out expected - private SortedSet ingressRules = ImmutableSortedSet. of(); + private SortedSet ingressRules = ImmutableSortedSet.of(); public SecurityGroup(long id, String account, String name, String description, String domain, long domainId, - Set ingressRules) { + Long jobId, Integer jobStatus, Set ingressRules) { this.id = id; this.account = account; this.name = name; this.description = description; this.domain = domain; this.domainId = domainId; + this.jobId = jobId; + this.jobStatus = jobStatus; this.ingressRules = ImmutableSortedSet.copyOf(checkNotNull(ingressRules, "ingressRules")); } /** * present only for serializer - * */ SecurityGroup() { } /** - * * @return the id of the security group */ public long getId() { @@ -124,7 +142,6 @@ public class SecurityGroup implements Comparable { } /** - * * @return the name of the security group */ @@ -133,7 +150,6 @@ public class SecurityGroup implements Comparable { } /** - * * @return an alternate display text of the security group. */ public String getDescription() { @@ -141,7 +157,6 @@ public class SecurityGroup implements Comparable { } /** - * * @return Domain name for the security group */ public String getDomain() { @@ -149,7 +164,6 @@ public class SecurityGroup implements Comparable { } /** - * * @return the domain id of the security group */ public long getDomainId() { @@ -157,7 +171,24 @@ public class SecurityGroup implements Comparable { } /** - * + * @return shows the current pending asynchronous job ID. This tag is not + * returned if no current pending jobs are acting on the virtual + * machine + */ + @Nullable + public Long getJobId() { + return jobId; + } + + /** + * @return shows the current pending asynchronous job status + */ + @Nullable + public Integer getJobStatus() { + return jobStatus; + } + + /** * @return the account owning the security group */ public String getAccount() { @@ -165,7 +196,6 @@ public class SecurityGroup implements Comparable { } /** - * * @return the list of ingress rules associated with the security group */ public Set getIngressRules() { @@ -178,6 +208,7 @@ public class SecurityGroup implements Comparable { int result = 1; result = prime * result + (int) (domainId ^ (domainId >>> 32)); result = prime * result + (int) (id ^ (id >>> 32)); + result = prime * result + ((jobStatus == null) ? 0 : jobStatus.hashCode()); return result; } @@ -194,6 +225,16 @@ public class SecurityGroup implements Comparable { return false; if (id != other.id) return false; + if (jobId == null) { + if (other.jobId != null) + return false; + } else if (!jobId.equals(other.jobId)) + return false; + if (jobStatus == null) { + if (other.jobStatus != null) + return false; + } else if (!jobStatus.equals(other.jobStatus)) + return false; return true; } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ServiceOffering.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ServiceOffering.java index 1e0881dd35..8860a3c63c 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ServiceOffering.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ServiceOffering.java @@ -18,18 +18,16 @@ */ package org.jclouds.cloudstack.domain; -import static com.google.common.base.Preconditions.checkNotNull; - import java.util.Date; import java.util.Set; +import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.Joiner; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableSet; import com.google.gson.annotations.SerializedName; /** - * * @author Adrian Cole */ public class ServiceOffering implements Comparable { @@ -50,6 +48,13 @@ public class ServiceOffering implements Comparable { private int memory; private boolean haSupport; private StorageType storageType; + private boolean defaultUse; + private String hostTags; + private boolean systemOffering; + private boolean cpuUseLimited; + private long networkRate; + private boolean systemVmType; + private Set tags = ImmutableSet.of(); public Builder id(long id) { @@ -112,9 +117,41 @@ public class ServiceOffering implements Comparable { return this; } + public Builder defaultUse(boolean defaultUse) { + this.defaultUse = defaultUse; + return this; + } + + public Builder hostTags(String hostTags) { + this.hostTags = hostTags; + return this; + } + + public Builder systemOffering(boolean systemOffering) { + this.systemOffering = systemOffering; + return this; + } + + public Builder cpuUseLimited(boolean cpuUseLimited) { + this.cpuUseLimited = cpuUseLimited; + return this; + } + + public Builder networkRate(long networkRate) { + this.networkRate = networkRate; + return this; + } + + public Builder systemVmType(boolean systemVmType) { + this.systemVmType = systemVmType; + return this; + } + + public ServiceOffering build() { return new ServiceOffering(id, name, displayText, created, domain, domainId, cpuNumber, cpuSpeed, memory, - haSupport, storageType, tags); + haSupport, storageType, tags, defaultUse, hostTags, systemOffering, cpuUseLimited, networkRate, + systemVmType); } } @@ -136,9 +173,24 @@ public class ServiceOffering implements Comparable { @SerializedName("storagetype") private StorageType storageType; private String tags; + @SerializedName("defaultuse") + private boolean defaultUse; + @SerializedName("hosttags") + private String hostTags; + @SerializedName("issystem") + private boolean systemOffering; + @SerializedName("limitcpuuse") + private boolean cpuUseLimited; + @SerializedName("networkrate") + private long networkRate; + @SerializedName("systemvmtype") + private boolean systemVmType; + public ServiceOffering(long id, String name, String displayText, Date created, String domain, long domainId, - int cpuNumber, int cpuSpeed, int memory, boolean haSupport, StorageType storageType, Set tags) { + int cpuNumber, int cpuSpeed, int memory, boolean haSupport, StorageType storageType, Set tags, + boolean defaultUse, String hostTags, boolean systemOffering, boolean cpuUseLimited, long networkRate, + boolean systemVmType) { this.id = id; this.name = name; this.displayText = displayText; @@ -155,14 +207,12 @@ public class ServiceOffering implements Comparable { /** * present only for serializer - * */ ServiceOffering() { } /** - * * @return the id of the service offering */ public long getId() { @@ -170,7 +220,6 @@ public class ServiceOffering implements Comparable { } /** - * * @return the name of the service offering */ @@ -179,7 +228,6 @@ public class ServiceOffering implements Comparable { } /** - * * @return an alternate display text of the service offering. */ public String getDisplayText() { @@ -187,7 +235,6 @@ public class ServiceOffering implements Comparable { } /** - * * @return the date this service offering was created */ public Date getCreated() { @@ -195,7 +242,6 @@ public class ServiceOffering implements Comparable { } /** - * * @return Domain name for the offering */ public String getDomain() { @@ -203,7 +249,6 @@ public class ServiceOffering implements Comparable { } /** - * * @return the domain id of the service offering */ public long getDomainId() { @@ -211,7 +256,6 @@ public class ServiceOffering implements Comparable { } /** - * * @return the number of CPU */ public int getCpuNumber() { @@ -219,7 +263,6 @@ public class ServiceOffering implements Comparable { } /** - * * @return the clock rate CPU speed in Mhz */ public int getCpuSpeed() { @@ -227,7 +270,6 @@ public class ServiceOffering implements Comparable { } /** - * * @return the memory in MB */ public int getMemory() { @@ -235,7 +277,6 @@ public class ServiceOffering implements Comparable { } /** - * * @return the ha support in the service offering */ public boolean supportsHA() { @@ -243,7 +284,6 @@ public class ServiceOffering implements Comparable { } /** - * * @return the storage type for this service offering */ public StorageType getStorageType() { @@ -251,11 +291,52 @@ public class ServiceOffering implements Comparable { } /** - * + * @return whether this is a default system vm offering + */ + public boolean isDefaultUse() { + return defaultUse; + } + + /** + * @return the host tag for the service offering + */ + public String getHostTags() { + return hostTags; + } + + /** + * @return whether this is a system vm offering + */ + public boolean isSystemOffering() { + return systemOffering; + } + + /** + * @return whether restrict the CPU usage to committed service offering + */ + public boolean isCpuUseLimited() { + return cpuUseLimited; + } + + /** + * @return data transfer rate in megabits per second allowed. + */ + public long getNetworkRate() { + return networkRate; + } + + /** + * @return whether this is a the systemvm type for system vm offering + */ + public boolean isSystemVmType() { + return systemVmType; + } + + /** * @return the tags for the service offering */ public Set getTags() { - return tags != null ? ImmutableSet.copyOf(Splitter.on(',').split(tags)) : ImmutableSet. of(); + return tags != null ? ImmutableSet.copyOf(Splitter.on(',').split(tags)) : ImmutableSet.of(); } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Template.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Template.java index 12cc7fb8ce..4ffd012d89 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Template.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Template.java @@ -18,16 +18,13 @@ */ package org.jclouds.cloudstack.domain; -import static com.google.common.base.Preconditions.checkNotNull; - +import javax.annotation.Nullable; import java.util.Date; -import javax.annotation.Nullable; - +import static com.google.common.base.Preconditions.checkNotNull; import com.google.gson.annotations.SerializedName; /** - * * @author Adrian Cole */ public class Template implements Comparable