From 2566c04c19d8abb7434ffab974acb5fa91d27b24 Mon Sep 17 00:00:00 2001 From: vijaykiran Date: Wed, 7 Dec 2011 13:17:35 +0100 Subject: [PATCH 1/2] Sync domain objects with json responses from the documentation - part 2 --- .../cloudstack/domain/Capabilities.java | 52 +++++++-- .../cloudstack/domain/IPForwardingRule.java | 94 +++++++++++++--- .../cloudstack/domain/LoadBalancerRule.java | 48 ++++++++- .../jclouds/cloudstack/domain/Network.java | 100 +++++++++++++++--- .../cloudstack/domain/PortForwardingRule.java | 84 +++++++++++---- .../org/jclouds/cloudstack/domain/Zone.java | 97 ++++++++++------- 6 files changed, 378 insertions(+), 97 deletions(-) diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capabilities.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capabilities.java index 1ccee5cfd0..5f08fc319f 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capabilities.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capabilities.java @@ -21,7 +21,6 @@ package org.jclouds.cloudstack.domain; import com.google.gson.annotations.SerializedName; /** - * * @author Adrian Cole */ public class Capabilities { @@ -33,6 +32,8 @@ public class Capabilities { private String cloudStackVersion; private boolean securityGroupsEnabled; private boolean canShareTemplates; + private boolean firewallRuleUiEnabled; + private boolean supportELB; public Builder cloudStackVersion(String cloudStackVersion) { this.cloudStackVersion = cloudStackVersion; @@ -49,8 +50,18 @@ public class Capabilities { return this; } + public Builder firewallRuleUiEnabled(boolean firewallRuleUiEnabled) { + this.firewallRuleUiEnabled = firewallRuleUiEnabled; + return this; + } + + public Builder supportELB(boolean supportELB) { + this.supportELB = supportELB; + return this; + } + public Capabilities build() { - return new Capabilities(cloudStackVersion, securityGroupsEnabled, canShareTemplates); + return new Capabilities(cloudStackVersion, securityGroupsEnabled, canShareTemplates, firewallRuleUiEnabled, supportELB); } } @@ -60,24 +71,27 @@ public class Capabilities { private boolean securityGroupsEnabled; @SerializedName("userpublictemplateenabled") private boolean canShareTemplates; + private boolean firewallRuleUiEnabled; + private boolean supportELB; + /** * present only for serializer - * */ Capabilities() { } - public Capabilities(String cloudStackVersion, boolean securityGroupsEnabled, boolean canShareTemplates) { + public Capabilities(String cloudStackVersion, boolean securityGroupsEnabled, boolean canShareTemplates, + boolean firewallRuleUiEnabled, boolean supportELB) { this.cloudStackVersion = cloudStackVersion; this.securityGroupsEnabled = securityGroupsEnabled; this.canShareTemplates = canShareTemplates; - + this.firewallRuleUiEnabled = firewallRuleUiEnabled; + this.supportELB = supportELB; } /** - * * @return version of the cloud stack */ public String getCloudStackVersion() { @@ -85,7 +99,6 @@ public class Capabilities { } /** - * * @return true if security groups support is enabled, false otherwise */ public boolean isSecurityGroupsEnabled() { @@ -93,7 +106,6 @@ public class Capabilities { } /** - * * @return true if user and domain admins can set templates to be shared, * false otherwise */ @@ -101,6 +113,20 @@ public class Capabilities { return canShareTemplates; } + /** + * @return true if the firewall rule UI is enabled + */ + public boolean isFirewallRuleUiEnabled() { + return firewallRuleUiEnabled; + } + + /** + * @return true if region supports elastic load balancer on basic zones + */ + public boolean isSupportELB() { + return supportELB; + } + @Override public int hashCode() { final int prime = 31; @@ -108,6 +134,8 @@ public class Capabilities { result = prime * result + (canShareTemplates ? 1231 : 1237); result = prime * result + ((cloudStackVersion == null) ? 0 : cloudStackVersion.hashCode()); result = prime * result + (securityGroupsEnabled ? 1231 : 1237); + result = prime * result + (firewallRuleUiEnabled ? 1231 : 1237); + result = prime * result + (supportELB ? 1231 : 1237); return result; } @@ -129,12 +157,18 @@ public class Capabilities { return false; if (securityGroupsEnabled != other.securityGroupsEnabled) return false; + if (firewallRuleUiEnabled != other.firewallRuleUiEnabled) + return false; + if (supportELB != other.supportELB) + return false; return true; } @Override public String toString() { return "[cloudStackVersion=" + cloudStackVersion + ", canShareTemplates=" + canShareTemplates - + ", securityGroupsEnabled=" + securityGroupsEnabled + "]"; + + ", securityGroupsEnabled=" + securityGroupsEnabled + + ", firewallRuleUiEnabled=" + firewallRuleUiEnabled + + ", supportELB=" + supportELB + "]"; } } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java index bf0db08ba6..059d6a047c 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java @@ -18,10 +18,13 @@ */ package org.jclouds.cloudstack.domain; +import java.util.HashSet; +import java.util.Set; + +import com.google.common.collect.ImmutableSet; import com.google.gson.annotations.SerializedName; /** - * * @author Adrian Cole */ public class IPForwardingRule implements Comparable { @@ -40,6 +43,10 @@ public class IPForwardingRule implements Comparable { private String virtualMachineDisplayName; public long virtualMachineId; private String virtualMachineName; + private Set CIDRs = ImmutableSet.of(); + private int privateEndPort; + private int publicEndPort; + public int publicPort; public Builder id(long id) { this.id = id; @@ -91,9 +98,29 @@ public class IPForwardingRule implements Comparable { return this; } + public Builder publicPort(int publicPort) { + this.publicPort = publicPort; + return this; + } + + public Builder CIDRs(Set CIDRs) { + this.CIDRs = CIDRs; + return this; + } + + public Builder privateEndPort(int privateEndPort) { + this.privateEndPort = privateEndPort; + return this; + } + + public Builder publicEndPort(int publicEndPort) { + this.publicEndPort = publicEndPort; + return this; + } + public IPForwardingRule build() { return new IPForwardingRule(id, IPAddress, IPAddressId, startPort, protocol, endPort, state, - virtualMachineDisplayName, virtualMachineId, virtualMachineName); + virtualMachineDisplayName, virtualMachineId, virtualMachineName, publicEndPort, publicPort, CIDRs, privateEndPort); } } @@ -114,6 +141,14 @@ public class IPForwardingRule implements Comparable { public long virtualMachineId; @SerializedName("virtualmachinename") private String virtualMachineName; + @SerializedName("publicport") + public int publicPort; + @SerializedName("cidrlist") + private Set CIDRs; + @SerializedName("privateendport") + private int privateEndPort; + @SerializedName("publicendport") + private int publicEndPort; // for deserializer IPForwardingRule() { @@ -121,7 +156,8 @@ public class IPForwardingRule implements Comparable { } public IPForwardingRule(long id, String iPAddress, long iPAddressId, int startPort, String protocol, int endPort, - String state, String virtualMachineDisplayName, long virtualMachineId, String virtualMachineName) { + String state, String virtualMachineDisplayName, long virtualMachineId, String virtualMachineName, + int publicEndPort, int publicPort, Set CIDRs, int privateEndPort) { this.id = id; this.IPAddress = iPAddress; this.IPAddressId = iPAddressId; @@ -132,6 +168,11 @@ public class IPForwardingRule implements Comparable { this.virtualMachineDisplayName = virtualMachineDisplayName; this.virtualMachineId = virtualMachineId; this.virtualMachineName = virtualMachineName; + this.CIDRs = new HashSet(CIDRs); + this.privateEndPort = privateEndPort; + this.publicEndPort = publicEndPort; + this.publicPort = publicPort; + } @Override @@ -140,7 +181,6 @@ public class IPForwardingRule implements Comparable { } /** - * * @return the ID of the ip forwarding rule */ public long getId() { @@ -148,7 +188,6 @@ public class IPForwardingRule implements Comparable { } /** - * * @return the public ip address for the ip forwarding rule */ public String getIPAddress() { @@ -156,7 +195,6 @@ public class IPForwardingRule implements Comparable { } /** - * * @return the public ip address id for the ip forwarding rule */ public long getIPAddressId() { @@ -164,7 +202,6 @@ public class IPForwardingRule implements Comparable { } /** - * * @return the private port for the ip forwarding rule */ public int getStartPort() { @@ -172,7 +209,6 @@ public class IPForwardingRule implements Comparable { } /** - * * @return the protocol of the ip forwarding rule */ public String getProtocol() { @@ -180,7 +216,6 @@ public class IPForwardingRule implements Comparable { } /** - * * @return the public port for the ip forwarding rule */ public int getEndPort() { @@ -188,7 +223,6 @@ public class IPForwardingRule implements Comparable { } /** - * * @return the state of the rule */ public String getState() { @@ -196,7 +230,6 @@ public class IPForwardingRule implements Comparable { } /** - * * @return the VM display name for the ip forwarding rule */ public String getVirtualMachineDisplayName() { @@ -204,7 +237,6 @@ public class IPForwardingRule implements Comparable { } /** - * * @return the VM ID for the ip forwarding rule */ public long getVirtualMachineId() { @@ -212,13 +244,40 @@ public class IPForwardingRule implements Comparable { } /** - * * @return the VM name for the ip forwarding rule */ public String getVirtualMachineName() { return virtualMachineName; } + /** + * @return the starting port of port forwarding rule's public port range + */ + public int getPublicPort() { + return publicPort; + } + + /** + * @return the cidr list to forward traffic from + */ + public Set getCIDRs() { + return CIDRs; + } + + /** + * @return the ending port of port forwarding rule's private port range + */ + public int getPrivateEndPort() { + return privateEndPort; + } + + /** + * @return the ending port of port forwarding rule's private port range + */ + public int getPublicEndPort() { + return publicEndPort; + } + @Override public int hashCode() { final int prime = 31; @@ -229,6 +288,9 @@ public class IPForwardingRule implements Comparable { result = prime * result + (int) (id ^ (id >>> 32)); result = prime * result + ((protocol == null) ? 0 : protocol.hashCode()); result = prime * result + startPort; + result = prime * result + publicEndPort; + result = prime * result + privateEndPort; + result = prime * result + publicPort; result = prime * result + ((state == null) ? 0 : state.hashCode()); result = prime * result + ((virtualMachineDisplayName == null) ? 0 : virtualMachineDisplayName.hashCode()); result = prime * result + (int) (virtualMachineId ^ (virtualMachineId >>> 32)); @@ -254,6 +316,12 @@ public class IPForwardingRule implements Comparable { return false; if (endPort != other.endPort) return false; + if (publicPort != other.publicPort) + return false; + if (publicEndPort != other.publicEndPort) + return false; + if (privateEndPort != other.privateEndPort) + return false; if (id != other.id) return false; if (protocol == null) { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java index 201983d65e..7e96eba121 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java @@ -20,16 +20,20 @@ package org.jclouds.cloudstack.domain; import static com.google.common.base.Preconditions.checkNotNull; +import java.util.Collections; +import java.util.Set; + import com.google.common.base.CaseFormat; +import com.google.common.collect.ImmutableSet; import com.google.gson.annotations.SerializedName; /** - * * @author Adrian Cole */ public class LoadBalancerRule implements Comparable { public static enum State { ADD, ACTIVE, UNRECOGNIZED; + @Override public String toString() { return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); @@ -47,6 +51,7 @@ public class LoadBalancerRule implements Comparable { public static enum Algorithm { SOURCE, ROUNDROBIN, LEASTCONN, UNRECOGNIZED; + @Override public String toString() { return name().toLowerCase(); @@ -79,6 +84,8 @@ public class LoadBalancerRule implements Comparable { private long publicIPId; private int publicPort; private State state; + private Set CIDRs = ImmutableSet.of(); + private long zoneId; public Builder id(long id) { this.id = id; @@ -140,9 +147,19 @@ public class LoadBalancerRule implements Comparable { return this; } + public Builder CIDRs(Set CIDRs) { + this.CIDRs = CIDRs; + return this; + } + + public Builder zoneId(long zoneId) { + this.zoneId = zoneId; + return this; + } + public LoadBalancerRule build() { return new LoadBalancerRule(id, account, algorithm, description, domain, domainId, name, privatePort, - publicIP, publicIPId, publicPort, state); + publicIP, publicIPId, publicPort, state, zoneId, CIDRs); } } @@ -163,6 +180,10 @@ public class LoadBalancerRule implements Comparable { @SerializedName("publicport") private int publicPort; private State state; + @SerializedName("cidrlist") + private Set CIDRs; + @SerializedName("zoneId") + private long zoneId; // for deserializer LoadBalancerRule() { @@ -170,7 +191,8 @@ public class LoadBalancerRule implements Comparable { } public LoadBalancerRule(long id, String account, Algorithm algorithm, String description, String domain, - long domainId, String name, int privatePort, String publicIP, long publicIPId, int publicPort, State state) { + long domainId, String name, int privatePort, String publicIP, long publicIPId, int publicPort, State state, + long zoneId, Set CIDRs) { this.id = id; this.account = account; this.algorithm = algorithm; @@ -269,11 +291,26 @@ public class LoadBalancerRule implements Comparable { return state; } + /** + * @return the cidr list to forward traffic from + */ + public Set getCIDRs() { + return Collections.unmodifiableSet(CIDRs); + } + + /** + * @return the id of the zone the rule belongs to + */ + public long getZoneId() { + return zoneId; + } + @Override public int compareTo(LoadBalancerRule arg0) { return new Long(id).compareTo(arg0.getId()); } + @Override public int hashCode() { final int prime = 31; @@ -289,6 +326,7 @@ public class LoadBalancerRule implements Comparable { result = prime * result + ((publicIP == null) ? 0 : publicIP.hashCode()); result = prime * result + (int) (publicIPId ^ (publicIPId >>> 32)); result = prime * result + publicPort; + result = prime * result + (int) (zoneId ^ (zoneId >>> 32)); result = prime * result + ((state == null) ? 0 : state.hashCode()); return result; } @@ -324,6 +362,8 @@ public class LoadBalancerRule implements Comparable { return false; if (domainId != other.domainId) return false; + if (zoneId != other.zoneId) + return false; if (id != other.id) return false; if (name == null) { @@ -353,7 +393,7 @@ public class LoadBalancerRule implements Comparable { @Override public String toString() { return "[account=" + account + ", algorithm=" + algorithm + ", description=" + description + ", domain=" + domain - + ", domainId=" + domainId + ", id=" + id + ", name=" + name + ", privatePort=" + privatePort + + ", domainId=" + domainId + ", zoneId=" + zoneId + ", id=" + id + ", name=" + name + ", privatePort=" + privatePort + ", publicIP=" + publicIP + ", publicIPId=" + publicIPId + ", publicPort=" + publicPort + ", state=" + state + "]"; } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Network.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Network.java index 3ff10928c7..757e5abdeb 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Network.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Network.java @@ -18,10 +18,7 @@ */ package org.jclouds.cloudstack.domain; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.ImmutableSortedSet; -import com.google.gson.annotations.SerializedName; +import static com.google.common.base.Preconditions.checkNotNull; import javax.annotation.Nullable; import java.net.URI; @@ -29,7 +26,12 @@ import java.util.List; import java.util.Set; import java.util.SortedSet; -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.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSortedSet; +import com.google.gson.annotations.SerializedName; /** * @author Adrian Cole @@ -66,12 +68,27 @@ public class Network implements Comparable { private TrafficType trafficType; private long zoneId; private Set services = ImmutableSet.of(); + private String account; + private long domainId; + private boolean securityGroupEnabled; + private Set tags = ImmutableSet.of(); + public Builder id(long id) { this.id = id; return this; } + public Builder account(String account) { + this.account = account; + return this; + } + + public Builder domainId(long domainId) { + this.domainId = domainId; + return this; + } + public Builder broadcastDomainType(String broadcastDomainType) { this.broadcastDomainType = broadcastDomainType; return this; @@ -197,15 +214,26 @@ public class Network implements Comparable { return this; } + public Builder tags(Set tags) { + this.tags = ImmutableSet.copyOf(checkNotNull(tags, "tags")); + return this; + } + + public Builder securityGroupEnabled(boolean securityGroupEnabled) { + this.securityGroupEnabled = securityGroupEnabled; + return this; + } + public Network build() { - return new Network(id, broadcastDomainType, broadcastURI, displayText, DNS, domain, endIP, + return new Network(id, broadcastDomainType, broadcastURI, displayText, DNS, domain, domainId, endIP, gateway, isDefault, isShared, isSystem, netmask, networkDomain, networkOfferingAvailability, networkOfferingDisplayText, networkOfferingId, networkOfferingName, related, startIP, name, state, - guestIPType, VLAN, trafficType, zoneId, services); + guestIPType, VLAN, trafficType, zoneId, services, tags, securityGroupEnabled, account); } } private long id; + private String account; @SerializedName("broadcastdomaintype") private String broadcastDomainType; @SerializedName("broadcasturi") @@ -216,8 +244,9 @@ public class Network implements Comparable { private String DNS1; @SerializedName("dns2") private String DNS2; - @SerializedName("networkdomain") private String domain; + @SerializedName("domainid") + private long domainId; @SerializedName("endip") private String endIP; private String gateway; @@ -253,6 +282,9 @@ public class Network implements Comparable { @SerializedName("zoneid") private long zoneId; @SerializedName("service") + private String tags; + @SerializedName("securitygroupenabled") + private boolean securityGroupEnabled; // so tests and serialization comes out expected private SortedSet services = ImmutableSortedSet.of(); @@ -264,11 +296,12 @@ public class Network implements Comparable { } public Network(long id, String broadcastDomainType, URI broadcastURI, String displayText, - List DNS, String domain, String endIP, String gateway, boolean isDefault, + List DNS, String domain, long domainId, String endIP, String gateway, boolean isDefault, boolean isShared, boolean isSystem, String netmask, String networkDomain, String networkOfferingAvailability, String networkOfferingDisplayText, long networkOfferingId, String networkOfferingName, long related, String startIP, String name, String state, GuestIPType type, String vLAN, TrafficType trafficType, - long zoneId, Set services) { + long zoneId, Set services, Set tags, boolean securityGroupEnabled, + String account) { this.id = id; this.broadcastDomainType = broadcastDomainType; this.broadcastURI = broadcastURI; @@ -276,6 +309,7 @@ public class Network implements Comparable { this.DNS1 = checkNotNull(DNS, "DNS").size() > 0 ? DNS.get(0) : null; this.DNS2 = DNS.size() > 1 ? DNS.get(1) : null; this.domain = domain; + this.domainId = domainId; this.endIP = endIP; this.gateway = gateway; this.isDefault = isDefault; @@ -296,6 +330,9 @@ public class Network implements Comparable { this.trafficType = trafficType; this.zoneId = zoneId; this.services = ImmutableSortedSet.copyOf(checkNotNull(services, "services")); + this.tags = tags.size() == 0 ? null : Joiner.on(',').join(tags); + this.securityGroupEnabled = securityGroupEnabled; + this.account = account; } /** @@ -339,12 +376,26 @@ public class Network implements Comparable { } /** - * @return Domain name for the Vms in the zone + * @return Domain name for the Network */ public String getDomain() { return domain; } + /** + * @return the domain id of the Network + */ + public long getDomainId() { + return domainId; + } + + /** + * @return the account associated with the network + */ + public String getAccount() { + return account; + } + /** * @return the end ip of the network */ @@ -485,6 +536,20 @@ public class Network implements Comparable { return services; } + /** + * @return true if security group is enabled, false otherwise + */ + public boolean isSecurityGroupEnabled() { + return securityGroupEnabled; + } + + /** + * @return the tags for the Network + */ + public Set getTags() { + return tags != null ? ImmutableSet.copyOf(Splitter.on(',').split(tags)) : ImmutableSet.of(); + } + @Override public int hashCode() { final int prime = 31; @@ -516,6 +581,8 @@ public class Network implements Comparable { result = prime * result + ((state == null) ? 0 : state.hashCode()); result = prime * result + ((trafficType == null) ? 0 : trafficType.hashCode()); result = prime * result + (int) (zoneId ^ (zoneId >>> 32)); + result = prime * result + ((tags == null) ? 0 : tags.hashCode()); + result = prime * result + (int) (domainId ^ (domainId >>> 32)); return result; } @@ -636,6 +703,13 @@ public class Network implements Comparable { return false; if (zoneId != other.zoneId) return false; + if (tags == null) { + if (other.tags != null) + return false; + } else if (!tags.equals(other.tags)) + return false; + if (domainId != other.domainId) + return false; return true; } @@ -645,11 +719,11 @@ public class Network implements Comparable { + guestIPType + ", trafficType=" + trafficType + ", DNS=" + getDNS() + ", VLAN=" + VLAN + ", startIP=" + startIP + ", endIP=" + endIP + ", netmask=" + netmask + ", gateway=" + gateway + ", broadcastDomainType=" + broadcastDomainType + ", broadcastURI=" + broadcastURI + ", services=" - + services + ", domain=" + domain + ", isDefault=" + isDefault + ", isShared=" + + services + ", domain=" + domain + ", domainId=" + domainId + ", isDefault=" + isDefault + ", isShared=" + isShared + ", isSystem=" + isSystem + ", related=" + related + ", zoneId=" + zoneId + ", domain=" + networkDomain + ", networkOfferingAvailability=" + networkOfferingAvailability + ", networkOfferingDisplayText=" + networkOfferingDisplayText + ", networkOfferingId=" + networkOfferingId - + ", networkOfferingName=" + networkOfferingName + "]"; + + ", networkOfferingName=" + networkOfferingName + ", tags=" + getTags() + "]"; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java index 2ac82d58e3..cac8acb330 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java @@ -18,10 +18,14 @@ */ package org.jclouds.cloudstack.domain; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import com.google.common.collect.ImmutableSet; import com.google.gson.annotations.SerializedName; /** - * * @author Adrian Cole */ public class PortForwardingRule implements Comparable { @@ -40,6 +44,9 @@ public class PortForwardingRule implements Comparable { private String virtualMachineDisplayName; public long virtualMachineId; private String virtualMachineName; + private Set CIDRs = ImmutableSet.of(); + private int privateEndPort; + private int publicEndPort; public Builder id(long id) { this.id = id; @@ -91,9 +98,24 @@ public class PortForwardingRule implements Comparable { return this; } + public Builder CIDRs(Set CIDRs) { + this.CIDRs = CIDRs; + return this; + } + + public Builder privateEndPort(int privateEndPort) { + this.privateEndPort = privateEndPort; + return this; + } + + public Builder publicEndPort(int publicEndPort) { + this.publicEndPort = publicEndPort; + return this; + } + public PortForwardingRule build() { return new PortForwardingRule(id, IPAddress, IPAddressId, privatePort, protocol, publicPort, state, - virtualMachineDisplayName, virtualMachineId, virtualMachineName); + virtualMachineDisplayName, virtualMachineId, virtualMachineName, CIDRs, privateEndPort, publicEndPort); } } @@ -106,7 +128,7 @@ public class PortForwardingRule implements Comparable { private int privatePort; private String protocol; @SerializedName("publicport") - public String publicPort; + public int publicPort; private String state; @SerializedName("virtualmachinedisplayname") private String virtualMachineDisplayName; @@ -114,6 +136,13 @@ public class PortForwardingRule implements Comparable { public long virtualMachineId; @SerializedName("virtualmachinename") private String virtualMachineName; + @SerializedName("cidrlist") + private Set CIDRs; + @SerializedName("privateendport") + private int privateEndPort; + @SerializedName("publicendport") + private int publicEndPort; + // for deserializer PortForwardingRule() { @@ -121,18 +150,21 @@ public class PortForwardingRule implements Comparable { } public PortForwardingRule(long id, String iPAddress, long iPAddressId, int privatePort, String protocol, - int publicPort, String state, String virtualMachineDisplayName, long virtualMachineId, - String virtualMachineName) { + int publicPort, String state, String virtualMachineDisplayName, long virtualMachineId, + String virtualMachineName, Set CIDRs, int privateEndPort, int publicEndPort) { this.id = id; this.IPAddress = iPAddress; this.IPAddressId = iPAddressId; this.privatePort = privatePort; this.protocol = protocol; - this.publicPort = publicPort + ""; + this.publicPort = publicPort; this.state = state; this.virtualMachineDisplayName = virtualMachineDisplayName; this.virtualMachineId = virtualMachineId; this.virtualMachineName = virtualMachineName; + this.CIDRs = new HashSet(CIDRs); + this.privateEndPort = privateEndPort; + this.publicEndPort = publicEndPort; } @Override @@ -141,7 +173,6 @@ public class PortForwardingRule implements Comparable { } /** - * * @return the ID of the port forwarding rule */ public long getId() { @@ -149,7 +180,6 @@ public class PortForwardingRule implements Comparable { } /** - * * @return the public ip address for the port forwarding rule */ public String getIPAddress() { @@ -157,7 +187,6 @@ public class PortForwardingRule implements Comparable { } /** - * * @return the public ip address id for the port forwarding rule */ public long getIPAddressId() { @@ -165,7 +194,6 @@ public class PortForwardingRule implements Comparable { } /** - * * @return the private port for the port forwarding rule */ public int getPrivatePort() { @@ -173,7 +201,6 @@ public class PortForwardingRule implements Comparable { } /** - * * @return the protocol of the port forwarding rule */ public String getProtocol() { @@ -181,15 +208,13 @@ public class PortForwardingRule implements Comparable { } /** - * * @return the public port for the port forwarding rule */ public int getPublicPort() { - return Integer.parseInt(publicPort); + return publicPort; } /** - * * @return the state of the rule */ public String getState() { @@ -197,7 +222,6 @@ public class PortForwardingRule implements Comparable { } /** - * * @return the VM display name for the port forwarding rule */ public String getVirtualMachineDisplayName() { @@ -205,7 +229,6 @@ public class PortForwardingRule implements Comparable { } /** - * * @return the VM ID for the port forwarding rule */ public long getVirtualMachineId() { @@ -213,13 +236,33 @@ public class PortForwardingRule implements Comparable { } /** - * * @return the VM name for the port forwarding rule */ public String getVirtualMachineName() { return virtualMachineName; } + /** + * @return the cidr list to forward traffic from + */ + public Set getCIDRs() { + return Collections.unmodifiableSet(CIDRs); + } + + /** + * @return the starting port of port forwarding rule's private port range + */ + public int getPrivateEndPort() { + return privateEndPort; + } + + /** + * @return the starting port of port forwarding rule's public port range + */ + public int getPublicEndPort() { + return publicEndPort; + } + @Override public int hashCode() { final int prime = 31; @@ -229,7 +272,7 @@ public class PortForwardingRule implements Comparable { result = prime * result + (int) (id ^ (id >>> 32)); result = prime * result + privatePort; result = prime * result + ((protocol == null) ? 0 : protocol.hashCode()); - result = prime * result + ((publicPort == null) ? 0 : publicPort.hashCode()); + result = prime * result + publicPort; result = prime * result + ((state == null) ? 0 : state.hashCode()); result = prime * result + ((virtualMachineDisplayName == null) ? 0 : virtualMachineDisplayName.hashCode()); result = prime * result + (int) (virtualMachineId ^ (virtualMachineId >>> 32)); @@ -262,10 +305,7 @@ public class PortForwardingRule implements Comparable { return false; } else if (!protocol.equals(other.protocol)) return false; - if (publicPort == null) { - if (other.publicPort != null) - return false; - } else if (!publicPort.equals(other.publicPort)) + if (privatePort != other.privatePort) return false; if (state == null) { if (other.state != null) diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Zone.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Zone.java index db48df5cb1..3412d20ba0 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Zone.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Zone.java @@ -20,15 +20,13 @@ package org.jclouds.cloudstack.domain; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.List; - import javax.annotation.Nullable; +import java.util.List; import com.google.common.collect.ImmutableList; import com.google.gson.annotations.SerializedName; /** - * * @author Adrian Cole */ public class Zone implements Comparable { @@ -47,9 +45,11 @@ public class Zone implements Comparable { private List internalDNS = ImmutableList.of(); private String name; private NetworkType networkType; - private String status; private String VLAN; private boolean securityGroupsEnabled; + private String allocationState; + private String dhcpProvider; + private String zoneToken; public Builder id(long id) { this.id = id; @@ -101,11 +101,6 @@ public class Zone implements Comparable { return this; } - public Builder status(String status) { - this.status = status; - return this; - } - public Builder VLAN(String VLAN) { this.VLAN = VLAN; return this; @@ -116,9 +111,25 @@ public class Zone implements Comparable { return this; } + + public Builder allocationState(String allocationState) { + this.allocationState = allocationState; + return this; + } + + public Builder dhcpProvider(String dhcpProvider) { + this.dhcpProvider = dhcpProvider; + return this; + } + + public Builder zoneToken(String zoneToken) { + this.zoneToken = zoneToken; + return this; + } + public Zone build() { return new Zone(id, description, displayText, DNS, domain, domainId, guestCIDRAddress, internalDNS, name, - networkType, status, VLAN, securityGroupsEnabled); + networkType, VLAN, securityGroupsEnabled, allocationState, dhcpProvider, zoneToken); } } @@ -143,23 +154,28 @@ public class Zone implements Comparable { private String name; @SerializedName("networktype") private NetworkType networkType; - private String status; @SerializedName("vlan") private String VLAN; @SerializedName("securitygroupsenabled") private boolean securityGroupsEnabled; + @SerializedName("allocationstate") + //TODO Change to enum? + private String allocationState; + @SerializedName("dhcpprovider") + private String dhcpProvider; + @SerializedName("zonetoken") + private String zoneToken; /** * present only for serializer - * */ Zone() { } public Zone(long id, String description, String displayText, List DNS, String domain, long domainId, - String guestCIDRAddress, List internalDNS, String name, NetworkType networkType, String status, - String vLAN, boolean securityGroupsEnabled) { + String guestCIDRAddress, List internalDNS, String name, NetworkType networkType, + String vLAN, boolean securityGroupsEnabled, String allocationState, String dhcpProvider, String zoneToken) { this.id = id; this.description = description; this.displayText = displayText; @@ -172,13 +188,14 @@ public class Zone implements Comparable { this.internalDNS2 = internalDNS.size() > 1 ? internalDNS.get(1) : null; this.name = name; this.networkType = networkType; - this.status = status; this.VLAN = vLAN; this.securityGroupsEnabled = securityGroupsEnabled; + this.allocationState = allocationState; + this.dhcpProvider = dhcpProvider; + this.zoneToken = zoneToken; } /** - * * @return Zone id */ public long getId() { @@ -186,7 +203,6 @@ public class Zone implements Comparable { } /** - * * @return Zone description */ public String getDescription() { @@ -194,7 +210,6 @@ public class Zone implements Comparable { } /** - * * @return the display text of the zone */ public String getDisplayText() { @@ -202,7 +217,6 @@ public class Zone implements Comparable { } /** - * * @return the external DNS for the Zone */ public List getDNS() { @@ -215,7 +229,6 @@ public class Zone implements Comparable { } /** - * * @return Domain name for the Vms in the zone */ public String getDomain() { @@ -223,7 +236,6 @@ public class Zone implements Comparable { } /** - * * @return the ID of the containing domain, null for public zones */ @Nullable @@ -232,7 +244,6 @@ public class Zone implements Comparable { } /** - * * @return the guest CIDR address for the Zone */ public String getGuestCIDRAddress() { @@ -240,7 +251,6 @@ public class Zone implements Comparable { } /** - * * @return the internal DNS for the Zone */ public List getInternalDNS() { @@ -253,7 +263,6 @@ public class Zone implements Comparable { } /** - * * @return Zone name */ public String getName() { @@ -261,7 +270,6 @@ public class Zone implements Comparable { } /** - * * @return the network type of the zone; can be Basic or Advanced */ public NetworkType getNetworkType() { @@ -269,15 +277,6 @@ public class Zone implements Comparable { } /** - * - * @return - */ - public String getStatus() { - return status; - } - - /** - * * @return the vlan range of the zone */ public String getVLAN() { @@ -285,13 +284,33 @@ public class Zone implements Comparable { } /** - * * @return true if this zone has security groups enabled */ public boolean isSecurityGroupsEnabled() { return securityGroupsEnabled; } + /** + * @return the allocation state of the cluster + */ + public String getAllocationState() { + return allocationState; + } + + /** + * @return the dhcp Provider for the Zone + */ + public String getDhcpProvider() { + return dhcpProvider; + } + + /** + * @return Zone Token + */ + public String getZoneToken() { + return zoneToken; + } + @Override public int hashCode() { final int prime = 31; @@ -308,6 +327,7 @@ public class Zone implements Comparable { result = prime * result + ((internalDNS1 == null) ? 0 : internalDNS1.hashCode()); result = prime * result + ((internalDNS2 == null) ? 0 : internalDNS2.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((allocationState == null) ? 0 : allocationState.hashCode()); result = prime * result + ((networkType == null) ? 0 : networkType.hashCode()); result = prime * result + (securityGroupsEnabled ? 1231 : 1237); return result; @@ -342,6 +362,11 @@ public class Zone implements Comparable { return false; } else if (!description.equals(other.description)) return false; + if (allocationState == null) { + if (other.allocationState != null) + return false; + } else if (!allocationState.equals(other.allocationState)) + return false; if (displayText == null) { if (other.displayText != null) return false; @@ -388,7 +413,7 @@ public class Zone implements Comparable { @Override public String toString() { - return "[id=" + id + ", status=" + status + ", name=" + name + ", description=" + description + ", displayText=" + return "[id=" + id + ", allocationState=" + allocationState + ", name=" + name + ", description=" + description + ", displayText=" + displayText + ", domain=" + domain + ", domainId=" + domainId + ", networkType=" + networkType + ", guestCIDRAddress=" + guestCIDRAddress + ", VLAN=" + VLAN + ", DNS=" + getDNS() + ", securityGroupsEnabled=" + isSecurityGroupsEnabled() + ", internalDNS=" + getInternalDNS() + "]"; From 8b06ee410d401415a59324bbebde58360f8e5432 Mon Sep 17 00:00:00 2001 From: vijaykiran Date: Wed, 7 Dec 2011 15:01:41 +0100 Subject: [PATCH 2/2] Update toString methods --- .../jclouds/cloudstack/domain/Account.java | 41 ++++++++++--- .../org/jclouds/cloudstack/domain/Alert.java | 11 ++-- .../domain/AsyncCreateResponse.java | 5 +- .../jclouds/cloudstack/domain/AsyncJob.java | 19 ++++-- .../cloudstack/domain/AsyncJobError.java | 5 +- .../cloudstack/domain/Capabilities.java | 11 ++-- .../jclouds/cloudstack/domain/Capacity.java | 20 +++---- .../cloudstack/domain/DiskOffering.java | 14 ++++- .../org/jclouds/cloudstack/domain/Event.java | 16 ++++- .../cloudstack/domain/IPForwardingRule.java | 7 ++- .../org/jclouds/cloudstack/domain/ISO.java | 4 +- .../cloudstack/domain/ISOExtraction.java | 30 +++++----- .../cloudstack/domain/ISOPermissions.java | 12 ++-- .../cloudstack/domain/IngressRule.java | 14 ++++- .../jclouds/cloudstack/domain/JobResult.java | 8 +-- .../cloudstack/domain/LoadBalancerRule.java | 24 ++++++-- .../org/jclouds/cloudstack/domain/NIC.java | 16 ++++- .../jclouds/cloudstack/domain/Network.java | 44 ++++++++++---- .../cloudstack/domain/NetworkOffering.java | 17 +++++- .../cloudstack/domain/NetworkService.java | 5 +- .../org/jclouds/cloudstack/domain/OSType.java | 6 +- .../cloudstack/domain/PortForwardingRule.java | 19 ++++-- .../cloudstack/domain/PublicIPAddress.java | 32 +++++++--- .../cloudstack/domain/ResourceLimit.java | 9 ++- .../cloudstack/domain/SecurityGroup.java | 13 +++- .../cloudstack/domain/ServiceOffering.java | 24 ++++++-- .../jclouds/cloudstack/domain/Snapshot.java | 6 +- .../cloudstack/domain/SnapshotPolicy.java | 16 ++--- .../domain/SnapshotPolicySchedule.java | 8 +++ .../jclouds/cloudstack/domain/SshKeyPair.java | 6 +- .../jclouds/cloudstack/domain/Template.java | 41 ++++++++++--- .../cloudstack/domain/TemplateExtraction.java | 20 +++++-- .../cloudstack/domain/TemplateMetadata.java | 16 +++-- .../cloudstack/domain/TemplatePermission.java | 12 ++-- .../org/jclouds/cloudstack/domain/User.java | 21 +++++-- .../jclouds/cloudstack/domain/VMGroup.java | 19 +++--- .../cloudstack/domain/VirtualMachine.java | 60 +++++++++++++------ .../org/jclouds/cloudstack/domain/Volume.java | 37 +++++++++++- .../org/jclouds/cloudstack/domain/Zone.java | 23 +++++-- 39 files changed, 527 insertions(+), 184 deletions(-) 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 16be1e802e..7b1d7d76c4 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,11 +18,12 @@ */ 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 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; @@ -598,15 +599,39 @@ public class Account extends ForwardingSet implements Comparable return new Long(id).compareTo(arg0.getId()); } + @Override public String toString() { - return String - .format( - "[id=%s, name=%s, type=%s, state=%s, domain=%s, domainId=%s, cleanupRequired=%s, sentBytes=%s, receivedBytes=%s, IPs=%s, IPsAvailable=%s, IPLimit=%s, VMs=%s, VMsAvailable=%s, VMsRunning=%s, VMsStopped=%s, VMLimit=%s, snapshots=%s, snapshotLimit=%s, snapshotsAvailable=%s, templateLimit=%s, templates=%s, templatesAvailable=%s, volumes=%s, volumeLimit=%s, volumesAvailable=%s, users=%s]", - id, name, type, state, domain, domainId, cleanupRequired, sentBytes, receivedBytes, IPs, - IPsAvailable, IPLimit, VMs, VMsAvailable, VMsRunning, VMsStopped, VMLimit, snapshots, snapshotLimit, - snapshotsAvailable, templateLimit, templates, templatesAvailable, volumes, volumeLimit, - volumesAvailable, users); + return "Account{" + + "id=" + id + + ", type=" + type + + ", networkDomain='" + networkDomain + '\'' + + ", domain='" + domain + '\'' + + ", domainId=" + domainId + + ", IPsAvailable=" + IPsAvailable + + ", IPLimit=" + IPLimit + + ", IPs=" + IPs + + ", cleanupRequired=" + cleanupRequired + + ", name='" + name + '\'' + + ", receivedBytes=" + receivedBytes + + ", sentBytes=" + sentBytes + + ", snapshotsAvailable=" + snapshotsAvailable + + ", snapshotLimit=" + snapshotLimit + + ", snapshots=" + snapshots + + ", state=" + state + + ", templatesAvailable=" + templatesAvailable + + ", templateLimit=" + templateLimit + + ", templates=" + templates + + ", VMsAvailable=" + VMsAvailable + + ", VMLimit=" + VMLimit + + ", VMsRunning=" + VMsRunning + + ", VMsStopped=" + VMsStopped + + ", VMs=" + VMs + + ", volumesAvailable=" + volumesAvailable + + ", volumeLimit=" + volumeLimit + + ", volumes=" + volumes + + ", users=" + users + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Alert.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Alert.java index 03dad72f86..e39ba9dce6 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Alert.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Alert.java @@ -118,14 +118,15 @@ public class Alert implements Comparable { return result; } + @Override public String toString() { return "Alert{" + - "id=" + id + - ", description='" + description + '\'' + - ", sent=" + sent + - ", type='" + type + '\'' + - '}'; + "id=" + id + + ", description='" + description + '\'' + + ", sent=" + sent + + ", type='" + type + '\'' + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncCreateResponse.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncCreateResponse.java index d4c5c2faf6..aa56420c17 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncCreateResponse.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncCreateResponse.java @@ -85,7 +85,10 @@ public class AsyncCreateResponse { @Override public String toString() { - return "[id=" + id + ", jobId=" + jobId + "]"; + return "AsyncCreateResponse{" + + "id=" + id + + ", jobId=" + jobId + + '}'; } } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJob.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJob.java index 8cd7d08201..cb4cfd25e8 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJob.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJob.java @@ -422,10 +422,21 @@ public class AsyncJob { @Override public String toString() { - return "[accountId=" + accountId + ", cmd=" + cmd + ", created=" + created + ", id=" + id + ", instanceId=" - + instanceId + ", instanceType=" + instanceType + ", error=" + error + ", progress=" + progress - + ", result=" + result + ", resultCode=" + resultCode + ", resultType=" + resultType + ", status=" + status - + ", userId=" + userId + "]"; + return "AsyncJob{" + + "accountId=" + accountId + + ", cmd='" + cmd + '\'' + + ", created=" + created + + ", id=" + id + + ", instanceId=" + instanceId + + ", instanceType='" + instanceType + '\'' + + ", progress=" + progress + + ", result=" + result + + ", resultCode=" + resultCode + + ", resultType='" + resultType + '\'' + + ", status=" + status + + ", userId=" + userId + + ", error=" + error + + '}'; } } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJobError.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJobError.java index 8bfeb5a6d0..a446dbf42f 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJobError.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/AsyncJobError.java @@ -120,7 +120,10 @@ public class AsyncJobError { @Override public String toString() { - return "[errorCode=" + errorCode + ", errorText=" + errorText + "]"; + return "AsyncJobError{" + + "errorCode=" + errorCode + + ", errorText='" + errorText + '\'' + + '}'; } } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capabilities.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capabilities.java index 5f08fc319f..027cad05cf 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capabilities.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capabilities.java @@ -166,9 +166,12 @@ public class Capabilities { @Override public String toString() { - return "[cloudStackVersion=" + cloudStackVersion + ", canShareTemplates=" + canShareTemplates - + ", securityGroupsEnabled=" + securityGroupsEnabled - + ", firewallRuleUiEnabled=" + firewallRuleUiEnabled - + ", supportELB=" + supportELB + "]"; + return "Capabilities{" + + "cloudStackVersion='" + cloudStackVersion + '\'' + + ", securityGroupsEnabled=" + securityGroupsEnabled + + ", canShareTemplates=" + canShareTemplates + + ", firewallRuleUiEnabled=" + firewallRuleUiEnabled + + ", supportELB=" + supportELB + + '}'; } } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capacity.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capacity.java index 1acfe9e865..0c525d71e1 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capacity.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Capacity.java @@ -231,16 +231,16 @@ public class Capacity implements Comparable { @Override public String toString() { - return "[" + - "podId=" + podId + - ", podName='" + podName + '\'' + - ", zoneId=" + zoneId + - ", zoneName='" + zoneName + '\'' + - ", type=" + type + - ", capacityUsed=" + capacityUsed + - ", capacityTotal=" + capacityTotal + - ", percentUsed=" + percentUsed + - ']'; + return "Capacity{" + + "capacityTotal=" + capacityTotal + + ", capacityUsed=" + capacityUsed + + ", percentUsed=" + percentUsed + + ", podId=" + podId + + ", podName='" + podName + '\'' + + ", type=" + type + + ", zoneId=" + zoneId + + ", zoneName='" + zoneName + '\'' + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/DiskOffering.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/DiskOffering.java index 8e28c4ff0d..6e2cd0be60 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/DiskOffering.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/DiskOffering.java @@ -270,9 +270,17 @@ public class DiskOffering implements Comparable { @Override public String toString() { - return "[id=" + id + ", name=" + name + ", displayText=" + displayText + ", created=" + created + ", diskSize=" - + diskSize + ", iscustomized=" + customized + ", domain=" + domain + ", domainId=" + domainId + ", tags=" - + getTags() + "]"; + return "DiskOffering{" + + "id=" + id + + ", name='" + name + '\'' + + ", displayText='" + displayText + '\'' + + ", created=" + created + + ", domain='" + domain + '\'' + + ", domainId=" + domainId + + ", diskSize=" + diskSize + + ", customized=" + customized + + ", tags='" + tags + '\'' + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Event.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Event.java index 29925ca727..afeb56c04d 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Event.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Event.java @@ -265,9 +265,19 @@ public class Event implements Comparable { @Override public String toString() { - return String.format("[id=%d, account=%s, description=%s, created=%s, domain=%s, domainId=%d, level=%s, " + - "parentId=%s, state=%s, type=%s, username=%s]", - id, account, description, created, domain, domainId, level, parentId, state, type, username); + return "Event{" + + "id=" + id + + ", account='" + account + '\'' + + ", description='" + description + '\'' + + ", created=" + created + + ", domain='" + domain + '\'' + + ", domainId=" + domainId + + ", level='" + level + '\'' + + ", parentId='" + parentId + '\'' + + ", state='" + state + '\'' + + ", type='" + type + '\'' + + ", username='" + username + '\'' + + '}'; } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java index 059d6a047c..4dca3a0c52 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java @@ -18,10 +18,11 @@ */ package org.jclouds.cloudstack.domain; -import java.util.HashSet; +import java.util.Collections; import java.util.Set; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; import com.google.gson.annotations.SerializedName; /** @@ -168,7 +169,7 @@ public class IPForwardingRule implements Comparable { this.virtualMachineDisplayName = virtualMachineDisplayName; this.virtualMachineId = virtualMachineId; this.virtualMachineName = virtualMachineName; - this.CIDRs = new HashSet(CIDRs); + this.CIDRs = Sets.newHashSet(CIDRs); this.privateEndPort = privateEndPort; this.publicEndPort = publicEndPort; this.publicPort = publicPort; @@ -261,7 +262,7 @@ public class IPForwardingRule implements Comparable { * @return the cidr list to forward traffic from */ public Set getCIDRs() { - return CIDRs; + return Collections.unmodifiableSet(CIDRs); } /** 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 2d32c34740..7f50c62620 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 @@ -689,7 +689,7 @@ public class ISO implements Comparable { @Override public String toString() { - return "[" + + return "ISO{" + "id=" + id + ", account='" + account + '\'' + ", accountId=" + accountId + @@ -722,7 +722,7 @@ public class ISO implements Comparable { ", templateType='" + templateType + '\'' + ", zoneId=" + zoneId + ", zoneName='" + zoneName + '\'' + - ']'; + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOExtraction.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOExtraction.java index 4a39f88248..28f53e09f7 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOExtraction.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOExtraction.java @@ -313,21 +313,21 @@ public class ISOExtraction implements Comparable { @Override public String toString() { - return "[" + - "id=" + id + - ", accountId=" + accountId + - ", created=" + created + - ", extractId=" + extractId + - ", extractMode=" + extractMode + - ", name='" + name + '\'' + - ", state='" + state + '\'' + - ", status='" + status + '\'' + - ", storageType='" + storageType + '\'' + - ", uploadPercentage=" + uploadPercentage + - ", url='" + url + '\'' + - ", zoneId=" + zoneId + - ", zoneName='" + zoneName + '\'' + - ']'; + return "ISOExtraction{" + + "id=" + id + + ", accountId=" + accountId + + ", created=" + created + + ", extractId=" + extractId + + ", extractMode=" + extractMode + + ", name='" + name + '\'' + + ", state='" + state + '\'' + + ", status='" + status + '\'' + + ", storageType='" + storageType + '\'' + + ", uploadPercentage=" + uploadPercentage + + ", url='" + url + '\'' + + ", zoneId=" + zoneId + + ", zoneName='" + zoneName + '\'' + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOPermissions.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOPermissions.java index 2e5de13991..f10a2e506c 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOPermissions.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ISOPermissions.java @@ -137,12 +137,12 @@ public class ISOPermissions implements Comparable { @Override public String toString() { - return "[" + - "id=" + id + - ", account='" + account + '\'' + - ", domainId=" + domainId + - ", isPublic=" + isPublic + - ']'; + return "ISOPermissions{" + + "id=" + id + + ", account='" + account + '\'' + + ", domainId=" + domainId + + ", isPublic=" + isPublic + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IngressRule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IngressRule.java index 016d39a5b3..4012e48101 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IngressRule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/IngressRule.java @@ -256,9 +256,17 @@ public class IngressRule implements Comparable { @Override public String toString() { - return "[id=" + id + ", securityGroupName=" + securityGroupName + ", account=" + account + ", startPort=" - + startPort + ", endPort=" + endPort + ", protocol=" + protocol + ", CIDR=" + CIDR + ", ICMPCode=" - + ICMPCode + ", ICMPType=" + ICMPType + "]"; + return "IngressRule{" + + "account='" + account + '\'' + + ", CIDR='" + CIDR + '\'' + + ", endPort=" + endPort + + ", ICMPCode=" + ICMPCode + + ", ICMPType=" + ICMPType + + ", protocol='" + protocol + '\'' + + ", id=" + id + + ", securityGroupName='" + securityGroupName + '\'' + + ", startPort=" + startPort + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/JobResult.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/JobResult.java index 77b9832913..73f69caf4b 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/JobResult.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/JobResult.java @@ -57,10 +57,10 @@ public class JobResult implements Comparable { @Override public String toString() { - return "[" + - "success=" + success + - ", displayText=" + (displayText != null ? '\'' + displayText + '\'' : "null") + - ']'; + return "JobResult{" + + "success=" + success + + ", displayText='" + displayText + '\'' + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java index 7e96eba121..1c9768927e 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java @@ -25,6 +25,7 @@ import java.util.Set; import com.google.common.base.CaseFormat; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; import com.google.gson.annotations.SerializedName; /** @@ -205,6 +206,9 @@ public class LoadBalancerRule implements Comparable { this.publicIPId = publicIPId; this.publicPort = publicPort; this.state = state; + this.zoneId = zoneId; + this.CIDRs = Sets.newHashSet(CIDRs); + } /** @@ -392,10 +396,22 @@ public class LoadBalancerRule implements Comparable { @Override public String toString() { - return "[account=" + account + ", algorithm=" + algorithm + ", description=" + description + ", domain=" + domain - + ", domainId=" + domainId + ", zoneId=" + zoneId + ", id=" + id + ", name=" + name + ", privatePort=" + privatePort - + ", publicIP=" + publicIP + ", publicIPId=" + publicIPId + ", publicPort=" + publicPort + ", state=" - + state + "]"; + return "LoadBalancerRule{" + + "id=" + id + + ", account='" + account + '\'' + + ", algorithm=" + algorithm + + ", description='" + description + '\'' + + ", domain='" + domain + '\'' + + ", domainId=" + domainId + + ", name='" + name + '\'' + + ", privatePort=" + privatePort + + ", publicIP='" + publicIP + '\'' + + ", publicIPId=" + publicIPId + + ", publicPort=" + publicPort + + ", state=" + state + + ", CIDRs=" + CIDRs + + ", zoneId=" + zoneId + + '}'; } } 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 246fbc4947..22133eb85c 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 @@ -297,9 +297,19 @@ public class NIC { @Override public String toString() { - return "[id=" + id + ", broadcastURI=" + broadcastURI + ", gateway=" + gateway + ", IPAddress=" + IPAddress - + ", isDefault=" + isDefault + ", isolationURI=" + isolationURI + ", netmask=" + netmask + ", MACAddress=" - + macAddress + ", networkId=" + networkId + ", trafficType=" + trafficType + ", guestIPType=" + guestIPType + "]"; + return "NIC{" + + "id=" + id + + ", broadcastURI=" + broadcastURI + + ", gateway='" + gateway + '\'' + + ", IPAddress='" + IPAddress + '\'' + + ", 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/Network.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Network.java index 757e5abdeb..43d81a3996 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Network.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Network.java @@ -281,11 +281,11 @@ public class Network implements Comparable { private TrafficType trafficType; @SerializedName("zoneid") private long zoneId; - @SerializedName("service") private String tags; @SerializedName("securitygroupenabled") private boolean securityGroupEnabled; // so tests and serialization comes out expected + @SerializedName("service") private SortedSet services = ImmutableSortedSet.of(); /** @@ -715,15 +715,39 @@ public class Network implements Comparable { @Override public String toString() { - return "[id=" + id + ", state=" + state + ", name=" + name + ", displayText=" + displayText + ", guestIPType=" - + guestIPType + ", trafficType=" + trafficType + ", DNS=" + getDNS() + ", VLAN=" + VLAN - + ", startIP=" + startIP + ", endIP=" + endIP + ", netmask=" + netmask + ", gateway=" + gateway - + ", broadcastDomainType=" + broadcastDomainType + ", broadcastURI=" + broadcastURI + ", services=" - + services + ", domain=" + domain + ", domainId=" + domainId + ", isDefault=" + isDefault + ", isShared=" - + isShared + ", isSystem=" + isSystem + ", related=" + related + ", zoneId=" + zoneId + ", domain=" - + networkDomain + ", networkOfferingAvailability=" + networkOfferingAvailability - + ", networkOfferingDisplayText=" + networkOfferingDisplayText + ", networkOfferingId=" + networkOfferingId - + ", networkOfferingName=" + networkOfferingName + ", tags=" + getTags() + "]"; + return "Network{" + + "id=" + id + + ", account='" + account + '\'' + + ", broadcastDomainType='" + broadcastDomainType + '\'' + + ", broadcastURI=" + broadcastURI + + ", displayText='" + displayText + '\'' + + ", DNS1='" + DNS1 + '\'' + + ", DNS2='" + DNS2 + '\'' + + ", domain='" + domain + '\'' + + ", domainId=" + domainId + + ", endIP='" + endIP + '\'' + + ", gateway='" + gateway + '\'' + + ", isDefault=" + isDefault + + ", isShared=" + isShared + + ", isSystem=" + isSystem + + ", netmask='" + netmask + '\'' + + ", networkDomain='" + networkDomain + '\'' + + ", networkOfferingAvailability='" + networkOfferingAvailability + '\'' + + ", networkOfferingDisplayText='" + networkOfferingDisplayText + '\'' + + ", networkOfferingId=" + networkOfferingId + + ", networkOfferingName='" + networkOfferingName + '\'' + + ", related=" + related + + ", startIP='" + startIP + '\'' + + ", name='" + name + '\'' + + ", state='" + state + '\'' + + ", guestIPType=" + guestIPType + + ", VLAN='" + VLAN + '\'' + + ", trafficType=" + trafficType + + ", zoneId=" + zoneId + + ", tags='" + tags + '\'' + + ", securityGroupEnabled=" + securityGroupEnabled + + ", services=" + services + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkOffering.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkOffering.java index 8e0c9c3f2c..d074bd7bb3 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkOffering.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkOffering.java @@ -334,9 +334,20 @@ public class NetworkOffering implements Comparable { @Override public String toString() { - return "[id=" + id + ", name=" + name + ", displayText=" + displayText + ", created=" + created - + ", maxConnections=" + maxConnections + ", trafficType=" + trafficType + ", isDefault=" + isDefault - + ", availability=" + availability + ", supportsVLAN=" + supportsVLAN + ", tags=" + getTags() + "]"; + return "NetworkOffering{" + + "id=" + id + + ", name='" + name + '\'' + + ", displayText='" + displayText + '\'' + + ", created=" + created + + ", availability=" + availability + + ", maxConnections=" + maxConnections + + ", isDefault=" + isDefault + + ", supportsVLAN=" + supportsVLAN + + ", trafficType=" + trafficType + + ", guestIPType=" + guestIPType + + ", networkRate=" + networkRate + + ", tags='" + tags + '\'' + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkService.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkService.java index ca9d7c4b7d..4853d3ea7e 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkService.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/NetworkService.java @@ -160,7 +160,10 @@ public class NetworkService implements Comparable { @Override public String toString() { - return "[name=" + name + ", capabilities=" + capabilities + "]"; + return "NetworkService{" + + "name='" + name + '\'' + + ", capabilities=" + capabilities + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/OSType.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/OSType.java index 50f27e2112..314e4d45c4 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/OSType.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/OSType.java @@ -125,7 +125,11 @@ public class OSType implements Comparable { @Override public String toString() { - return "[id=" + id + ", OSCategoryId=" + OSCategoryId + ", description=" + description + "]"; + return "OSType{" + + "id=" + id + + ", OSCategoryId=" + OSCategoryId + + ", description='" + description + '\'' + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java index cac8acb330..b00d9c5c14 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java @@ -329,10 +329,21 @@ public class PortForwardingRule implements Comparable { @Override public String toString() { - return "[IPAddress=" + IPAddress + ", IPAddressId=" + IPAddressId + ", id=" + id + ", privatePort=" + privatePort - + ", protocol=" + protocol + ", publicPort=" + publicPort + ", state=" + state - + ", virtualMachineDisplayName=" + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId - + ", virtualMachineName=" + virtualMachineName + "]"; + return "PortForwardingRule{" + + "id=" + id + + ", IPAddress='" + IPAddress + '\'' + + ", IPAddressId=" + IPAddressId + + ", privatePort=" + privatePort + + ", protocol='" + protocol + '\'' + + ", publicPort=" + publicPort + + ", state='" + state + '\'' + + ", virtualMachineDisplayName='" + virtualMachineDisplayName + '\'' + + ", virtualMachineId=" + virtualMachineId + + ", virtualMachineName='" + virtualMachineName + '\'' + + ", CIDRs=" + CIDRs + + ", privateEndPort=" + privateEndPort + + ", publicEndPort=" + publicEndPort + + '}'; } } 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 90edc0ee34..b5405ecc87 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,10 +18,11 @@ */ 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; @@ -538,12 +539,29 @@ public class PublicIPAddress implements Comparable { @Override public String toString() { - return "[id=" + id + ", IPAddress=" + IPAddress + ", VLANId=" + VLANId + ", VLANName=" + VLANName + ", account=" - + account + ", allocated=" + allocated + ", associatedNetworkId=" + associatedNetworkId + ", domain=" - + domain + ", domainId=" + domainId + ", usesVirtualNetwork=" + usesVirtualNetwork + ", isSourceNAT=" - + isSourceNAT + ", isStaticNAT=" + isStaticNAT + ", networkId=" + networkId + ", state=" + state - + ", virtualMachineDisplayName=" + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId - + ", virtualMachineName=" + virtualMachineName + ", zoneId=" + zoneId + ", zoneName=" + zoneName + "]"; + return "PublicIPAddress{" + + "id=" + id + + ", account='" + account + '\'' + + ", allocated=" + allocated + + ", associatedNetworkId=" + associatedNetworkId + + ", domain='" + domain + '\'' + + ", domainId=" + domainId + + ", usesVirtualNetwork=" + usesVirtualNetwork + + ", IPAddress='" + IPAddress + '\'' + + ", isSourceNAT=" + isSourceNAT + + ", isStaticNAT=" + isStaticNAT + + ", networkId=" + networkId + + ", state=" + state + + ", virtualMachineDisplayName='" + virtualMachineDisplayName + '\'' + + ", virtualMachineId=" + virtualMachineId + + ", virtualMachineName='" + virtualMachineName + '\'' + + ", VLANId=" + VLANId + + ", VLANName='" + VLANName + '\'' + + ", zoneId=" + zoneId + + ", zoneName='" + zoneName + '\'' + + ", jobId=" + jobId + + ", jobStatus=" + jobStatus + + '}'; } } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java index 3595b9c0cd..e10c840c3e 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java @@ -148,8 +148,13 @@ public class ResourceLimit implements Comparable { @Override public String toString() { - return String.format("[account=%s, domain=%s, domainId=%d, max=%d, resourceType=%s]", - account, domain, domainId, max, resourceType); + return "ResourceLimit{" + + "account='" + account + '\'' + + ", domain='" + domain + '\'' + + ", domainId=" + domainId + + ", max=" + max + + ", resourceType=" + resourceType + + '}'; } /** 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 a33a5f10a7..dc16d6d430 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 @@ -240,8 +240,17 @@ public class SecurityGroup implements Comparable { @Override public String toString() { - return "[id=" + id + ", account=" + account + ", name=" + name + ", description=" + description + ", domain=" - + domain + ", domainId=" + domainId + ", ingressRules=" + ingressRules + "]"; + return "SecurityGroup{" + + "id=" + id + + ", account='" + account + '\'' + + ", name='" + name + '\'' + + ", description='" + description + '\'' + + ", domain='" + domain + '\'' + + ", domainId=" + domainId + + ", jobId=" + jobId + + ", jobStatus=" + jobStatus + + ", ingressRules=" + ingressRules + + '}'; } @Override 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 8860a3c63c..a080e13356 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 @@ -411,10 +411,26 @@ public class ServiceOffering implements Comparable { @Override public String toString() { - return "[id=" + id + ", name=" + name + ", displayText=" + displayText + ", created=" + created + ", cpuNumber=" - + cpuNumber + ", cpuSpeed=" + cpuSpeed + ", memory=" + memory + ", storageType=" + storageType - + ", haSupport=" + haSupport + ", domain=" + domain + ", domainId=" + domainId + ", tags=" + getTags() - + "]"; + return "ServiceOffering{" + + "id=" + id + + ", name='" + name + '\'' + + ", displayText='" + displayText + '\'' + + ", created=" + created + + ", domain='" + domain + '\'' + + ", domainId=" + domainId + + ", cpuNumber=" + cpuNumber + + ", cpuSpeed=" + cpuSpeed + + ", memory=" + memory + + ", haSupport=" + haSupport + + ", storageType=" + storageType + + ", tags='" + tags + '\'' + + ", defaultUse=" + defaultUse + + ", hostTags='" + hostTags + '\'' + + ", systemOffering=" + systemOffering + + ", cpuUseLimited=" + cpuUseLimited + + ", networkRate=" + networkRate + + ", systemVmType=" + systemVmType + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Snapshot.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Snapshot.java index 1729870010..d83651f5b0 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Snapshot.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/Snapshot.java @@ -406,7 +406,7 @@ public class Snapshot implements Comparable { @Override public String toString() { - return "Snapshot[" + + return "Snapshot{" + "id=" + id + ", account='" + account + '\'' + ", created=" + created + @@ -420,8 +420,8 @@ public class Snapshot implements Comparable { ", state=" + state + ", volumeId=" + volumeId + ", volumeName='" + volumeName + '\'' + - ", volumeType='" + volumeType + '\'' + - ']'; + ", volumeType=" + volumeType + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicy.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicy.java index 5150b253de..96d645c3c2 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicy.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicy.java @@ -188,14 +188,14 @@ public class SnapshotPolicy implements Comparable { @Override public String toString() { - return "[" + - "id=" + id + - ", interval=" + interval + - ", numberToRetain=" + numberToRetain + - ", schedule='" + schedule + '\'' + - ", timezone='" + timezone + '\'' + - ", volumeId=" + volumeId + - ']'; + return "SnapshotPolicy{" + + "id=" + id + + ", interval=" + interval + + ", numberToRetain=" + numberToRetain + + ", schedule='" + schedule + '\'' + + ", timezone='" + timezone + '\'' + + ", volumeId=" + volumeId + + '}'; } @Override diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicySchedule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicySchedule.java index 1603446cc1..82525c2c21 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicySchedule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SnapshotPolicySchedule.java @@ -41,4 +41,12 @@ public class SnapshotPolicySchedule { public String getTime() { return time; } + + @Override + public String toString() { + return "SnapshotPolicySchedule{" + + "interval=" + interval + + ", time='" + time + '\'' + + '}'; + } } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SshKeyPair.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SshKeyPair.java index 70e68977dc..134ab5468b 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SshKeyPair.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/SshKeyPair.java @@ -125,7 +125,11 @@ public class SshKeyPair implements Comparable { @Override public String toString() { - return "[fingerprint=" + fingerprint + ", name=" + name + "]"; + return "SshKeyPair{" + + "fingerprint='" + fingerprint + '\'' + + ", name='" + name + '\'' + + ", privateKey='" + privateKey + '\'' + + '}'; } @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 4ffd012d89..d1968cc84e 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 @@ -737,13 +737,40 @@ public class Template implements Comparable