http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java new file mode 100644 index 0000000..6703c80 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/IPForwardingRule.java @@ -0,0 +1,396 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.cloudstack.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.beans.ConstructorProperties; +import java.util.Set; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.MoreObjects; +import com.google.common.base.MoreObjects.ToStringHelper; +import com.google.common.base.Objects; +import com.google.common.collect.ImmutableSet; + +/** + * Class IPForwardingRule + */ +public class IPForwardingRule implements Comparable<IPForwardingRule> { + + public static Builder<?> builder() { + return new ConcreteBuilder(); + } + + public Builder<?> toBuilder() { + return new ConcreteBuilder().fromIPForwardingRule(this); + } + + public abstract static class Builder<T extends Builder<T>> { + protected abstract T self(); + + protected String id; + protected String IPAddress; + protected String IPAddressId; + protected int startPort; + protected String protocol; + protected int endPort; + protected String state; + protected String virtualMachineDisplayName; + protected String virtualMachineId; + protected String virtualMachineName; + protected int publicPort; + protected Set<String> CIDRs = ImmutableSet.of(); + protected int privateEndPort; + protected int publicEndPort; + + /** + * @see IPForwardingRule#getId() + */ + public T id(String id) { + this.id = id; + return self(); + } + + /** + * @see IPForwardingRule#getIPAddress() + */ + public T IPAddress(String IPAddress) { + this.IPAddress = IPAddress; + return self(); + } + + /** + * @see IPForwardingRule#getIPAddressId() + */ + public T IPAddressId(String IPAddressId) { + this.IPAddressId = IPAddressId; + return self(); + } + + /** + * @see IPForwardingRule#getStartPort() + */ + public T startPort(int startPort) { + this.startPort = startPort; + return self(); + } + + /** + * @see IPForwardingRule#getProtocol() + */ + public T protocol(String protocol) { + this.protocol = protocol; + return self(); + } + + /** + * @see IPForwardingRule#getEndPort() + */ + public T endPort(int endPort) { + this.endPort = endPort; + return self(); + } + + /** + * @see IPForwardingRule#getState() + */ + public T state(String state) { + this.state = state; + return self(); + } + + /** + * @see IPForwardingRule#getVirtualMachineDisplayName() + */ + public T virtualMachineDisplayName(String virtualMachineDisplayName) { + this.virtualMachineDisplayName = virtualMachineDisplayName; + return self(); + } + + /** + * @see IPForwardingRule#getVirtualMachineId() + */ + public T virtualMachineId(String virtualMachineId) { + this.virtualMachineId = virtualMachineId; + return self(); + } + + /** + * @see IPForwardingRule#getVirtualMachineName() + */ + public T virtualMachineName(String virtualMachineName) { + this.virtualMachineName = virtualMachineName; + return self(); + } + + /** + * @see IPForwardingRule#getPublicPort() + */ + public T publicPort(int publicPort) { + this.publicPort = publicPort; + return self(); + } + + /** + * @see IPForwardingRule#getCIDRs() + */ + public T CIDRs(Set<String> CIDRs) { + this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs")); + return self(); + } + + public T CIDRs(String... in) { + return CIDRs(ImmutableSet.copyOf(in)); + } + + /** + * @see IPForwardingRule#getPrivateEndPort() + */ + public T privateEndPort(int privateEndPort) { + this.privateEndPort = privateEndPort; + return self(); + } + + /** + * @see IPForwardingRule#getPublicEndPort() + */ + public T publicEndPort(int publicEndPort) { + this.publicEndPort = publicEndPort; + return self(); + } + + public IPForwardingRule build() { + return new IPForwardingRule(id, IPAddress, IPAddressId, startPort, protocol, endPort, state, virtualMachineDisplayName, + virtualMachineId, virtualMachineName, publicPort, CIDRs, privateEndPort, publicEndPort); + } + + public T fromIPForwardingRule(IPForwardingRule in) { + return this + .id(in.getId()) + .IPAddress(in.getIPAddress()) + .IPAddressId(in.getIPAddressId()) + .startPort(in.getStartPort()) + .protocol(in.getProtocol()) + .endPort(in.getEndPort()) + .state(in.getState()) + .virtualMachineDisplayName(in.getVirtualMachineDisplayName()) + .virtualMachineId(in.getVirtualMachineId()) + .virtualMachineName(in.getVirtualMachineName()) + .publicPort(in.getPublicPort()) + .CIDRs(in.getCIDRs()) + .privateEndPort(in.getPrivateEndPort()) + .publicEndPort(in.getPublicEndPort()); + } + } + + private static class ConcreteBuilder extends Builder<ConcreteBuilder> { + @Override + protected ConcreteBuilder self() { + return this; + } + } + + private final String id; + private final String IPAddress; + private final String IPAddressId; + private final int startPort; + private final String protocol; + private final int endPort; + private final String state; + private final String virtualMachineDisplayName; + private final String virtualMachineId; + private final String virtualMachineName; + private final int publicPort; + private final Set<String> CIDRs; + private final int privateEndPort; + private final int publicEndPort; + + @ConstructorProperties({ + "id", "ipaddress", "ipaddressid", "startport", "protocol", "endport", "state", "virtualmachinedisplayname", + "virtualmachineid", "virtualmachinename", "publicport", "cidrlist", "privateendport", "publicendport" + }) + protected IPForwardingRule(String id, String IPAddress, String IPAddressId, int startPort, @Nullable String protocol, + int endPort, @Nullable String state, @Nullable String virtualMachineDisplayName, + @Nullable String virtualMachineId, @Nullable String virtualMachineName, int publicPort, + @Nullable Set<String> CIDRs, int privateEndPort, int publicEndPort) { + this.id = checkNotNull(id, "id"); + this.IPAddress = IPAddress; + this.IPAddressId = IPAddressId; + this.startPort = startPort; + this.protocol = protocol; + this.endPort = endPort; + this.state = state; + this.virtualMachineDisplayName = virtualMachineDisplayName; + this.virtualMachineId = virtualMachineId; + this.virtualMachineName = virtualMachineName; + this.publicPort = publicPort; + this.CIDRs = CIDRs == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(CIDRs); + this.privateEndPort = privateEndPort; + this.publicEndPort = publicEndPort; + } + + /** + * @return the ID of the ip forwarding rule + */ + public String getId() { + return this.id; + } + + /** + * @return the public ip address for the ip forwarding rule + */ + @Nullable + public String getIPAddress() { + return this.IPAddress; + } + + /** + * @return the public ip address id for the ip forwarding rule + */ + @Nullable + public String getIPAddressId() { + return this.IPAddressId; + } + + /** + * @return the private port for the ip forwarding rule + */ + public int getStartPort() { + return this.startPort; + } + + /** + * @return the protocol of the ip forwarding rule + */ + @Nullable + public String getProtocol() { + return this.protocol; + } + + /** + * @return the public port for the ip forwarding rule + */ + public int getEndPort() { + return this.endPort; + } + + /** + * @return the state of the rule + */ + @Nullable + public String getState() { + return this.state; + } + + /** + * @return the VM display name for the ip forwarding rule + */ + @Nullable + public String getVirtualMachineDisplayName() { + return this.virtualMachineDisplayName; + } + + /** + * @return the VM ID for the ip forwarding rule + */ + @Nullable + public String getVirtualMachineId() { + return this.virtualMachineId; + } + + /** + * @return the VM name for the ip forwarding rule + */ + @Nullable + public String getVirtualMachineName() { + return this.virtualMachineName; + } + + /** + * @return the starting port of port forwarding rule's public port range + */ + public int getPublicPort() { + return this.publicPort; + } + + /** + * @return the cidr list to forward traffic from + */ + public Set<String> getCIDRs() { + return this.CIDRs; + } + + /** + * @return the ending port of port forwarding rule's private port range + */ + public int getPrivateEndPort() { + return this.privateEndPort; + } + + /** + * @return the ending port of port forwarding rule's private port range + */ + public int getPublicEndPort() { + return this.publicEndPort; + } + + @Override + public int hashCode() { + return Objects.hashCode(id, IPAddress, IPAddressId, startPort, protocol, endPort, state, virtualMachineDisplayName, virtualMachineId, virtualMachineName, publicPort, CIDRs, privateEndPort, publicEndPort); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + IPForwardingRule that = IPForwardingRule.class.cast(obj); + return Objects.equal(this.id, that.id) + && Objects.equal(this.IPAddress, that.IPAddress) + && Objects.equal(this.IPAddressId, that.IPAddressId) + && Objects.equal(this.startPort, that.startPort) + && Objects.equal(this.protocol, that.protocol) + && Objects.equal(this.endPort, that.endPort) + && Objects.equal(this.state, that.state) + && Objects.equal(this.virtualMachineDisplayName, that.virtualMachineDisplayName) + && Objects.equal(this.virtualMachineId, that.virtualMachineId) + && Objects.equal(this.virtualMachineName, that.virtualMachineName) + && Objects.equal(this.publicPort, that.publicPort) + && Objects.equal(this.CIDRs, that.CIDRs) + && Objects.equal(this.privateEndPort, that.privateEndPort) + && Objects.equal(this.publicEndPort, that.publicEndPort); + } + + protected ToStringHelper string() { + return MoreObjects.toStringHelper(this) + .add("id", id).add("IPAddress", IPAddress).add("IPAddressId", IPAddressId).add("startPort", startPort) + .add("protocol", protocol).add("endPort", endPort).add("state", state).add("virtualMachineDisplayName", virtualMachineDisplayName) + .add("virtualMachineId", virtualMachineId).add("virtualMachineName", virtualMachineName).add("publicPort", publicPort) + .add("CIDRs", CIDRs).add("privateEndPort", privateEndPort).add("publicEndPort", publicEndPort); + } + + @Override + public String toString() { + return string().toString(); + } + + @Override + public int compareTo(IPForwardingRule o) { + return id.compareTo(o.getId()); + } +}
http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ISO.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ISO.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ISO.java new file mode 100644 index 0000000..3e79b04 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ISO.java @@ -0,0 +1,767 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.cloudstack.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.beans.ConstructorProperties; +import java.util.Date; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.MoreObjects; +import com.google.common.base.MoreObjects.ToStringHelper; +import com.google.common.base.Objects; + +/** + * Class ISO + */ +public class ISO { + + /** + */ + public static enum ISOFilter { + + featured, self, self_executable, executable, community, UNRECOGNIZED; + + public static ISOFilter fromValue(String format) { + try { + return valueOf(checkNotNull(format, "format")); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } + } + } + + public static Builder<?> builder() { + return new ConcreteBuilder(); + } + + public Builder<?> toBuilder() { + return new ConcreteBuilder().fromISO(this); + } + + public abstract static class Builder<T extends Builder<T>> { + protected abstract T self(); + + protected String id; + protected String account; + protected String accountId; + protected boolean bootable; + protected String checksum; + protected Date created; + protected boolean crossZones; + protected String displayText; + protected String domain; + protected String domainid; + protected String format; + protected String hostId; + protected String hostName; + protected String hypervisor; + protected boolean isExtractable; + protected boolean isFeatured; + protected boolean isPublic; + protected boolean isReady; + protected String jobId; + protected String jobStatus; + protected String name; + protected String osTypeId; + protected String osTypeName; + protected boolean passwordEnabled; + protected Date removed; + protected long size; + protected String sourceTemplateId; + protected String status; + protected String templateTag; + protected String templateType; + protected String zoneId; + protected String zoneName; + + /** + * @see ISO#getId() + */ + public T id(String id) { + this.id = id; + return self(); + } + + /** + * @see ISO#getAccount() + */ + public T account(String account) { + this.account = account; + return self(); + } + + /** + * @see ISO#getAccountId() + */ + public T accountId(String accountId) { + this.accountId = accountId; + return self(); + } + + /** + * @see ISO#isBootable() + */ + public T bootable(boolean bootable) { + this.bootable = bootable; + return self(); + } + + /** + * @see ISO#getChecksum() + */ + public T checksum(String checksum) { + this.checksum = checksum; + return self(); + } + + /** + * @see ISO#getCreated() + */ + public T created(Date created) { + this.created = created; + return self(); + } + + /** + * @see ISO#isCrossZones() + */ + public T crossZones(boolean crossZones) { + this.crossZones = crossZones; + return self(); + } + + /** + * @see ISO#getDisplayText() + */ + public T displayText(String displayText) { + this.displayText = displayText; + return self(); + } + + /** + * @see ISO#getDomain() + */ + public T domain(String domain) { + this.domain = domain; + return self(); + } + + /** + * @see ISO#getDomainid() + */ + public T domainid(String domainid) { + this.domainid = domainid; + return self(); + } + + /** + * @see ISO#getFormat() + */ + public T format(String format) { + this.format = format; + return self(); + } + + /** + * @see ISO#getHostId() + */ + public T hostId(String hostId) { + this.hostId = hostId; + return self(); + } + + /** + * @see ISO#getHostName() + */ + public T hostName(String hostName) { + this.hostName = hostName; + return self(); + } + + /** + * @see ISO#getHypervisor() + */ + public T hypervisor(String hypervisor) { + this.hypervisor = hypervisor; + return self(); + } + + /** + * @see ISO#isExtractable() + */ + public T isExtractable(boolean isExtractable) { + this.isExtractable = isExtractable; + return self(); + } + + /** + * @see ISO#isFeatured() + */ + public T isFeatured(boolean isFeatured) { + this.isFeatured = isFeatured; + return self(); + } + + /** + * @see ISO#isPublic() + */ + public T isPublic(boolean isPublic) { + this.isPublic = isPublic; + return self(); + } + + /** + * @see ISO#isReady() + */ + public T isReady(boolean isReady) { + this.isReady = isReady; + return self(); + } + + /** + * @see ISO#getJobId() + */ + public T jobId(String jobId) { + this.jobId = jobId; + return self(); + } + + /** + * @see ISO#getJobStatus() + */ + public T jobStatus(String jobStatus) { + this.jobStatus = jobStatus; + return self(); + } + + /** + * @see ISO#getName() + */ + public T name(String name) { + this.name = name; + return self(); + } + + /** + * @see ISO#getOsTypeId() + */ + public T osTypeId(String osTypeId) { + this.osTypeId = osTypeId; + return self(); + } + + /** + * @see ISO#getOsTypeName() + */ + public T osTypeName(String osTypeName) { + this.osTypeName = osTypeName; + return self(); + } + + /** + * @see ISO#isPasswordEnabled() + */ + public T passwordEnabled(boolean passwordEnabled) { + this.passwordEnabled = passwordEnabled; + return self(); + } + + /** + * @see ISO#getRemoved() + */ + public T removed(Date removed) { + this.removed = removed; + return self(); + } + + /** + * @see ISO#getSize() + */ + public T size(long size) { + this.size = size; + return self(); + } + + /** + * @see ISO#getSourceTemplateId() + */ + public T sourceTemplateId(String sourceTemplateId) { + this.sourceTemplateId = sourceTemplateId; + return self(); + } + + /** + * @see ISO#getStatus() + */ + public T status(String status) { + this.status = status; + return self(); + } + + /** + * @see ISO#getTemplateTag() + */ + public T templateTag(String templateTag) { + this.templateTag = templateTag; + return self(); + } + + /** + * @see ISO#getTemplateType() + */ + public T templateType(String templateType) { + this.templateType = templateType; + return self(); + } + + /** + * @see ISO#getZoneId() + */ + public T zoneId(String zoneId) { + this.zoneId = zoneId; + return self(); + } + + /** + * @see ISO#getZoneName() + */ + public T zoneName(String zoneName) { + this.zoneName = zoneName; + return self(); + } + + public ISO build() { + return new ISO(id, account, accountId, bootable, checksum, created, crossZones, displayText, domain, domainid, + format, hostId, hostName, hypervisor, isExtractable, isFeatured, isPublic, isReady, jobId, jobStatus, name, + osTypeId, osTypeName, passwordEnabled, removed, size, sourceTemplateId, status, templateTag, templateType, + zoneId, zoneName); + } + + public T fromISO(ISO in) { + return this + .id(in.getId()) + .account(in.getAccount()) + .accountId(in.getAccountId()) + .bootable(in.isBootable()) + .checksum(in.getChecksum()) + .created(in.getCreated()) + .crossZones(in.isCrossZones()) + .displayText(in.getDisplayText()) + .domain(in.getDomain()) + .domainid(in.getDomainid()) + .format(in.getFormat()) + .hostId(in.getHostId()) + .hostName(in.getHostName()) + .hypervisor(in.getHypervisor()) + .isExtractable(in.isExtractable()) + .isFeatured(in.isFeatured()) + .isPublic(in.isPublic()) + .isReady(in.isReady()) + .jobId(in.getJobId()) + .jobStatus(in.getJobStatus()) + .name(in.getName()) + .osTypeId(in.getOsTypeId()) + .osTypeName(in.getOsTypeName()) + .passwordEnabled(in.isPasswordEnabled()) + .removed(in.getRemoved()) + .size(in.getSize()) + .sourceTemplateId(in.getSourceTemplateId()) + .status(in.getStatus()) + .templateTag(in.getTemplateTag()) + .templateType(in.getTemplateType()) + .zoneId(in.getZoneId()) + .zoneName(in.getZoneName()); + } + } + + private static class ConcreteBuilder extends Builder<ConcreteBuilder> { + @Override + protected ConcreteBuilder self() { + return this; + } + } + + private final String id; + private final String account; + private final String accountId; + private final boolean bootable; + private final String checksum; + private final Date created; + private final boolean crossZones; + private final String displayText; + private final String domain; + private final String domainid; + private final String format; + private final String hostId; + private final String hostName; + private final String hypervisor; + private final boolean isExtractable; + private final boolean isFeatured; + private final boolean isPublic; + private final boolean isReady; + private final String jobId; + private final String jobStatus; + private final String name; + private final String osTypeId; + private final String osTypeName; + private final boolean passwordEnabled; + private final Date removed; + private final long size; + private final String sourceTemplateId; + private final String status; + private final String templateTag; + private final String templateType; + private final String zoneId; + private final String zoneName; + + @ConstructorProperties({ + "id", "account", "accountid", "bootable", "checksum", "created", "crossZones", "displaytext", "domain", "domainid", "format", "hostid", "hostname", "hypervisor", "isextractable", "isfeatured", "ispublic", "isready", "jobid", "jobstatus", "name", "ostypeid", "ostypename", "passwordenabled", "removed", "size", "sourcetemplateid", "status", "templatetag", "templatetype", "zoneid", "zonename" + }) + protected ISO(String id, @Nullable String account, @Nullable String accountId, boolean bootable, @Nullable String checksum, + @Nullable Date created, boolean crossZones, @Nullable String displayText, @Nullable String domain, + @Nullable String domainid, @Nullable String format, @Nullable String hostId, @Nullable String hostName, + @Nullable String hypervisor, boolean isExtractable, boolean isFeatured, boolean isPublic, boolean isReady, + @Nullable String jobId, @Nullable String jobStatus, @Nullable String name, @Nullable String osTypeId, + @Nullable String osTypeName, boolean passwordEnabled, @Nullable Date removed, long size, @Nullable String sourceTemplateId, + @Nullable String status, @Nullable String templateTag, @Nullable String templateType, @Nullable String zoneId, @Nullable String zoneName) { + this.id = checkNotNull(id, "id"); + this.account = account; + this.accountId = accountId; + this.bootable = bootable; + this.checksum = checksum; + this.created = created; + this.crossZones = crossZones; + this.displayText = displayText; + this.domain = domain; + this.domainid = domainid; + this.format = format; + this.hostId = hostId; + this.hostName = hostName; + this.hypervisor = hypervisor; + this.isExtractable = isExtractable; + this.isFeatured = isFeatured; + this.isPublic = isPublic; + this.isReady = isReady; + this.jobId = jobId; + this.jobStatus = jobStatus; + this.name = name; + this.osTypeId = osTypeId; + this.osTypeName = osTypeName; + this.passwordEnabled = passwordEnabled; + this.removed = removed; + this.size = size; + this.sourceTemplateId = sourceTemplateId; + this.status = status; + this.templateTag = templateTag; + this.templateType = templateType; + this.zoneId = zoneId; + this.zoneName = zoneName; + } + + /** + * @return the template ID + */ + public String getId() { + return this.id; + } + + /** + * @return the account name to which the template belongs + */ + @Nullable + public String getAccount() { + return this.account; + } + + /** + * @return the account id to which the template belongs + */ + @Nullable + public String getAccountId() { + return this.accountId; + } + + public boolean isBootable() { + return this.bootable; + } + + /** + * @return checksum of the template + */ + @Nullable + public String getChecksum() { + return this.checksum; + } + + /** + * @return the date this template was created + */ + @Nullable + public Date getCreated() { + return this.created; + } + + public boolean isCrossZones() { + return this.crossZones; + } + + /** + * @return the template display text + */ + @Nullable + public String getDisplayText() { + return this.displayText; + } + + /** + * @return the name of the domain to which the template belongs + */ + @Nullable + public String getDomain() { + return this.domain; + } + + /** + * @return the ID of the domain to which the template belongs + */ + @Nullable + public String getDomainid() { + return this.domainid; + } + + /** + * @return the format of the template. + */ + @Nullable + public String getFormat() { + return this.format; + } + + /** + * @return the ID of the secondary storage host for the template + */ + @Nullable + public String getHostId() { + return this.hostId; + } + + /** + * @return the name of the secondary storage host for the template + */ + @Nullable + public String getHostName() { + return this.hostName; + } + + /** + * @return the hypervisor on which the template runs + */ + @Nullable + public String getHypervisor() { + return this.hypervisor; + } + + public boolean isExtractable() { + return this.isExtractable; + } + + public boolean isFeatured() { + return this.isFeatured; + } + + public boolean isPublic() { + return this.isPublic; + } + + public boolean isReady() { + return this.isReady; + } + + /** + * @return shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the template + */ + @Nullable + public String getJobId() { + return this.jobId; + } + + /** + * @return shows the current pending asynchronous job status + */ + @Nullable + public String getJobStatus() { + return this.jobStatus; + } + + /** + * @return the template name + */ + @Nullable + public String getName() { + return this.name; + } + + /** + * @return the ID of the OS type for this template. + */ + @Nullable + public String getOsTypeId() { + return this.osTypeId; + } + + /** + * @return the name of the OS type for this template. + */ + @Nullable + public String getOsTypeName() { + return this.osTypeName; + } + + public boolean isPasswordEnabled() { + return this.passwordEnabled; + } + + /** + * @return the date this template was removed + */ + @Nullable + public Date getRemoved() { + return this.removed; + } + + /** + * @return the size of the template + */ + public long getSize() { + return this.size; + } + + /** + * @return the template ID of the parent template if present + */ + @Nullable + public String getSourceTemplateId() { + return this.sourceTemplateId; + } + + /** + * @return the status of the template + */ + @Nullable + public String getStatus() { + return this.status; + } + + /** + * @return the tag of this template + */ + @Nullable + public String getTemplateTag() { + return this.templateTag; + } + + /** + * @return the type of the template + */ + @Nullable + public String getTemplateType() { + return this.templateType; + } + + /** + * @return the ID of the zone for this template + */ + @Nullable + public String getZoneId() { + return this.zoneId; + } + + /** + * @return the name of the zone for this template + */ + @Nullable + public String getZoneName() { + return this.zoneName; + } + + @Override + public int hashCode() { + return Objects.hashCode(id, account, accountId, bootable, checksum, created, crossZones, displayText, domain, + domainid, format, hostId, hostName, hypervisor, isExtractable, isFeatured, isPublic, isReady, jobId, jobStatus, + name, osTypeId, osTypeName, passwordEnabled, removed, size, sourceTemplateId, status, templateTag, templateType, zoneId, zoneName); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + ISO that = ISO.class.cast(obj); + return Objects.equal(this.id, that.id) + && Objects.equal(this.account, that.account) + && Objects.equal(this.accountId, that.accountId) + && Objects.equal(this.bootable, that.bootable) + && Objects.equal(this.checksum, that.checksum) + && Objects.equal(this.created, that.created) + && Objects.equal(this.crossZones, that.crossZones) + && Objects.equal(this.displayText, that.displayText) + && Objects.equal(this.domain, that.domain) + && Objects.equal(this.domainid, that.domainid) + && Objects.equal(this.format, that.format) + && Objects.equal(this.hostId, that.hostId) + && Objects.equal(this.hostName, that.hostName) + && Objects.equal(this.hypervisor, that.hypervisor) + && Objects.equal(this.isExtractable, that.isExtractable) + && Objects.equal(this.isFeatured, that.isFeatured) + && Objects.equal(this.isPublic, that.isPublic) + && Objects.equal(this.isReady, that.isReady) + && Objects.equal(this.jobId, that.jobId) + && Objects.equal(this.jobStatus, that.jobStatus) + && Objects.equal(this.name, that.name) + && Objects.equal(this.osTypeId, that.osTypeId) + && Objects.equal(this.osTypeName, that.osTypeName) + && Objects.equal(this.passwordEnabled, that.passwordEnabled) + && Objects.equal(this.removed, that.removed) + && Objects.equal(this.size, that.size) + && Objects.equal(this.sourceTemplateId, that.sourceTemplateId) + && Objects.equal(this.status, that.status) + && Objects.equal(this.templateTag, that.templateTag) + && Objects.equal(this.templateType, that.templateType) + && Objects.equal(this.zoneId, that.zoneId) + && Objects.equal(this.zoneName, that.zoneName); + } + + protected ToStringHelper string() { + return MoreObjects.toStringHelper(this) + .add("id", id).add("account", account).add("accountId", accountId).add("bootable", bootable) + .add("checksum", checksum).add("created", created).add("crossZones", crossZones).add("displayText", displayText) + .add("domain", domain).add("domainid", domainid).add("format", format).add("hostId", hostId).add("hostName", hostName) + .add("hypervisor", hypervisor).add("isExtractable", isExtractable).add("isFeatured", isFeatured).add("isPublic", isPublic) + .add("isReady", isReady).add("jobId", jobId).add("jobStatus", jobStatus).add("name", name).add("osTypeId", osTypeId) + .add("osTypeName", osTypeName).add("passwordEnabled", passwordEnabled).add("removed", removed).add("size", size) + .add("sourceTemplateId", sourceTemplateId).add("status", status).add("templateTag", templateTag).add("templateType", templateType) + .add("zoneId", zoneId).add("zoneName", zoneName); + } + + @Override + public String toString() { + return string().toString(); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ISOExtraction.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ISOExtraction.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ISOExtraction.java new file mode 100644 index 0000000..e6706e5 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ISOExtraction.java @@ -0,0 +1,368 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.cloudstack.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.beans.ConstructorProperties; +import java.util.Date; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.MoreObjects; +import com.google.common.base.MoreObjects.ToStringHelper; +import com.google.common.base.Objects; + +/** + * Class ISOExtraction + */ +public class ISOExtraction { + + public static Builder<?> builder() { + return new ConcreteBuilder(); + } + + public Builder<?> toBuilder() { + return new ConcreteBuilder().fromISOExtraction(this); + } + + public abstract static class Builder<T extends Builder<T>> { + protected abstract T self(); + + protected String id; + protected String accountId; + protected Date created; + protected String extractId; + protected ExtractMode extractMode; + protected String name; + protected String state; + protected String status; + protected String storageType; + protected int uploadPercentage; + protected String url; + protected String zoneId; + protected String zoneName; + + /** + * @see ISOExtraction#getId() + */ + public T id(String id) { + this.id = id; + return self(); + } + + /** + * @see ISOExtraction#getAccountId() + */ + public T accountId(String accountId) { + this.accountId = accountId; + return self(); + } + + /** + * @see ISOExtraction#getCreated() + */ + public T created(Date created) { + this.created = created; + return self(); + } + + /** + * @see ISOExtraction#getExtractId() + */ + public T extractId(String extractId) { + this.extractId = extractId; + return self(); + } + + /** + * @see ISOExtraction#getExtractMode() + */ + public T extractMode(ExtractMode extractMode) { + this.extractMode = extractMode; + return self(); + } + + /** + * @see ISOExtraction#getName() + */ + public T name(String name) { + this.name = name; + return self(); + } + + /** + * @see ISOExtraction#getState() + */ + public T state(String state) { + this.state = state; + return self(); + } + + /** + * @see ISOExtraction#getStatus() + */ + public T status(String status) { + this.status = status; + return self(); + } + + /** + * @see ISOExtraction#getStorageType() + */ + public T storageType(String storageType) { + this.storageType = storageType; + return self(); + } + + /** + * @see ISOExtraction#getUploadPercentage() + */ + public T uploadPercentage(int uploadPercentage) { + this.uploadPercentage = uploadPercentage; + return self(); + } + + /** + * @see ISOExtraction#getUrl() + */ + public T url(String url) { + this.url = url; + return self(); + } + + /** + * @see ISOExtraction#getZoneId() + */ + public T zoneId(String zoneId) { + this.zoneId = zoneId; + return self(); + } + + /** + * @see ISOExtraction#getZoneName() + */ + public T zoneName(String zoneName) { + this.zoneName = zoneName; + return self(); + } + + public ISOExtraction build() { + return new ISOExtraction(id, accountId, created, extractId, extractMode, name, state, status, storageType, uploadPercentage, url, zoneId, zoneName); + } + + public T fromISOExtraction(ISOExtraction in) { + return this + .id(in.getId()) + .accountId(in.getAccountId()) + .created(in.getCreated()) + .extractId(in.getExtractId()) + .extractMode(in.getExtractMode()) + .name(in.getName()) + .state(in.getState()) + .status(in.getStatus()) + .storageType(in.getStorageType()) + .uploadPercentage(in.getUploadPercentage()) + .url(in.getUrl()) + .zoneId(in.getZoneId()) + .zoneName(in.getZoneName()); + } + } + + private static class ConcreteBuilder extends Builder<ConcreteBuilder> { + @Override + protected ConcreteBuilder self() { + return this; + } + } + + private final String id; + private final String accountId; + private final Date created; + private final String extractId; + private final ExtractMode extractMode; + private final String name; + private final String state; + private final String status; + private final String storageType; + private final int uploadPercentage; + private final String url; + private final String zoneId; + private final String zoneName; + + @ConstructorProperties({ + "id", "accountid", "created", "extractId", "extractMode", "name", "state", "status", "storagetype", "uploadpercentage", "url", "zoneid", "zonename" + }) + protected ISOExtraction(String id, @Nullable String accountId, @Nullable Date created, @Nullable String extractId, + @Nullable ExtractMode extractMode, @Nullable String name, @Nullable String state, @Nullable String status, + @Nullable String storageType, int uploadPercentage, @Nullable String url, @Nullable String zoneId, + @Nullable String zoneName) { + this.id = checkNotNull(id, "id"); + this.accountId = accountId; + this.created = created; + this.extractId = extractId; + this.extractMode = extractMode; + this.name = name; + this.state = state; + this.status = status; + this.storageType = storageType; + this.uploadPercentage = uploadPercentage; + this.url = url; + this.zoneId = zoneId; + this.zoneName = zoneName; + } + + /** + * @return the id of extracted object + */ + public String getId() { + return this.id; + } + + /** + * @return the account id to which the extracted object belongs + */ + @Nullable + public String getAccountId() { + return this.accountId; + } + + /** + * @return the time and date the object was created + */ + @Nullable + public Date getCreated() { + return this.created; + } + + /** + * @return the upload id of extracted object + */ + @Nullable + public String getExtractId() { + return this.extractId; + } + + /** + * @return the mode of extraction - upload or download + */ + @Nullable + public ExtractMode getExtractMode() { + return this.extractMode; + } + + /** + * @return the name of the extracted object + */ + @Nullable + public String getName() { + return this.name; + } + + /** + * @return the state of the extracted object + */ + @Nullable + public String getState() { + return this.state; + } + + /** + * @return the status of the extraction + */ + @Nullable + public String getStatus() { + return this.status; + } + + /** + * @return type of the storage + */ + @Nullable + public String getStorageType() { + return this.storageType; + } + + /** + * @return the percentage of the entity uploaded to the specified location + */ + public int getUploadPercentage() { + return this.uploadPercentage; + } + + /** + * @return if mode = upload then url of the uploaded entity. if mode = download the url from which the entity can be downloaded + */ + @Nullable + public String getUrl() { + return this.url; + } + + /** + * @return zone ID the object was extracted from + */ + @Nullable + public String getZoneId() { + return this.zoneId; + } + + /** + * @return zone name the object was extracted from + */ + @Nullable + public String getZoneName() { + return this.zoneName; + } + + @Override + public int hashCode() { + return Objects.hashCode(id, accountId, created, extractId, extractMode, name, state, status, storageType, uploadPercentage, url, zoneId, zoneName); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + ISOExtraction that = ISOExtraction.class.cast(obj); + return Objects.equal(this.id, that.id) + && Objects.equal(this.accountId, that.accountId) + && Objects.equal(this.created, that.created) + && Objects.equal(this.extractId, that.extractId) + && Objects.equal(this.extractMode, that.extractMode) + && Objects.equal(this.name, that.name) + && Objects.equal(this.state, that.state) + && Objects.equal(this.status, that.status) + && Objects.equal(this.storageType, that.storageType) + && Objects.equal(this.uploadPercentage, that.uploadPercentage) + && Objects.equal(this.url, that.url) + && Objects.equal(this.zoneId, that.zoneId) + && Objects.equal(this.zoneName, that.zoneName); + } + + protected ToStringHelper string() { + return MoreObjects.toStringHelper(this) + .add("id", id).add("accountId", accountId).add("created", created).add("extractId", extractId).add("extractMode", extractMode) + .add("name", name).add("state", state).add("status", status).add("storageType", storageType).add("uploadPercentage", uploadPercentage) + .add("url", url).add("zoneId", zoneId).add("zoneName", zoneName); + } + + @Override + public String toString() { + return string().toString(); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ISOPermissions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ISOPermissions.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ISOPermissions.java new file mode 100644 index 0000000..b85e741 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ISOPermissions.java @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.cloudstack.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.beans.ConstructorProperties; +import java.util.Set; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.MoreObjects; +import com.google.common.base.MoreObjects.ToStringHelper; +import com.google.common.base.Objects; +import com.google.common.collect.ImmutableSet; + +/** + * Class ISOPermissions + */ +public class ISOPermissions { + + public static Builder<?> builder() { + return new ConcreteBuilder(); + } + + public Builder<?> toBuilder() { + return new ConcreteBuilder().fromISOPermissions(this); + } + + public abstract static class Builder<T extends Builder<T>> { + protected abstract T self(); + + protected String id; + protected Set<String> accounts = ImmutableSet.of(); + protected String domainId; + protected boolean isPublic; + + /** + * @see ISOPermissions#getId() + */ + public T id(String id) { + this.id = id; + return self(); + } + + /** + * @see ISOPermissions#getAccounts() + */ + public T accounts(Set<String> accounts) { + this.accounts = ImmutableSet.copyOf(checkNotNull(accounts, "accounts")); + return self(); + } + + public T accounts(String... in) { + return accounts(ImmutableSet.copyOf(in)); + } + + /** + * @see ISOPermissions#getDomainId() + */ + public T domainId(String domainId) { + this.domainId = domainId; + return self(); + } + + /** + * @see ISOPermissions#isPublic() + */ + public T isPublic(boolean isPublic) { + this.isPublic = isPublic; + return self(); + } + + public ISOPermissions build() { + return new ISOPermissions(id, accounts, domainId, isPublic); + } + + public T fromISOPermissions(ISOPermissions in) { + return this + .id(in.getId()) + .accounts(in.getAccounts()) + .domainId(in.getDomainId()) + .isPublic(in.isPublic()); + } + } + + private static class ConcreteBuilder extends Builder<ConcreteBuilder> { + @Override + protected ConcreteBuilder self() { + return this; + } + } + + private final String id; + private final Set<String> accounts; + private final String domainId; + private final boolean isPublic; + + @ConstructorProperties({ + "id", "account", "domainid", "ispublic" + }) + protected ISOPermissions(String id, @Nullable Set<String> accounts, @Nullable String domainId, boolean isPublic) { + this.id = checkNotNull(id, "id"); + this.accounts = accounts == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(accounts); + this.domainId = domainId; + this.isPublic = isPublic; + } + + /** + * @return the template ID + */ + public String getId() { + return this.id; + } + + /** + * @return the list of accounts the template is available for + */ + public Set<String> getAccounts() { + return this.accounts; + } + + /** + * @return the ID of the domain to which the template belongs + */ + @Nullable + public String getDomainId() { + return this.domainId; + } + + /** + * @return true if this template is a public template, false otherwise + */ + public boolean isPublic() { + return this.isPublic; + } + + @Override + public int hashCode() { + return Objects.hashCode(id, accounts, domainId, isPublic); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + ISOPermissions that = ISOPermissions.class.cast(obj); + return Objects.equal(this.id, that.id) + && Objects.equal(this.accounts, that.accounts) + && Objects.equal(this.domainId, that.domainId) + && Objects.equal(this.isPublic, that.isPublic); + } + + protected ToStringHelper string() { + return MoreObjects.toStringHelper(this) + .add("id", id).add("accounts", accounts).add("domainId", domainId).add("isPublic", isPublic); + } + + @Override + public String toString() { + return string().toString(); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/IngressRule.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/IngressRule.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/IngressRule.java new file mode 100644 index 0000000..efb5ff9 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/IngressRule.java @@ -0,0 +1,278 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.cloudstack.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.beans.ConstructorProperties; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.MoreObjects; +import com.google.common.base.MoreObjects.ToStringHelper; +import com.google.common.base.Objects; + +public class IngressRule implements Comparable<IngressRule> { + + public static Builder<?> builder() { + return new ConcreteBuilder(); + } + + public Builder<?> toBuilder() { + return new ConcreteBuilder().fromIngressRule(this); + } + + public abstract static class Builder<T extends Builder<T>> { + protected abstract T self(); + + protected String account; + protected String CIDR; + protected int endPort; + protected int ICMPCode; + protected int ICMPType; + protected String protocol; + protected String id; + protected String securityGroupName; + protected int startPort; + + /** + * @see IngressRule#getAccount() + */ + public T account(String account) { + this.account = account; + return self(); + } + + /** + * @see IngressRule#getCIDR() + */ + public T CIDR(String CIDR) { + this.CIDR = CIDR; + return self(); + } + + /** + * @see IngressRule#getEndPort() + */ + public T endPort(int endPort) { + this.endPort = endPort; + return self(); + } + + /** + * @see IngressRule#getICMPCode() + */ + public T ICMPCode(int ICMPCode) { + this.ICMPCode = ICMPCode; + return self(); + } + + /** + * @see IngressRule#getICMPType() + */ + public T ICMPType(int ICMPType) { + this.ICMPType = ICMPType; + return self(); + } + + /** + * @see IngressRule#getProtocol() + */ + public T protocol(String protocol) { + this.protocol = protocol; + return self(); + } + + /** + * @see IngressRule#getId() + */ + public T id(String id) { + this.id = id; + return self(); + } + + /** + * @see IngressRule#getSecurityGroupName() + */ + public T securityGroupName(String securityGroupName) { + this.securityGroupName = securityGroupName; + return self(); + } + + /** + * @see IngressRule#getStartPort() + */ + public T startPort(int startPort) { + this.startPort = startPort; + return self(); + } + + public IngressRule build() { + return new IngressRule(account, CIDR, endPort, ICMPCode, ICMPType, protocol, id, securityGroupName, startPort); + } + + public T fromIngressRule(IngressRule in) { + return this + .account(in.getAccount()) + .CIDR(in.getCIDR()) + .endPort(in.getEndPort()) + .ICMPCode(in.getICMPCode()) + .ICMPType(in.getICMPType()) + .protocol(in.getProtocol()) + .id(in.getId()) + .securityGroupName(in.getSecurityGroupName()) + .startPort(in.getStartPort()); + } + } + + private static class ConcreteBuilder extends Builder<ConcreteBuilder> { + @Override + protected ConcreteBuilder self() { + return this; + } + } + + private final String account; + private final String CIDR; + private final int endPort; + private final int ICMPCode; + private final int ICMPType; + private final String protocol; + private final String id; + private final String securityGroupName; + private final int startPort; + + @ConstructorProperties({ + "account", "cidr", "endport", "icmpcode", "icmptype", "protocol", "ruleid", "securitygroupname", "startport" + }) + protected IngressRule(@Nullable String account, @Nullable String CIDR, int endPort, int ICMPCode, int ICMPType, + @Nullable String protocol, String id, @Nullable String securityGroupName, int startPort) { + this.account = account; + this.CIDR = CIDR; + this.endPort = endPort; + this.ICMPCode = ICMPCode; + this.ICMPType = ICMPType; + this.protocol = protocol; + this.id = checkNotNull(id, "id"); + this.securityGroupName = securityGroupName; + this.startPort = startPort; + } + + /** + * @return account owning the ingress rule + */ + @Nullable + public String getAccount() { + return this.account; + } + + /** + * @return the CIDR notation for the base IP address of the ingress rule + */ + @Nullable + public String getCIDR() { + return this.CIDR; + } + + /** + * @return the ending IP of the ingress rule + */ + public int getEndPort() { + return this.endPort; + } + + /** + * @return the code for the ICMP message response + */ + public int getICMPCode() { + return this.ICMPCode; + } + + /** + * @return the type of the ICMP message response + */ + public int getICMPType() { + return this.ICMPType; + } + + /** + * @return the protocol of the ingress rule + */ + @Nullable + public String getProtocol() { + return this.protocol; + } + + /** + * @return the id of the ingress rule + */ + public String getId() { + return this.id; + } + + /** + * @return security group name + */ + @Nullable + public String getSecurityGroupName() { + return this.securityGroupName; + } + + /** + * @return the starting IP of the ingress rule + */ + public int getStartPort() { + return this.startPort; + } + + @Override + public int hashCode() { + return Objects.hashCode(account, CIDR, endPort, ICMPCode, ICMPType, protocol, id, securityGroupName, startPort); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + IngressRule that = IngressRule.class.cast(obj); + return Objects.equal(this.account, that.account) + && Objects.equal(this.CIDR, that.CIDR) + && Objects.equal(this.endPort, that.endPort) + && Objects.equal(this.ICMPCode, that.ICMPCode) + && Objects.equal(this.ICMPType, that.ICMPType) + && Objects.equal(this.protocol, that.protocol) + && Objects.equal(this.id, that.id) + && Objects.equal(this.securityGroupName, that.securityGroupName) + && Objects.equal(this.startPort, that.startPort); + } + + protected ToStringHelper string() { + return MoreObjects.toStringHelper(this) + .add("account", account).add("CIDR", CIDR).add("endPort", endPort).add("ICMPCode", ICMPCode) + .add("ICMPType", ICMPType).add("protocol", protocol).add("id", id).add("securityGroupName", securityGroupName).add("startPort", startPort); + } + + @Override + public String toString() { + return string().toString(); + } + + @Override + public int compareTo(IngressRule o) { + return id.compareTo(o.getId()); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/JobResult.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/JobResult.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/JobResult.java new file mode 100644 index 0000000..7df671e --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/JobResult.java @@ -0,0 +1,126 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.cloudstack.domain; + +import java.beans.ConstructorProperties; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.MoreObjects; +import com.google.common.base.MoreObjects.ToStringHelper; +import com.google.common.base.Objects; + +/** + * The result of an operation. + * <p/> + * A handful of Cloudstack API calls return this structure when there is no domain model data to return - for example, + * when deleting an object. + */ +public class JobResult { + + public static Builder<?> builder() { + return new ConcreteBuilder(); + } + + public Builder<?> toBuilder() { + return new ConcreteBuilder().fromJobResult(this); + } + + public abstract static class Builder<T extends Builder<T>> { + protected abstract T self(); + + protected boolean success; + protected String displayText; + + /** + * @see JobResult#isSuccess() + */ + public T success(boolean success) { + this.success = success; + return self(); + } + + /** + * @see JobResult#getDisplayText() + */ + public T displayText(String displayText) { + this.displayText = displayText; + return self(); + } + + public JobResult build() { + return new JobResult(success, displayText); + } + + public T fromJobResult(JobResult in) { + return this + .success(in.isSuccess()) + .displayText(in.getDisplayText()); + } + } + + private static class ConcreteBuilder extends Builder<ConcreteBuilder> { + @Override + protected ConcreteBuilder self() { + return this; + } + } + + private final boolean success; + private final String displayText; + + @ConstructorProperties({ + "success", "displaytext" + }) + protected JobResult(boolean success, @Nullable String displayText) { + this.success = success; + this.displayText = displayText; + } + + public boolean isSuccess() { + return this.success; + } + + @Nullable + public String getDisplayText() { + return this.displayText; + } + + @Override + public int hashCode() { + return Objects.hashCode(success, displayText); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + JobResult that = JobResult.class.cast(obj); + return Objects.equal(this.success, that.success) + && Objects.equal(this.displayText, that.displayText); + } + + protected ToStringHelper string() { + return MoreObjects.toStringHelper(this).add("success", success).add("displayText", displayText); + } + + @Override + public String toString() { + return string().toString(); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java new file mode 100644 index 0000000..d0e9f10 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/LoadBalancerRule.java @@ -0,0 +1,444 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.cloudstack.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.beans.ConstructorProperties; +import java.util.Set; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.CaseFormat; +import com.google.common.base.MoreObjects; +import com.google.common.base.MoreObjects.ToStringHelper; +import com.google.common.base.Objects; +import com.google.common.collect.ImmutableSet; + +/** + * Class LoadBalancerRule + */ +public class LoadBalancerRule { + + /** + */ + public static enum State { + ADD, ACTIVE, UNRECOGNIZED; + + @Override + public String toString() { + return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); + } + + public static State fromValue(String state) { + try { + return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state"))); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } + } + + } + + public static enum Algorithm { + SOURCE, ROUNDROBIN, LEASTCONN, UNRECOGNIZED; + + @Override + public String toString() { + return name().toLowerCase(); + } + + public static Algorithm fromValue(String algorithm) { + try { + return Algorithm.valueOf(checkNotNull(algorithm, "algorithm").toUpperCase()); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } + } + + } + + public static Builder<?> builder() { + return new ConcreteBuilder(); + } + + public Builder<?> toBuilder() { + return new ConcreteBuilder().fromLoadBalancerRule(this); + } + + public abstract static class Builder<T extends Builder<T>> { + protected abstract T self(); + + protected String id; + protected String account; + protected LoadBalancerRule.Algorithm algorithm; + protected String description; + protected String domain; + protected String domainId; + protected String name; + protected int privatePort; + protected String publicIP; + protected String publicIPId; + protected int publicPort; + protected LoadBalancerRule.State state; + protected Set<String> CIDRs = ImmutableSet.of(); + protected String zoneId; + + /** + * @see LoadBalancerRule#getId() + */ + public T id(String id) { + this.id = id; + return self(); + } + + /** + * @see LoadBalancerRule#getAccount() + */ + public T account(String account) { + this.account = account; + return self(); + } + + /** + * @see LoadBalancerRule#getAlgorithm() + */ + public T algorithm(LoadBalancerRule.Algorithm algorithm) { + this.algorithm = algorithm; + return self(); + } + + /** + * @see LoadBalancerRule#getDescription() + */ + public T description(String description) { + this.description = description; + return self(); + } + + /** + * @see LoadBalancerRule#getDomain() + */ + public T domain(String domain) { + this.domain = domain; + return self(); + } + + /** + * @see LoadBalancerRule#getDomainId() + */ + public T domainId(String domainId) { + this.domainId = domainId; + return self(); + } + + /** + * @see LoadBalancerRule#getName() + */ + public T name(String name) { + this.name = name; + return self(); + } + + /** + * @see LoadBalancerRule#getPrivatePort() + */ + public T privatePort(int privatePort) { + this.privatePort = privatePort; + return self(); + } + + /** + * @see LoadBalancerRule#getPublicIP() + */ + public T publicIP(String publicIP) { + this.publicIP = publicIP; + return self(); + } + + /** + * @see LoadBalancerRule#getPublicIPId() + */ + public T publicIPId(String publicIPId) { + this.publicIPId = publicIPId; + return self(); + } + + /** + * @see LoadBalancerRule#getPublicPort() + */ + public T publicPort(int publicPort) { + this.publicPort = publicPort; + return self(); + } + + /** + * @see LoadBalancerRule#getState() + */ + public T state(LoadBalancerRule.State state) { + this.state = state; + return self(); + } + + /** + * @see LoadBalancerRule#getCIDRs() + */ + public T CIDRs(Set<String> CIDRs) { + this.CIDRs = ImmutableSet.copyOf(checkNotNull(CIDRs, "CIDRs")); + return self(); + } + + public T CIDRs(String... in) { + return CIDRs(ImmutableSet.copyOf(in)); + } + + /** + * @see LoadBalancerRule#getZoneId() + */ + public T zoneId(String zoneId) { + this.zoneId = zoneId; + return self(); + } + + public LoadBalancerRule build() { + return new LoadBalancerRule(id, account, algorithm, description, domain, domainId, name, privatePort, publicIP, publicIPId, publicPort, state, CIDRs, zoneId); + } + + public T fromLoadBalancerRule(LoadBalancerRule in) { + return this + .id(in.getId()) + .account(in.getAccount()) + .algorithm(in.getAlgorithm()) + .description(in.getDescription()) + .domain(in.getDomain()) + .domainId(in.getDomainId()) + .name(in.getName()) + .privatePort(in.getPrivatePort()) + .publicIP(in.getPublicIP()) + .publicIPId(in.getPublicIPId()) + .publicPort(in.getPublicPort()) + .state(in.getState()) + .CIDRs(in.getCIDRs()) + .zoneId(in.getZoneId()); + } + } + + private static class ConcreteBuilder extends Builder<ConcreteBuilder> { + @Override + protected ConcreteBuilder self() { + return this; + } + } + + private final String id; + private final String account; + private final LoadBalancerRule.Algorithm algorithm; + private final String description; + private final String domain; + private final String domainId; + private final String name; + private final int privatePort; + private final String publicIP; + private final String publicIPId; + private final int publicPort; + private final LoadBalancerRule.State state; + private final Set<String> CIDRs; + private final String zoneId; + + + @ConstructorProperties({ + "id", "account", "algorithm", "description", "domain", "domainid", "name", "privateport", "publicip", + "publicipid", "publicport", "state", "cidrlist", "zoneId" + }) + private LoadBalancerRule(String id, @Nullable String account, @Nullable Algorithm algorithm, + @Nullable String description, @Nullable String domain, @Nullable String domainId, + @Nullable String name, int privatePort, @Nullable String publicIP, + @Nullable String publicIPId, int publicPort, @Nullable State state, + @Nullable String CIDRs, @Nullable String zoneId) { + this(id, account, algorithm, description, domain, domainId, name, privatePort, publicIP, publicIPId, publicPort, state, + splitStringOnCommas(CIDRs), zoneId); + } + + private static Set<String> splitStringOnCommas(String in) { + return in == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(in.split(",")); + } + + protected LoadBalancerRule(String id, @Nullable String account, @Nullable LoadBalancerRule.Algorithm algorithm, + @Nullable String description, @Nullable String domain, @Nullable String domainId, @Nullable String name, + int privatePort, @Nullable String publicIP, @Nullable String publicIPId, int publicPort, + @Nullable LoadBalancerRule.State state, @Nullable Iterable<String> CIDRs, @Nullable String zoneId) { + this.id = checkNotNull(id, "id"); + this.account = account; + this.algorithm = algorithm; + this.description = description; + this.domain = domain; + this.domainId = domainId; + this.name = name; + this.privatePort = privatePort; + this.publicIP = publicIP; + this.publicIPId = publicIPId; + this.publicPort = publicPort; + this.state = state; + this.CIDRs = CIDRs == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(CIDRs); + this.zoneId = zoneId; + } + + /** + * @return the load balancer rule ID + */ + public String getId() { + return this.id; + } + + /** + * @return the account of the load balancer rule + */ + @Nullable + public String getAccount() { + return this.account; + } + + /** + * @return the load balancer algorithm (source, roundrobin, leastconn) + */ + @Nullable + public LoadBalancerRule.Algorithm getAlgorithm() { + return this.algorithm; + } + + /** + * @return the description of the load balancer + */ + @Nullable + public String getDescription() { + return this.description; + } + + /** + * @return the domain of the load balancer rule + */ + @Nullable + public String getDomain() { + return this.domain; + } + + /** + * @return the domain ID of the load balancer rule + */ + @Nullable + public String getDomainId() { + return this.domainId; + } + + /** + * @return the name of the load balancer + */ + @Nullable + public String getName() { + return this.name; + } + + /** + * @return the private port + */ + public int getPrivatePort() { + return this.privatePort; + } + + /** + * @return the public ip address + */ + @Nullable + public String getPublicIP() { + return this.publicIP; + } + + /** + * @return the public ip address id + */ + @Nullable + public String getPublicIPId() { + return this.publicIPId; + } + + /** + * @return the public port + */ + public int getPublicPort() { + return this.publicPort; + } + + /** + * @return the state of the rule + */ + @Nullable + public LoadBalancerRule.State getState() { + return this.state; + } + + /** + * @return the cidr list to forward traffic from + */ + public Set<String> getCIDRs() { + return this.CIDRs; + } + + /** + * @return the id of the zone the rule beStrings to + */ + @Nullable + public String getZoneId() { + return this.zoneId; + } + + @Override + public int hashCode() { + return Objects.hashCode(id, account, algorithm, description, domain, domainId, name, privatePort, publicIP, publicIPId, publicPort, state, CIDRs, zoneId); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + LoadBalancerRule that = LoadBalancerRule.class.cast(obj); + return Objects.equal(this.id, that.id) + && Objects.equal(this.account, that.account) + && Objects.equal(this.algorithm, that.algorithm) + && Objects.equal(this.description, that.description) + && Objects.equal(this.domain, that.domain) + && Objects.equal(this.domainId, that.domainId) + && Objects.equal(this.name, that.name) + && Objects.equal(this.privatePort, that.privatePort) + && Objects.equal(this.publicIP, that.publicIP) + && Objects.equal(this.publicIPId, that.publicIPId) + && Objects.equal(this.publicPort, that.publicPort) + && Objects.equal(this.state, that.state) + && Objects.equal(this.CIDRs, that.CIDRs) + && Objects.equal(this.zoneId, that.zoneId); + } + + protected ToStringHelper string() { + return MoreObjects.toStringHelper(this) + .add("id", id).add("account", account).add("algorithm", algorithm).add("description", description).add("domain", domain).add("domainId", domainId).add("name", name).add("privatePort", privatePort).add("publicIP", publicIP).add("publicIPId", publicIPId).add("publicPort", publicPort).add("state", state).add("CIDRs", CIDRs).add("zoneId", zoneId); + } + + @Override + public String toString() { + return string().toString(); + } + +}
