You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2013/09/19 00:09:32 UTC
[5/8] JCLOUDS-236: Add CloudSigma v2 API and Providers
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NICStats.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NICStats.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NICStats.java
new file mode 100644
index 0000000..af7966a
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NICStats.java
@@ -0,0 +1,119 @@
+/*
+ * 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.cloudsigma2.domain;
+
+import javax.inject.Named;
+import java.beans.ConstructorProperties;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class NICStats {
+
+ @Named("interface_type")
+ private final InterfaceType interfaceType;
+ @Named("io")
+ private final IOStats ioStats;
+ @Named("ip_v4")
+ private final String ipV4;
+ @Named("ip_v6")
+ private final String ipV6;
+ private final String mac;
+
+ @ConstructorProperties({
+ "interface_type", "io", "ip_v4", "ip_v6", "mac"
+ })
+ public NICStats(InterfaceType interfaceType, IOStats ioStats, String ipV4, String ipV6, String mac) {
+ this.interfaceType = interfaceType;
+ this.ioStats = ioStats;
+ this.ipV4 = ipV4;
+ this.ipV6 = ipV6;
+ this.mac = mac;
+ }
+
+ /**
+ * @return Type of interface
+ */
+ public InterfaceType getInterfaceType() {
+ return interfaceType;
+ }
+
+ /**
+ * @return NIC runtime Input and Output data"
+ */
+ public IOStats getIoStats() {
+ return ioStats;
+ }
+
+ /**
+ * @return Public IPv4 configuration
+ */
+ public String getIpV4() {
+ return ipV4;
+ }
+
+ /**
+ * @return Public IPv6 configuration
+ */
+ public String getIpV6() {
+ return ipV6;
+ }
+
+ /**
+ * @return MAC address of this NIC
+ */
+ public String getMac() {
+ return mac;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof NICStats)) return false;
+
+ NICStats nicStats = (NICStats) o;
+
+ if (interfaceType != nicStats.interfaceType) return false;
+ if (ioStats != null ? !ioStats.equals(nicStats.ioStats) : nicStats.ioStats != null) return false;
+ if (ipV4 != null ? !ipV4.equals(nicStats.ipV4) : nicStats.ipV4 != null) return false;
+ if (ipV6 != null ? !ipV6.equals(nicStats.ipV6) : nicStats.ipV6 != null) return false;
+ if (mac != null ? !mac.equals(nicStats.mac) : nicStats.mac != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = interfaceType != null ? interfaceType.hashCode() : 0;
+ result = 31 * result + (ioStats != null ? ioStats.hashCode() : 0);
+ result = 31 * result + (ipV4 != null ? ipV4.hashCode() : 0);
+ result = 31 * result + (ipV6 != null ? ipV6.hashCode() : 0);
+ result = 31 * result + (mac != null ? mac.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "interfaceType=" + interfaceType +
+ ", ioStats=" + ioStats +
+ ", ipV4='" + ipV4 + '\'' +
+ ", ipV6='" + ipV6 + '\'' +
+ ", mac='" + mac + '\'' +
+ "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Owner.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Owner.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Owner.java
new file mode 100644
index 0000000..d98658d
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Owner.java
@@ -0,0 +1,169 @@
+/*
+ * 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.cloudsigma2.domain;
+
+import javax.inject.Named;
+import java.beans.ConstructorProperties;
+import java.net.URI;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class Owner {
+ public static class Builder{
+ private String uuid;
+ private URI resourceUri;
+ private String email;
+
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
+ public Builder resourceUri(URI resourceUri) {
+ this.resourceUri = resourceUri;
+ return this;
+ }
+
+ public Builder email(String email) {
+ this.email = email;
+ return this;
+ }
+
+ public Owner build() {
+ return new Owner(uuid, resourceUri, email);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
+ result = prime * result + ((resourceUri == null) ? 0 : resourceUri.hashCode());
+ result = prime * result + ((email == null) ? 0 : email.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Builder other = (Builder) obj;
+ if (uuid == null) {
+ if (other.uuid != null)
+ return false;
+ } else if (!uuid.equals(other.uuid))
+ return false;
+ if (resourceUri == null) {
+ if (other.resourceUri != null)
+ return false;
+ } else if (!resourceUri.equals(other.resourceUri))
+ return false;
+ if (email == null) {
+ if (other.email != null)
+ return false;
+ } else if (!email.equals(other.email))
+ return false;
+ return true;
+ }
+ }
+ private String uuid;
+ @Named("resoource_uri")
+ private URI resourceUri;
+ private String email;
+
+ @ConstructorProperties({
+ "uuid", "resource_uri", "email"
+ })
+ public Owner(String uuid, URI resourceUri, String email){
+ this.uuid = uuid;
+ this.resourceUri = resourceUri;
+ this.email = email;
+ }
+
+ /**
+ *
+ * @return uuid of the owner.
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ *
+ * @return resource uri of the profile.
+ */
+ public URI getResourceUri() {
+ return resourceUri;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
+ result = prime * result + ((resourceUri == null) ? 0 : resourceUri.hashCode());
+ result = prime * result + ((email == null) ? 0 : email.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+
+ if (obj == null)
+ return false;
+
+ if (getClass() != obj.getClass())
+ return false;
+
+ Owner other = (Owner) obj;
+
+ if (resourceUri == null) {
+ if (other.resourceUri != null)
+ return false;
+ } else if (!resourceUri.equals(other.resourceUri))
+ return false;
+
+ if (uuid == null) {
+ if (other.uuid != null)
+ return false;
+ } else if (!uuid.equals(other.uuid))
+ return false;
+
+ if (email == null) {
+ if (other.email != null)
+ return false;
+ } else if (!email.equals(other.email))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", email=" + email + ", resourceUri=" + resourceUri + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Price.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Price.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Price.java
new file mode 100644
index 0000000..4a18f2e
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Price.java
@@ -0,0 +1,220 @@
+/*
+ * 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.cloudsigma2.domain;
+
+import java.beans.ConstructorProperties;
+import java.math.BigInteger;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class Price {
+
+ public static class Builder{
+ private String currency;
+ private String id;
+ private Integer level;
+ private BigInteger multiplier;
+ private double price;
+ private SubscriptionResource resource;
+ private String unit;
+
+ /**
+ * @param currency The currency of the price
+ * Price Builder
+ */
+ public Builder currency(String currency) {
+ this.currency = currency;
+ return this;
+ }
+
+ /**
+ * @param id Unique identificator
+ * Price Builder
+ */
+ public Builder id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * @param level The burst level the price applies to
+ * Price Builder
+ */
+ public Builder level(int level) {
+ this.level = level;
+ return this;
+ }
+
+ /**
+ * @param multiplier The multiplier applied to get the price of one unit per second, from the unit of the price
+ * Price Builder
+ */
+ public Builder multiplier(BigInteger multiplier) {
+ this.multiplier = multiplier;
+ return this;
+ }
+
+ /**
+ * @param price Price
+ * Price Builder
+ */
+ public Builder price(double price) {
+ this.price = price;
+ return this;
+ }
+
+ /**
+ * @param resource The resource the price applies to
+ * Price Builder
+ */
+ public Builder resource(SubscriptionResource resource) {
+ this.resource = resource;
+ return this;
+ }
+
+ /**
+ * @param unit The unit of the price
+ * Price Builder
+ */
+ public Builder unit(String unit) {
+ this.unit = unit;
+ return this;
+ }
+
+ public Price build(){
+ return new Price(currency, id, level, multiplier, price, resource, unit);
+ }
+ }
+
+ private final String currency;
+ private final String id;
+ private final Integer level;
+ private final BigInteger multiplier;
+ private final double price;
+ private final SubscriptionResource resource;
+ private final String unit;
+
+ @ConstructorProperties({
+ "currency", "id", "level", "multiplier", "price", "resource", "unit"
+ })
+ public Price(String currency, String id, Integer level, BigInteger multiplier, double price
+ , SubscriptionResource resource, String unit) {
+ this.currency = currency;
+ this.id = id;
+ this.level = level;
+ this.multiplier = multiplier;
+ this.price = price;
+ this.resource = resource;
+ this.unit = unit;
+ }
+
+ /**
+ * @return The currency of the price
+ */
+ public String getCurrency() {
+ return currency;
+ }
+
+ /**
+ * @return Unique identificator
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @return The burst level the price applies to
+ */
+ public Integer getLevel() {
+ return level;
+ }
+
+ /**
+ * @return The multiplier applied to get the price of one unit per second, from the unit of the price
+ */
+ public BigInteger getMultiplier() {
+ return multiplier;
+ }
+
+ /**
+ * @return Price
+ */
+ public double getPrice() {
+ return price;
+ }
+
+ /**
+ * @return The resource the price applies to
+ */
+ public SubscriptionResource getResource() {
+ return resource;
+ }
+
+ /**
+ * @return The unit of the price
+ */
+ public String getUnit() {
+ return unit;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Price)) return false;
+
+ Price price1 = (Price) o;
+
+ if (Double.compare(price1.price, price) != 0) return false;
+ if (currency != null ? !currency.equals(price1.currency) : price1.currency != null) return false;
+ if (id != null ? !id.equals(price1.id) : price1.id != null) return false;
+ if (level != null ? !level.equals(price1.level) : price1.level != null) return false;
+ if (multiplier != null ? !multiplier.equals(price1.multiplier) : price1.multiplier != null) return false;
+ if (resource != price1.resource) return false;
+ if (unit != null ? !unit.equals(price1.unit) : price1.unit != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result;
+ long temp;
+ result = currency != null ? currency.hashCode() : 0;
+ result = 31 * result + (id != null ? id.hashCode() : 0);
+ result = 31 * result + (level != null ? level.hashCode() : 0);
+ result = 31 * result + (multiplier != null ? multiplier.hashCode() : 0);
+ temp = Double.doubleToLongBits(price);
+ result = 31 * result + (int) (temp ^ (temp >>> 32));
+ result = 31 * result + (resource != null ? resource.hashCode() : 0);
+ result = 31 * result + (unit != null ? unit.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "currency='" + currency + '\'' +
+ ", id='" + id + '\'' +
+ ", level=" + level +
+ ", multiplier=" + multiplier +
+ ", price='" + price + '\'' +
+ ", resource=" + resource +
+ ", unit='" + unit + '\'' +
+ "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Pricing.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Pricing.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Pricing.java
new file mode 100644
index 0000000..b87a5ed
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Pricing.java
@@ -0,0 +1,109 @@
+/*
+ * 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.cloudsigma2.domain;
+
+import com.google.common.collect.ImmutableList;
+
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class Pricing {
+
+ public static class Builder{
+ private BurstLevel current;
+ private BurstLevel next;
+ private List<Price> priceList;
+
+ public Builder current(BurstLevel current) {
+ this.current = current;
+ return this;
+ }
+
+ public Builder next(BurstLevel next) {
+ this.next = next;
+ return this;
+ }
+
+ public Builder priceList(List<Price> priceList) {
+ this.priceList = ImmutableList.copyOf(priceList);
+ return this;
+ }
+
+ public Pricing build(){
+ return new Pricing(current, next, priceList);
+ }
+ }
+
+ private final BurstLevel current;
+ private final BurstLevel next;
+ private final List<Price> priceList;
+
+ @ConstructorProperties({
+ "current", "next", "objects"
+ })
+ public Pricing(BurstLevel current, BurstLevel next, List<Price> priceList) {
+ this.current = current;
+ this.next = next;
+ this.priceList = priceList;
+ }
+
+ public BurstLevel getCurrent() {
+ return current;
+ }
+
+ public BurstLevel getNext() {
+ return next;
+ }
+
+ public List<Price> getPriceList() {
+ return priceList;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Pricing)) return false;
+
+ Pricing pricing = (Pricing) o;
+
+ if (current != null ? !current.equals(pricing.current) : pricing.current != null) return false;
+ if (next != null ? !next.equals(pricing.next) : pricing.next != null) return false;
+ if (priceList != null ? !priceList.equals(pricing.priceList) : pricing.priceList != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = current != null ? current.hashCode() : 0;
+ result = 31 * result + (next != null ? next.hashCode() : 0);
+ result = 31 * result + (priceList != null ? priceList.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "current=" + current +
+ ", next=" + next +
+ ", priceList=" + priceList +
+ "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ProfileInfo.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ProfileInfo.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ProfileInfo.java
new file mode 100644
index 0000000..2a548de
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ProfileInfo.java
@@ -0,0 +1,518 @@
+/*
+ * 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.cloudsigma2.domain;
+
+import javax.inject.Named;
+import java.beans.ConstructorProperties;
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class ProfileInfo {
+
+ public static class Builder {
+ private String address;
+ private boolean isApiHttpsOnly;
+ private String autotopupAmount;
+ private String autotopupThreshold;
+ private String bankReference;
+ private String company;
+ private String country;
+ private String currency;
+ private String email;
+ private String firstName;
+ private boolean hasAutotopup;
+ private boolean invoicing;
+ private boolean isKeyAuth;
+ private String language;
+ private String lastName;
+ private boolean isMailingListEnabled;
+ private Map<String, String> meta;
+ private String myNotes;
+ private String nickname;
+ private String phone;
+ private String postcode;
+ private String reseller;
+ private Date signupTime;
+ private String state;
+ private String taxName;
+ private double taxRate;
+ private String title;
+ private String town;
+ private String uuid;
+ private String vat;
+
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+ public Builder address(String address) {
+ this.address = address;
+ return this;
+ }
+ public Builder isApiHttpsOnly(boolean isApiHttpsOnly) {
+ this.isApiHttpsOnly = isApiHttpsOnly;
+ return this;
+ }
+ public Builder autotopupAmount(String autotopupAmount) {
+ this.autotopupAmount = autotopupAmount;
+ return this;
+ }
+ public Builder autotopupThreshold(String autotopupThreshold) {
+ this.autotopupThreshold = autotopupThreshold;
+ return this;
+ }
+ public Builder bankReference(String bankReference) {
+ this.bankReference = bankReference;
+ return this;
+ }
+ public Builder company(String company) {
+ this.company = company;
+ return this;
+ }
+ public Builder country(String country) {
+ this.country = country;
+ return this;
+ }
+ public Builder currency(String currency) {
+ this.currency = currency;
+ return this;
+ }
+ public Builder email(String email) {
+ this.email = email;
+ return this;
+ }
+ public Builder firstName(String firstName) {
+ this.firstName = firstName;
+ return this;
+ }
+ public Builder hasAutotopup(boolean hasAutotopup) {
+ this.hasAutotopup = hasAutotopup;
+ return this;
+ }
+ public Builder invoicing(boolean invoicing) {
+ this.invoicing = invoicing;
+ return this;
+ }
+ public Builder isKeyAuth(boolean isKeyAuth) {
+ this.isKeyAuth = isKeyAuth;
+ return this;
+ }
+ public Builder language(String language) {
+ this.language = language;
+ return this;
+ }
+ public Builder lastName(String lastName) {
+ this.lastName = lastName;
+ return this;
+ }
+ public Builder isMailingListEnabled(boolean isMailingListEnabled) {
+ this.isMailingListEnabled = isMailingListEnabled;
+ return this;
+ }
+ public Builder meta(Map<String, String> meta) {
+ this.meta = meta;
+ return this;
+ }
+ public Builder myNotes(String myNotes) {
+ this.myNotes = myNotes;
+ return this;
+ }
+ public Builder nickname(String nickname) {
+ this.nickname = nickname;
+ return this;
+ }
+ public Builder phone(String phone) {
+ this.phone = phone;
+ return this;
+ }
+ public Builder postcode(String postcode) {
+ this.postcode = postcode;
+ return this;
+ }
+ public Builder reseller(String reseller) {
+ this.reseller = reseller;
+ return this;
+ }
+ public Builder signupTime(Date signupTime) {
+ this.signupTime = signupTime;
+ return this;
+ }
+ public Builder state(String state) {
+ this.state = state;
+ return this;
+ }
+ public Builder taxName(String taxName) {
+ this.taxName = taxName;
+ return this;
+ }
+ public Builder taxRate(double taxRate) {
+ this.taxRate = taxRate;
+ return this;
+ }
+ public Builder title(String title) {
+ this.title = title;
+ return this;
+ }
+ public Builder town(String town) {
+ this.town = town;
+ return this;
+ }
+ public Builder vat(String vat) {
+ this.vat = vat;
+ return this;
+ }
+
+ public ProfileInfo build() {
+ return new ProfileInfo(address, isApiHttpsOnly, autotopupAmount, autotopupThreshold, bankReference, company
+ , country, currency, email, firstName, hasAutotopup, invoicing, isKeyAuth, language, lastName
+ , isMailingListEnabled, meta, myNotes, nickname, phone , postcode, reseller, signupTime, state
+ , taxName, taxRate, title, town, uuid, vat);
+ }
+
+ }
+
+ private final String address;
+ @Named("api_https_only")
+ private final boolean isApiHttpsOnly;
+ @Named("autotopup_amount")
+ private final String autotopupAmount;
+ @Named("autotopup_threshold")
+ private final String autotopupThreshold;
+ @Named("bank_reference")
+ private final String bankReference;
+ private final String company;
+ private final String country;
+ private final String currency;
+ private final String email;
+ @Named("first_name")
+ private final String firstName;
+ @Named("has_autotopup")
+ private final boolean hasAutotopup;
+ private final boolean invoicing;
+ @Named("key_auth")
+ private final boolean isKeyAuth;
+ private final String language;
+ @Named("last_name")
+ private final String lastName;
+ @Named("mailing_list")
+ private final boolean isMailingListEnabled;
+ private final Map<String, String> meta;
+ @Named("my_notes")
+ private final String myNotes;
+ private final String nickname;
+ private final String phone;
+ private final String postcode;
+ private final String reseller;
+ @Named("signup_time")
+ private final Date signupTime;
+ private final String state;
+ @Named("tax_name")
+ private final String taxName;
+ @Named("tax_rate")
+ private final double taxRate;
+ private final String title;
+ private final String town;
+ private final String uuid;
+ private final String vat;
+
+ @ConstructorProperties({
+ "address", "api_https_only", "autopopup_amount", "autopopup_threshold"
+ , "bank_reference", "company", "country", "currency", "email", "first_name"
+ , "has_autotopup", "invoicing", "key_auth", "language", "last_name"
+ , "mailing_list", "meta", "my_notes", "nickname", "phone"
+ , "postcode", "reseller", "signup_time", "state", "tax_name", "tax_rate"
+ , "title", "town", "uuid", "vat"
+ })
+ public ProfileInfo(String address, boolean apiHttpsOnly, String autotopupAmount, String autotopupThreshold
+ , String bankReference, String company, String country, String currency, String email, String firstName
+ , boolean hasAutotopup, boolean invoicing, boolean keyAuth, String language, String lastName
+ , boolean mailingListEnabled, Map<String, String> meta, String myNotes, String nickname, String phone
+ , String postcode, String reseller, Date signupTime, String state, String taxName, double taxRate
+ , String title, String town, String uuid, String vat) {
+ this.address = address;
+ isApiHttpsOnly = apiHttpsOnly;
+ this.autotopupAmount = autotopupAmount;
+ this.autotopupThreshold = autotopupThreshold;
+ this.bankReference = bankReference;
+ this.company = company;
+ this.country = country;
+ this.currency = currency;
+ this.email = email;
+ this.firstName = firstName;
+ this.hasAutotopup = hasAutotopup;
+ this.invoicing = invoicing;
+ isKeyAuth = keyAuth;
+ this.language = language;
+ this.lastName = lastName;
+ isMailingListEnabled = mailingListEnabled;
+ this.meta = meta;
+ this.myNotes = myNotes;
+ this.nickname = nickname;
+ this.phone = phone;
+ this.postcode = postcode;
+ this.reseller = reseller;
+ this.signupTime = signupTime;
+ this.state = state;
+ this.taxName = taxName;
+ this.taxRate = taxRate;
+ this.title = title;
+ this.town = town;
+ this.uuid = uuid;
+ this.vat = vat;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public boolean isApiHttpsOnly() {
+ return isApiHttpsOnly;
+ }
+
+ public String getAutotopupAmount() {
+ return autotopupAmount;
+ }
+
+ public String getAutotopupThreshold() {
+ return autotopupThreshold;
+ }
+
+ public String getBankReference() {
+ return bankReference;
+ }
+
+ public String getCompany() {
+ return company;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public boolean isHasAutotopup() {
+ return hasAutotopup;
+ }
+
+ public boolean isInvoicing() {
+ return invoicing;
+ }
+
+ public boolean isKeyAuth() {
+ return isKeyAuth;
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public boolean isMailingListEnabled() {
+ return isMailingListEnabled;
+ }
+
+ public Map<String, String> getMeta() {
+ return meta;
+ }
+
+ public String getMyNotes() {
+ return myNotes;
+ }
+
+ public String getNickname() {
+ return nickname;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public String getPostcode() {
+ return postcode;
+ }
+
+ public String getReseller() {
+ return reseller;
+ }
+
+ public Date getSignupTime() {
+ return signupTime;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public String getTaxName() {
+ return taxName;
+ }
+
+ public double getTaxRate() {
+ return taxRate;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public String getTown() {
+ return town;
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public String getVat() {
+ return vat;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ProfileInfo)) return false;
+
+ ProfileInfo that = (ProfileInfo) o;
+
+ if (hasAutotopup != that.hasAutotopup) return false;
+ if (invoicing != that.invoicing) return false;
+ if (isApiHttpsOnly != that.isApiHttpsOnly) return false;
+ if (isKeyAuth != that.isKeyAuth) return false;
+ if (isMailingListEnabled != that.isMailingListEnabled) return false;
+ if (Double.compare(that.taxRate, taxRate) != 0) return false;
+ if (address != null ? !address.equals(that.address) : that.address != null) return false;
+ if (autotopupAmount != null ? !autotopupAmount.equals(that.autotopupAmount) : that.autotopupAmount != null)
+ return false;
+ if (autotopupThreshold != null ? !autotopupThreshold.equals(that.autotopupThreshold) : that.autotopupThreshold != null)
+ return false;
+ if (bankReference != null ? !bankReference.equals(that.bankReference) : that.bankReference != null)
+ return false;
+ if (company != null ? !company.equals(that.company) : that.company != null) return false;
+ if (country != null ? !country.equals(that.country) : that.country != null) return false;
+ if (currency != null ? !currency.equals(that.currency) : that.currency != null) return false;
+ if (email != null ? !email.equals(that.email) : that.email != null) return false;
+ if (firstName != null ? !firstName.equals(that.firstName) : that.firstName != null) return false;
+ if (language != null ? !language.equals(that.language) : that.language != null) return false;
+ if (lastName != null ? !lastName.equals(that.lastName) : that.lastName != null) return false;
+ if (meta != null ? !meta.equals(that.meta) : that.meta != null) return false;
+ if (myNotes != null ? !myNotes.equals(that.myNotes) : that.myNotes != null) return false;
+ if (nickname != null ? !nickname.equals(that.nickname) : that.nickname != null) return false;
+ if (phone != null ? !phone.equals(that.phone) : that.phone != null) return false;
+ if (postcode != null ? !postcode.equals(that.postcode) : that.postcode != null) return false;
+ if (reseller != null ? !reseller.equals(that.reseller) : that.reseller != null) return false;
+ if (signupTime != null ? !signupTime.equals(that.signupTime) : that.signupTime != null) return false;
+ if (state != null ? !state.equals(that.state) : that.state != null) return false;
+ if (taxName != null ? !taxName.equals(that.taxName) : that.taxName != null) return false;
+ if (title != null ? !title.equals(that.title) : that.title != null) return false;
+ if (town != null ? !town.equals(that.town) : that.town != null) return false;
+ if (uuid != null ? !uuid.equals(that.uuid) : that.uuid != null) return false;
+ if (vat != null ? !vat.equals(that.vat) : that.vat != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result;
+ long temp;
+ result = address != null ? address.hashCode() : 0;
+ result = 31 * result + (isApiHttpsOnly ? 1 : 0);
+ result = 31 * result + (autotopupAmount != null ? autotopupAmount.hashCode() : 0);
+ result = 31 * result + (autotopupThreshold != null ? autotopupThreshold.hashCode() : 0);
+ result = 31 * result + (bankReference != null ? bankReference.hashCode() : 0);
+ result = 31 * result + (company != null ? company.hashCode() : 0);
+ result = 31 * result + (country != null ? country.hashCode() : 0);
+ result = 31 * result + (currency != null ? currency.hashCode() : 0);
+ result = 31 * result + (email != null ? email.hashCode() : 0);
+ result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
+ result = 31 * result + (hasAutotopup ? 1 : 0);
+ result = 31 * result + (invoicing ? 1 : 0);
+ result = 31 * result + (isKeyAuth ? 1 : 0);
+ result = 31 * result + (language != null ? language.hashCode() : 0);
+ result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
+ result = 31 * result + (isMailingListEnabled ? 1 : 0);
+ result = 31 * result + (meta != null ? meta.hashCode() : 0);
+ result = 31 * result + (myNotes != null ? myNotes.hashCode() : 0);
+ result = 31 * result + (nickname != null ? nickname.hashCode() : 0);
+ result = 31 * result + (phone != null ? phone.hashCode() : 0);
+ result = 31 * result + (postcode != null ? postcode.hashCode() : 0);
+ result = 31 * result + (reseller != null ? reseller.hashCode() : 0);
+ result = 31 * result + (signupTime != null ? signupTime.hashCode() : 0);
+ result = 31 * result + (state != null ? state.hashCode() : 0);
+ result = 31 * result + (taxName != null ? taxName.hashCode() : 0);
+ temp = Double.doubleToLongBits(taxRate);
+ result = 31 * result + (int) (temp ^ (temp >>> 32));
+ result = 31 * result + (title != null ? title.hashCode() : 0);
+ result = 31 * result + (town != null ? town.hashCode() : 0);
+ result = 31 * result + (uuid != null ? uuid.hashCode() : 0);
+ result = 31 * result + (vat != null ? vat.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[" +
+ "address='" + address + '\'' +
+ ", isApiHttpsOnly=" + isApiHttpsOnly +
+ ", autotopupAmount='" + autotopupAmount + '\'' +
+ ", autotopupThreshold='" + autotopupThreshold + '\'' +
+ ", bankReference='" + bankReference + '\'' +
+ ", company='" + company + '\'' +
+ ", country='" + country + '\'' +
+ ", currency='" + currency + '\'' +
+ ", email='" + email + '\'' +
+ ", firstName='" + firstName + '\'' +
+ ", hasAutotopup=" + hasAutotopup +
+ ", invoicing=" + invoicing +
+ ", isKeyAuth=" + isKeyAuth +
+ ", language='" + language + '\'' +
+ ", lastName='" + lastName + '\'' +
+ ", isMailingListEnabled=" + isMailingListEnabled +
+ ", meta=" + meta +
+ ", myNotes='" + myNotes + '\'' +
+ ", nickname='" + nickname + '\'' +
+ ", phone='" + phone + '\'' +
+ ", postcode='" + postcode + '\'' +
+ ", reseller='" + reseller + '\'' +
+ ", signupTime='" + signupTime + '\'' +
+ ", state='" + state + '\'' +
+ ", taxName='" + taxName + '\'' +
+ ", taxRate=" + taxRate +
+ ", title='" + title + '\'' +
+ ", town='" + town + '\'' +
+ ", uuid='" + uuid + '\'' +
+ ", vat='" + vat + '\'' +
+ "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Server.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Server.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Server.java
new file mode 100644
index 0000000..f9878fe
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Server.java
@@ -0,0 +1,164 @@
+/*
+ * 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.cloudsigma2.domain;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import java.beans.ConstructorProperties;
+import java.net.URI;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class Server extends Item {
+
+ public static class Builder extends Item.Builder {
+ protected Owner owner;
+ protected ServerStatus status;
+ protected ServerRuntime runtime;
+
+ /**
+ * @param owner server's owner.
+ * @return Server Builder
+ */
+ public Builder owner(Owner owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ /**
+ * @param status Status of the guest.
+ * @return Server Builder
+ */
+ public Builder status(ServerStatus status) {
+ this.status = status;
+ return this;
+ }
+
+ /**
+ * @param runtime Runtime information of the guest
+ * @return Server Builder
+ */
+ public Builder runtime(ServerRuntime runtime) {
+ this.runtime = runtime;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @return Server Builder
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ return Builder.class.cast(super.uuid(uuid));
+ }
+
+ /**
+ * {@inheritDoc}
+ * @return Server Builder
+ */
+ @Override
+ public Builder name(String name) {
+ return Builder.class.cast(super.name(name));
+ }
+
+ /**
+ * {@inheritDoc}
+ * @return Server Builder
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ return Builder.class.cast(super.resourceUri(resourceUri));
+ }
+
+ public Server build() {
+ return new Server(uuid, name, resourceUri, owner, status, runtime);
+ }
+
+ public static Builder fromServer(Server in) {
+ return new Builder().uuid(in.getUuid()).name(in.getName()).resourceUri(in.getResourceUri()).owner(in.getOwner()).status(in.getStatus())
+ .runtime(in.getRuntime());
+ }
+ }
+
+ protected final Owner owner;
+ protected final ServerStatus status;
+ protected final ServerRuntime runtime;
+
+ @ConstructorProperties({
+ "uuid", "name", "resource_uri", "owner", "status", "runtime"
+ })
+ public Server(@Nullable String uuid, String name, URI resourceUri, Owner owner, ServerStatus status, ServerRuntime runtime) {
+ super(uuid, name, resourceUri);
+ this.owner = owner;
+ this.status = status;
+ this.runtime = runtime;
+ }
+
+ /**
+ * @return server's owner.
+ */
+ public Owner getOwner() {
+ return owner;
+ }
+
+ /**
+ * @return Status of the guest.
+ */
+ public ServerStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * @return Runtime information of the guest
+ */
+ public ServerRuntime getRuntime() {
+ return runtime;
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Server)) return false;
+ if (!super.equals(o)) return false;
+
+ Server server = (Server) o;
+
+ if (owner != null ? !owner.equals(server.owner) : server.owner != null) return false;
+ if (runtime != null ? !runtime.equals(server.runtime) : server.runtime != null) return false;
+ if (status != server.status) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (owner != null ? owner.hashCode() : 0);
+ result = 31 * result + (status != null ? status.hashCode() : 0);
+ result = 31 * result + (runtime != null ? runtime.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", name=" + name + ", resourceUri=" + resourceUri + ", owner=" + owner
+ + ", status=" + status + ", runtime=" + runtime + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerAvailabilityGroup.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerAvailabilityGroup.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerAvailabilityGroup.java
new file mode 100644
index 0000000..7375ede
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerAvailabilityGroup.java
@@ -0,0 +1,70 @@
+/*
+ * 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.cloudsigma2.domain;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class ServerAvailabilityGroup {
+
+ private final List<String> uuids;
+
+ public ServerAvailabilityGroup(List<String> uuids) {
+ this.uuids = uuids;
+ }
+
+ public List<String> getUuids() {
+ return uuids;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ServerAvailabilityGroup)) return false;
+
+ ServerAvailabilityGroup that = (ServerAvailabilityGroup) o;
+
+ if (uuids != null ? !uuids.equals(that.uuids) : that.uuids != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return uuids != null ? uuids.hashCode() : 0;
+ }
+
+ @Override
+ public String toString() {
+ String returnString = "";
+
+ Iterator iterator = uuids.iterator();
+
+ while (iterator.hasNext()){
+ returnString += iterator.next();
+
+ if(iterator.hasNext()){
+ returnString += ",";
+ }
+ }
+
+ return returnString;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerDrive.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerDrive.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerDrive.java
new file mode 100644
index 0000000..9d5cbb0
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerDrive.java
@@ -0,0 +1,171 @@
+/*
+ * 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.cloudsigma2.domain;
+
+import javax.inject.Named;
+import java.beans.ConstructorProperties;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class ServerDrive {
+
+ public static class Builder{
+ private int bootOrder;
+ private String deviceChannel;
+ private DeviceEmulationType deviceEmulationType;
+ private Drive drive;
+
+ public Builder bootOrder(int bootOrder){
+ this.bootOrder = bootOrder;
+ return this;
+ }
+
+ public Builder deviceChannel(String deviceChannel){
+ this.deviceChannel = deviceChannel;
+ return this;
+ }
+
+ public Builder deviceEmulationType(DeviceEmulationType deviceEmulationType){
+ this.deviceEmulationType = deviceEmulationType;
+ return this;
+ }
+
+ public Builder drive(Drive drive){
+ this.drive = drive;
+ return this;
+ }
+
+ public ServerDrive build(){
+ return new ServerDrive(bootOrder, deviceChannel, deviceEmulationType, drive);
+ }
+ }
+
+ @Named("boot_order")
+ private final int bootOrder;
+ @Named("dev_channel")
+ private final String deviceChannel;
+ @Named("device")
+ private final DeviceEmulationType deviceEmulationType;
+ @Named("drive")
+ private final Drive drive;
+ private final String driveUuid;
+
+ /**
+ *
+ * @param bootOrder drive boot order
+ * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc.
+ * @param deviceEmulationType device emulation type
+ * @param drive drive to attach. UUID Required.
+ */
+ @ConstructorProperties({
+ "boot_order", "dev_channel", "device", "drive"
+ })
+ public ServerDrive(int bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType, Drive drive) {
+ this.bootOrder = bootOrder;
+ this.deviceChannel = deviceChannel;
+ this.deviceEmulationType = deviceEmulationType;
+ this.drive = drive;
+ this.driveUuid = drive.getUuid();
+ }
+
+ /**
+ *
+ * @param bootOrder drive boot order
+ * @param deviceChannel device channel in format {controller:unit} ex. 0:1, 0:2, etc.
+ * @param deviceEmulationType device emulation type
+ * @param driveUuid drive uuid.
+ */
+ public ServerDrive(int bootOrder, String deviceChannel, DeviceEmulationType deviceEmulationType, String driveUuid) {
+ this.bootOrder = bootOrder;
+ this.deviceChannel = deviceChannel;
+ this.deviceEmulationType = deviceEmulationType;
+ this.driveUuid = driveUuid;
+ this.drive = null;
+ }
+
+ /**
+ *
+ * @return drive boot order
+ */
+ public int getBootOrder() {
+ return bootOrder;
+ }
+
+ /**
+ *
+ * @return device channel in format {controller:unit} ex. 0:1, 0:2, etc.
+ */
+ public String getDeviceChannel() {
+ return deviceChannel;
+ }
+
+ /**
+ *
+ * @return device emulation type
+ */
+ public DeviceEmulationType getDeviceEmulationType() {
+ return deviceEmulationType;
+ }
+
+ /**
+ *
+ * @return drive
+ */
+ public Drive getDrive() {
+ return drive;
+ }
+
+ /**
+ *
+ * @return drive uuid
+ */
+ public String getDriveUuid() {
+ return driveUuid;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ServerDrive)) return false;
+
+ ServerDrive that = (ServerDrive) o;
+
+ if (bootOrder != that.bootOrder) return false;
+ if (deviceChannel != null ? !deviceChannel.equals(that.deviceChannel) : that.deviceChannel != null)
+ return false;
+ if (deviceEmulationType != that.deviceEmulationType) return false;
+ if (drive != null ? !drive.equals(that.drive) : that.drive != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = bootOrder;
+ result = 31 * result + (deviceChannel != null ? deviceChannel.hashCode() : 0);
+ result = 31 * result + (deviceEmulationType != null ? deviceEmulationType.hashCode() : 0);
+ result = 31 * result + (drive != null ? drive.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[bootOrder=" + bootOrder + ", deviceChannel=" + deviceChannel + ", deviceEmulationType=" + deviceEmulationType
+ + ", drive=" + drive + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerInfo.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerInfo.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerInfo.java
new file mode 100644
index 0000000..130f9ce
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerInfo.java
@@ -0,0 +1,436 @@
+/*
+ * 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.cloudsigma2.domain;
+
+import com.google.common.collect.ImmutableList;
+
+import javax.inject.Named;
+import java.beans.ConstructorProperties;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class ServerInfo extends Server {
+
+ public static class Builder extends Server.Builder {
+ private int cpu;
+ private boolean cpusInsteadOfCores;
+ private List<ServerDrive> drives;
+ private boolean enableNuma;
+ private boolean hvRelaxed;
+ private boolean hvTsc;
+ private BigInteger memory;
+ private Map<String, String> meta;
+ private List<NIC> nics;
+ private List<String> requirements;
+ private List<String> tags;
+ private String vncPassword;
+ private int smp;
+
+ /**
+ * @param cpu server’s CPU Clock speed measured in MHz
+ * @return ServerInfo Builder
+ */
+ public Builder cpu(int cpu) {
+ this.cpu = cpu;
+ return this;
+ }
+
+ /**
+ * @param cpusInsteadOfCores expose server SMPs as separate CPUs, instead of cores of a single CPU
+ * @return ServerInfo Builder
+ */
+ public Builder cpusInsteadOfCores(boolean cpusInsteadOfCores) {
+ this.cpusInsteadOfCores = cpusInsteadOfCores;
+ return this;
+ }
+
+ /**
+ * @param drives list of attached Drives to server
+ * @return ServerInfo Builder
+ */
+ public Builder drives(List<ServerDrive> drives) {
+ this.drives = ImmutableList.copyOf(drives);
+ return this;
+ }
+
+ /**
+ * @param enableNuma expose NUMA topology to the server
+ * @return ServerInfo Builder
+ */
+ public Builder enableNuma(boolean enableNuma) {
+ this.enableNuma = enableNuma;
+ return this;
+ }
+
+ /**
+ * @param hvRelaxed improve performance of Windows servers
+ * @return ServerInfo Builder
+ */
+ public Builder hvRelaxed(boolean hvRelaxed) {
+ this.hvRelaxed = hvRelaxed;
+ return this;
+ }
+
+ /**
+ * @param hvTsc improves performance of Windows servers with the trade off that the servers
+ * @return ServerInfo Builder
+ */
+ public Builder hvTsc(boolean hvTsc) {
+ this.hvTsc = hvTsc;
+ return this;
+ }
+
+ /**
+ * @param memory server’s Random Access Memory measured in bytes
+ * @return ServerInfo Builder
+ */
+ public Builder memory(BigInteger memory) {
+ this.memory = memory;
+ return this;
+ }
+
+ /**
+ * @param meta user assigned meta information for this server
+ * @return ServerInfo Builder
+ */
+ public Builder meta(Map<String, String> meta) {
+ this.meta = meta;
+ return this;
+ }
+
+ /**
+ * @param nics list of nics attached to this server
+ * @return ServerInfo Builder
+ */
+ public Builder nics(List<NIC> nics) {
+ this.nics = ImmutableList.copyOf(nics);
+ return this;
+ }
+
+ /**
+ * @param requirements a collection of special requirements for this server
+ * @return ServerInfo Builder
+ */
+ public Builder requirements(List<String> requirements) {
+ this.requirements = ImmutableList.copyOf(requirements);
+ return this;
+ }
+
+ /**
+ * @param tags list of tags this server is associated with
+ * @return ServerInfo Builder
+ */
+ public Builder tags(List<String> tags) {
+ this.tags = ImmutableList.copyOf(tags);
+ return this;
+ }
+
+ /**
+ * @param vncPassword VNC Password to connect to server
+ * @return ServerInfo Builder
+ */
+ public Builder vncPassword(String vncPassword) {
+ this.vncPassword = vncPassword;
+ return this;
+ }
+
+ /**
+ * @param smp Symmetric Multiprocessing (SMP) i.e. number of CPU cores
+ * @return ServerInfo Builder
+ */
+ public Builder smp(int smp) {
+ this.smp = smp;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @return ServerInfo Builder
+ */
+ @Override
+ public Builder owner(Owner owner) {
+ return Builder.class.cast(super.owner(owner));
+ }
+
+ /**
+ * {@inheritDoc}
+ * @return ServerInfo Builder
+ */
+ @Override
+ public Builder status(ServerStatus status) {
+ return Builder.class.cast(super.status(status));
+ }
+
+ /**
+ * {@inheritDoc}
+ * @return ServerInfo Builder
+ */
+ @Override
+ public Builder runtime(ServerRuntime runtime) {
+ return Builder.class.cast(super.runtime(runtime));
+ }
+
+ /**
+ * {@inheritDoc}
+ * @return ServerInfo Builder
+ */
+ @Override
+ public Builder uuid(String uuid) {
+ return Builder.class.cast(super.uuid(uuid));
+ }
+
+ /**
+ * {@inheritDoc}
+ * @return ServerInfo Builder
+ */
+ @Override
+ public Builder name(String name) {
+ return Builder.class.cast(super.name(name));
+ }
+
+ /**
+ * {@inheritDoc}
+ * @return ServerInfo Builder
+ */
+ @Override
+ public Builder resourceUri(URI resourceUri) {
+ return Builder.class.cast(super.resourceUri(resourceUri));
+ }
+
+ public static Builder fromServerInfo(ServerInfo serverInfo) {
+ return new Builder().uuid(serverInfo.getUuid()).name(serverInfo.getName()).resourceUri(serverInfo.getResourceUri())
+ .owner(serverInfo.getOwner()).status(serverInfo.getStatus()).runtime(serverInfo.getRuntime())
+ .cpusInsteadOfCores(serverInfo.isCpusInsteadOfCores()).drives(serverInfo.getDrives())
+ .enableNuma(serverInfo.isNumaEnabled()).hvRelaxed(serverInfo.isHvRelaxed()).hvTsc(serverInfo.isHvTsc())
+ .memory(serverInfo.getMemory()).meta(serverInfo.getMeta()).nics(serverInfo.getNics())
+ .requirements(serverInfo.getRequirements()).tags(serverInfo.getTags()).vncPassword(serverInfo.getVncPassword())
+ .smp(serverInfo.getSmp());
+ }
+
+ public static Builder fromServer(Server in) {
+ return new Builder().uuid(in.getUuid()).name(in.getName()).resourceUri(in.getResourceUri()).owner(in.getOwner()).status(in.getStatus())
+ .runtime(in.getRuntime());
+ }
+
+ /**
+ * Warning: name, cpu, memory & vncPassword should be specified
+ *
+ * @return server with details
+ */
+ public ServerInfo build() {
+ return new ServerInfo(uuid, name, resourceUri, owner, status, runtime, cpu, cpusInsteadOfCores, drives
+ , enableNuma, hvRelaxed, hvTsc, memory, meta, nics, requirements, tags, vncPassword, smp);
+ }
+ }
+
+ private final int cpu;
+ @Named("cpus_instead_of_cores")
+ private final boolean cpusInsteadOfCores;
+ private final List<ServerDrive> drives;
+ @Named("enable_numa")
+ private final boolean enableNuma;
+ @Named("hv_relaxed")
+ private final boolean hvRelaxed;
+ @Named("hv_tsc")
+ private final boolean hvTsc;
+ @Named("mem")
+ private final BigInteger memory;
+ private final Map<String, String> meta;
+ private final List<NIC> nics;
+ private final List<String> requirements;
+ private final List<String> tags;
+ @Named("vnc_password")
+ private final String vncPassword;
+ private final int smp;
+
+ @ConstructorProperties({
+ "uuid", "name", "resource_uri", "owner", "status", "runtime",
+ "cpu", "cpus_instead_of_cores", "drives", "enable_numa",
+ "hv_relaxed", "hv_tsc", "mem", "meta", "nics",
+ "requirements", "tags", "vnc_password", "smp"
+ })
+ public ServerInfo(String uuid, String name, URI resourceUri, Owner owner, ServerStatus status, ServerRuntime runtime
+ , int cpu, boolean cpusInsteadOfCores, List<ServerDrive> drives, boolean enableNuma
+ , boolean hvRelaxed, boolean hvTsc, BigInteger memory, Map<String, String> meta, List<NIC> nics
+ , List<String> requirements, List<String> tags, String vncPassword, int smp) {
+ super(uuid, name, resourceUri, owner, status, runtime);
+ this.cpu = cpu;
+ this.cpusInsteadOfCores = cpusInsteadOfCores;
+ this.drives = drives == null ? new ArrayList<ServerDrive>() : drives;
+ this.enableNuma = enableNuma;
+ this.hvRelaxed = hvRelaxed;
+ this.hvTsc = hvTsc;
+ this.memory = memory;
+ this.meta = meta;
+ this.nics = nics == null ? new ArrayList<NIC>() : nics;
+ this.requirements = requirements;
+ this.tags = tags;
+ this.vncPassword = vncPassword;
+ this.smp = smp;
+ }
+
+ /**
+ * @return server’s CPU Clock speed measured in MHz
+ */
+ public int getCpu() {
+ return cpu;
+ }
+
+ /**
+ * @return expose server SMPs as separate CPUs, instead of cores of a single CPU
+ */
+ public boolean isCpusInsteadOfCores() {
+ return cpusInsteadOfCores;
+ }
+
+ /**
+ * @return list of attached Drives to server
+ */
+ public List<ServerDrive> getDrives() {
+ return drives;
+ }
+
+ /**
+ * @return expose NUMA topology to the server
+ */
+ public boolean isNumaEnabled() {
+ return enableNuma;
+ }
+
+ /**
+ * @return improve performance of Windows servers
+ */
+ public boolean isHvRelaxed() {
+ return hvRelaxed;
+ }
+
+ /**
+ * @return improves performance of Windows servers with the trade off that the servers
+ */
+ public boolean isHvTsc() {
+ return hvTsc;
+ }
+
+ /**
+ * @return server’s Random Access Memory measured in bytes
+ */
+ public BigInteger getMemory() {
+ return memory;
+ }
+
+ /**
+ * @return user assigned meta information for this server
+ */
+ public Map<String, String> getMeta() {
+ return meta;
+ }
+
+ /**
+ * @return list of nics attached to this server
+ */
+ public List<NIC> getNics() {
+ return nics;
+ }
+
+ /**
+ * @return a collection of special requirements for this server
+ */
+ public List<String> getRequirements() {
+ return requirements;
+ }
+
+ /**
+ * @return list of tags this server is associated with
+ */
+ public List<String> getTags() {
+ return tags;
+ }
+
+ /**
+ * @return VNC Password to connect to server
+ */
+ public String getVncPassword() {
+ return vncPassword;
+ }
+
+ /**
+ * @return Symmetric Multiprocessing (SMP) i.e. number of CPU cores
+ */
+ public int getSmp() {
+ return smp;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ServerInfo)) return false;
+ if (!super.equals(o)) return false;
+
+ ServerInfo that = (ServerInfo) o;
+
+ if (cpu != that.cpu) return false;
+ if (cpusInsteadOfCores != that.cpusInsteadOfCores) return false;
+ if (enableNuma != that.enableNuma) return false;
+ if (hvRelaxed != that.hvRelaxed) return false;
+ if (hvTsc != that.hvTsc) return false;
+ if (smp != that.smp) return false;
+ if (drives != null ? !drives.equals(that.drives) : that.drives != null) return false;
+ if (memory != null ? !memory.equals(that.memory) : that.memory != null) return false;
+ if (meta != null ? !meta.equals(that.meta) : that.meta != null) return false;
+ if (nics != null ? !nics.equals(that.nics) : that.nics != null) return false;
+ if (requirements != null ? !requirements.equals(that.requirements) : that.requirements != null) return false;
+ if (tags != null ? !tags.equals(that.tags) : that.tags != null) return false;
+ if (vncPassword != null ? !vncPassword.equals(that.vncPassword) : that.vncPassword != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + cpu;
+ result = 31 * result + (cpusInsteadOfCores ? 1 : 0);
+ result = 31 * result + (drives != null ? drives.hashCode() : 0);
+ result = 31 * result + (enableNuma ? 1 : 0);
+ result = 31 * result + (hvRelaxed ? 1 : 0);
+ result = 31 * result + (hvTsc ? 1 : 0);
+ result = 31 * result + (memory != null ? memory.hashCode() : 0);
+ result = 31 * result + (meta != null ? meta.hashCode() : 0);
+ result = 31 * result + (nics != null ? nics.hashCode() : 0);
+ result = 31 * result + (requirements != null ? requirements.hashCode() : 0);
+ result = 31 * result + (tags != null ? tags.hashCode() : 0);
+ result = 31 * result + (vncPassword != null ? vncPassword.hashCode() : 0);
+ result = 31 * result + smp;
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "[uuid=" + uuid + ", name=" + name + ", resourceUri=" + resourceUri + ", owner=" + owner
+ + ", status=" + status + ", runtime=" + runtime + ", cpu=" + cpu + ", cpusInsteadOfCores=" + cpusInsteadOfCores
+ + ", enableNuma=" + enableNuma + ", hvRelaxed=" + hvRelaxed + ", hvTsc=" + hvTsc + ", memory=" + memory
+ + ", drives=" + drives + ", meta=" + meta + ", nics=" + nics + ", requirements=" + requirements
+ + ", tags=" + tags + ", vncPassword=" + vncPassword + ", smp=" + smp + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerRuntime.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerRuntime.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerRuntime.java
new file mode 100644
index 0000000..a0e4fa6
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerRuntime.java
@@ -0,0 +1,96 @@
+/*
+ * 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.cloudsigma2.domain;
+
+import javax.inject.Named;
+import java.beans.ConstructorProperties;
+import java.util.Date;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class ServerRuntime {
+
+ public static class Builder{
+ private Date activeSince;
+ private Iterable<NICStats> nicStats;
+
+
+ public Builder activeSince(Date activeSince) {
+ this.activeSince = activeSince;
+ return this;
+ }
+
+ public Builder nicStats(Iterable<NICStats> nicStats) {
+ this.nicStats = nicStats;
+ return this;
+ }
+
+ public ServerRuntime build() {
+ return new ServerRuntime(activeSince, nicStats);
+ }
+ }
+
+ @Named("active_since")
+ private final Date activeSince;
+ @Named("nics")
+ private final Iterable<NICStats> nicStats;
+
+ @ConstructorProperties({
+ "active_since", "nics"
+ })
+ public ServerRuntime(Date activeSince, Iterable<NICStats> nicStats){
+ this.activeSince = activeSince;
+ this.nicStats = nicStats;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((nicStats == null) ? 0 : nicStats.hashCode());
+ result = prime * result + ((activeSince == null) ? 0 : activeSince.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ServerRuntime other = (ServerRuntime) obj;
+ if (nicStats == null) {
+ if (other.nicStats != null)
+ return false;
+ } else if (!nicStats.equals(other.nicStats))
+ return false;
+ if (activeSince == null) {
+ if (other.activeSince != null)
+ return false;
+ } else if (!activeSince.equals(other.activeSince))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[activeSince=" + activeSince + ", nicStats=" + nicStats + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerStatus.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerStatus.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerStatus.java
new file mode 100644
index 0000000..0fd720f
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerStatus.java
@@ -0,0 +1,44 @@
+/*
+ * 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.cloudsigma2.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public enum ServerStatus {
+ RUNNING, STARTING, STOPPING, STOPPED, PAUSED, UNAVAILABLE, UNRECOGNIZED;
+ public String value() {
+ return name().toLowerCase();
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static ServerStatus fromValue(String status) {
+ try {
+ return valueOf(checkNotNull(status, "status").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}