You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by an...@apache.org on 2014/10/24 19:29:20 UTC
[3/3] git commit: add support for
primaryNetworkComponent.networkVlan.id,
primaryBackendNetworkComponent.networkVlan.id, postInstallScriptUri, user-data,
privateNetworkOnly and sshKeys options
add support for primaryNetworkComponent.networkVlan.id, primaryBackendNetworkComponent.networkVlan.id, postInstallScriptUri, user-data, privateNetworkOnly and sshKeys options
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/4c765b18
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/4c765b18
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/4c765b18
Branch: refs/heads/1.8.x
Commit: 4c765b1884014b1abb65befdd16c780f6032e116
Parents: 3d7362a
Author: Andrea Turli <an...@gmail.com>
Authored: Tue Oct 14 15:21:39 2014 +0200
Committer: Andrea Turli <an...@gmail.com>
Committed: Fri Oct 24 19:17:29 2014 +0200
----------------------------------------------------------------------
.../softlayer/SoftLayerProviderMetadata.java | 2 +-
.../softlayer/binders/VirtualGuestToJson.java | 178 +++++-----
.../functions/internal/OperatingSystems.java | 2 +
.../options/SoftLayerTemplateOptions.java | 169 ++++++++++
.../SoftLayerComputeServiceAdapter.java | 71 +++-
.../jclouds/softlayer/domain/NetworkVlan.java | 181 ++++++++++
.../softlayer/domain/SecuritySshKey.java | 200 +++++++++++
.../jclouds/softlayer/domain/VirtualGuest.java | 233 +++++++++----
.../softlayer/domain/VirtualGuestAttribute.java | 86 +++++
.../domain/VirtualGuestNetworkComponent.java | 28 +-
.../softlayer/domain/internal/BlockDevice.java | 43 +++
.../internal/BlockDeviceTemplateGroup.java | 26 ++
.../softlayer/domain/internal/Datacenter.java | 26 ++
.../domain/internal/NetworkComponent.java | 25 ++
.../softlayer/domain/internal/NetworkVlan.java | 25 ++
.../PrimaryBackendNetworkComponent.java | 25 ++
.../internal/PrimaryNetworkComponent.java | 25 ++
.../domain/internal/TemplateObject.java | 331 +++++++++++++++++++
.../softlayer/features/VirtualGuestApi.java | 2 +-
.../binders/VirtualGuestToJsonTest.java | 43 +--
.../SoftLayerComputeServiceAdapterLiveTest.java | 4 +-
.../SoftLayerComputeServiceContextLiveTest.java | 17 +-
.../SoftLayerTemplateBuilderLiveTest.java | 3 +-
.../features/VirtualGuestApiExpectTest.java | 4 +-
.../parse/CreateVirtualGuestResponseTest.java | 3 +-
.../parse/GetVirtualGuestResponseTest.java | 2 +-
.../parse/ListVirtualGuestsResponseTest.java | 2 +-
.../test/resources/virtual_guest_create.json | 2 +-
28 files changed, 1520 insertions(+), 238 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerProviderMetadata.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerProviderMetadata.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerProviderMetadata.java
index d1f2c90..6e60141 100644
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerProviderMetadata.java
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerProviderMetadata.java
@@ -66,7 +66,7 @@ public class SoftLayerProviderMetadata extends BaseProviderMetadata {
.apiMetadata(new SoftLayerApiMetadata())
.homepage(URI.create("http://www.softlayer.com"))
.console(URI.create("https://manage.softlayer.com"))
- .iso3166Codes("SG", "US-CA", "US-TX", "US-VA", "US-WA", "US-TX", "NL", "HK", "NSFTW-IL") // NSFTW-IL is a weird isoCode returned by Softlayer
+ .iso3166Codes("SG", "US-CA", "US-TX", "US-VA", "US-WA", "NL", "HK", "NSFTW-IL", "AU", "CA-ON", "GB") // NSFTW-IL is a weird isoCode returned by Softlayer
.endpoint("https://api.softlayer.com/rest")
.defaultProperties(SoftLayerProviderMetadata.defaultProperties());
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/binders/VirtualGuestToJson.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/binders/VirtualGuestToJson.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/binders/VirtualGuestToJson.java
index ddb9fdc..1931834 100644
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/binders/VirtualGuestToJson.java
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/binders/VirtualGuestToJson.java
@@ -20,17 +20,29 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
import org.jclouds.http.HttpRequest;
import org.jclouds.json.Json;
import org.jclouds.rest.Binder;
+import org.jclouds.softlayer.compute.strategy.SoftLayerComputeServiceAdapter;
+import org.jclouds.softlayer.domain.SecuritySshKey;
import org.jclouds.softlayer.domain.VirtualGuest;
import org.jclouds.softlayer.domain.VirtualGuestBlockDevice;
-import org.jclouds.softlayer.domain.VirtualGuestNetworkComponent;
+import org.jclouds.softlayer.domain.internal.BlockDevice;
+import org.jclouds.softlayer.domain.internal.BlockDeviceTemplateGroup;
+import org.jclouds.softlayer.domain.internal.Datacenter;
+import org.jclouds.softlayer.domain.internal.NetworkComponent;
+import org.jclouds.softlayer.domain.internal.NetworkVlan;
+import org.jclouds.softlayer.domain.internal.PrimaryBackendNetworkComponent;
+import org.jclouds.softlayer.domain.internal.PrimaryNetworkComponent;
+import org.jclouds.softlayer.domain.internal.TemplateObject;
import javax.inject.Inject;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkArgument;
@@ -43,7 +55,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
*/
public class VirtualGuestToJson implements Binder {
- private final Json json;
+ public static final String USER_DATA_KEY = "value";
+ private static final String SSH_KEY_ID = "id";
+ protected Json json;
@Inject
public VirtualGuestToJson(Json json) {
@@ -65,28 +79,67 @@ public class VirtualGuestToJson implements Binder {
* @return String
*/
String buildJson(VirtualGuest virtualGuest) {
- TemplateObject templateObject = null;
+ TemplateObject.Builder templateObjectBuilder = TemplateObject.builder();
String hostname = checkNotNull(virtualGuest.getHostname(), "hostname");
String domain = checkNotNull(virtualGuest.getDomain(), "domain");
int startCpus = checkNotNull(virtualGuest.getStartCpus(), "startCpus");
int maxMemory = checkNotNull(virtualGuest.getMaxMemory(), "maxMemory");
- boolean localDiskFlag = checkNotNull(virtualGuest.isLocalDiskFlag(), "localDiskFlag");
+ boolean hourlyBillingFlag = virtualGuest.isHourlyBillingFlag();
+ boolean localDisk = virtualGuest.isLocalDiskFlag();
+
String datacenterName = checkNotNull(virtualGuest.getDatacenter().getName(), "datacenterName");
- Set<NetworkComponent> networkComponents = getNetworkComponents(virtualGuest);
+ Set<NetworkComponent> networkComponents = createNetworkComponents(virtualGuest);
+
+ templateObjectBuilder.hostname(hostname)
+ .domain(domain)
+ .startCpus(startCpus)
+ .maxMemory(maxMemory)
+ .hourlyBillingFlag(hourlyBillingFlag)
+ .localDiskFlag(localDisk)
+ .dedicatedAccountHostOnlyFlag(virtualGuest.isDedicatedAccountHostOnly())
+ .privateNetworkOnlyFlag(virtualGuest.isPrivateNetworkOnly())
+ .datacenter(new Datacenter(datacenterName))
+ .networkComponents(networkComponents);
+
if (virtualGuest.getOperatingSystem() != null) {
String operatingSystemReferenceCode = checkNotNull(virtualGuest.getOperatingSystem()
.getOperatingSystemReferenceCode(), "operatingSystemReferenceCode");
- templateObject = new TemplateObject(hostname, domain, startCpus, maxMemory, true,
- operatingSystemReferenceCode, null, localDiskFlag, new Datacenter(datacenterName), networkComponents,
- getBlockDevices(virtualGuest));
+ templateObjectBuilder.operatingSystemReferenceCode(operatingSystemReferenceCode)
+ .blockDevices(getBlockDevices(virtualGuest));
} else if (virtualGuest.getVirtualGuestBlockDeviceTemplateGroup() != null) {
String globalIdentifier = checkNotNull(virtualGuest.getVirtualGuestBlockDeviceTemplateGroup()
.getGlobalIdentifier(), "blockDeviceTemplateGroup.globalIdentifier");
- templateObject = new TemplateObject(hostname, domain, startCpus, maxMemory, true, null,
- new BlockDeviceTemplateGroup(globalIdentifier), localDiskFlag, new Datacenter(datacenterName),
- networkComponents, null);
+ templateObjectBuilder.blockDeviceTemplateGroup(new BlockDeviceTemplateGroup(globalIdentifier));
+ }
+
+ if (virtualGuest.getPrimaryNetworkComponent() != null) {
+ templateObjectBuilder.primaryNetworkComponent(new PrimaryNetworkComponent(new NetworkVlan(virtualGuest
+ .getPrimaryNetworkComponent().getNetworkVlan().getId())));
+ }
+
+ if (virtualGuest.getPrimaryBackendNetworkComponent() != null) {
+ templateObjectBuilder.primaryBackendNetworkComponent(new PrimaryBackendNetworkComponent(new NetworkVlan(virtualGuest
+ .getPrimaryBackendNetworkComponent().getNetworkVlan().getId())));
+ }
+
+ if (virtualGuest.getPostInstallScriptUri() != null) {
+ templateObjectBuilder.postInstallScriptUri(virtualGuest.getPostInstallScriptUri());
+ }
+
+ if (virtualGuest.getVirtualGuestAttribute() != null) {
+ templateObjectBuilder.userData(ImmutableSet.<Map<String, String>>of(ImmutableMap.of(USER_DATA_KEY,
+ virtualGuest.getVirtualGuestAttribute().getValue())));
}
- return json.toJson(ImmutableMap.of("parameters", ImmutableList.of(templateObject)));
+
+ if (virtualGuest.getSshKeys() != null) {
+ Set<Map<String, Integer>> sshKeys = Sets.newHashSet();
+ for (SecuritySshKey securitySshKey : virtualGuest.getSshKeys()) {
+ sshKeys.add(ImmutableMap.of(SSH_KEY_ID, securitySshKey.getId()));
+ }
+ templateObjectBuilder.sshKeys(sshKeys);
+ }
+
+ return json.toJson(ImmutableMap.of("parameters", ImmutableList.of(templateObjectBuilder.build())));
}
private List<BlockDevice> getBlockDevices(VirtualGuest virtualGuest) {
@@ -101,104 +154,29 @@ public class VirtualGuestToJson implements Binder {
return ImmutableList.copyOf(blockDevices);
}
- private Set<NetworkComponent> getNetworkComponents(VirtualGuest virtualGuest) {
- if (virtualGuest.getVirtualGuestNetworkComponents() == null) {
+ private Set<NetworkComponent> createNetworkComponents(VirtualGuest virtualGuest) {
+ if (virtualGuest.getPrimaryNetworkComponent() == null && virtualGuest.getPrimaryBackendNetworkComponent() == null) {
return null;
}
ImmutableSet.Builder networkComponents = ImmutableSet.builder();
- for (VirtualGuestNetworkComponent networkComponent : virtualGuest.getVirtualGuestNetworkComponents()) {
- networkComponents.add(new NetworkComponent(networkComponent.getSpeed()));
- }
- return networkComponents.build();
- }
-
- private static class TemplateObject {
- private final String hostname;
- private final String domain;
- private final int startCpus;
- private final int maxMemory;
- private final boolean hourlyBillingFlag;
- private final BlockDeviceTemplateGroup blockDeviceTemplateGroup;
- private final String operatingSystemReferenceCode;
- private final boolean localDiskFlag;
- private final Datacenter datacenter;
- private final Set<NetworkComponent> networkComponents;
- private final List<BlockDevice> blockDevices;
-
- private TemplateObject(String hostname, String domain, int startCpus, int maxMemory, boolean hourlyBillingFlag,
- String operatingSystemReferenceCode, BlockDeviceTemplateGroup blockDeviceTemplateGroup,
- boolean localDiskFlag, Datacenter datacenter, Set<NetworkComponent> networkComponents,
- List<BlockDevice> blockDevices) {
- this.hostname = hostname;
- this.domain = domain;
- this.startCpus = startCpus;
- this.maxMemory = maxMemory;
- this.hourlyBillingFlag = hourlyBillingFlag;
- this.operatingSystemReferenceCode = operatingSystemReferenceCode;
- this.blockDeviceTemplateGroup = blockDeviceTemplateGroup;
- this.localDiskFlag = localDiskFlag;
- this.datacenter = datacenter;
- this.networkComponents = networkComponents;
- this.blockDevices = blockDevices;
- }
- }
+ int maxSpeed = SoftLayerComputeServiceAdapter.DEFAULT_MAX_PORT_SPEED;
- private class Datacenter {
- private String name;
-
- private Datacenter(String name) {
- this.name = name;
+ if (virtualGuest.getPrimaryNetworkComponent() != null && virtualGuest.getPrimaryNetworkComponent().getMaxSpeed() > maxSpeed) {
+ maxSpeed = virtualGuest.getPrimaryNetworkComponent().getMaxSpeed();
}
- }
-
- private class NetworkComponent {
- private int maxSpeed;
-
- private NetworkComponent(int maxSpeed) {
- this.maxSpeed = maxSpeed;
- }
- }
-
- private class BlockDevice {
- private String device;
- private DiskImage diskImage;
-
- public String getDevice() {
- return device;
- }
-
- public DiskImage getDiskImage() {
- return diskImage;
- }
-
- private BlockDevice(String device, float diskImageCapacity) {
- this.device = device;
- this.diskImage = new DiskImage(diskImageCapacity);
- }
- }
-
- private class DiskImage {
- private float capacity;
-
- private DiskImage(float capacity) {
- this.capacity = capacity;
+ if (virtualGuest.getPrimaryBackendNetworkComponent() != null && virtualGuest.getPrimaryBackendNetworkComponent().getMaxSpeed() > maxSpeed) {
+ maxSpeed = virtualGuest.getPrimaryBackendNetworkComponent().getMaxSpeed();
}
+ networkComponents.add(new NetworkComponent(maxSpeed));
+ return networkComponents.build();
}
- private class BlockDeviceTemplateGroup {
- private String globalIdentifier;
+ public class BlockDevicesComparator implements Comparator<BlockDevice> {
- private BlockDeviceTemplateGroup(String globalIdentifier) {
- this.globalIdentifier = globalIdentifier;
+ @Override
+ public int compare(BlockDevice b1, BlockDevice b2) {
+ return Integer.valueOf(b1.getDevice()).compareTo(Integer.valueOf(b2.getDevice()));
}
}
- private class BlockDevicesComparator implements Comparator<BlockDevice> {
-
- @Override
- public int compare(BlockDevice b1, BlockDevice b2) {
- return Integer.valueOf(b1.getDevice()).compareTo(Integer.valueOf(b2.getDevice()));
- }
- }
-
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/internal/OperatingSystems.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/internal/OperatingSystems.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/internal/OperatingSystems.java
index 899a529..577caee 100644
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/internal/OperatingSystems.java
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/internal/OperatingSystems.java
@@ -84,6 +84,8 @@ public class OperatingSystems {
}
} else if (version.contains(" ")) {
return version.substring(0, version.indexOf(" "));
+ } else if (version.matches("^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)$")) {
+ return version;
}
return null;
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/options/SoftLayerTemplateOptions.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/options/SoftLayerTemplateOptions.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/options/SoftLayerTemplateOptions.java
index 6e0a85a..1c04f40 100644
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/options/SoftLayerTemplateOptions.java
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/options/SoftLayerTemplateOptions.java
@@ -53,6 +53,14 @@ public class SoftLayerTemplateOptions extends TemplateOptions implements Cloneab
protected Optional<List<Integer>> blockDevices = Optional.absent();
protected Optional<String> diskType = Optional.absent();
protected Optional<Integer> portSpeed = Optional.absent();
+ protected Optional<String> userData = Optional.absent();
+ protected Optional<Integer> primaryNetworkComponentNetworkVlanId = Optional.absent();
+ protected Optional<Integer> primaryBackendNetworkComponentNetworkVlanId = Optional.absent();
+ protected Optional<Boolean> hourlyBillingFlag = Optional.absent();
+ protected Optional<Boolean> dedicatedAccountHostOnlyFlag = Optional.absent();
+ protected Optional<Boolean> privateNetworkOnlyFlag = Optional.absent();
+ protected Optional<String> postInstallScriptUri = Optional.absent();
+ protected Optional<List<Integer>> sshKeys = Optional.absent();
@Override
public SoftLayerTemplateOptions clone() {
@@ -76,6 +84,27 @@ public class SoftLayerTemplateOptions extends TemplateOptions implements Cloneab
if (portSpeed.isPresent()) {
eTo.portSpeed(portSpeed.get());
}
+ if (userData.isPresent()) {
+ eTo.userData(userData.get());
+ }
+ if (primaryNetworkComponentNetworkVlanId.isPresent()) {
+ eTo.primaryNetworkComponentNetworkVlanId(primaryNetworkComponentNetworkVlanId.get());
+ }
+ if (primaryBackendNetworkComponentNetworkVlanId.isPresent()) {
+ eTo.primaryBackendNetworkComponentNetworkVlanId(primaryBackendNetworkComponentNetworkVlanId.get());
+ }
+ if (hourlyBillingFlag.isPresent()) {
+ eTo.hourlyBillingFlag(hourlyBillingFlag.get());
+ }
+ if (dedicatedAccountHostOnlyFlag.isPresent()) {
+ eTo.dedicatedAccountHostOnlyFlag(dedicatedAccountHostOnlyFlag.get());
+ }
+ if (privateNetworkOnlyFlag.isPresent()) {
+ eTo.privateNetworkOnlyFlag(privateNetworkOnlyFlag.get());
+ }
+ if (sshKeys.isPresent()) {
+ eTo.sshKeys(sshKeys.get());
+ }
}
}
@@ -117,6 +146,59 @@ public class SoftLayerTemplateOptions extends TemplateOptions implements Cloneab
return this;
}
+ public TemplateOptions userData(String userData) {
+ checkNotNull(userData, "userData was null");
+ this.userData = Optional.of(userData);
+ return this;
+ }
+
+ public TemplateOptions primaryNetworkComponentNetworkVlanId(Integer primaryNetworkComponentNetworkVlanId) {
+ checkNotNull(primaryNetworkComponentNetworkVlanId, "primaryNetworkComponentNetworkVlanId was null");
+ this.primaryNetworkComponentNetworkVlanId = Optional.of(primaryNetworkComponentNetworkVlanId);
+ return this;
+ }
+
+ public TemplateOptions primaryBackendNetworkComponentNetworkVlanId(Integer primaryBackendNetworkComponentNetworkVlanId) {
+ checkNotNull(primaryBackendNetworkComponentNetworkVlanId, "primaryBackendNetworkComponentNetworkVlanId was null");
+ this.primaryBackendNetworkComponentNetworkVlanId = Optional.of(primaryBackendNetworkComponentNetworkVlanId);
+ return this;
+ }
+
+ public TemplateOptions hourlyBillingFlag(boolean hourlyBillingFlag) {
+ checkNotNull(hourlyBillingFlag, "hourlyBillingFlag was null");
+ this.hourlyBillingFlag = Optional.of(hourlyBillingFlag);
+ return this;
+ }
+
+ public TemplateOptions dedicatedAccountHostOnlyFlag(boolean dedicatedAccountHostOnlyFlag) {
+ checkNotNull(dedicatedAccountHostOnlyFlag, "dedicatedAccountHostOnlyFlag was null");
+ this.dedicatedAccountHostOnlyFlag = Optional.of(dedicatedAccountHostOnlyFlag);
+ return this;
+ }
+
+ public TemplateOptions privateNetworkOnlyFlag(boolean privateNetworkOnlyFlag) {
+ checkNotNull(privateNetworkOnlyFlag, "privateNetworkOnlyFlag was null");
+ this.privateNetworkOnlyFlag = Optional.of(privateNetworkOnlyFlag);
+ return this;
+ }
+
+ public TemplateOptions postInstallScriptUri(String postInstallScriptUri) {
+ checkNotNull(postInstallScriptUri, "postInstallScriptUri was null");
+ this.postInstallScriptUri = Optional.of(postInstallScriptUri);
+ return this;
+ }
+
+ public TemplateOptions sshKeys(Iterable<Integer> sshKeys) {
+ for (Integer sshKey : checkNotNull(sshKeys, "sshKeys"))
+ checkNotNull(sshKey, "sshKeys must be non-empty");
+ this.sshKeys = Optional.<List<Integer>> of(ImmutableList.copyOf(sshKeys));
+ return this;
+ }
+
+ public TemplateOptions sshKeys(Integer... sshKeys) {
+ return sshKeys(ImmutableList.copyOf(checkNotNull(sshKeys, "sshKeys")));
+ }
+
public String getDomainName() {
return domainName;
}
@@ -133,6 +215,24 @@ public class SoftLayerTemplateOptions extends TemplateOptions implements Cloneab
return portSpeed;
}
+ public Optional<String> getUserData() { return userData; }
+
+ public Optional<Integer> getPrimaryNetworkComponentNetworkVlanId() { return primaryNetworkComponentNetworkVlanId; }
+
+ public Optional<Integer> getPrimaryBackendNetworkComponentNetworkVlanId() { return primaryBackendNetworkComponentNetworkVlanId; }
+
+ public Optional<Boolean> isHourlyBillingFlag() { return hourlyBillingFlag; }
+
+ public Optional<Boolean> isDedicatedAccountHostOnlyFlag() { return dedicatedAccountHostOnlyFlag; }
+
+ public Optional<Boolean> isPrivateNetworkOnlyFlag() { return privateNetworkOnlyFlag; }
+
+ public Optional<String> getPostInstallScriptUri() { return postInstallScriptUri; }
+
+ public Optional<List<Integer>> getSshKeys() {
+ return sshKeys;
+ }
+
public static final SoftLayerTemplateOptions NONE = new SoftLayerTemplateOptions();
public static class Builder {
@@ -174,6 +274,75 @@ public class SoftLayerTemplateOptions extends TemplateOptions implements Cloneab
return SoftLayerTemplateOptions.class.cast(options.portSpeed(portSpeed));
}
+ /**
+ * @see #userData
+ */
+ public static SoftLayerTemplateOptions userData(String userData) {
+ SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
+ return SoftLayerTemplateOptions.class.cast(options.userData(userData));
+ }
+
+ /**
+ * @see #primaryNetworkComponentNetworkVlanId
+ */
+ public static SoftLayerTemplateOptions primaryNetworkComponentNetworkVlanId(Integer primaryNetworkComponentNetworkVlanId) {
+ SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
+ return SoftLayerTemplateOptions.class.cast(options.primaryNetworkComponentNetworkVlanId(primaryNetworkComponentNetworkVlanId));
+ }
+
+ /**
+ * @see #primaryBackendNetworkComponentNetworkVlanId
+ */
+ public static SoftLayerTemplateOptions primaryBackendNetworkComponentNetworkVlanId(Integer primaryBackendNetworkComponentNetworkVlanId) {
+ SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
+ return SoftLayerTemplateOptions.class.cast(options.primaryBackendNetworkComponentNetworkVlanId(primaryBackendNetworkComponentNetworkVlanId));
+ }
+
+ /**
+ * @see #hourlyBillingFlag
+ */
+ public static SoftLayerTemplateOptions hourlyBillingFlag(boolean hourlyBillingFlag) {
+ SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
+ return SoftLayerTemplateOptions.class.cast(options.hourlyBillingFlag(hourlyBillingFlag));
+ }
+
+ /**
+ * @see #dedicatedAccountHostOnlyFlag
+ */
+ public static SoftLayerTemplateOptions dedicatedAccountHostOnlyFlag(boolean dedicatedAccountHostOnlyFlag) {
+ SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
+ return SoftLayerTemplateOptions.class.cast(options.dedicatedAccountHostOnlyFlag(dedicatedAccountHostOnlyFlag));
+ }
+
+ /**
+ * @see #privateNetworkOnlyFlag
+ */
+ public static SoftLayerTemplateOptions privateNetworkOnlyFlag(boolean privateNetworkOnlyFlag) {
+ SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
+ return SoftLayerTemplateOptions.class.cast(options.privateNetworkOnlyFlag(privateNetworkOnlyFlag));
+ }
+
+ /**
+ * @see #postInstallScriptUri(String)
+ */
+ public static SoftLayerTemplateOptions postInstallScriptUri(String postInstallScriptUri) {
+ SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
+ return SoftLayerTemplateOptions.class.cast(options.postInstallScriptUri(postInstallScriptUri));
+ }
+
+ /**
+ * @see #sshKeys(Iterable)
+ */
+ public static SoftLayerTemplateOptions sshKeys(Integer... sshKeys) {
+ SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
+ return SoftLayerTemplateOptions.class.cast(options.sshKeys(sshKeys));
+ }
+
+ public static SoftLayerTemplateOptions sshKeys(Iterable<Integer> sshKeys) {
+ SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
+ return SoftLayerTemplateOptions.class.cast(options.blockDevices(sshKeys));
+ }
+
// methods that only facilitate returning the correct object type
/**
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java
index cc11210..2e5f574 100644
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java
@@ -57,13 +57,16 @@ import org.jclouds.softlayer.SoftLayerApi;
import org.jclouds.softlayer.compute.options.SoftLayerTemplateOptions;
import org.jclouds.softlayer.domain.ContainerVirtualGuestConfiguration;
import org.jclouds.softlayer.domain.Datacenter;
+import org.jclouds.softlayer.domain.NetworkVlan;
import org.jclouds.softlayer.domain.OperatingSystem;
import org.jclouds.softlayer.domain.Password;
+import org.jclouds.softlayer.domain.SecuritySshKey;
import org.jclouds.softlayer.domain.SoftwareDescription;
import org.jclouds.softlayer.domain.SoftwareLicense;
import org.jclouds.softlayer.domain.VirtualDiskImage;
import org.jclouds.softlayer.domain.VirtualDiskImageSoftware;
import org.jclouds.softlayer.domain.VirtualGuest;
+import org.jclouds.softlayer.domain.VirtualGuestAttribute;
import org.jclouds.softlayer.domain.VirtualGuestBlockDevice;
import org.jclouds.softlayer.domain.VirtualGuestBlockDeviceTemplate;
import org.jclouds.softlayer.domain.VirtualGuestBlockDeviceTemplateGroup;
@@ -91,7 +94,7 @@ public class SoftLayerComputeServiceAdapter implements
private static final String BOOTABLE_DEVICE = "0";
public static final String DEFAULT_DISK_TYPE = "LOCAL";
- public static final int DEFAULT_PORT_SPEED = 100;
+ public static final int DEFAULT_MAX_PORT_SPEED = 100;
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
@@ -126,14 +129,14 @@ public class SoftLayerComputeServiceAdapter implements
checkNotNull(template, "template was null");
checkNotNull(template.getOptions(), "template options was null");
checkArgument(template.getOptions().getClass().isAssignableFrom(SoftLayerTemplateOptions.class),
- "options class %s should have been assignable from SoftLayerTemplateOptions", template.getOptions()
- .getClass());
+ "options class %s should have been assignable from SoftLayerTemplateOptions",
+ template.getOptions().getClass());
SoftLayerTemplateOptions templateOptions = template.getOptions().as(SoftLayerTemplateOptions.class);
String domainName = templateOptions.getDomainName();
String diskType = templateOptions.getDiskType().or(DEFAULT_DISK_TYPE);
- int portSpeed = templateOptions.getPortSpeed().or(DEFAULT_PORT_SPEED);
-
+ boolean hourlyBillingFlag = templateOptions.isHourlyBillingFlag().or(true);
+ int maxPortSpeed = templateOptions.getPortSpeed().or(DEFAULT_MAX_PORT_SPEED);
final Datacenter datacenter = Datacenter.builder().name(template.getLocation().getId()).build();
final String imageId = template.getImage().getId();
int cores = (int) template.getHardware().getProcessors().get(0).getCores();
@@ -141,11 +144,10 @@ public class SoftLayerComputeServiceAdapter implements
VirtualGuest.Builder virtualGuestBuilder = VirtualGuest.builder()
.domain(domainName)
.hostname(name)
+ .hourlyBillingFlag(hourlyBillingFlag)
.startCpus(cores)
.maxMemory(template.getHardware().getRam())
- .datacenter(datacenter)
- .networkComponents(VirtualGuestNetworkComponent.builder().speed(portSpeed).build());
-
+ .datacenter(datacenter);
// set operating system or blockDeviceTemplateGroup
Optional<OperatingSystem> optionalOperatingSystem = tryExtractOperatingSystemFrom(imageId);
if (optionalOperatingSystem.isPresent()) {
@@ -162,6 +164,47 @@ public class SoftLayerComputeServiceAdapter implements
virtualGuestBuilder.blockDevices(blockDevices);
virtualGuestBuilder.localDiskFlag(isLocalDisk(diskType));
}
+ // set dedicatedAccountHostOnlyFlag
+ if (templateOptions.isDedicatedAccountHostOnlyFlag().isPresent()) {
+ virtualGuestBuilder.dedicatedAccountHostOnly(templateOptions.isDedicatedAccountHostOnlyFlag().get());
+ }
+ // set privateNetworkOnlyFlag
+ if (templateOptions.isPrivateNetworkOnlyFlag().isPresent()) {
+ virtualGuestBuilder.privateNetworkOnlyFlag(templateOptions.isPrivateNetworkOnlyFlag().get());
+ }
+ // set primaryNetworkComponent.networkVlan.id
+ if (templateOptions.getPrimaryNetworkComponentNetworkVlanId().isPresent()) {
+ int primaryNetworkComponentNetworkVlanId = templateOptions.getPrimaryNetworkComponentNetworkVlanId().get();
+ virtualGuestBuilder.primaryNetworkComponent(
+ VirtualGuestNetworkComponent.builder()
+ .networkVlan(NetworkVlan.builder().id(primaryNetworkComponentNetworkVlanId).build())
+ .speed(maxPortSpeed).build());
+ }
+ // set primaryBackendNetworkComponent.networkVlan.id
+ if (templateOptions.getPrimaryBackendNetworkComponentNetworkVlanId().isPresent()) {
+ int primaryBackendNetworkComponentNetworkVlanId = templateOptions.getPrimaryBackendNetworkComponentNetworkVlanId().get();
+ virtualGuestBuilder.primaryBackendNetworkComponent(
+ VirtualGuestNetworkComponent.builder()
+ .networkVlan(NetworkVlan.builder().id(primaryBackendNetworkComponentNetworkVlanId).build())
+ .speed(maxPortSpeed).build());
+ }
+ // set postInstallScriptUri
+ if (templateOptions.getPostInstallScriptUri().isPresent()) {
+ // Specifies the uri location of the script to be downloaded and run after installation is complete.
+ virtualGuestBuilder.postInstallScriptUri(templateOptions.getPostInstallScriptUri().get());
+ }
+ // set userData
+ if (templateOptions.getUserData().isPresent()) {
+ virtualGuestBuilder.virtualGuestAttribute(VirtualGuestAttribute.builder().value(templateOptions.getUserData().get()).build());
+ }
+ // set sshKeys
+ if (templateOptions.getSshKeys().isPresent()) {
+ Set<SecuritySshKey> sshKeys = Sets.newHashSet();
+ for (int sshKeyId : templateOptions.getSshKeys().get()) {
+ sshKeys.add(SecuritySshKey.builder().id(sshKeyId).build());
+ }
+ virtualGuestBuilder.sshKeys(sshKeys);
+ }
VirtualGuest virtualGuest = virtualGuestBuilder.build();
logger.debug(">> creating new VirtualGuest(%s)", virtualGuest);
@@ -429,13 +472,13 @@ public class SoftLayerComputeServiceAdapter implements
public boolean apply(VirtualGuest guest) {
checkNotNull(guest, "virtual guest was null");
- VirtualGuest newGuest = client.getVirtualGuestApi().getVirtualGuest(guest.getId());
- boolean hasBackendIp = newGuest.getPrimaryBackendIpAddress() != null;
- boolean hasPrimaryIp = newGuest.getPrimaryIpAddress() != null;
- boolean hasPasswords = newGuest.getOperatingSystem() != null
- && newGuest.getOperatingSystem().getPasswords().size() > 0;
+ VirtualGuest virtualGuest = client.getVirtualGuestApi().getVirtualGuest(guest.getId());
+ boolean hasBackendIp = virtualGuest.getPrimaryBackendIpAddress() != null;
+ boolean hasPrimaryIp = virtualGuest.getPrimaryIpAddress() != null;
+ boolean hasPasswords = virtualGuest.getOperatingSystem() != null
+ && !virtualGuest.getOperatingSystem().getPasswords().isEmpty();
- return hasBackendIp && hasPrimaryIp && hasPasswords;
+ return virtualGuest.isPrivateNetworkOnly() ? hasBackendIp && hasPasswords : hasBackendIp && hasPrimaryIp && hasPasswords;
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/NetworkVlan.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/NetworkVlan.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/NetworkVlan.java
new file mode 100644
index 0000000..bf9018e
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/NetworkVlan.java
@@ -0,0 +1,181 @@
+/*
+ * 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.softlayer.domain;
+
+import java.beans.ConstructorProperties;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+public class NetworkVlan {
+
+ private final int id;
+ private final int accountId;
+ private final String name;
+ private final int networkVrfId;
+ private final int primarySubnetId;
+ private final int vlanNumber;
+ private final String note;
+
+ @ConstructorProperties({
+ "id", "accountId", "name", "networkVrfId", "primarySubnetId", "vlanNumber", "note"
+ })
+ public NetworkVlan(int id, int accountId, @Nullable String name, int networkVrfId, int primarySubnetId,
+ int vlanNumber, @Nullable String note) {
+ this.id = id;
+ this.accountId = accountId;
+ this.name = name;
+ this.networkVrfId = networkVrfId;
+ this.primarySubnetId = primarySubnetId;
+ this.vlanNumber = vlanNumber;
+ this.note = note;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public int getAccountId() {
+ return accountId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getNetworkVrfId() {
+ return networkVrfId;
+ }
+
+ public int getPrimarySubnetId() {
+ return primarySubnetId;
+ }
+
+ public int getVlanNumber() {
+ return vlanNumber;
+ }
+
+ public String getNote() {
+ return note;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ NetworkVlan that = (NetworkVlan) o;
+
+ return Objects.equal(this.id, that.id) &&
+ Objects.equal(this.accountId, that.accountId) &&
+ Objects.equal(this.name, that.name) &&
+ Objects.equal(this.networkVrfId, that.networkVrfId) &&
+ Objects.equal(this.primarySubnetId, that.primarySubnetId) &&
+ Objects.equal(this.vlanNumber, that.vlanNumber) &&
+ Objects.equal(this.note, that.note);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, accountId, name, networkVrfId, primarySubnetId, vlanNumber,
+ note);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("id", id)
+ .add("accountId", accountId)
+ .add("name", name)
+ .add("networkVrfId", networkVrfId)
+ .add("primarySubnetId", primarySubnetId)
+ .add("vlanNumber", vlanNumber)
+ .add("note", note)
+ .toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromNetworkVlan(this);
+ }
+
+ public static class Builder {
+
+ protected int id;
+ protected int accountId;
+ protected String name;
+ protected int networkVrfId;
+ protected int primarySubnetId;
+ protected int vlanNumber;
+ protected String note;
+
+ public Builder id(int id) {
+ this.id = id;
+ return this;
+ }
+
+ public Builder accountId(int accountId) {
+ this.accountId = accountId;
+ return this;
+ }
+
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public Builder networkVrfId(int networkVrfId) {
+ this.networkVrfId = networkVrfId;
+ return this;
+ }
+
+ public Builder primarySubnetId(int primarySubnetId) {
+ this.primarySubnetId = primarySubnetId;
+ return this;
+ }
+
+ public Builder vlanNumber(int vlanNumber) {
+ this.vlanNumber = vlanNumber;
+ return this;
+ }
+
+ public Builder note(String note) {
+ this.note = note;
+ return this;
+ }
+
+ public NetworkVlan build() {
+ return new NetworkVlan(id, accountId, name, networkVrfId, primarySubnetId,
+ vlanNumber, note);
+ }
+
+ public Builder fromNetworkVlan(NetworkVlan in) {
+ return this
+ .id(in.getId())
+ .accountId(in.getAccountId())
+ .name(in.getName())
+ .networkVrfId(in.getNetworkVrfId())
+ .primarySubnetId(in.getPrimarySubnetId())
+ .vlanNumber(in.getVlanNumber())
+ .note(in.getNote());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/SecuritySshKey.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/SecuritySshKey.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/SecuritySshKey.java
new file mode 100644
index 0000000..0947975
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/SecuritySshKey.java
@@ -0,0 +1,200 @@
+/*
+ * 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.softlayer.domain;
+
+import java.beans.ConstructorProperties;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+public class SecuritySshKey {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromSecuritySshKey(this);
+ }
+
+ public static class Builder {
+
+ protected int id;
+ protected String key;
+ protected String label;
+ protected String fingerprint;
+ protected String notes;
+ protected String createDate;
+ protected String modifyDate;
+
+ /**
+ * @see SecuritySshKey#getId()
+ */
+ public Builder id(int id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.softlayer.domain.SecuritySshKey#getKey()
+ */
+ public Builder key(String key) {
+ this.key = key;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.softlayer.domain.SecuritySshKey#getLabel() ()
+ */
+ public Builder label(String label) {
+ this.label = label;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.softlayer.domain.SecuritySshKey#getFingerprint()
+ */
+ public Builder fingerprint(String fingerprint) {
+ this.fingerprint = fingerprint;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.softlayer.domain.SecuritySshKey#getNotes()
+ */
+ public Builder notes(String notes) {
+ this.notes = notes;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.softlayer.domain.SecuritySshKey#getCreateDate()
+ */
+ public Builder createDate(String createDate) {
+ this.createDate = createDate;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.softlayer.domain.SecuritySshKey#getModifyDate()
+ */
+ public Builder modifyDate(String modifyDate) {
+ this.modifyDate = modifyDate;
+ return this;
+ }
+
+ public SecuritySshKey build() {
+ return new SecuritySshKey(id, key, label, fingerprint, notes, createDate, modifyDate);
+ }
+
+ public Builder fromSecuritySshKey(SecuritySshKey in) {
+ return this
+ .id(in.getId())
+ .key(in.getKey())
+ .label(in.getLabel())
+ .fingerprint(in.getFingerprint())
+ .notes(in.getNotes())
+ .createDate(in.getCreateDate())
+ .modifyDate(in.getModifyDate());
+ }
+ }
+
+ private final int id;
+ private final String key;
+ private final String label;
+ private final String fingerprint;
+ private final String notes;
+ private final String createDate;
+ private final String modifyDate;
+
+ @ConstructorProperties({
+ "id", "key", "label", "name", "notes", "createDate", "modifyDate" })
+ protected SecuritySshKey(int id, @Nullable String key, @Nullable String label,
+ @Nullable String fingerprint, @Nullable String notes, @Nullable String createDate,
+ @Nullable String modifyDate) {
+ this.id = id;
+ this.key = key;
+ this.label = label;
+ this.fingerprint = fingerprint;
+ this.notes = notes;
+ this.createDate = createDate;
+ this.modifyDate = modifyDate;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public String getFingerprint() {
+ return fingerprint;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public String getCreateDate() {
+ return createDate;
+ }
+
+ public String getModifyDate() {
+ return modifyDate;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ SecuritySshKey that = (SecuritySshKey) o;
+
+ return Objects.equal(this.id, that.id) &&
+ Objects.equal(this.key, that.key) &&
+ Objects.equal(this.label, that.label) &&
+ Objects.equal(this.fingerprint, that.fingerprint) &&
+ Objects.equal(this.notes, that.notes) &&
+ Objects.equal(this.createDate, that.createDate) &&
+ Objects.equal(this.modifyDate, that.modifyDate);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, key, label, fingerprint, notes, createDate, modifyDate);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("id", id)
+ .add("key", key)
+ .add("label", label)
+ .add("name", fingerprint)
+ .add("notes", notes)
+ .add("createDate", createDate)
+ .add("modifyDate", modifyDate)
+ .toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java
index 9d1f248..9b2e596 100644
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java
@@ -102,7 +102,6 @@ public class VirtualGuest {
protected int accountId;
protected Date createDate;
- protected boolean dedicatedAccountHostOnly;
protected String domain;
protected String fullyQualifiedDomainName;
protected String hostname;
@@ -114,7 +113,6 @@ public class VirtualGuest {
protected Date metricPollDate;
protected Date modifyDate;
protected String notes;
- protected boolean privateNetworkOnly;
protected int startCpus;
protected int statusId;
protected String uuid;
@@ -128,10 +126,18 @@ public class VirtualGuest {
protected SoftwareLicense softwareLicense;
protected int activeTransactionCount;
protected List<VirtualGuestBlockDevice> blockDevices;
+ protected boolean hourlyBillingFlag;
protected boolean localDiskFlag;
+ protected boolean dedicatedAccountHostOnlyFlag;
+ protected boolean privateNetworkOnlyFlag;
protected VirtualGuestBlockDeviceTemplateGroup blockDeviceTemplateGroup;
protected Set<VirtualGuestNetworkComponent> networkComponents;
protected Set<TagReference> tagReferences;
+ protected VirtualGuestNetworkComponent primaryNetworkComponent;
+ protected VirtualGuestNetworkComponent primaryBackendNetworkComponent;
+ protected String postInstallScriptUri;
+ protected VirtualGuestAttribute virtualGuestAttribute;
+ protected Set<SecuritySshKey> sshKeys;
/**
* @see VirtualGuest#getAccountId()
@@ -152,8 +158,8 @@ public class VirtualGuest {
/**
* @see VirtualGuest#isDedicatedAccountHostOnly()
*/
- public T dedicatedAccountHostOnly(boolean dedicatedAccountHostOnly) {
- this.dedicatedAccountHostOnly = dedicatedAccountHostOnly;
+ public T dedicatedAccountHostOnly(boolean dedicatedAccountHostOnlyFlag) {
+ this.dedicatedAccountHostOnlyFlag = dedicatedAccountHostOnlyFlag;
return self();
}
@@ -246,14 +252,6 @@ public class VirtualGuest {
}
/**
- * @see VirtualGuest#isPrivateNetworkOnly()
- */
- public T privateNetworkOnly(boolean privateNetworkOnly) {
- this.privateNetworkOnly = privateNetworkOnly;
- return self();
- }
-
- /**
* @see VirtualGuest#getStartCpus()
*/
public T startCpus(int startCpus) {
@@ -361,21 +359,42 @@ public class VirtualGuest {
return blockDevices(ImmutableList.copyOf(checkNotNull(in, "blockDevices")));
}
+ public T hourlyBillingFlag(boolean hourlyBillingFlag) {
+ this.hourlyBillingFlag = hourlyBillingFlag;
+ return self();
+ }
+
public T localDiskFlag(boolean localDiskFlag) {
this.localDiskFlag = localDiskFlag;
return self();
}
+ public T dedicatedAccountHostOnlyFlag(boolean dedicatedAccountHostOnlyFlag) {
+ this.dedicatedAccountHostOnlyFlag = dedicatedAccountHostOnlyFlag;
+ return self();
+ }
+
+ public T privateNetworkOnlyFlag(boolean privateNetworkOnlyFlag) {
+ this.privateNetworkOnlyFlag = privateNetworkOnlyFlag;
+ return self();
+ }
+
public T blockDeviceTemplateGroup(VirtualGuestBlockDeviceTemplateGroup blockDeviceTemplateGroup) {
this.blockDeviceTemplateGroup = blockDeviceTemplateGroup;
return self();
}
+ /**
+ * @see org.jclouds.softlayer.domain.VirtualGuest#getPrimaryBackendNetworkComponent() ()
+ */
public T networkComponents(Set<VirtualGuestNetworkComponent> networkComponents) {
this.networkComponents = ImmutableSet.copyOf(checkNotNull(networkComponents, "networkComponents"));
return self();
}
+ /**
+ * @see org.jclouds.softlayer.domain.VirtualGuest#getPrimaryBackendNetworkComponent() ()
+ */
public T networkComponents(VirtualGuestNetworkComponent... in) {
return networkComponents(ImmutableSet.copyOf(checkNotNull(in, "networkComponents")));
}
@@ -389,13 +408,53 @@ public class VirtualGuest {
return tagReferences(ImmutableSet.copyOf(checkNotNull(in, "tagReferences")));
}
+ public T primaryNetworkComponent(VirtualGuestNetworkComponent primaryNetworkComponent) {
+ this.primaryNetworkComponent = primaryNetworkComponent;
+ return self();
+ }
+
+ public T primaryBackendNetworkComponent(VirtualGuestNetworkComponent primaryBackendNetworkComponent) {
+ this.primaryBackendNetworkComponent = primaryBackendNetworkComponent;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.softlayer.domain.VirtualGuest#getPostInstallScriptUri() ()
+ */
+ public T postInstallScriptUri(String postInstallScriptUri) {
+ this.postInstallScriptUri = postInstallScriptUri;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.softlayer.domain.VirtualGuest#getVirtualGuestAttribute() ()
+ */
+ public T virtualGuestAttribute(VirtualGuestAttribute virtualGuestAttribute) {
+ this.virtualGuestAttribute = virtualGuestAttribute;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.softlayer.domain.VirtualGuest#getSshKeys() ()
+ */
+ public T sshKeys(Set<SecuritySshKey> sshKeys) {
+ this.sshKeys = ImmutableSet.copyOf(checkNotNull(sshKeys, "sshKeys"));
+ return self();
+ }
+
+ public T sshKeys(SecuritySshKey... in) {
+ return sshKeys(ImmutableSet.copyOf(checkNotNull(in, "sshKeys")));
+ }
+
public VirtualGuest build() {
- return new VirtualGuest(accountId, createDate, dedicatedAccountHostOnly, domain, fullyQualifiedDomainName, hostname,
- id, lastVerifiedDate, maxCpu, maxCpuUnits, maxMemory, metricPollDate, modifyDate, notes, privateNetworkOnly,
+ return new VirtualGuest(accountId, createDate, domain, fullyQualifiedDomainName, hostname,
+ id, lastVerifiedDate, maxCpu, maxCpuUnits, maxMemory, metricPollDate, modifyDate, notes,
startCpus, statusId, uuid, primaryBackendIpAddress, primaryIpAddress, new BillingItem(billingItemId),
operatingSystem, operatingSystemReferenceCode, datacenter, powerState, softwareLicense,
- activeTransactionCount, blockDevices, localDiskFlag, blockDeviceTemplateGroup, networkComponents,
- tagReferences );
+ activeTransactionCount, blockDevices, hourlyBillingFlag, localDiskFlag, dedicatedAccountHostOnlyFlag,
+ privateNetworkOnlyFlag, blockDeviceTemplateGroup, networkComponents, tagReferences,
+ primaryNetworkComponent, primaryBackendNetworkComponent, postInstallScriptUri, virtualGuestAttribute,
+ sshKeys);
}
public T fromVirtualGuest(VirtualGuest in) {
@@ -414,7 +473,6 @@ public class VirtualGuest {
.metricPollDate(in.getMetricPollDate())
.modifyDate(in.getModifyDate())
.notes(in.getNotes())
- .privateNetworkOnly(in.isPrivateNetworkOnly())
.startCpus(in.getStartCpus())
.statusId(in.getStatusId())
.uuid(in.getUuid())
@@ -426,10 +484,16 @@ public class VirtualGuest {
.datacenter(in.getDatacenter())
.powerState(in.getPowerState())
.activeTransactionCount(in.getActiveTransactionCount())
+ .hourlyBillingFlag(in.isHourlyBillingFlag())
.localDiskFlag(in.isLocalDiskFlag())
+ .dedicatedAccountHostOnlyFlag(in.isDedicatedAccountHostOnly())
+ .privateNetworkOnlyFlag(in.isPrivateNetworkOnly())
.blockDeviceTemplateGroup(in.getVirtualGuestBlockDeviceTemplateGroup())
.networkComponents(in.getVirtualGuestNetworkComponents())
- .tagReferences(in.getTagReferences());
+ .tagReferences(in.getTagReferences())
+ .postInstallScriptUri(in.getPostInstallScriptUri())
+ .virtualGuestAttribute(in.getVirtualGuestAttribute())
+ .sshKeys(in.getSshKeys());
}
}
@@ -442,7 +506,6 @@ public class VirtualGuest {
private final int accountId;
private final Date createDate;
- private final boolean dedicatedAccountHostOnly;
private final String domain;
private final String fullyQualifiedDomainName;
private final String hostname;
@@ -454,7 +517,6 @@ public class VirtualGuest {
private final Date metricPollDate;
private final Date modifyDate;
private final String notes;
- private final boolean privateNetworkOnly;
private final int startCpus;
private final int statusId;
private final String uuid;
@@ -468,32 +530,45 @@ public class VirtualGuest {
private final SoftwareLicense softwareLicense;
private final int activeTransactionCount;
private final List<VirtualGuestBlockDevice> blockDevices;
+ private final boolean hourlyBillingFlag;
private final boolean localDiskFlag;
+ private final boolean dedicatedAccountHostOnlyFlag;
+ private final boolean privateNetworkOnlyFlag;
private final VirtualGuestBlockDeviceTemplateGroup blockDeviceTemplateGroup;
private final Set<VirtualGuestNetworkComponent> networkComponents;
private final Set<TagReference> tagReferences;
-
- @ConstructorProperties({ "accountId", "createDate", "dedicatedAccountHostOnlyFlag", "domain",
- "fullyQualifiedDomainName", "hostname", "id", "lastVerifiedDate", "maxCpu", "maxCpuUnits", "maxMemory",
- "metricPollDate", "modifyDate", "notes", "privateNetworkOnlyFlag", "startCpus", "statusId", "uuid",
- "primaryBackendIpAddress", "primaryIpAddress", "billingItem", "operatingSystem",
- "operatingSystemReferenceCode", "datacenter", "powerState", "softwareLicense", "activeTransactionCount",
- "blockDevices", "localDiskFlag", "blockDeviceTemplateGroup", "networkComponents", "tagReferences"
-})
- protected VirtualGuest(int accountId, @Nullable Date createDate, boolean dedicatedAccountHostOnly, @Nullable String domain,
+ private final VirtualGuestNetworkComponent primaryNetworkComponent;
+ private final VirtualGuestNetworkComponent primaryBackendNetworkComponent;
+ private final String postInstallScriptUri;
+ private final VirtualGuestAttribute virtualGuestAttribute;
+ private final Set<SecuritySshKey> sshKeys;
+
+ @ConstructorProperties({"accountId", "createDate", "domain", "fullyQualifiedDomainName", "hostname", "id",
+ "lastVerifiedDate", "maxCpu", "maxCpuUnits", "maxMemory", "metricPollDate", "modifyDate", "notes",
+ "startCpus", "statusId", "uuid", "primaryBackendIpAddress", "primaryIpAddress", "billingItem",
+ "operatingSystem", "operatingSystemReferenceCode", "datacenter", "powerState", "softwareLicense",
+ "activeTransactionCount", "blockDevices", "hourlyBillingFlag", "localDiskFlag",
+ "dedicatedAccountHostOnlyFlag", "privateNetworkOnlyFlag", "blockDeviceTemplateGroup", "networkComponents",
+ "tagReferences", "primaryNetworkComponent", "primaryBackendNetworkComponent", "postInstallScriptUri",
+ "virtualGuestAttribute", "sshKeys"})
+ protected VirtualGuest(int accountId, @Nullable Date createDate, @Nullable String domain,
@Nullable String fullyQualifiedDomainName, @Nullable String hostname, int id, @Nullable Date lastVerifiedDate,
int maxCpu, @Nullable String maxCpuUnits, int maxMemory, @Nullable Date metricPollDate, @Nullable Date modifyDate,
- @Nullable String notes, boolean privateNetworkOnly, int startCpus, int statusId, @Nullable String uuid,
+ @Nullable String notes, int startCpus, int statusId, @Nullable String uuid,
@Nullable String primaryBackendIpAddress, @Nullable String primaryIpAddress, @Nullable BillingItem billingItem,
@Nullable OperatingSystem operatingSystem, @Nullable String operatingSystemReferenceCode,
@Nullable Datacenter datacenter, @Nullable PowerState powerState, @Nullable SoftwareLicense softwareLicense,
int activeTransactionCount, @Nullable List<VirtualGuestBlockDevice> blockDevices,
- boolean localDiskFlag, @Nullable VirtualGuestBlockDeviceTemplateGroup blockDeviceTemplateGroup,
+ boolean hourlyBillingFlag, boolean localDiskFlag, boolean dedicatedAccountHostOnlyFlag,
+ boolean privateNetworkOnlyFlag, @Nullable VirtualGuestBlockDeviceTemplateGroup blockDeviceTemplateGroup,
@Nullable Set<VirtualGuestNetworkComponent> networkComponents,
- @Nullable Set<TagReference> tagReferences ) {
+ @Nullable Set<TagReference> tagReferences,
+ @Nullable VirtualGuestNetworkComponent primaryNetworkComponent,
+ @Nullable VirtualGuestNetworkComponent primaryBackendNetworkComponent,
+ @Nullable String postInstallScriptUri, @Nullable VirtualGuestAttribute virtualGuestAttribute,
+ @Nullable Set<SecuritySshKey> sshKeys) {
this.accountId = accountId;
this.createDate = createDate;
- this.dedicatedAccountHostOnly = dedicatedAccountHostOnly;
this.domain = domain;
this.fullyQualifiedDomainName = fullyQualifiedDomainName;
this.hostname = hostname;
@@ -505,7 +580,6 @@ public class VirtualGuest {
this.metricPollDate = metricPollDate;
this.modifyDate = modifyDate;
this.notes = notes;
- this.privateNetworkOnly = privateNetworkOnly;
this.startCpus = startCpus;
this.statusId = statusId;
this.uuid = uuid;
@@ -519,10 +593,18 @@ public class VirtualGuest {
this.powerState = powerState;
this.softwareLicense = softwareLicense;
this.activeTransactionCount = activeTransactionCount;
+ this.hourlyBillingFlag = hourlyBillingFlag;
this.localDiskFlag = localDiskFlag;
+ this.dedicatedAccountHostOnlyFlag = dedicatedAccountHostOnlyFlag;
+ this.privateNetworkOnlyFlag = privateNetworkOnlyFlag;
this.blockDeviceTemplateGroup = blockDeviceTemplateGroup;
this.networkComponents = networkComponents;
this.tagReferences = tagReferences;
+ this.primaryNetworkComponent = primaryNetworkComponent;
+ this.primaryBackendNetworkComponent = primaryBackendNetworkComponent;
+ this.postInstallScriptUri = postInstallScriptUri;
+ this.virtualGuestAttribute = virtualGuestAttribute;
+ this.sshKeys = sshKeys;
}
/**
@@ -541,14 +623,6 @@ public class VirtualGuest {
}
/**
- * @return When true this flag specifies that a compute instance is to run on hosts that only
- have guests from the same account.
- */
- public boolean isDedicatedAccountHostOnly() {
- return this.dedicatedAccountHostOnly;
- }
-
- /**
* @return A computing instance's domain name
*/
@Nullable
@@ -635,13 +709,6 @@ public class VirtualGuest {
}
/**
- * @return Whether the computing instance only has access to the private network.
- */
- public boolean isPrivateNetworkOnly() {
- return this.privateNetworkOnly;
- }
-
- /**
* @return The number of CPUs available to a computing instance upon startup.
*/
public int getStartCpus() {
@@ -732,10 +799,30 @@ public class VirtualGuest {
return blockDevices;
}
+ public boolean isHourlyBillingFlag() {
+ return this.hourlyBillingFlag;
+ }
+
public boolean isLocalDiskFlag() {
return localDiskFlag;
}
+ /**
+ * @return Whether the computing instance only has access to the private network.
+ */
+ public boolean isPrivateNetworkOnly() {
+ return this.privateNetworkOnlyFlag;
+ }
+
+ /**
+ * @return When true this flag specifies that a compute instance is to run on hosts that only
+ have guests from the same account.
+ */
+ public boolean isDedicatedAccountHostOnly() {
+ return this.dedicatedAccountHostOnlyFlag;
+ }
+
+
public VirtualGuestBlockDeviceTemplateGroup getVirtualGuestBlockDeviceTemplateGroup() {
return blockDeviceTemplateGroup;
}
@@ -750,13 +837,35 @@ public class VirtualGuest {
return tagReferences;
}
+ public VirtualGuestNetworkComponent getPrimaryNetworkComponent() {
+ return primaryNetworkComponent;
+ }
+
+ public VirtualGuestNetworkComponent getPrimaryBackendNetworkComponent() {
+ return primaryBackendNetworkComponent;
+ }
+
+ public String getPostInstallScriptUri() {
+ return postInstallScriptUri;
+ }
+
+ public VirtualGuestAttribute getVirtualGuestAttribute() {
+ return virtualGuestAttribute;
+ }
+
+ public Set<SecuritySshKey> getSshKeys() {
+ return sshKeys;
+ }
+
@Override
public int hashCode() {
- return Objects.hashCode(accountId, createDate, dedicatedAccountHostOnly, domain, fullyQualifiedDomainName,
+ return Objects.hashCode(accountId, createDate, domain, fullyQualifiedDomainName,
hostname, id, lastVerifiedDate, maxCpu, maxCpuUnits, maxMemory, metricPollDate, modifyDate, notes,
- privateNetworkOnly, startCpus, statusId, uuid, primaryBackendIpAddress, primaryIpAddress,
- billingItemId, operatingSystem, datacenter, powerState, softwareLicense, blockDevices, localDiskFlag,
- blockDeviceTemplateGroup, tagReferences);
+ startCpus, statusId, uuid, primaryBackendIpAddress, primaryIpAddress,
+ billingItemId, operatingSystem, datacenter, powerState, softwareLicense, blockDevices,
+ hourlyBillingFlag, localDiskFlag, dedicatedAccountHostOnlyFlag, privateNetworkOnlyFlag,
+ blockDeviceTemplateGroup, tagReferences, primaryNetworkComponent, primaryBackendNetworkComponent,
+ postInstallScriptUri, virtualGuestAttribute, sshKeys);
}
@Override
@@ -766,7 +875,6 @@ public class VirtualGuest {
VirtualGuest that = VirtualGuest.class.cast(obj);
return Objects.equal(this.accountId, that.accountId)
&& Objects.equal(this.createDate, that.createDate)
- && Objects.equal(this.dedicatedAccountHostOnly, that.dedicatedAccountHostOnly)
&& Objects.equal(this.domain, that.domain)
&& Objects.equal(this.fullyQualifiedDomainName, that.fullyQualifiedDomainName)
&& Objects.equal(this.hostname, that.hostname)
@@ -778,7 +886,6 @@ public class VirtualGuest {
&& Objects.equal(this.metricPollDate, that.metricPollDate)
&& Objects.equal(this.modifyDate, that.modifyDate)
&& Objects.equal(this.notes, that.notes)
- && Objects.equal(this.privateNetworkOnly, that.privateNetworkOnly)
&& Objects.equal(this.startCpus, that.startCpus)
&& Objects.equal(this.statusId, that.statusId)
&& Objects.equal(this.uuid, that.uuid)
@@ -791,10 +898,14 @@ public class VirtualGuest {
&& Objects.equal(this.powerState, that.powerState)
&& Objects.equal(this.softwareLicense, that.softwareLicense)
&& Objects.equal(this.blockDevices, that.blockDevices)
+ && Objects.equal(this.hourlyBillingFlag, that.hourlyBillingFlag)
&& Objects.equal(this.localDiskFlag, that.localDiskFlag)
+ && Objects.equal(this.dedicatedAccountHostOnlyFlag, that.dedicatedAccountHostOnlyFlag)
+ && Objects.equal(this.privateNetworkOnlyFlag, that.privateNetworkOnlyFlag)
&& Objects.equal(this.blockDeviceTemplateGroup, that.blockDeviceTemplateGroup)
&& Objects.equal(this.networkComponents, that.networkComponents)
- && Objects.equal(this.tagReferences, that.tagReferences);
+ && Objects.equal(this.tagReferences, that.tagReferences)
+ && Objects.equal(this.sshKeys, that.sshKeys);
}
@Override
@@ -802,7 +913,6 @@ public class VirtualGuest {
return Objects.toStringHelper(this)
.add("accountId", accountId)
.add("createDate", createDate)
- .add("dedicatedAccountHostOnly", dedicatedAccountHostOnly)
.add("domain", domain)
.add("fullyQualifiedDomainName", fullyQualifiedDomainName)
.add("hostname", hostname)
@@ -814,7 +924,6 @@ public class VirtualGuest {
.add("metricPollDate", metricPollDate)
.add("modifyDate", modifyDate)
.add("notes", notes)
- .add("privateNetworkOnly", privateNetworkOnly)
.add("startCpus", startCpus)
.add("statusId", statusId)
.add("uuid", uuid)
@@ -828,10 +937,18 @@ public class VirtualGuest {
.add("softwareLicense", softwareLicense)
.add("activeTransactionCount", activeTransactionCount)
.add("blockDevices", blockDevices)
+ .add("hourlyBillingFlag", hourlyBillingFlag)
.add("localDiskFlag", localDiskFlag)
+ .add("dedicatedAccountHostOnlyFlag", dedicatedAccountHostOnlyFlag)
+ .add("privateNetworkOnlyFlag", privateNetworkOnlyFlag)
.add("blockDeviceTemplateGroup", blockDeviceTemplateGroup)
.add("networkComponents", networkComponents)
.add("tagReferences", tagReferences)
+ .add("primaryNetworkComponent", primaryNetworkComponent)
+ .add("primaryBackendNetworkComponent", primaryBackendNetworkComponent)
+ .add("postInstallScriptUri", postInstallScriptUri)
+ .add("virtualGuestAttribute", virtualGuestAttribute)
+ .add("sshKeys", sshKeys)
.toString();
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuestAttribute.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuestAttribute.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuestAttribute.java
new file mode 100644
index 0000000..374b5ef
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuestAttribute.java
@@ -0,0 +1,86 @@
+/*
+ * 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.softlayer.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.beans.ConstructorProperties;
+
+import com.google.common.base.Objects;
+
+public class VirtualGuestAttribute {
+ private final String value;
+
+ @ConstructorProperties({"value"} )
+ public VirtualGuestAttribute(String value) {
+ this.value = checkNotNull(value, "value");
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ VirtualGuestAttribute that = (VirtualGuestAttribute) o;
+
+ return Objects.equal(this.value, that.value);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(value);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("value", value)
+ .toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromVirtualGuestAttribute(this);
+ }
+
+ public static class Builder {
+ private String value;
+
+ /**
+ * @see VirtualGuestAttribute#getValue()
+ */
+ public Builder value(String value) {
+ this.value = value;
+ return this;
+ }
+
+ public VirtualGuestAttribute build() {
+ return new VirtualGuestAttribute(value);
+ }
+
+ public Builder fromVirtualGuestAttribute(VirtualGuestAttribute in) {
+ return this
+ .value(in.getValue());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuestNetworkComponent.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuestNetworkComponent.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuestNetworkComponent.java
index 760c70e..82a28e5 100644
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuestNetworkComponent.java
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuestNetworkComponent.java
@@ -49,6 +49,7 @@ public class VirtualGuestNetworkComponent {
protected int port;
protected int speed;
protected String status;
+ protected NetworkVlan networkVlan;
/**
* @see org.jclouds.softlayer.domain.VirtualGuestNetworkComponent#getId()
@@ -119,9 +120,14 @@ public class VirtualGuestNetworkComponent {
return this;
}
+ public Builder networkVlan(NetworkVlan networkVlan) {
+ this.networkVlan = networkVlan;
+ return this;
+ }
+
public VirtualGuestNetworkComponent build() {
return new VirtualGuestNetworkComponent(id, uuid, guestId, networkId, macAddress, maxSpeed, name, port,
- speed, status);
+ speed, status, networkVlan);
}
public Builder fromVirtualGuestNetworkComponent(VirtualGuestNetworkComponent in) {
@@ -134,7 +140,8 @@ public class VirtualGuestNetworkComponent {
.maxSpeed(in.getMaxSpeed())
.port(in.getPort())
.speed(in.getSpeed())
- .status(in.getStatus());
+ .status(in.getStatus())
+ .networkVlan(in.getNetworkVlan());
}
}
@@ -148,11 +155,13 @@ public class VirtualGuestNetworkComponent {
private final int port;
private final int speed;
private final String status;
+ private final NetworkVlan networkVlan;
- @ConstructorProperties({ "id", "uuid", "guestId", "networkId", "macAddress", "maxSpeed", "name", "port", "speed", "status" })
+ @ConstructorProperties({ "id", "uuid", "guestId", "networkId", "macAddress", "maxSpeed", "name", "port", "speed",
+ "status", "networkVlan" })
protected VirtualGuestNetworkComponent(int id, String uuid, int guestId, int networkId, @Nullable String macAddress,
int maxSpeed, @Nullable String name, int port, int speed,
- @Nullable String status) {
+ @Nullable String status, @Nullable NetworkVlan networkVlan) {
this.id = id;
this.uuid = uuid;
this.guestId = guestId;
@@ -163,6 +172,7 @@ public class VirtualGuestNetworkComponent {
this.port = port;
this.speed = speed;
this.status = status;
+ this.networkVlan = networkVlan;
}
public int getId() {
@@ -205,6 +215,10 @@ public class VirtualGuestNetworkComponent {
return status;
}
+ public NetworkVlan getNetworkVlan() {
+ return networkVlan;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -221,13 +235,14 @@ public class VirtualGuestNetworkComponent {
Objects.equal(this.name, that.name) &&
Objects.equal(this.port, that.port) &&
Objects.equal(this.speed, that.speed) &&
- Objects.equal(this.status, that.status);
+ Objects.equal(this.status, that.status) &&
+ Objects.equal(this.networkVlan, that.networkVlan);
}
@Override
public int hashCode() {
return Objects.hashCode(id, uuid, guestId, networkId, macAddress, maxSpeed,
- name, port, speed, status);
+ name, port, speed, status, networkVlan);
}
@Override
@@ -243,6 +258,7 @@ public class VirtualGuestNetworkComponent {
.add("port", port)
.add("speed", speed)
.add("status", status)
+ .add("networkVlan", networkVlan)
.toString();
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/BlockDevice.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/BlockDevice.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/BlockDevice.java
new file mode 100644
index 0000000..9d1868f
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/BlockDevice.java
@@ -0,0 +1,43 @@
+/*
+ * 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.softlayer.domain.internal;
+
+public class BlockDevice {
+ private final String device;
+ private final DiskImage diskImage;
+
+ public String getDevice() {
+ return device;
+ }
+
+ public DiskImage getDiskImage() {
+ return diskImage;
+ }
+
+ public BlockDevice(String device, float diskImageCapacity) {
+ this.device = device;
+ this.diskImage = new DiskImage(diskImageCapacity);
+ }
+
+ private class DiskImage {
+ private float capacity;
+
+ public DiskImage(float capacity) {
+ this.capacity = capacity;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/BlockDeviceTemplateGroup.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/BlockDeviceTemplateGroup.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/BlockDeviceTemplateGroup.java
new file mode 100644
index 0000000..a2e4289
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/BlockDeviceTemplateGroup.java
@@ -0,0 +1,26 @@
+/*
+ * 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.softlayer.domain.internal;
+
+public class BlockDeviceTemplateGroup {
+
+ private final String globalIdentifier;
+
+ public BlockDeviceTemplateGroup(String globalIdentifier) {
+ this.globalIdentifier = globalIdentifier;
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/Datacenter.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/Datacenter.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/Datacenter.java
new file mode 100644
index 0000000..bb4b11c
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/Datacenter.java
@@ -0,0 +1,26 @@
+/*
+ * 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.softlayer.domain.internal;
+
+public class Datacenter {
+
+ private final String name;
+
+ public Datacenter(String name) {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/NetworkComponent.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/NetworkComponent.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/NetworkComponent.java
new file mode 100644
index 0000000..8f6f122
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/NetworkComponent.java
@@ -0,0 +1,25 @@
+/*
+ * 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.softlayer.domain.internal;
+
+public class NetworkComponent {
+ private final int maxSpeed;
+
+ public NetworkComponent(int maxSpeed) {
+ this.maxSpeed = maxSpeed;
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/NetworkVlan.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/NetworkVlan.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/NetworkVlan.java
new file mode 100644
index 0000000..31fdd78
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/NetworkVlan.java
@@ -0,0 +1,25 @@
+/*
+ * 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.softlayer.domain.internal;
+
+public class NetworkVlan {
+ private final int id;
+
+ public NetworkVlan(int id) {
+ this.id = id;
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/PrimaryBackendNetworkComponent.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/PrimaryBackendNetworkComponent.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/PrimaryBackendNetworkComponent.java
new file mode 100644
index 0000000..7db997c
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/PrimaryBackendNetworkComponent.java
@@ -0,0 +1,25 @@
+/*
+ * 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.softlayer.domain.internal;
+
+public class PrimaryBackendNetworkComponent {
+ private final NetworkVlan networkVlan;
+
+ public PrimaryBackendNetworkComponent(NetworkVlan networkVlan) {
+ this.networkVlan = networkVlan;
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c765b18/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/PrimaryNetworkComponent.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/PrimaryNetworkComponent.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/PrimaryNetworkComponent.java
new file mode 100644
index 0000000..722eea5
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/domain/internal/PrimaryNetworkComponent.java
@@ -0,0 +1,25 @@
+/*
+ * 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.softlayer.domain.internal;
+
+public class PrimaryNetworkComponent {
+ private final NetworkVlan networkVlan;
+
+ public PrimaryNetworkComponent(NetworkVlan networkVlan) {
+ this.networkVlan = networkVlan;
+ }
+}