http://git-wip-us.apache.org/repos/asf/stratos/blob/1d88fdf4/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java deleted file mode 100644 index 2b3fcdf..0000000 --- a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/PortForwardingRule.java +++ /dev/null @@ -1,432 +0,0 @@ -/* - * 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 PortForwardingRule - */ -public class PortForwardingRule implements Comparable<PortForwardingRule> { - - public static enum Protocol { - TCP, - UDP, - ICMP, - UNKNOWN; - - public static Protocol fromValue(String value) { - try { - return valueOf(value.toUpperCase()); - } catch (IllegalArgumentException e) { - return UNKNOWN; - } - } - - @Override - public String toString() { - return name().toLowerCase(); - } - } - - public static enum State { - STAGED, // Rule been created but has never got through network rule conflict detection. - // Rules in this state can not be sent to network elements. - ADD, // Add means the rule has been created and has gone through network rule conflict detection. - ACTIVE, // Rule has been sent to the network elements and reported to be active. - DELETING, // Revoke means this rule has been revoked. If this rule has been sent to the - // network elements, the rule will be deleted from database. - UNKNOWN; - - public static State fromValue(String value) { - try { - return valueOf(value.toUpperCase()); - } catch (IllegalArgumentException e) { - return UNKNOWN; - } - } - - @Override - public String toString() { - return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); - } - } - - public static Builder<?> builder() { - return new ConcreteBuilder(); - } - - public Builder<?> toBuilder() { - return new ConcreteBuilder().fromPortForwardingRule(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 privatePort; - protected Protocol protocol; - protected int publicPort; - protected State state; - protected String virtualMachineDisplayName; - protected String virtualMachineId; - protected String virtualMachineName; - protected Set<String> CIDRs = ImmutableSet.of(); - protected int privateEndPort; - protected int publicEndPort; - - /** - * @see PortForwardingRule#getId() - */ - public T id(String id) { - this.id = id; - return self(); - } - - /** - * @see PortForwardingRule#getIPAddress() - */ - public T IPAddress(String IPAddress) { - this.IPAddress = IPAddress; - return self(); - } - - /** - * @see PortForwardingRule#getIPAddressId() - */ - public T IPAddressId(String IPAddressId) { - this.IPAddressId = IPAddressId; - return self(); - } - - /** - * @see PortForwardingRule#getPrivatePort() - */ - public T privatePort(int privatePort) { - this.privatePort = privatePort; - return self(); - } - - /** - * @see PortForwardingRule#getProtocol() - */ - public T protocol(Protocol protocol) { - this.protocol = protocol; - return self(); - } - - /** - * @see PortForwardingRule#getPublicPort() - */ - public T publicPort(int publicPort) { - this.publicPort = publicPort; - return self(); - } - - /** - * @see PortForwardingRule#getState() - */ - public T state(State state) { - this.state = state; - return self(); - } - - /** - * @see PortForwardingRule#getVirtualMachineDisplayName() - */ - public T virtualMachineDisplayName(String virtualMachineDisplayName) { - this.virtualMachineDisplayName = virtualMachineDisplayName; - return self(); - } - - /** - * @see PortForwardingRule#getVirtualMachineId() - */ - public T virtualMachineId(String virtualMachineId) { - this.virtualMachineId = virtualMachineId; - return self(); - } - - /** - * @see PortForwardingRule#getVirtualMachineName() - */ - public T virtualMachineName(String virtualMachineName) { - this.virtualMachineName = virtualMachineName; - return self(); - } - - /** - * @see PortForwardingRule#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 PortForwardingRule#getPrivateEndPort() - */ - public T privateEndPort(int privateEndPort) { - this.privateEndPort = privateEndPort; - return self(); - } - - /** - * @see PortForwardingRule#getPublicEndPort() - */ - public T publicEndPort(int publicEndPort) { - this.publicEndPort = publicEndPort; - return self(); - } - - public PortForwardingRule build() { - return new PortForwardingRule(id, IPAddress, IPAddressId, privatePort, protocol, publicPort, state, virtualMachineDisplayName, - virtualMachineId, virtualMachineName, CIDRs, privateEndPort, publicEndPort); - } - - public T fromPortForwardingRule(PortForwardingRule in) { - return this - .id(in.getId()) - .IPAddress(in.getIPAddress()) - .IPAddressId(in.getIPAddressId()) - .privatePort(in.getPrivatePort()) - .protocol(in.getProtocol()) - .publicPort(in.getPublicPort()) - .state(in.getState()) - .virtualMachineDisplayName(in.getVirtualMachineDisplayName()) - .virtualMachineId(in.getVirtualMachineId()) - .virtualMachineName(in.getVirtualMachineName()) - .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 privatePort; - private final PortForwardingRule.Protocol protocol; - private final int publicPort; - private final PortForwardingRule.State state; - private final String virtualMachineDisplayName; - private final String virtualMachineId; - private final String virtualMachineName; - private final Set<String> CIDRs; - private final int privateEndPort; - private final int publicEndPort; - - @ConstructorProperties({ - "id", "ipaddress", "ipaddressid", "privateport", "protocol", "publicport", "state", "virtualmachinedisplayname", - "virtualmachineid", "virtualmachinename", "cidrlist", "privateendport", "publicendport" - }) - private PortForwardingRule(String id, @Nullable String IPAddress, @Nullable String IPAddressId, int privatePort, - @Nullable Protocol protocol, int publicPort, @Nullable State state, @Nullable String virtualMachineDisplayName, - @Nullable String virtualMachineId, @Nullable String virtualMachineName, @Nullable String CIDRs, - int privateEndPort, int publicEndPort) { - this(id, IPAddress, IPAddressId, privatePort, protocol, publicPort, state, virtualMachineDisplayName, virtualMachineId, - virtualMachineName, splitStringOnCommas(CIDRs), privateEndPort, publicEndPort); - } - - private static Set<String> splitStringOnCommas(String in) { - return in == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(in.split(",")); - } - - protected PortForwardingRule(String id, @Nullable String IPAddress, @Nullable String IPAddressId, int privatePort, - @Nullable Protocol protocol, int publicPort, @Nullable State state, - @Nullable String virtualMachineDisplayName, @Nullable String virtualMachineId, - @Nullable String virtualMachineName, @Nullable Set<String> CIDRs, int privateEndPort, int publicEndPort) { - this.id = checkNotNull(id, "id"); - this.IPAddress = IPAddress; - this.IPAddressId = IPAddressId; - this.privatePort = privatePort; - this.protocol = protocol; - this.publicPort = publicPort; - this.state = state; - this.virtualMachineDisplayName = virtualMachineDisplayName; - this.virtualMachineId = virtualMachineId; - this.virtualMachineName = virtualMachineName; - this.CIDRs = CIDRs == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(CIDRs); - this.privateEndPort = privateEndPort; - this.publicEndPort = publicEndPort; - } - - /** - * @return the ID of the port forwarding rule - */ - public String getId() { - return this.id; - } - - /** - * @return the public ip address for the port forwarding rule - */ - @Nullable - public String getIPAddress() { - return this.IPAddress; - } - - /** - * @return the public ip address id for the port forwarding rule - */ - @Nullable - public String getIPAddressId() { - return this.IPAddressId; - } - - /** - * @return the private port for the port forwarding rule - */ - public int getPrivatePort() { - return this.privatePort; - } - - /** - * @return the protocol of the port forwarding rule - */ - @Nullable - public Protocol getProtocol() { - return this.protocol; - } - - /** - * @return the public port for the port forwarding rule - */ - public int getPublicPort() { - return this.publicPort; - } - - /** - * @return the state of the rule - */ - @Nullable - public State getState() { - return this.state; - } - - /** - * @return the VM display name for the port forwarding rule - */ - @Nullable - public String getVirtualMachineDisplayName() { - return this.virtualMachineDisplayName; - } - - /** - * @return the VM ID for the port forwarding rule - */ - @Nullable - public String getVirtualMachineId() { - return this.virtualMachineId; - } - - /** - * @return the VM name for the port forwarding rule - */ - @Nullable - public String getVirtualMachineName() { - return this.virtualMachineName; - } - - /** - * @return the cidr list to forward traffic from - */ - public Set<String> getCIDRs() { - return this.CIDRs; - } - - /** - * @return the starting port of port forwarding rule's private port range - */ - public int getPrivateEndPort() { - return this.privateEndPort; - } - - /** - * @return the starting port of port forwarding rule's public port range - */ - public int getPublicEndPort() { - return this.publicEndPort; - } - - @Override - public int hashCode() { - return Objects.hashCode(id, IPAddress, IPAddressId, privatePort, protocol, publicPort, state, virtualMachineDisplayName, virtualMachineId, virtualMachineName, CIDRs, privateEndPort, publicEndPort); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - PortForwardingRule that = PortForwardingRule.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.privatePort, that.privatePort) - && Objects.equal(this.protocol, that.protocol) - && Objects.equal(this.publicPort, that.publicPort) - && 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.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("privatePort", privatePort) - .add("protocol", protocol).add("publicPort", publicPort).add("state", state).add("virtualMachineDisplayName", virtualMachineDisplayName) - .add("virtualMachineId", virtualMachineId).add("virtualMachineName", virtualMachineName).add("CIDRs", CIDRs) - .add("privateEndPort", privateEndPort).add("publicEndPort", publicEndPort); - } - - @Override - public String toString() { - return string().toString(); - } - - @Override - public int compareTo(PortForwardingRule o) { - return id.compareTo(o.getId()); - } -}
http://git-wip-us.apache.org/repos/asf/stratos/blob/1d88fdf4/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/Project.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/Project.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/Project.java deleted file mode 100644 index 29323a4..0000000 --- a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/Project.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * 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.CaseFormat; -import com.google.common.base.MoreObjects; -import com.google.common.base.MoreObjects.ToStringHelper; -import com.google.common.base.Objects; - -/** - * Representation of the API project response - */ -public class Project implements Comparable<Project> { - - public static enum State { - ACTIVE, DISABLED, SUSPENDED, UNRECOGNIZED; - - @Override - public String toString() { - return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()); - } - - public static State fromValue(String state) { - try { - return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state"))); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - - } - - public static Builder<?> builder() { - return new ConcreteBuilder(); - } - - public Builder<?> toBuilder() { - return new ConcreteBuilder().fromDomain(this); - } - - public abstract static class Builder<T extends Builder<T>> { - protected abstract T self(); - - protected String id; - protected String account; - protected String displayText; - protected String domain; - protected String domainId; - protected String name; - protected State state; - - /** - * @see org.jclouds.cloudstack.domain.Project#getId() - */ - public T id(String id) { - this.id = id; - return self(); - } - - /** - * @see org.jclouds.cloudstack.domain.Project#getName() - */ - public T name(String name) { - this.name = name; - return self(); - } - - /** - * @see org.jclouds.cloudstack.domain.Project#getDomainId() - */ - public T domainId(String domainId) { - this.domainId = domainId; - return self(); - } - - /** - * @see org.jclouds.cloudstack.domain.Project#getDomain() - */ - public T domain(String domain) { - this.domain = domain; - return self(); - } - - /** - * @see org.jclouds.cloudstack.domain.Project#getAccount() - */ - public T account(String account) { - this.account = account; - return self(); - } - - /** - * @see org.jclouds.cloudstack.domain.Project#getDisplayText() - */ - public T displayText(String displayText) { - this.displayText = displayText; - return self(); - } - - /** - * @see org.jclouds.cloudstack.domain.Project#getState() - */ - public T state(State state) { - this.state = state; - return self(); - } - - - public Project build() { - return new Project(id, account, displayText, domain, domainId, name, state); - } - - public T fromDomain(Project in) { - return this - .id(in.getId()) - .account(in.getAccount()) - .displayText(in.getDisplayText()) - .domain(in.getDomain()) - .domainId(in.getDomainId()) - .name(in.getName()) - .state(in.getState()); - } - } - - private static class ConcreteBuilder extends Builder<ConcreteBuilder> { - @Override - protected ConcreteBuilder self() { - return this; - } - } - - private final String id; - private final String account; - private final String displayText; - private final String domain; - private final String domainId; - private final String name; - private final State state; - - @ConstructorProperties({ - "id", "account", "displaytext", "domain", "domainid", "name", "state" - }) - protected Project(String id, String account, String displayText, String domain, String domainId, - String name, State state) { - this.id = checkNotNull(id, "id"); - this.account = account; - this.displayText = displayText; - this.domain = domain; - this.domainId = domainId; - this.name = name; - this.state = checkNotNull(state, "state"); - } - - public String getId() { - return this.id; - } - - @Nullable - public String getAccount() { - return this.account; - } - - @Nullable - public String getDisplayText() { - return this.displayText; - } - - @Nullable - public String getDomain() { - return this.domain; - } - - @Nullable - public String getDomainId() { - return this.domainId; - } - - @Nullable - public String getName() { - return this.name; - } - - public State getState() { - return this.state; - } - - @Override - public int hashCode() { - return Objects.hashCode(id, account, displayText, domain, domainId, name, state); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - Project that = Project.class.cast(obj); - return Objects.equal(this.id, that.id) - && Objects.equal(this.account, that.account) - && Objects.equal(this.displayText, that.displayText) - && Objects.equal(this.domain, that.domain) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.name, that.name) - && Objects.equal(this.state, that.state); - } - - protected ToStringHelper string() { - return MoreObjects.toStringHelper(this).omitNullValues() - .add("id", id).add("account", account).add("displayText", displayText) - .add("domain", domain).add("domainId", domainId).add("name", name).add("state", state); - } - - @Override - public String toString() { - return string().toString(); - } - - @Override - public int compareTo(Project other) { - return id.compareTo(other.getId()); - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/1d88fdf4/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/PublicIPAddress.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/PublicIPAddress.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/PublicIPAddress.java deleted file mode 100644 index 1d6cff3..0000000 --- a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/PublicIPAddress.java +++ /dev/null @@ -1,568 +0,0 @@ -/* - * 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.CaseFormat; -import com.google.common.base.MoreObjects; -import com.google.common.base.MoreObjects.ToStringHelper; -import com.google.common.base.Objects; - -/** - * Class PublicIPAddress - */ -public class PublicIPAddress { - - /** - */ - public static enum State { - ALLOCATING, ALLOCATED, RELEASING, 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 Builder<?> builder() { - return new ConcreteBuilder(); - } - - public Builder<?> toBuilder() { - return new ConcreteBuilder().fromPublicIPAddress(this); - } - - public abstract static class Builder<T extends Builder<T>> { - protected abstract T self(); - - protected String id; - protected String account; - protected Date allocated; - protected String associatedNetworkId; - protected String domain; - protected String domainId; - protected boolean usesVirtualNetwork; - protected String IPAddress; - protected boolean isSourceNAT; - protected boolean isStaticNAT; - protected String networkId; - protected PublicIPAddress.State state; - protected String virtualMachineDisplayName; - protected String virtualMachineId; - protected String virtualMachineName; - protected String VLANId; - protected String VLANName; - protected String zoneId; - protected String zoneName; - protected String jobId; - protected Integer jobStatus; - - /** - * @see PublicIPAddress#getId() - */ - public T id(String id) { - this.id = id; - return self(); - } - - /** - * @see PublicIPAddress#getAccount() - */ - public T account(String account) { - this.account = account; - return self(); - } - - /** - * @see PublicIPAddress#getAllocated() - */ - public T allocated(Date allocated) { - this.allocated = allocated; - return self(); - } - - /** - * @see PublicIPAddress#getAssociatedNetworkId() - */ - public T associatedNetworkId(String associatedNetworkId) { - this.associatedNetworkId = associatedNetworkId; - return self(); - } - - /** - * @see PublicIPAddress#getDomain() - */ - public T domain(String domain) { - this.domain = domain; - return self(); - } - - /** - * @see PublicIPAddress#getDomainId() - */ - public T domainId(String domainId) { - this.domainId = domainId; - return self(); - } - - /** - * @see PublicIPAddress#isUsesVirtualNetwork() - */ - public T usesVirtualNetwork(boolean usesVirtualNetwork) { - this.usesVirtualNetwork = usesVirtualNetwork; - return self(); - } - - /** - * @see PublicIPAddress#getIPAddress() - */ - public T IPAddress(String IPAddress) { - this.IPAddress = IPAddress; - return self(); - } - - /** - * @see PublicIPAddress#isSourceNAT() - */ - public T isSourceNAT(boolean isSourceNAT) { - this.isSourceNAT = isSourceNAT; - return self(); - } - - /** - * @see PublicIPAddress#isStaticNAT() - */ - public T isStaticNAT(boolean isStaticNAT) { - this.isStaticNAT = isStaticNAT; - return self(); - } - - /** - * @see PublicIPAddress#getNetworkId() - */ - public T networkId(String networkId) { - this.networkId = networkId; - return self(); - } - - /** - * @see PublicIPAddress#getState() - */ - public T state(PublicIPAddress.State state) { - this.state = state; - return self(); - } - - /** - * @see PublicIPAddress#getVirtualMachineDisplayName() - */ - public T virtualMachineDisplayName(String virtualMachineDisplayName) { - this.virtualMachineDisplayName = virtualMachineDisplayName; - return self(); - } - - /** - * @see PublicIPAddress#getVirtualMachineId() - */ - public T virtualMachineId(String virtualMachineId) { - this.virtualMachineId = virtualMachineId; - return self(); - } - - /** - * @see PublicIPAddress#getVirtualMachineName() - */ - public T virtualMachineName(String virtualMachineName) { - this.virtualMachineName = virtualMachineName; - return self(); - } - - /** - * @see PublicIPAddress#getVLANId() - */ - public T VLANId(String VLANId) { - this.VLANId = VLANId; - return self(); - } - - /** - * @see PublicIPAddress#getVLANName() - */ - public T VLANName(String VLANName) { - this.VLANName = VLANName; - return self(); - } - - /** - * @see PublicIPAddress#getZoneId() - */ - public T zoneId(String zoneId) { - this.zoneId = zoneId; - return self(); - } - - /** - * @see PublicIPAddress#getZoneName() - */ - public T zoneName(String zoneName) { - this.zoneName = zoneName; - return self(); - } - - /** - * @see PublicIPAddress#getJobId() - */ - public T jobId(String jobId) { - this.jobId = jobId; - return self(); - } - - /** - * @see PublicIPAddress#getJobStatus() - */ - public T jobStatus(Integer jobStatus) { - this.jobStatus = jobStatus; - return self(); - } - - public PublicIPAddress build() { - return new PublicIPAddress(id, account, allocated, associatedNetworkId, domain, domainId, usesVirtualNetwork, IPAddress, isSourceNAT, isStaticNAT, networkId, state, virtualMachineDisplayName, virtualMachineId, virtualMachineName, VLANId, VLANName, zoneId, zoneName, jobId, jobStatus); - } - - public T fromPublicIPAddress(PublicIPAddress in) { - return this - .id(in.getId()) - .account(in.getAccount()) - .allocated(in.getAllocated()) - .associatedNetworkId(in.getAssociatedNetworkId()) - .domain(in.getDomain()) - .domainId(in.getDomainId()) - .usesVirtualNetwork(in.isUsesVirtualNetwork()) - .IPAddress(in.getIPAddress()) - .isSourceNAT(in.isSourceNAT()) - .isStaticNAT(in.isStaticNAT()) - .networkId(in.getNetworkId()) - .state(in.getState()) - .virtualMachineDisplayName(in.getVirtualMachineDisplayName()) - .virtualMachineId(in.getVirtualMachineId()) - .virtualMachineName(in.getVirtualMachineName()) - .VLANId(in.getVLANId()) - .VLANName(in.getVLANName()) - .zoneId(in.getZoneId()) - .zoneName(in.getZoneName()) - .jobId(in.getJobId()) - .jobStatus(in.getJobStatus()); - } - } - - private static class ConcreteBuilder extends Builder<ConcreteBuilder> { - @Override - protected ConcreteBuilder self() { - return this; - } - } - - private final String id; - private final String account; - private final Date allocated; - private final String associatedNetworkId; - private final String domain; - private final String domainId; - private final boolean usesVirtualNetwork; - private final String IPAddress; - private final boolean isSourceNAT; - private final boolean isStaticNAT; - private final String networkId; - private final PublicIPAddress.State state; - private final String virtualMachineDisplayName; - private final String virtualMachineId; - private final String virtualMachineName; - private final String VLANId; - private final String VLANName; - private final String zoneId; - private final String zoneName; - private final String jobId; - private final Integer jobStatus; - - @ConstructorProperties({ - "id", "account", "allocated", "associatednetworkid", "domain", "domainid", "forvirtualnetwork", "ipaddress", "issourcenat", - "isstaticnat", "networkid", "state", "virtualmachinedisplayname", "virtualmachineid", "virtualmachinename", "VLANid", - "VLANname", "zoneid", "zonename", "jobid", "jobstatus" - }) - protected PublicIPAddress(String id, @Nullable String account, @Nullable Date allocated, @Nullable String associatedNetworkId, - @Nullable String domain, @Nullable String domainId, boolean usesVirtualNetwork, @Nullable String IPAddress, - boolean isSourceNAT, boolean isStaticNAT, @Nullable String networkId, @Nullable PublicIPAddress.State state, - @Nullable String virtualMachineDisplayName, @Nullable String virtualMachineId, @Nullable String virtualMachineName, - @Nullable String VLANId, @Nullable String VLANName, @Nullable String zoneId, @Nullable String zoneName, - @Nullable String jobId, @Nullable Integer jobStatus) { - this.id = checkNotNull(id, "id"); - this.account = account; - this.allocated = allocated; - this.associatedNetworkId = associatedNetworkId; - this.domain = domain; - this.domainId = domainId; - this.usesVirtualNetwork = usesVirtualNetwork; - this.IPAddress = IPAddress; - this.isSourceNAT = isSourceNAT; - this.isStaticNAT = isStaticNAT; - this.networkId = networkId; - this.state = state; - this.virtualMachineDisplayName = virtualMachineDisplayName; - this.virtualMachineId = virtualMachineId; - this.virtualMachineName = virtualMachineName; - this.VLANId = VLANId; - this.VLANName = VLANName; - this.zoneId = zoneId; - this.zoneName = zoneName; - this.jobId = jobId; - this.jobStatus = jobStatus; - } - - /** - * @return public IP address id - */ - public String getId() { - return this.id; - } - - /** - * @return the account the public IP address is associated with - */ - @Nullable - public String getAccount() { - return this.account; - } - - /** - * @return date the public IP address was acquired - */ - @Nullable - public Date getAllocated() { - return this.allocated; - } - - /** - * @return the ID of the Network associated with the IP address - */ - @Nullable - public String getAssociatedNetworkId() { - return this.associatedNetworkId; - } - - /** - * @return the domain the public IP address is associated with - */ - @Nullable - public String getDomain() { - return this.domain; - } - - /** - * @return the domain ID the public IP address is associated with - */ - @Nullable - public String getDomainId() { - return this.domainId; - } - - /** - * @return uses virtual network - */ - public boolean isUsesVirtualNetwork() { - return this.usesVirtualNetwork; - } - - /** - * @return public IP address - */ - @Nullable - public String getIPAddress() { - return this.IPAddress; - } - - /** - * @return true if the IP address is a source nat address, false otherwise - */ - public boolean isSourceNAT() { - return this.isSourceNAT; - } - - /** - * @return true if this ip is for static nat, false otherwise - */ - public boolean isStaticNAT() { - return this.isStaticNAT; - } - - /** - * @return the ID of the Network where ip belongs to - */ - @Nullable - public String getNetworkId() { - return this.networkId; - } - - /** - * @return State of the ip address. Can be: Allocating, Allocated and - * Releasing - */ - @Nullable - public PublicIPAddress.State getState() { - return this.state; - } - - /** - * @return virtual machine display name the ip address is assigned to (not - * null only for static nat Ip) - */ - @Nullable - public String getVirtualMachineDisplayName() { - return this.virtualMachineDisplayName; - } - - /** - * @return virtual machine id the ip address is assigned to (not null only - * for static nat Ip) - */ - @Nullable - public String getVirtualMachineId() { - return this.virtualMachineId; - } - - /** - * @return virtual machine name the ip address is assigned to (not null only - * for static nat Ip) - */ - @Nullable - public String getVirtualMachineName() { - return this.virtualMachineName; - } - - /** - * @return the ID of the VLAN associated with the IP address - */ - @Nullable - public String getVLANId() { - return this.VLANId; - } - - /** - * @return the VLAN associated with the IP address - */ - @Nullable - public String getVLANName() { - return this.VLANName; - } - - /** - * @return the ID of the zone the public IP address belongs to - */ - @Nullable - public String getZoneId() { - return this.zoneId; - } - - /** - * @return the name of the zone the public IP address belongs to - */ - @Nullable - public String getZoneName() { - return this.zoneName; - } - - /** - * @return shows the current pending asynchronous job ID. This tag is not - * returned if no current pending jobs are acting on the virtual - * machine - */ - @Nullable - public String getJobId() { - return this.jobId; - } - - /** - * @return shows the current pending asynchronous job status - */ - @Nullable - public Integer getJobStatus() { - return this.jobStatus; - } - - @Override - public int hashCode() { - return Objects.hashCode(id, account, allocated, associatedNetworkId, domain, domainId, usesVirtualNetwork, IPAddress, isSourceNAT, isStaticNAT, networkId, state, virtualMachineDisplayName, virtualMachineId, virtualMachineName, VLANId, VLANName, zoneId, zoneName, jobId, jobStatus); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - PublicIPAddress that = PublicIPAddress.class.cast(obj); - return Objects.equal(this.id, that.id) - && Objects.equal(this.account, that.account) - && Objects.equal(this.allocated, that.allocated) - && Objects.equal(this.associatedNetworkId, that.associatedNetworkId) - && Objects.equal(this.domain, that.domain) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.usesVirtualNetwork, that.usesVirtualNetwork) - && Objects.equal(this.IPAddress, that.IPAddress) - && Objects.equal(this.isSourceNAT, that.isSourceNAT) - && Objects.equal(this.isStaticNAT, that.isStaticNAT) - && Objects.equal(this.networkId, that.networkId) - && 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.VLANId, that.VLANId) - && Objects.equal(this.VLANName, that.VLANName) - && Objects.equal(this.zoneId, that.zoneId) - && Objects.equal(this.zoneName, that.zoneName) - && Objects.equal(this.jobId, that.jobId) - && Objects.equal(this.jobStatus, that.jobStatus); - } - - protected ToStringHelper string() { - return MoreObjects.toStringHelper(this) - .add("id", id).add("account", account).add("allocated", allocated).add("associatedNetworkId", associatedNetworkId) - .add("domain", domain).add("domainId", domainId).add("usesVirtualNetwork", usesVirtualNetwork).add("IPAddress", IPAddress) - .add("isSourceNAT", isSourceNAT).add("isStaticNAT", isStaticNAT).add("networkId", networkId).add("state", state) - .add("virtualMachineDisplayName", virtualMachineDisplayName).add("virtualMachineId", virtualMachineId) - .add("virtualMachineName", virtualMachineName).add("VLANId", VLANId).add("VLANName", VLANName).add("zoneId", zoneId) - .add("zoneName", zoneName).add("jobId", jobId).add("jobStatus", jobStatus); - } - - @Override - public String toString() { - return string().toString(); - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/1d88fdf4/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java deleted file mode 100644 index 9d59faf..0000000 --- a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * 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.Map; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.base.Function; -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; -import com.google.common.collect.Maps; - -/** - * Class ResourceLimit - */ -public class ResourceLimit { - - /** - * Type of resource to update. - */ - public enum ResourceType { - /** - * 0 - Instance. Number of instances a user can create. - */ - INSTANCE(0), - /** - * 1 - IP. Number of public IP addresses a user can own. - */ - IP(1), - /** - * 2 - Volume. Number of disk volumes a user can create. - */ - VOLUME(2), - /** - * 3 - Snapshot. Number of snapshots a user can create. - */ - SNAPSHOT(3), - /** - * 4 - Template. Number of templates that a user can register/create. - */ - TEMPLATE(4), - /** - * 5 - Projects. - */ - PROJECT(5), - /** - * 6 - Networks. - */ - NETWORK(6), - /** - * 7 - VPC. Number of VPC the user can own. - */ - VPC(7), - /** - * 8 - CPU. The number of CPUs the user can allocate. - */ - CPU(8), - /** - * 9 - Memory. The amount of memory the user can allocate. - */ - MEMORY(9), - /** - * 10 - Primary storage. - */ - PRIMARY_STORAGE(10), - /** - * 11 - Secondary storage. - */ - SECONDARY_STORAGE(11), - - UNRECOGNIZED(Integer.MAX_VALUE); - - private int code; - - private static final Map<Integer, ResourceType> INDEX = Maps.uniqueIndex(ImmutableSet.copyOf(ResourceType.values()), - new Function<ResourceType, Integer>() { - - @Override - public Integer apply(ResourceType input) { - return input.code; - } - - }); - - ResourceType(int code) { - this.code = code; - } - - public int getCode() { - return code; - } - - @Override - public String toString() { - return name(); - } - - public static ResourceType fromValue(String resourceType) { - Integer code = Integer.valueOf(checkNotNull(resourceType, "resourcetype")); - return INDEX.containsKey(code) ? INDEX.get(code) : UNRECOGNIZED; - } - } - - public static Builder<?> builder() { - return new ConcreteBuilder(); - } - - public Builder<?> toBuilder() { - return new ConcreteBuilder().fromResourceLimit(this); - } - - public abstract static class Builder<T extends Builder<T>> { - protected abstract T self(); - - protected String account; - protected String domain; - protected String domainId; - protected int max; - protected ResourceType resourceType; - - /** - * @see ResourceLimit#getAccount() - */ - public T account(String account) { - this.account = account; - return self(); - } - - /** - * @see ResourceLimit#getDomain() - */ - public T domain(String domain) { - this.domain = domain; - return self(); - } - - /** - * @see ResourceLimit#getDomainId() - */ - public T domainId(String domainId) { - this.domainId = domainId; - return self(); - } - - /** - * @see ResourceLimit#getMax() - */ - public T max(int max) { - this.max = max; - return self(); - } - - /** - * @see ResourceLimit#getResourceType() - */ - public T resourceType(ResourceType resourceType) { - this.resourceType = resourceType; - return self(); - } - - public ResourceLimit build() { - return new ResourceLimit(account, domain, domainId, max, resourceType); - } - - public T fromResourceLimit(ResourceLimit in) { - return this - .account(in.getAccount()) - .domain(in.getDomain()) - .domainId(in.getDomainId()) - .max(in.getMax()) - .resourceType(in.getResourceType()); - } - } - - private static class ConcreteBuilder extends Builder<ConcreteBuilder> { - @Override - protected ConcreteBuilder self() { - return this; - } - } - - private final String account; - private final String domain; - private final String domainId; - private final int max; - private final ResourceLimit.ResourceType resourceType; - - @ConstructorProperties({ - "account", "domain", "domainid", "max", "resourcetype" - }) - protected ResourceLimit(@Nullable String account, @Nullable String domain, @Nullable String domainId, int max, - @Nullable ResourceType resourceType) { - this.account = account; - this.domain = domain; - this.domainId = domainId; - this.max = max; - this.resourceType = resourceType; - } - - @Nullable - public String getAccount() { - return this.account; - } - - @Nullable - public String getDomain() { - return this.domain; - } - - @Nullable - public String getDomainId() { - return this.domainId; - } - - public int getMax() { - return this.max; - } - - @Nullable - public ResourceType getResourceType() { - return this.resourceType; - } - - @Override - public int hashCode() { - return Objects.hashCode(account, domain, domainId, max, resourceType); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - ResourceLimit that = ResourceLimit.class.cast(obj); - return Objects.equal(this.account, that.account) - && Objects.equal(this.domain, that.domain) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.max, that.max) - && Objects.equal(this.resourceType, that.resourceType); - } - - protected ToStringHelper string() { - return MoreObjects.toStringHelper(this) - .add("account", account).add("domain", domain).add("domainId", domainId).add("max", max).add("resourceType", resourceType); - } - - @Override - public String toString() { - return string().toString(); - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/1d88fdf4/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/SecurityGroup.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/SecurityGroup.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/SecurityGroup.java deleted file mode 100644 index 356fb00..0000000 --- a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/SecurityGroup.java +++ /dev/null @@ -1,289 +0,0 @@ -/* - * 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; -import com.google.common.collect.ImmutableSortedSet; - -/** - * Class SecurityGroup - */ -public class SecurityGroup implements Comparable<SecurityGroup> { - - public static Builder<?> builder() { - return new ConcreteBuilder(); - } - - public Builder<?> toBuilder() { - return new ConcreteBuilder().fromSecurityGroup(this); - } - - public abstract static class Builder<T extends Builder<T>> { - protected abstract T self(); - - protected String id; - protected String account; - protected String name; - protected String description; - protected String domain; - protected String domainId; - protected String jobId; - protected Integer jobStatus; - protected Set<IngressRule> ingressRules; - - /** - * @see SecurityGroup#getId() - */ - public T id(String id) { - this.id = id; - return self(); - } - - /** - * @see SecurityGroup#getAccount() - */ - public T account(String account) { - this.account = account; - return self(); - } - - /** - * @see SecurityGroup#getName() - */ - public T name(String name) { - this.name = name; - return self(); - } - - /** - * @see SecurityGroup#getDescription() - */ - public T description(String description) { - this.description = description; - return self(); - } - - /** - * @see SecurityGroup#getDomain() - */ - public T domain(String domain) { - this.domain = domain; - return self(); - } - - /** - * @see SecurityGroup#getDomainId() - */ - public T domainId(String domainId) { - this.domainId = domainId; - return self(); - } - - /** - * @see SecurityGroup#getJobId() - */ - public T jobId(String jobId) { - this.jobId = jobId; - return self(); - } - - /** - * @see SecurityGroup#getJobStatus() - */ - public T jobStatus(Integer jobStatus) { - this.jobStatus = jobStatus; - return self(); - } - - /** - * @see SecurityGroup#getIngressRules() - */ - public T ingressRules(Set<IngressRule> ingressRules) { - this.ingressRules = ingressRules; - return self(); - } - - public SecurityGroup build() { - return new SecurityGroup(id, account, name, description, domain, domainId, jobId, jobStatus, ingressRules); - } - - public T fromSecurityGroup(SecurityGroup in) { - return this - .id(in.getId()) - .account(in.getAccount()) - .name(in.getName()) - .description(in.getDescription()) - .domain(in.getDomain()) - .domainId(in.getDomainId()) - .jobId(in.getJobId()) - .jobStatus(in.getJobStatus()) - .ingressRules(in.getIngressRules()); - } - } - - private static class ConcreteBuilder extends Builder<ConcreteBuilder> { - @Override - protected ConcreteBuilder self() { - return this; - } - } - - private final String id; - private final String account; - private final String name; - private final String description; - private final String domain; - private final String domainId; - private final String jobId; - private final Integer jobStatus; - private final Set<IngressRule> ingressRules; - - @ConstructorProperties({ - "id", "account", "name", "description", "domain", "domainid", "jobid", "jobstatus", "ingressrule" - }) - protected SecurityGroup(String id, @Nullable String account, @Nullable String name, @Nullable String description, - @Nullable String domain, @Nullable String domainId, @Nullable String jobId, @Nullable Integer jobStatus, - @Nullable Set<IngressRule> ingressRules) { - this.id = checkNotNull(id, "id"); - this.account = account; - this.name = name; - this.description = description; - this.domain = domain; - this.domainId = domainId; - this.jobId = jobId; - this.jobStatus = jobStatus; - this.ingressRules = ingressRules == null ? ImmutableSet.<IngressRule>of() : ImmutableSortedSet.copyOf(ingressRules); - } - - /** - * @return the id of the security group - */ - public String getId() { - return this.id; - } - - /** - * @return the account owning the security group - */ - @Nullable - public String getAccount() { - return this.account; - } - - /** - * @return the name of the security group - */ - @Nullable - public String getName() { - return this.name; - } - - /** - * @return an alternate display text of the security group. - */ - @Nullable - public String getDescription() { - return this.description; - } - - /** - * @return Domain name for the security group - */ - @Nullable - public String getDomain() { - return this.domain; - } - - /** - * @return the domain id of the security group - */ - @Nullable - public String getDomainId() { - return this.domainId; - } - - /** - * @return shows the current pending asynchronous job ID. This tag is not - * returned if no current pending jobs are acting on the virtual - * machine - */ - @Nullable - public String getJobId() { - return this.jobId; - } - - /** - * @return shows the current pending asynchronous job status - */ - @Nullable - public Integer getJobStatus() { - return this.jobStatus; - } - - /** - * @return the list of ingress rules associated with the security group - */ - public Set<IngressRule> getIngressRules() { - return this.ingressRules; - } - - @Override - public int hashCode() { - return Objects.hashCode(id, account, name, description, domain, domainId, jobId, jobStatus, ingressRules); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - SecurityGroup that = SecurityGroup.class.cast(obj); - return Objects.equal(this.id, that.id) - && Objects.equal(this.account, that.account) - && Objects.equal(this.name, that.name) - && Objects.equal(this.description, that.description) - && Objects.equal(this.domain, that.domain) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.jobId, that.jobId) - && Objects.equal(this.jobStatus, that.jobStatus) - && Objects.equal(this.ingressRules, that.ingressRules); - } - - protected ToStringHelper string() { - return MoreObjects.toStringHelper(this).add("id", id).add("account", account).add("name", name).add("description", description) - .add("domain", domain).add("domainId", domainId).add("jobId", jobId).add("jobStatus", jobStatus).add("ingressRules", ingressRules); - } - - @Override - public String toString() { - return string().toString(); - } - - @Override - public int compareTo(SecurityGroup o) { - return id.compareTo(o.getId()); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/1d88fdf4/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ServiceOffering.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ServiceOffering.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ServiceOffering.java deleted file mode 100644 index d17ccca..0000000 --- a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/ServiceOffering.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * 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 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 ServiceOffering - */ -public class ServiceOffering implements Comparable<ServiceOffering> { - - public static Builder<?> builder() { - return new ConcreteBuilder(); - } - - public Builder<?> toBuilder() { - return new ConcreteBuilder().fromServiceOffering(this); - } - - public abstract static class Builder<T extends Builder<T>> { - protected abstract T self(); - - protected String id; - protected String name; - protected String displayText; - protected Date created; - protected String domain; - protected String domainId; - protected int cpuNumber; - protected int cpuSpeed; - protected int memory; - protected boolean haSupport; - protected StorageType storageType; - protected boolean defaultUse; - protected boolean systemOffering; - protected boolean cpuUseLimited; - protected long networkRate; - protected boolean systemVmType; - protected ImmutableSet.Builder<String> tags = ImmutableSet.<String>builder(); - - /** - * @see ServiceOffering#getId() - */ - public T id(String id) { - this.id = id; - return self(); - } - - /** - * @see ServiceOffering#getName() - */ - public T name(String name) { - this.name = name; - return self(); - } - - /** - * @see ServiceOffering#getDisplayText() - */ - public T displayText(String displayText) { - this.displayText = displayText; - return self(); - } - - /** - * @see ServiceOffering#getCreated() - */ - public T created(Date created) { - this.created = created; - return self(); - } - - /** - * @see ServiceOffering#getDomain() - */ - public T domain(String domain) { - this.domain = domain; - return self(); - } - - /** - * @see ServiceOffering#getDomainId() - */ - public T domainId(String domainId) { - this.domainId = domainId; - return self(); - } - - /** - * @see ServiceOffering#getCpuNumber() - */ - public T cpuNumber(int cpuNumber) { - this.cpuNumber = cpuNumber; - return self(); - } - - /** - * @see ServiceOffering#getCpuSpeed() - */ - public T cpuSpeed(int cpuSpeed) { - this.cpuSpeed = cpuSpeed; - return self(); - } - - /** - * @see ServiceOffering#getMemory() - */ - public T memory(int memory) { - this.memory = memory; - return self(); - } - - /** - * @see ServiceOffering#supportsHA() - */ - public T supportsHA(boolean haSupport) { - this.haSupport = haSupport; - return self(); - } - - /** - * @see ServiceOffering#getStorageType() - */ - public T storageType(StorageType storageType) { - this.storageType = storageType; - return self(); - } - - /** - * @see ServiceOffering#getTags() - */ - public T tags(Iterable<String> tags) { - this.tags = ImmutableSet.<String>builder().addAll(tags); - return self(); - } - - /** - * @see ServiceOffering#getTags() - */ - public T tag(String tag) { - this.tags.add(tag); - return self(); - } - - /** - * @see ServiceOffering#isDefaultUse() - */ - public T defaultUse(boolean defaultUse) { - this.defaultUse = defaultUse; - return self(); - } - - /** - * @see ServiceOffering#isSystemOffering() - */ - public T systemOffering(boolean systemOffering) { - this.systemOffering = systemOffering; - return self(); - } - - /** - * @see ServiceOffering#isCpuUseLimited() - */ - public T cpuUseLimited(boolean cpuUseLimited) { - this.cpuUseLimited = cpuUseLimited; - return self(); - } - - /** - * @see ServiceOffering#getNetworkRate() - */ - public T networkRate(long networkRate) { - this.networkRate = networkRate; - return self(); - } - - /** - * @see ServiceOffering#isSystemVmType() - */ - public T systemVmType(boolean systemVmType) { - this.systemVmType = systemVmType; - return self(); - } - - public ServiceOffering build() { - return new ServiceOffering(id, name, displayText, created, domain, domainId, cpuNumber, cpuSpeed, memory, haSupport, storageType, - tags.build(), defaultUse, systemOffering, cpuUseLimited, networkRate, systemVmType); - } - - public T fromServiceOffering(ServiceOffering in) { - return this - .id(in.getId()) - .name(in.getName()) - .displayText(in.getDisplayText()) - .created(in.getCreated()) - .domain(in.getDomain()) - .domainId(in.getDomainId()) - .cpuNumber(in.getCpuNumber()) - .cpuSpeed(in.getCpuSpeed()) - .memory(in.getMemory()) - .supportsHA(in.supportsHA()) - .storageType(in.getStorageType()) - .tags(in.getTags()) - .defaultUse(in.isDefaultUse()) - .systemOffering(in.isSystemOffering()) - .cpuUseLimited(in.isCpuUseLimited()) - .networkRate(in.getNetworkRate()) - .systemVmType(in.isSystemVmType()); - } - } - - private static class ConcreteBuilder extends Builder<ConcreteBuilder> { - @Override - protected ConcreteBuilder self() { - return this; - } - } - - private final String id; - private final String name; - private final String displayText; - private final Date created; - private final String domain; - private final String domainId; - private final int cpuNumber; - private final int cpuSpeed; - private final int memory; - private final boolean haSupport; - private final StorageType storageType; - private final Set<String> tags; - private final boolean defaultUse; - private final boolean systemOffering; - private final boolean cpuUseLimited; - private final long networkRate; - private final boolean systemVmType; - - @ConstructorProperties({ - "id", "name", "displaytext", "created", "domain", "domainid", "cpunumber", "cpuspeed", "memory", "offerha", "storagetype", "tags", "defaultuse", "issystem", "limitcpuuse", "networkrate", "systemvmtype" - }) - protected ServiceOffering(String id, @Nullable String name, @Nullable String displayText, @Nullable Date created, - @Nullable String domain, @Nullable String domainId, int cpuNumber, int cpuSpeed, int memory, - boolean haSupport, @Nullable StorageType storageType, @Nullable Iterable<String> tags, boolean defaultUse, - boolean systemOffering, boolean cpuUseLimited, long networkRate, boolean systemVmType) { - this.id = checkNotNull(id, "id"); - this.name = name; - this.displayText = displayText; - this.created = created; - this.domain = domain; - this.domainId = domainId; - this.cpuNumber = cpuNumber; - this.cpuSpeed = cpuSpeed; - this.memory = memory; - this.haSupport = haSupport; - this.storageType = storageType; - this.tags = tags != null ? ImmutableSet.copyOf(tags) : ImmutableSet.<String> of(); - this.defaultUse = defaultUse; - this.systemOffering = systemOffering; - this.cpuUseLimited = cpuUseLimited; - this.networkRate = networkRate; - this.systemVmType = systemVmType; - } - - /** - * @return the id of the service offering - */ - public String getId() { - return this.id; - } - - /** - * @return the name of the service offering - */ - public String getName() { - return this.name; - } - - /** - * @return an alternate display text of the service offering. - */ - @Nullable - public String getDisplayText() { - return this.displayText; - } - - /** - * @return the date this service offering was created - */ - @Nullable - public Date getCreated() { - return this.created; - } - - /** - * @return Domain name for the offering - */ - @Nullable - public String getDomain() { - return this.domain; - } - - /** - * @return the domain id of the service offering - */ - @Nullable - public String getDomainId() { - return this.domainId; - } - - /** - * @return the number of CPU - */ - public int getCpuNumber() { - return this.cpuNumber; - } - - /** - * @return the clock rate CPU speed in Mhz - */ - public int getCpuSpeed() { - return this.cpuSpeed; - } - - /** - * @return the memory in MB - */ - public int getMemory() { - return this.memory; - } - - public boolean supportsHA() { - return this.haSupport; - } - - /** - * @return the storage type for this service offering - */ - @Nullable - public StorageType getStorageType() { - return this.storageType; - } - - /** - * @return the tags for the service offering - */ - public Set<String> getTags() { - return tags; - } - - /** - * @return whether this is a default system vm offering - */ - public boolean isDefaultUse() { - return this.defaultUse; - } - - /** - * @return whether this is a system vm offering - */ - public boolean isSystemOffering() { - return this.systemOffering; - } - - /** - * @return whether restrict the CPU usage to committed service offering - */ - public boolean isCpuUseLimited() { - return this.cpuUseLimited; - } - - /** - * @return data transfer rate in megabits per second allowed. - */ - public long getNetworkRate() { - return this.networkRate; - } - - /** - * @return whether this is a the systemvm type for system vm offering - */ - public boolean isSystemVmType() { - return this.systemVmType; - } - - @Override - public int hashCode() { - return Objects.hashCode(id, name, displayText, created, domain, domainId, cpuNumber, cpuSpeed, memory, haSupport, storageType, tags, defaultUse, systemOffering, cpuUseLimited, networkRate, systemVmType); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - ServiceOffering that = ServiceOffering.class.cast(obj); - return Objects.equal(this.id, that.id) - && Objects.equal(this.name, that.name) - && Objects.equal(this.displayText, that.displayText) - && Objects.equal(this.created, that.created) - && Objects.equal(this.domain, that.domain) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.cpuNumber, that.cpuNumber) - && Objects.equal(this.cpuSpeed, that.cpuSpeed) - && Objects.equal(this.memory, that.memory) - && Objects.equal(this.haSupport, that.haSupport) - && Objects.equal(this.storageType, that.storageType) - && Objects.equal(this.getTags(), that.getTags()) - && Objects.equal(this.defaultUse, that.defaultUse) - && Objects.equal(this.systemOffering, that.systemOffering) - && Objects.equal(this.cpuUseLimited, that.cpuUseLimited) - && Objects.equal(this.networkRate, that.networkRate) - && Objects.equal(this.systemVmType, that.systemVmType); - } - - protected ToStringHelper string() { - return MoreObjects.toStringHelper(this) - .add("id", id).add("name", name).add("displayText", displayText).add("created", created).add("domain", domain) - .add("domainId", domainId).add("cpuNumber", cpuNumber).add("cpuSpeed", cpuSpeed).add("memory", memory) - .add("haSupport", haSupport).add("storageType", storageType).add("tags", getTags()).add("defaultUse", defaultUse) - .add("systemOffering", systemOffering).add("cpuUseLimited", cpuUseLimited) - .add("networkRate", networkRate).add("systemVmType", systemVmType); - } - - @Override - public String toString() { - return string().toString(); - } - - @Override - public int compareTo(ServiceOffering o) { - return id.compareTo(o.getId()); - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/1d88fdf4/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/Snapshot.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/Snapshot.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/Snapshot.java deleted file mode 100644 index d832a2a..0000000 --- a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/main/java/org/jclouds/cloudstack/domain/Snapshot.java +++ /dev/null @@ -1,442 +0,0 @@ -/* - * 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.CaseFormat; -import com.google.common.base.MoreObjects; -import com.google.common.base.MoreObjects.ToStringHelper; -import com.google.common.base.Objects; - -/** - * Class Snapshot - */ -public class Snapshot { - - /** - */ - public static enum State { - - BACKED_UP, CREATING, BACKING_UP, 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 Type { - - MANUAL, RECURRING, UNRECOGNIZED; - - public static Type fromValue(String type) { - try { - return valueOf(checkNotNull(type, "type")); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - } - - /** - */ - public static enum Interval { - - HOURLY, DAILY, WEEKLY, MONTHLY, template, none, UNRECOGNIZED; - - public static Interval fromValue(String type) { - try { - return valueOf(checkNotNull(type, "type")); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - } - - public static Builder<?> builder() { - return new ConcreteBuilder(); - } - - public Builder<?> toBuilder() { - return new ConcreteBuilder().fromSnapshot(this); - } - - public abstract static class Builder<T extends Builder<T>> { - protected abstract T self(); - - protected String id; - protected String account; - protected Date created; - protected String domain; - protected String domainId; - protected Snapshot.Interval interval; - protected String jobId; - protected String jobStatus; - protected String name; - protected Snapshot.Type snapshotType; - protected Snapshot.State state; - protected String volumeId; - protected String volumeName; - protected Volume.Type volumeType; - - /** - * @see Snapshot#getId() - */ - public T id(String id) { - this.id = id; - return self(); - } - - /** - * @see Snapshot#getAccount() - */ - public T account(String account) { - this.account = account; - return self(); - } - - /** - * @see Snapshot#getCreated() - */ - public T created(Date created) { - this.created = created; - return self(); - } - - /** - * @see Snapshot#getDomain() - */ - public T domain(String domain) { - this.domain = domain; - return self(); - } - - /** - * @see Snapshot#getDomainId() - */ - public T domainId(String domainId) { - this.domainId = domainId; - return self(); - } - - /** - * @see Snapshot#getInterval() - */ - public T interval(Snapshot.Interval interval) { - this.interval = interval; - return self(); - } - - /** - * @see Snapshot#getJobId() - */ - public T jobId(String jobId) { - this.jobId = jobId; - return self(); - } - - /** - * @see Snapshot#getJobStatus() - */ - public T jobStatus(String jobStatus) { - this.jobStatus = jobStatus; - return self(); - } - - /** - * @see Snapshot#getName() - */ - public T name(String name) { - this.name = name; - return self(); - } - - /** - * @see Snapshot#getSnapshotType() - */ - public T snapshotType(Snapshot.Type snapshotType) { - this.snapshotType = snapshotType; - return self(); - } - - /** - * @see Snapshot#getState() - */ - public T state(Snapshot.State state) { - this.state = state; - return self(); - } - - /** - * @see Snapshot#getVolumeId() - */ - public T volumeId(String volumeId) { - this.volumeId = volumeId; - return self(); - } - - /** - * @see Snapshot#getVolumeName() - */ - public T volumeName(String volumeName) { - this.volumeName = volumeName; - return self(); - } - - /** - * @see Snapshot#getVolumeType() - */ - public T volumeType(Volume.Type volumeType) { - this.volumeType = volumeType; - return self(); - } - - public Snapshot build() { - return new Snapshot(id, account, created, domain, domainId, interval, jobId, jobStatus, name, snapshotType, state, - volumeId, volumeName, volumeType); - } - - public T fromSnapshot(Snapshot in) { - return this - .id(in.getId()) - .account(in.getAccount()) - .created(in.getCreated()) - .domain(in.getDomain()) - .domainId(in.getDomainId()) - .interval(in.getInterval()) - .jobId(in.getJobId()) - .jobStatus(in.getJobStatus()) - .name(in.getName()) - .snapshotType(in.getSnapshotType()) - .state(in.getState()) - .volumeId(in.getVolumeId()) - .volumeName(in.getVolumeName()) - .volumeType(in.getVolumeType()); - } - } - - private static class ConcreteBuilder extends Builder<ConcreteBuilder> { - @Override - protected ConcreteBuilder self() { - return this; - } - } - - private final String id; - private final String account; - private final Date created; - private final String domain; - private final String domainId; - private final Snapshot.Interval interval; - private final String jobId; - private final String jobStatus; - private final String name; - private final Snapshot.Type snapshotType; - private final Snapshot.State state; - private final String volumeId; - private final String volumeName; - private final Volume.Type volumeType; - - @ConstructorProperties({ - "id", "account", "created", "domain", "domainid", "intervaltype", "jobid", "jobstatus", "name", "snapshottype", "state", "volumeid", "volumename", "volumetype" - }) - protected Snapshot(String id, @Nullable String account, @Nullable Date created, @Nullable String domain, @Nullable String domainId, - @Nullable Snapshot.Interval interval, @Nullable String jobId, @Nullable String jobStatus, @Nullable String name, - @Nullable Snapshot.Type snapshotType, @Nullable Snapshot.State state, @Nullable String volumeId, @Nullable String volumeName, - @Nullable Volume.Type volumeType) { - this.id = checkNotNull(id, "id"); - this.account = account; - this.created = created; - this.domain = domain; - this.domainId = domainId; - this.interval = interval; - this.jobId = jobId; - this.jobStatus = jobStatus; - this.name = name; - this.snapshotType = snapshotType; - this.state = state; - this.volumeId = volumeId; - this.volumeName = volumeName; - this.volumeType = volumeType; - } - - /** - * @return ID of the snapshot - */ - public String getId() { - return this.id; - } - - /** - * @return the account associated with the snapshot - */ - @Nullable - public String getAccount() { - return this.account; - } - - /** - * @return the date the snapshot was created - */ - @Nullable - public Date getCreated() { - return this.created; - } - - /** - * @return the domain name of the snapshot's account - */ - @Nullable - public String getDomain() { - return this.domain; - } - - /** - * @return the domain ID of the snapshot's account - */ - @Nullable - public String getDomainId() { - return this.domainId; - } - - /** - * @return valid types are hourly, daily, weekly, monthly, template, and none. - */ - @Nullable - public Snapshot.Interval getInterval() { - return this.interval; - } - - /** - * @return the job ID associated with the snapshot. This is only displayed if the snapshot listed is part of a currently running asynchronous job. - */ - @Nullable - public String getJobId() { - return this.jobId; - } - - /** - * @return the job status associated with the snapshot. This is only displayed if the snapshot listed is part of a currently running asynchronous job. - */ - @Nullable - public String getJobStatus() { - return this.jobStatus; - } - - /** - * @return name of the snapshot - */ - @Nullable - public String getName() { - return this.name; - } - - /** - * @return the type of the snapshot - */ - @Nullable - public Snapshot.Type getSnapshotType() { - return this.snapshotType; - } - - /** - * @return the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage - */ - @Nullable - public Snapshot.State getState() { - return this.state; - } - - /** - * @return ID of the disk volume - */ - @Nullable - public String getVolumeId() { - return this.volumeId; - } - - /** - * @return name of the disk volume - */ - @Nullable - public String getVolumeName() { - return this.volumeName; - } - - /** - * @return type of the disk volume - */ - @Nullable - public Volume.Type getVolumeType() { - return this.volumeType; - } - - @Override - public int hashCode() { - return Objects.hashCode(id, account, created, domain, domainId, interval, jobId, jobStatus, name, snapshotType, state, volumeId, volumeName, volumeType); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - Snapshot that = Snapshot.class.cast(obj); - return Objects.equal(this.id, that.id) - && Objects.equal(this.account, that.account) - && Objects.equal(this.created, that.created) - && Objects.equal(this.domain, that.domain) - && Objects.equal(this.domainId, that.domainId) - && Objects.equal(this.interval, that.interval) - && Objects.equal(this.jobId, that.jobId) - && Objects.equal(this.jobStatus, that.jobStatus) - && Objects.equal(this.name, that.name) - && Objects.equal(this.snapshotType, that.snapshotType) - && Objects.equal(this.state, that.state) - && Objects.equal(this.volumeId, that.volumeId) - && Objects.equal(this.volumeName, that.volumeName) - && Objects.equal(this.volumeType, that.volumeType); - } - - protected ToStringHelper string() { - return MoreObjects.toStringHelper(this) - .add("id", id).add("account", account).add("created", created).add("domain", domain).add("domainId", domainId) - .add("interval", interval).add("jobId", jobId).add("jobStatus", jobStatus).add("name", name).add("snapshotType", snapshotType) - .add("state", state).add("volumeId", volumeId).add("volumeName", volumeName).add("volumeType", volumeType); - } - - @Override - public String toString() { - return string().toString(); - } - -}
