Merge pull request #223 from vijaykiran/sync-domain-objects

Sync domain objects with json responses from the documentation - part 2
This commit is contained in:
Adrian Cole 2011-12-07 09:22:19 -08:00
commit 615de6d2a1
39 changed files with 895 additions and 271 deletions

View File

@ -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<User> implements Comparable<Account>
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

View File

@ -118,14 +118,15 @@ public class Alert implements Comparable<Alert> {
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

View File

@ -85,7 +85,10 @@ public class AsyncCreateResponse {
@Override
public String toString() {
return "[id=" + id + ", jobId=" + jobId + "]";
return "AsyncCreateResponse{" +
"id=" + id +
", jobId=" + jobId +
'}';
}
}

View File

@ -422,10 +422,21 @@ public class AsyncJob<T> {
@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 +
'}';
}
}

View File

@ -120,7 +120,10 @@ public class AsyncJobError {
@Override
public String toString() {
return "[errorCode=" + errorCode + ", errorText=" + errorText + "]";
return "AsyncJobError{" +
"errorCode=" + errorCode +
", errorText='" + errorText + '\'' +
'}';
}
}

View File

@ -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,21 @@ 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 + "]";
return "Capabilities{" +
"cloudStackVersion='" + cloudStackVersion + '\'' +
", securityGroupsEnabled=" + securityGroupsEnabled +
", canShareTemplates=" + canShareTemplates +
", firewallRuleUiEnabled=" + firewallRuleUiEnabled +
", supportELB=" + supportELB +
'}';
}
}

View File

@ -234,16 +234,16 @@ public class Capacity implements Comparable<Capacity> {
@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

View File

@ -270,9 +270,17 @@ public class DiskOffering implements Comparable<DiskOffering> {
@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

View File

@ -265,9 +265,19 @@ public class Event implements Comparable<Event> {
@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 + '\'' +
'}';
}

View File

@ -18,10 +18,14 @@
*/
package org.jclouds.cloudstack.domain;
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;
/**
*
* @author Adrian Cole
*/
public class IPForwardingRule implements Comparable<IPForwardingRule> {
@ -40,6 +44,10 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
private String virtualMachineDisplayName;
public long virtualMachineId;
private String virtualMachineName;
private Set<String> CIDRs = ImmutableSet.of();
private int privateEndPort;
private int publicEndPort;
public int publicPort;
public Builder id(long id) {
this.id = id;
@ -91,9 +99,29 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
return this;
}
public Builder publicPort(int publicPort) {
this.publicPort = publicPort;
return this;
}
public Builder CIDRs(Set<String> 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 +142,14 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
public long virtualMachineId;
@SerializedName("virtualmachinename")
private String virtualMachineName;
@SerializedName("publicport")
public int publicPort;
@SerializedName("cidrlist")
private Set<String> CIDRs;
@SerializedName("privateendport")
private int privateEndPort;
@SerializedName("publicendport")
private int publicEndPort;
// for deserializer
IPForwardingRule() {
@ -121,7 +157,8 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
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<String> CIDRs, int privateEndPort) {
this.id = id;
this.IPAddress = iPAddress;
this.IPAddressId = iPAddressId;
@ -132,6 +169,11 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
this.virtualMachineDisplayName = virtualMachineDisplayName;
this.virtualMachineId = virtualMachineId;
this.virtualMachineName = virtualMachineName;
this.CIDRs = Sets.newHashSet(CIDRs);
this.privateEndPort = privateEndPort;
this.publicEndPort = publicEndPort;
this.publicPort = publicPort;
}
@Override
@ -140,7 +182,6 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
/**
*
* @return the ID of the ip forwarding rule
*/
public long getId() {
@ -148,7 +189,6 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
/**
*
* @return the public ip address for the ip forwarding rule
*/
public String getIPAddress() {
@ -156,7 +196,6 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
/**
*
* @return the public ip address id for the ip forwarding rule
*/
public long getIPAddressId() {
@ -164,7 +203,6 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
/**
*
* @return the private port for the ip forwarding rule
*/
public int getStartPort() {
@ -172,7 +210,6 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
/**
*
* @return the protocol of the ip forwarding rule
*/
public String getProtocol() {
@ -180,7 +217,6 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
/**
*
* @return the public port for the ip forwarding rule
*/
public int getEndPort() {
@ -188,7 +224,6 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
/**
*
* @return the state of the rule
*/
public String getState() {
@ -196,7 +231,6 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
/**
*
* @return the VM display name for the ip forwarding rule
*/
public String getVirtualMachineDisplayName() {
@ -204,7 +238,6 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
/**
*
* @return the VM ID for the ip forwarding rule
*/
public long getVirtualMachineId() {
@ -212,13 +245,40 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
}
/**
*
* @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<String> getCIDRs() {
return Collections.unmodifiableSet(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 +289,9 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
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 +317,12 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
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) {

View File

@ -689,7 +689,7 @@ public class ISO implements Comparable<ISO> {
@Override
public String toString() {
return "[" +
return "ISO{" +
"id=" + id +
", account='" + account + '\'' +
", accountId=" + accountId +
@ -722,7 +722,7 @@ public class ISO implements Comparable<ISO> {
", templateType='" + templateType + '\'' +
", zoneId=" + zoneId +
", zoneName='" + zoneName + '\'' +
']';
'}';
}
@Override

View File

@ -313,21 +313,21 @@ public class ISOExtraction implements Comparable<ISOExtraction> {
@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

View File

@ -137,12 +137,12 @@ public class ISOPermissions implements Comparable<ISOPermissions> {
@Override
public String toString() {
return "[" +
"id=" + id +
", account='" + account + '\'' +
", domainId=" + domainId +
", isPublic=" + isPublic +
']';
return "ISOPermissions{" +
"id=" + id +
", account='" + account + '\'' +
", domainId=" + domainId +
", isPublic=" + isPublic +
'}';
}
@Override

View File

@ -256,9 +256,17 @@ public class IngressRule implements Comparable<IngressRule> {
@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

View File

@ -57,10 +57,10 @@ public class JobResult implements Comparable<JobResult> {
@Override
public String toString() {
return "[" +
"success=" + success +
", displayText=" + (displayText != null ? '\'' + displayText + '\'' : "null") +
']';
return "JobResult{" +
"success=" + success +
", displayText='" + displayText + '\'' +
'}';
}
@Override

View File

@ -20,16 +20,21 @@ 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.common.collect.Sets;
import com.google.gson.annotations.SerializedName;
/**
*
* @author Adrian Cole
*/
public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
public static enum State {
ADD, ACTIVE, UNRECOGNIZED;
@Override
public String toString() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
@ -47,6 +52,7 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
public static enum Algorithm {
SOURCE, ROUNDROBIN, LEASTCONN, UNRECOGNIZED;
@Override
public String toString() {
return name().toLowerCase();
@ -79,6 +85,8 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
private long publicIPId;
private int publicPort;
private State state;
private Set<String> CIDRs = ImmutableSet.of();
private long zoneId;
public Builder id(long id) {
this.id = id;
@ -140,9 +148,19 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
return this;
}
public Builder CIDRs(Set<String> 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 +181,10 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
@SerializedName("publicport")
private int publicPort;
private State state;
@SerializedName("cidrlist")
private Set<String> CIDRs;
@SerializedName("zoneId")
private long zoneId;
// for deserializer
LoadBalancerRule() {
@ -170,7 +192,8 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
}
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<String> CIDRs) {
this.id = id;
this.account = account;
this.algorithm = algorithm;
@ -183,6 +206,9 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
this.publicIPId = publicIPId;
this.publicPort = publicPort;
this.state = state;
this.zoneId = zoneId;
this.CIDRs = Sets.newHashSet(CIDRs);
}
/**
@ -269,11 +295,26 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
return state;
}
/**
* @return the cidr list to forward traffic from
*/
public Set<String> 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 +330,7 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
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 +366,8 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
return false;
if (domainId != other.domainId)
return false;
if (zoneId != other.zoneId)
return false;
if (id != other.id)
return false;
if (name == null) {
@ -352,10 +396,22 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
@Override
public String toString() {
return "[account=" + account + ", algorithm=" + algorithm + ", description=" + description + ", domain=" + domain
+ ", domainId=" + domainId + ", 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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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<Network> {
private TrafficType trafficType;
private long zoneId;
private Set<? extends NetworkService> services = ImmutableSet.<NetworkService>of();
private String account;
private long domainId;
private boolean securityGroupEnabled;
private Set<String> 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<Network> {
return this;
}
public Builder tags(Set<String> 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<Network> {
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;
@ -252,8 +281,11 @@ public class Network implements Comparable<Network> {
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<? extends NetworkService> services = ImmutableSortedSet.<NetworkService>of();
/**
@ -264,11 +296,12 @@ public class Network implements Comparable<Network> {
}
public Network(long id, String broadcastDomainType, URI broadcastURI, String displayText,
List<String> DNS, String domain, String endIP, String gateway, boolean isDefault,
List<String> 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<? extends NetworkService> services) {
long zoneId, Set<? extends NetworkService> services, Set<String> tags, boolean securityGroupEnabled,
String account) {
this.id = id;
this.broadcastDomainType = broadcastDomainType;
this.broadcastURI = broadcastURI;
@ -276,6 +309,7 @@ public class Network implements Comparable<Network> {
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<Network> {
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<Network> {
}
/**
* @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<Network> {
return services;
}
/**
* @return true if security group is enabled, false otherwise
*/
public boolean isSecurityGroupEnabled() {
return securityGroupEnabled;
}
/**
* @return the tags for the Network
*/
public Set<String> getTags() {
return tags != null ? ImmutableSet.copyOf(Splitter.on(',').split(tags)) : ImmutableSet.<String>of();
}
@Override
public int hashCode() {
final int prime = 31;
@ -516,6 +581,8 @@ public class Network implements Comparable<Network> {
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,20 +703,51 @@ public class Network implements Comparable<Network> {
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;
}
@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 + ", isDefault=" + isDefault + ", isShared="
+ isShared + ", isSystem=" + isSystem + ", related=" + related + ", zoneId=" + zoneId + ", domain="
+ networkDomain + ", networkOfferingAvailability=" + networkOfferingAvailability
+ ", networkOfferingDisplayText=" + networkOfferingDisplayText + ", networkOfferingId=" + networkOfferingId
+ ", networkOfferingName=" + networkOfferingName + "]";
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

View File

@ -334,9 +334,20 @@ public class NetworkOffering implements Comparable<NetworkOffering> {
@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

View File

@ -160,7 +160,10 @@ public class NetworkService implements Comparable<NetworkService> {
@Override
public String toString() {
return "[name=" + name + ", capabilities=" + capabilities + "]";
return "NetworkService{" +
"name='" + name + '\'' +
", capabilities=" + capabilities +
'}';
}
@Override

View File

@ -125,7 +125,11 @@ public class OSType implements Comparable<OSType> {
@Override
public String toString() {
return "[id=" + id + ", OSCategoryId=" + OSCategoryId + ", description=" + description + "]";
return "OSType{" +
"id=" + id +
", OSCategoryId=" + OSCategoryId +
", description='" + description + '\'' +
'}';
}
@Override

View File

@ -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<PortForwardingRule> {
@ -40,6 +44,9 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
private String virtualMachineDisplayName;
public long virtualMachineId;
private String virtualMachineName;
private Set<String> 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<PortForwardingRule> {
return this;
}
public Builder CIDRs(Set<String> 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<PortForwardingRule> {
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<PortForwardingRule> {
public long virtualMachineId;
@SerializedName("virtualmachinename")
private String virtualMachineName;
@SerializedName("cidrlist")
private Set<String> CIDRs;
@SerializedName("privateendport")
private int privateEndPort;
@SerializedName("publicendport")
private int publicEndPort;
// for deserializer
PortForwardingRule() {
@ -121,18 +150,21 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
}
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<String> 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<String>(CIDRs);
this.privateEndPort = privateEndPort;
this.publicEndPort = publicEndPort;
}
@Override
@ -141,7 +173,6 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
}
/**
*
* @return the ID of the port forwarding rule
*/
public long getId() {
@ -149,7 +180,6 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
}
/**
*
* @return the public ip address for the port forwarding rule
*/
public String getIPAddress() {
@ -157,7 +187,6 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
}
/**
*
* @return the public ip address id for the port forwarding rule
*/
public long getIPAddressId() {
@ -165,7 +194,6 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
}
/**
*
* @return the private port for the port forwarding rule
*/
public int getPrivatePort() {
@ -173,7 +201,6 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
}
/**
*
* @return the protocol of the port forwarding rule
*/
public String getProtocol() {
@ -181,15 +208,13 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
}
/**
*
* @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<PortForwardingRule> {
}
/**
*
* @return the VM display name for the port forwarding rule
*/
public String getVirtualMachineDisplayName() {
@ -205,7 +229,6 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
}
/**
*
* @return the VM ID for the port forwarding rule
*/
public long getVirtualMachineId() {
@ -213,13 +236,33 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
}
/**
*
* @return the VM name for the port forwarding rule
*/
public String getVirtualMachineName() {
return virtualMachineName;
}
/**
* @return the cidr list to forward traffic from
*/
public Set<String> 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<PortForwardingRule> {
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<PortForwardingRule> {
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)
@ -289,10 +329,21 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
@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 +
'}';
}
}

View File

@ -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<PublicIPAddress> {
@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 +
'}';
}
}

View File

@ -148,8 +148,13 @@ public class ResourceLimit implements Comparable<ResourceLimit> {
@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 +
'}';
}
/**

View File

@ -240,8 +240,17 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
@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

View File

@ -411,10 +411,26 @@ public class ServiceOffering implements Comparable<ServiceOffering> {
@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

View File

@ -406,7 +406,7 @@ public class Snapshot implements Comparable<Snapshot> {
@Override
public String toString() {
return "Snapshot[" +
return "Snapshot{" +
"id=" + id +
", account='" + account + '\'' +
", created=" + created +
@ -420,8 +420,8 @@ public class Snapshot implements Comparable<Snapshot> {
", state=" + state +
", volumeId=" + volumeId +
", volumeName='" + volumeName + '\'' +
", volumeType='" + volumeType + '\'' +
']';
", volumeType=" + volumeType +
'}';
}
@Override

View File

@ -188,14 +188,14 @@ public class SnapshotPolicy implements Comparable<SnapshotPolicy> {
@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

View File

@ -41,4 +41,12 @@ public class SnapshotPolicySchedule {
public String getTime() {
return time;
}
@Override
public String toString() {
return "SnapshotPolicySchedule{" +
"interval=" + interval +
", time='" + time + '\'' +
'}';
}
}

View File

@ -125,7 +125,11 @@ public class SshKeyPair implements Comparable<SshKeyPair> {
@Override
public String toString() {
return "[fingerprint=" + fingerprint + ", name=" + name + "]";
return "SshKeyPair{" +
"fingerprint='" + fingerprint + '\'' +
", name='" + name + '\'' +
", privateKey='" + privateKey + '\'' +
'}';
}
@Override

View File

@ -737,13 +737,40 @@ public class Template implements Comparable<Template> {
@Override
public String toString() {
return "[id=" + id + ", name=" + name + ", displayText=" + displayText + ", format=" + format + ", type=" + type
+ ", hypervisor=" + hypervisor + ", size=" + size + ", status=" + status + ", created=" + created
+ ", removed=" + removed + ", OSType=" + OSType + ", OSTypeId=" + OSTypeId + ", account=" + account
+ ", accountId=" + accountId + ", domain=" + domain + ", domainId=" + domainId + ", zone=" + zone
+ ", zoneId=" + zoneId + ", ready=" + ready + ", bootable=" + bootable + ", crossZones=" + crossZones
+ ", extractable=" + extractable + ", featured=" + featured + ", ispublic=" + ispublic
+ ", passwordEnabled=" + passwordEnabled + ", jobId=" + jobId + ", jobStatus=" + jobStatus + "]";
return "Template{" +
"id=" + id +
", displayText='" + displayText + '\'' +
", domain='" + domain + '\'' +
", domainId=" + domainId +
", account='" + account + '\'' +
", accountId=" + accountId +
", zone='" + zone + '\'' +
", zoneId=" + zoneId +
", OSType='" + OSType + '\'' +
", OSTypeId=" + OSTypeId +
", name='" + name + '\'' +
", type=" + type +
", status='" + status + '\'' +
", format=" + format +
", hypervisor='" + hypervisor + '\'' +
", size=" + size +
", created=" + created +
", removed=" + removed +
", crossZones=" + crossZones +
", bootable=" + bootable +
", extractable=" + extractable +
", featured=" + featured +
", ispublic=" + ispublic +
", ready=" + ready +
", passwordEnabled=" + passwordEnabled +
", jobId=" + jobId +
", jobStatus='" + jobStatus + '\'' +
", checksum='" + checksum + '\'' +
", hostId=" + hostId +
", hostName='" + hostName + '\'' +
", sourceTemplateId=" + sourceTemplateId +
", templateTag='" + templateTag + '\'' +
'}';
}
@Override

View File

@ -332,11 +332,21 @@ public class TemplateExtraction implements Comparable<TemplateExtraction> {
@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 "TemplateExtraction{" +
"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

View File

@ -220,9 +220,17 @@ public class TemplateMetadata {
return Objects.hashCode(name, displayText, osTypeId, snapshotId, volumeId, passwordEnabled, virtualMachineId);
}
@Override
public String toString() {
return "[" + "name='" + name + '\'' + ", osTypeId=" + osTypeId + ", displayText='" + displayText + '\'' + ']';
}
@Override
public String toString() {
return "TemplateMetadata{" +
"name='" + name + '\'' +
", osTypeId=" + osTypeId +
", displayText='" + displayText + '\'' +
", snapshotId=" + snapshotId +
", volumeId=" + volumeId +
", virtualMachineId=" + virtualMachineId +
", passwordEnabled=" + passwordEnabled +
'}';
}
}

View File

@ -143,12 +143,12 @@ public class TemplatePermission implements Comparable<TemplatePermission> {
@Override
public String toString() {
return "[" +
"id=" + id +
", account='" + account + '\'' +
", domainId=" + domainId +
", isPublic=" + isPublic +
']';
return "TemplatePermission{" +
"id=" + id +
", account='" + account + '\'' +
", domainId=" + domainId +
", isPublic=" + isPublic +
'}';
}
@Override

View File

@ -326,11 +326,22 @@ public class User implements Comparable<User> {
@Override
public String toString() {
return String
.format(
"[id=%s, name=%s, state=%s, created=%s, account=%s, accountType=%s, domain=%s, domainId=%s, email=%s, firstName=%s, lastName=%s, apiKey=%s, secretKey=%s, timeZone=%s]",
id, name, state, created, account, accountType, domain, domainId, email, firstName, lastName, apiKey,
secretKey, timeZone);
return "User{" +
"id=" + id +
", name='" + name + '\'' +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", email='" + email + '\'' +
", created=" + created +
", state='" + state + '\'' +
", account='" + account + '\'' +
", accountType=" + accountType +
", domain='" + domain + '\'' +
", domainId=" + domainId +
", timeZone='" + timeZone + '\'' +
", apiKey='" + apiKey + '\'' +
", secretKey='" + secretKey + '\'' +
'}';
}
}

View File

@ -18,10 +18,10 @@
*/
package org.jclouds.cloudstack.domain;
import com.google.gson.annotations.SerializedName;
import java.util.Date;
import com.google.gson.annotations.SerializedName;
/**
* @author Richard Downer
*/
@ -170,13 +170,14 @@ public class VMGroup implements Comparable<VMGroup> {
@Override
public String toString() {
return "[id=" + id +
", account='" + account + '\'' +
", created=" + created +
", domain='" + domain + '\'' +
", domainId=" + domainId +
", name='" + name + '\'' +
'}';
return "VMGroup{" +
"id=" + id +
", account='" + account + '\'' +
", created=" + created +
", domain='" + domain + '\'' +
", domainId=" + domainId +
", name='" + name + '\'' +
'}';
}
@Override

View File

@ -958,23 +958,49 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
@Override
public String toString() {
return "[id=" + id
// + ", account=" + account + ", cpuCount=" + cpuCount + ", cpuSpeed=" + cpuSpeed + ", cpuUsed=" + cpuUsed
+ ", displayName=" + displayName + ", created=" + created
// + ", domain=" + domain + ", domainId="
// + domainId + ", usesVirtualNetwork=" + usesVirtualNetwork + ", group=" + group + ", groupId=" + groupId
// + ", guestOSId=" + guestOSId + ", HAEnabled=" + HAEnabled + ", hostId=" + hostId + ", hostname=" + hostname
+ ", IPAddress=" + IPAddress
// + ", ISODisplayText=" + ISODisplayText + ", ISOId=" + ISOId + ", ISOName="
// + ISOName + ", jobId=" + jobId + ", jobStatus=" + jobStatus + ", memory=" + memory + ", name=" + name
// + ", networkKbsRead=" + networkKbsRead + ", networkKbsWrite=" + networkKbsWrite + ", password=" + password
// + ", passwordEnabled=" + passwordEnabled + ", rootDeviceId=" + rootDeviceId + ", rootDeviceType="
// + rootDeviceType + ", serviceOfferingId=" + serviceOfferingId + ", serviceOfferingName=" + serviceOfferingName
+ ", state=" + state
// + ", templateDisplayText=" + templateDisplayText
// + ", templateId=" + templateId + ", templateName=" + templateName + ", zoneId=" + zoneId + ", zoneName="
// + zoneName + ", nics=" + nics + ", hypervisor=" + hypervisor + ", securityGroups=" + securityGroups
+ "]";
return "VirtualMachine{" +
"id=" + id +
", account='" + account + '\'' +
", cpuCount=" + cpuCount +
", cpuSpeed=" + cpuSpeed +
", cpuUsed='" + cpuUsed + '\'' +
", displayName='" + displayName + '\'' +
", created=" + created +
", domain='" + domain + '\'' +
", domainId=" + domainId +
", usesVirtualNetwork=" + usesVirtualNetwork +
", group='" + group + '\'' +
", groupId=" + groupId +
", guestOSId=" + guestOSId +
", HAEnabled=" + HAEnabled +
", hostId=" + hostId +
", hostname='" + hostname + '\'' +
", IPAddress='" + IPAddress + '\'' +
", ISODisplayText='" + ISODisplayText + '\'' +
", ISOId=" + ISOId +
", ISOName='" + ISOName + '\'' +
", jobId=" + jobId +
", jobStatus=" + jobStatus +
", memory=" + memory +
", name='" + name + '\'' +
", networkKbsRead=" + networkKbsRead +
", networkKbsWrite=" + networkKbsWrite +
", password='" + password + '\'' +
", passwordEnabled=" + passwordEnabled +
", rootDeviceId=" + rootDeviceId +
", rootDeviceType='" + rootDeviceType + '\'' +
", serviceOfferingId=" + serviceOfferingId +
", serviceOfferingName='" + serviceOfferingName + '\'' +
", state=" + state +
", templateDisplayText='" + templateDisplayText + '\'' +
", templateId=" + templateId +
", templateName='" + templateName + '\'' +
", zoneId=" + zoneId +
", zoneName='" + zoneName + '\'' +
", nics=" + nics +
", hypervisor='" + hypervisor + '\'' +
", securityGroups=" + securityGroups +
'}';
}
@Override

View File

@ -19,10 +19,11 @@
package org.jclouds.cloudstack.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Date;
import java.util.Map;
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.ImmutableSet;
@ -551,7 +552,39 @@ public class Volume implements Comparable<Volume> {
@Override
public String toString() {
return getClass().getCanonicalName() + "[" + id + "; " + name + "; " + vmState + "]";
return "Volume{" +
"id=" + id +
", account='" + account + '\'' +
", attached=" + attached +
", created=" + created +
", destroyed=" + destroyed +
", deviceId=" + deviceId +
", diskOfferingDisplayText='" + diskOfferingDisplayText + '\'' +
", diskOfferingId=" + diskOfferingId +
", diskOfferingName='" + diskOfferingName + '\'' +
", domain='" + domain + '\'' +
", domainId=" + domainId +
", hypervisor='" + hypervisor + '\'' +
", isExtractable=" + isExtractable +
", jobId=" + jobId +
", jobStatus='" + jobStatus + '\'' +
", name='" + name + '\'' +
", serviceOfferingDisplayText='" + serviceOfferingDisplayText + '\'' +
", serviceOfferingId=" + serviceOfferingId +
", serviceOfferingName='" + serviceOfferingName + '\'' +
", size=" + size +
", snapshotId=" + snapshotId +
", state=" + state +
", storage='" + storage + '\'' +
", storageType='" + storageType + '\'' +
", type=" + type +
", virtualMachineId=" + virtualMachineId +
", vmDisplayName='" + vmDisplayName + '\'' +
", vmName='" + vmName + '\'' +
", vmState=" + vmState +
", zoneId=" + zoneId +
", zoneName='" + zoneName + '\'' +
'}';
}
public enum State {

View File

@ -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<Zone> {
@ -47,9 +45,11 @@ public class Zone implements Comparable<Zone> {
private List<String> 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<Zone> {
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<Zone> {
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<Zone> {
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<String> DNS, String domain, long domainId,
String guestCIDRAddress, List<String> internalDNS, String name, NetworkType networkType, String status,
String vLAN, boolean securityGroupsEnabled) {
String guestCIDRAddress, List<String> 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<Zone> {
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<Zone> {
}
/**
*
* @return Zone description
*/
public String getDescription() {
@ -194,7 +210,6 @@ public class Zone implements Comparable<Zone> {
}
/**
*
* @return the display text of the zone
*/
public String getDisplayText() {
@ -202,7 +217,6 @@ public class Zone implements Comparable<Zone> {
}
/**
*
* @return the external DNS for the Zone
*/
public List<String> getDNS() {
@ -215,7 +229,6 @@ public class Zone implements Comparable<Zone> {
}
/**
*
* @return Domain name for the Vms in the zone
*/
public String getDomain() {
@ -223,7 +236,6 @@ public class Zone implements Comparable<Zone> {
}
/**
*
* @return the ID of the containing domain, null for public zones
*/
@Nullable
@ -232,7 +244,6 @@ public class Zone implements Comparable<Zone> {
}
/**
*
* @return the guest CIDR address for the Zone
*/
public String getGuestCIDRAddress() {
@ -240,7 +251,6 @@ public class Zone implements Comparable<Zone> {
}
/**
*
* @return the internal DNS for the Zone
*/
public List<String> getInternalDNS() {
@ -253,7 +263,6 @@ public class Zone implements Comparable<Zone> {
}
/**
*
* @return Zone name
*/
public String getName() {
@ -261,7 +270,6 @@ public class Zone implements Comparable<Zone> {
}
/**
*
* @return the network type of the zone; can be Basic or Advanced
*/
public NetworkType getNetworkType() {
@ -269,15 +277,6 @@ public class Zone implements Comparable<Zone> {
}
/**
*
* @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<Zone> {
}
/**
*
* @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<Zone> {
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<Zone> {
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,10 +413,25 @@ public class Zone implements Comparable<Zone> {
@Override
public String toString() {
return "[id=" + id + ", status=" + status + ", name=" + name + ", description=" + description + ", displayText="
+ displayText + ", domain=" + domain + ", domainId=" + domainId + ", networkType=" + networkType
+ ", guestCIDRAddress=" + guestCIDRAddress + ", VLAN=" + VLAN + ", DNS=" + getDNS()
+ ", securityGroupsEnabled=" + isSecurityGroupsEnabled() + ", internalDNS=" + getInternalDNS() + "]";
return "Zone{" +
"id=" + id +
", description='" + description + '\'' +
", displayText='" + displayText + '\'' +
", DNS1='" + DNS1 + '\'' +
", DNS2='" + DNS2 + '\'' +
", domain='" + domain + '\'' +
", domainId=" + domainId +
", guestCIDRAddress='" + guestCIDRAddress + '\'' +
", internalDNS1='" + internalDNS1 + '\'' +
", internalDNS2='" + internalDNS2 + '\'' +
", name='" + name + '\'' +
", networkType=" + networkType +
", VLAN='" + VLAN + '\'' +
", securityGroupsEnabled=" + securityGroupsEnabled +
", allocationState='" + allocationState + '\'' +
", dhcpProvider='" + dhcpProvider + '\'' +
", zoneToken='" + zoneToken + '\'' +
'}';
}
@Override