mirror of
https://github.com/apache/jclouds.git
synced 2025-03-01 05:49:06 +00:00
add support for primaryNetworkComponent.networkVlan.id, primaryBackendNetworkComponent.networkVlan.id, postInstallScriptUri, user-data, privateNetworkOnly and sshKeys options
This commit is contained in:
parent
6cb1558424
commit
f134367c69
@ -66,7 +66,7 @@ public class SoftLayerProviderMetadata extends BaseProviderMetadata {
|
|||||||
.apiMetadata(new SoftLayerApiMetadata())
|
.apiMetadata(new SoftLayerApiMetadata())
|
||||||
.homepage(URI.create("http://www.softlayer.com"))
|
.homepage(URI.create("http://www.softlayer.com"))
|
||||||
.console(URI.create("https://manage.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")
|
.endpoint("https://api.softlayer.com/rest")
|
||||||
.defaultProperties(SoftLayerProviderMetadata.defaultProperties());
|
.defaultProperties(SoftLayerProviderMetadata.defaultProperties());
|
||||||
}
|
}
|
||||||
|
@ -20,17 +20,29 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.json.Json;
|
import org.jclouds.json.Json;
|
||||||
import org.jclouds.rest.Binder;
|
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.VirtualGuest;
|
||||||
import org.jclouds.softlayer.domain.VirtualGuestBlockDevice;
|
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 javax.inject.Inject;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
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 {
|
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
|
@Inject
|
||||||
public VirtualGuestToJson(Json json) {
|
public VirtualGuestToJson(Json json) {
|
||||||
@ -65,28 +79,67 @@ public class VirtualGuestToJson implements Binder {
|
|||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
String buildJson(VirtualGuest virtualGuest) {
|
String buildJson(VirtualGuest virtualGuest) {
|
||||||
TemplateObject templateObject = null;
|
TemplateObject.Builder templateObjectBuilder = TemplateObject.builder();
|
||||||
String hostname = checkNotNull(virtualGuest.getHostname(), "hostname");
|
String hostname = checkNotNull(virtualGuest.getHostname(), "hostname");
|
||||||
String domain = checkNotNull(virtualGuest.getDomain(), "domain");
|
String domain = checkNotNull(virtualGuest.getDomain(), "domain");
|
||||||
int startCpus = checkNotNull(virtualGuest.getStartCpus(), "startCpus");
|
int startCpus = checkNotNull(virtualGuest.getStartCpus(), "startCpus");
|
||||||
int maxMemory = checkNotNull(virtualGuest.getMaxMemory(), "maxMemory");
|
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");
|
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) {
|
if (virtualGuest.getOperatingSystem() != null) {
|
||||||
String operatingSystemReferenceCode = checkNotNull(virtualGuest.getOperatingSystem()
|
String operatingSystemReferenceCode = checkNotNull(virtualGuest.getOperatingSystem()
|
||||||
.getOperatingSystemReferenceCode(), "operatingSystemReferenceCode");
|
.getOperatingSystemReferenceCode(), "operatingSystemReferenceCode");
|
||||||
templateObject = new TemplateObject(hostname, domain, startCpus, maxMemory, true,
|
templateObjectBuilder.operatingSystemReferenceCode(operatingSystemReferenceCode)
|
||||||
operatingSystemReferenceCode, null, localDiskFlag, new Datacenter(datacenterName), networkComponents,
|
.blockDevices(getBlockDevices(virtualGuest));
|
||||||
getBlockDevices(virtualGuest));
|
|
||||||
} else if (virtualGuest.getVirtualGuestBlockDeviceTemplateGroup() != null) {
|
} else if (virtualGuest.getVirtualGuestBlockDeviceTemplateGroup() != null) {
|
||||||
String globalIdentifier = checkNotNull(virtualGuest.getVirtualGuestBlockDeviceTemplateGroup()
|
String globalIdentifier = checkNotNull(virtualGuest.getVirtualGuestBlockDeviceTemplateGroup()
|
||||||
.getGlobalIdentifier(), "blockDeviceTemplateGroup.globalIdentifier");
|
.getGlobalIdentifier(), "blockDeviceTemplateGroup.globalIdentifier");
|
||||||
templateObject = new TemplateObject(hostname, domain, startCpus, maxMemory, true, null,
|
templateObjectBuilder.blockDeviceTemplateGroup(new BlockDeviceTemplateGroup(globalIdentifier));
|
||||||
new BlockDeviceTemplateGroup(globalIdentifier), localDiskFlag, new Datacenter(datacenterName),
|
|
||||||
networkComponents, null);
|
|
||||||
}
|
}
|
||||||
return json.toJson(ImmutableMap.of("parameters", ImmutableList.of(templateObject)));
|
|
||||||
|
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())));
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
private List<BlockDevice> getBlockDevices(VirtualGuest virtualGuest) {
|
||||||
@ -101,104 +154,29 @@ public class VirtualGuestToJson implements Binder {
|
|||||||
return ImmutableList.copyOf(blockDevices);
|
return ImmutableList.copyOf(blockDevices);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<NetworkComponent> getNetworkComponents(VirtualGuest virtualGuest) {
|
private Set<NetworkComponent> createNetworkComponents(VirtualGuest virtualGuest) {
|
||||||
if (virtualGuest.getVirtualGuestNetworkComponents() == null) {
|
if (virtualGuest.getPrimaryNetworkComponent() == null && virtualGuest.getPrimaryBackendNetworkComponent() == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ImmutableSet.Builder networkComponents = ImmutableSet.builder();
|
ImmutableSet.Builder networkComponents = ImmutableSet.builder();
|
||||||
for (VirtualGuestNetworkComponent networkComponent : virtualGuest.getVirtualGuestNetworkComponents()) {
|
int maxSpeed = SoftLayerComputeServiceAdapter.DEFAULT_MAX_PORT_SPEED;
|
||||||
networkComponents.add(new NetworkComponent(networkComponent.getSpeed()));
|
|
||||||
|
if (virtualGuest.getPrimaryNetworkComponent() != null && virtualGuest.getPrimaryNetworkComponent().getMaxSpeed() > maxSpeed) {
|
||||||
|
maxSpeed = virtualGuest.getPrimaryNetworkComponent().getMaxSpeed();
|
||||||
}
|
}
|
||||||
|
if (virtualGuest.getPrimaryBackendNetworkComponent() != null && virtualGuest.getPrimaryBackendNetworkComponent().getMaxSpeed() > maxSpeed) {
|
||||||
|
maxSpeed = virtualGuest.getPrimaryBackendNetworkComponent().getMaxSpeed();
|
||||||
|
}
|
||||||
|
networkComponents.add(new NetworkComponent(maxSpeed));
|
||||||
return networkComponents.build();
|
return networkComponents.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TemplateObject {
|
public class BlockDevicesComparator implements Comparator<BlockDevice> {
|
||||||
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,
|
@Override
|
||||||
String operatingSystemReferenceCode, BlockDeviceTemplateGroup blockDeviceTemplateGroup,
|
public int compare(BlockDevice b1, BlockDevice b2) {
|
||||||
boolean localDiskFlag, Datacenter datacenter, Set<NetworkComponent> networkComponents,
|
return Integer.valueOf(b1.getDevice()).compareTo(Integer.valueOf(b2.getDevice()));
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Datacenter {
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private Datacenter(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class BlockDeviceTemplateGroup {
|
|
||||||
private String globalIdentifier;
|
|
||||||
|
|
||||||
private BlockDeviceTemplateGroup(String globalIdentifier) {
|
|
||||||
this.globalIdentifier = globalIdentifier;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class BlockDevicesComparator implements Comparator<BlockDevice> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compare(BlockDevice b1, BlockDevice b2) {
|
|
||||||
return Integer.valueOf(b1.getDevice()).compareTo(Integer.valueOf(b2.getDevice()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ import org.jclouds.softlayer.domain.OperatingSystem;
|
|||||||
import org.jclouds.softlayer.domain.VirtualGuest;
|
import org.jclouds.softlayer.domain.VirtualGuest;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.MoreObjects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
@ -90,7 +90,7 @@ public class SoftLayerComputeServiceContextModule extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return MoreObjects.toStringHelper(api)
|
return Objects.toStringHelper(api)
|
||||||
.add("method", "virtualGuestApi.getCreateObjectOptions")
|
.add("method", "virtualGuestApi.getCreateObjectOptions")
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,8 @@ public class OperatingSystems {
|
|||||||
}
|
}
|
||||||
} else if (version.contains(" ")) {
|
} else if (version.contains(" ")) {
|
||||||
return version.substring(0, version.indexOf(" "));
|
return version.substring(0, version.indexOf(" "));
|
||||||
|
} else if (version.matches("^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)$")) {
|
||||||
|
return version;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,14 @@ public class SoftLayerTemplateOptions extends TemplateOptions implements Cloneab
|
|||||||
protected Optional<List<Integer>> blockDevices = Optional.absent();
|
protected Optional<List<Integer>> blockDevices = Optional.absent();
|
||||||
protected Optional<String> diskType = Optional.absent();
|
protected Optional<String> diskType = Optional.absent();
|
||||||
protected Optional<Integer> portSpeed = 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
|
@Override
|
||||||
public SoftLayerTemplateOptions clone() {
|
public SoftLayerTemplateOptions clone() {
|
||||||
@ -76,6 +84,27 @@ public class SoftLayerTemplateOptions extends TemplateOptions implements Cloneab
|
|||||||
if (portSpeed.isPresent()) {
|
if (portSpeed.isPresent()) {
|
||||||
eTo.portSpeed(portSpeed.get());
|
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;
|
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() {
|
public String getDomainName() {
|
||||||
return domainName;
|
return domainName;
|
||||||
}
|
}
|
||||||
@ -133,6 +215,24 @@ public class SoftLayerTemplateOptions extends TemplateOptions implements Cloneab
|
|||||||
return portSpeed;
|
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 final SoftLayerTemplateOptions NONE = new SoftLayerTemplateOptions();
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
@ -174,6 +274,75 @@ public class SoftLayerTemplateOptions extends TemplateOptions implements Cloneab
|
|||||||
return SoftLayerTemplateOptions.class.cast(options.portSpeed(portSpeed));
|
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
|
// methods that only facilitate returning the correct object type
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,13 +57,16 @@ import org.jclouds.softlayer.SoftLayerApi;
|
|||||||
import org.jclouds.softlayer.compute.options.SoftLayerTemplateOptions;
|
import org.jclouds.softlayer.compute.options.SoftLayerTemplateOptions;
|
||||||
import org.jclouds.softlayer.domain.ContainerVirtualGuestConfiguration;
|
import org.jclouds.softlayer.domain.ContainerVirtualGuestConfiguration;
|
||||||
import org.jclouds.softlayer.domain.Datacenter;
|
import org.jclouds.softlayer.domain.Datacenter;
|
||||||
|
import org.jclouds.softlayer.domain.NetworkVlan;
|
||||||
import org.jclouds.softlayer.domain.OperatingSystem;
|
import org.jclouds.softlayer.domain.OperatingSystem;
|
||||||
import org.jclouds.softlayer.domain.Password;
|
import org.jclouds.softlayer.domain.Password;
|
||||||
|
import org.jclouds.softlayer.domain.SecuritySshKey;
|
||||||
import org.jclouds.softlayer.domain.SoftwareDescription;
|
import org.jclouds.softlayer.domain.SoftwareDescription;
|
||||||
import org.jclouds.softlayer.domain.SoftwareLicense;
|
import org.jclouds.softlayer.domain.SoftwareLicense;
|
||||||
import org.jclouds.softlayer.domain.VirtualDiskImage;
|
import org.jclouds.softlayer.domain.VirtualDiskImage;
|
||||||
import org.jclouds.softlayer.domain.VirtualDiskImageSoftware;
|
import org.jclouds.softlayer.domain.VirtualDiskImageSoftware;
|
||||||
import org.jclouds.softlayer.domain.VirtualGuest;
|
import org.jclouds.softlayer.domain.VirtualGuest;
|
||||||
|
import org.jclouds.softlayer.domain.VirtualGuestAttribute;
|
||||||
import org.jclouds.softlayer.domain.VirtualGuestBlockDevice;
|
import org.jclouds.softlayer.domain.VirtualGuestBlockDevice;
|
||||||
import org.jclouds.softlayer.domain.VirtualGuestBlockDeviceTemplate;
|
import org.jclouds.softlayer.domain.VirtualGuestBlockDeviceTemplate;
|
||||||
import org.jclouds.softlayer.domain.VirtualGuestBlockDeviceTemplateGroup;
|
import org.jclouds.softlayer.domain.VirtualGuestBlockDeviceTemplateGroup;
|
||||||
@ -91,7 +94,7 @@ public class SoftLayerComputeServiceAdapter implements
|
|||||||
|
|
||||||
private static final String BOOTABLE_DEVICE = "0";
|
private static final String BOOTABLE_DEVICE = "0";
|
||||||
public static final String DEFAULT_DISK_TYPE = "LOCAL";
|
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
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
@ -126,14 +129,14 @@ public class SoftLayerComputeServiceAdapter implements
|
|||||||
checkNotNull(template, "template was null");
|
checkNotNull(template, "template was null");
|
||||||
checkNotNull(template.getOptions(), "template options was null");
|
checkNotNull(template.getOptions(), "template options was null");
|
||||||
checkArgument(template.getOptions().getClass().isAssignableFrom(SoftLayerTemplateOptions.class),
|
checkArgument(template.getOptions().getClass().isAssignableFrom(SoftLayerTemplateOptions.class),
|
||||||
"options class %s should have been assignable from SoftLayerTemplateOptions", template.getOptions()
|
"options class %s should have been assignable from SoftLayerTemplateOptions",
|
||||||
.getClass());
|
template.getOptions().getClass());
|
||||||
|
|
||||||
SoftLayerTemplateOptions templateOptions = template.getOptions().as(SoftLayerTemplateOptions.class);
|
SoftLayerTemplateOptions templateOptions = template.getOptions().as(SoftLayerTemplateOptions.class);
|
||||||
String domainName = templateOptions.getDomainName();
|
String domainName = templateOptions.getDomainName();
|
||||||
String diskType = templateOptions.getDiskType().or(DEFAULT_DISK_TYPE);
|
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 Datacenter datacenter = Datacenter.builder().name(template.getLocation().getId()).build();
|
||||||
final String imageId = template.getImage().getId();
|
final String imageId = template.getImage().getId();
|
||||||
int cores = (int) template.getHardware().getProcessors().get(0).getCores();
|
int cores = (int) template.getHardware().getProcessors().get(0).getCores();
|
||||||
@ -141,11 +144,10 @@ public class SoftLayerComputeServiceAdapter implements
|
|||||||
VirtualGuest.Builder virtualGuestBuilder = VirtualGuest.builder()
|
VirtualGuest.Builder virtualGuestBuilder = VirtualGuest.builder()
|
||||||
.domain(domainName)
|
.domain(domainName)
|
||||||
.hostname(name)
|
.hostname(name)
|
||||||
|
.hourlyBillingFlag(hourlyBillingFlag)
|
||||||
.startCpus(cores)
|
.startCpus(cores)
|
||||||
.maxMemory(template.getHardware().getRam())
|
.maxMemory(template.getHardware().getRam())
|
||||||
.datacenter(datacenter)
|
.datacenter(datacenter);
|
||||||
.networkComponents(VirtualGuestNetworkComponent.builder().speed(portSpeed).build());
|
|
||||||
|
|
||||||
// set operating system or blockDeviceTemplateGroup
|
// set operating system or blockDeviceTemplateGroup
|
||||||
Optional<OperatingSystem> optionalOperatingSystem = tryExtractOperatingSystemFrom(imageId);
|
Optional<OperatingSystem> optionalOperatingSystem = tryExtractOperatingSystemFrom(imageId);
|
||||||
if (optionalOperatingSystem.isPresent()) {
|
if (optionalOperatingSystem.isPresent()) {
|
||||||
@ -162,6 +164,47 @@ public class SoftLayerComputeServiceAdapter implements
|
|||||||
virtualGuestBuilder.blockDevices(blockDevices);
|
virtualGuestBuilder.blockDevices(blockDevices);
|
||||||
virtualGuestBuilder.localDiskFlag(isLocalDisk(diskType));
|
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();
|
VirtualGuest virtualGuest = virtualGuestBuilder.build();
|
||||||
logger.debug(">> creating new VirtualGuest(%s)", virtualGuest);
|
logger.debug(">> creating new VirtualGuest(%s)", virtualGuest);
|
||||||
@ -429,13 +472,13 @@ public class SoftLayerComputeServiceAdapter implements
|
|||||||
public boolean apply(VirtualGuest guest) {
|
public boolean apply(VirtualGuest guest) {
|
||||||
checkNotNull(guest, "virtual guest was null");
|
checkNotNull(guest, "virtual guest was null");
|
||||||
|
|
||||||
VirtualGuest newGuest = client.getVirtualGuestApi().getVirtualGuest(guest.getId());
|
VirtualGuest virtualGuest = client.getVirtualGuestApi().getVirtualGuest(guest.getId());
|
||||||
boolean hasBackendIp = newGuest.getPrimaryBackendIpAddress() != null;
|
boolean hasBackendIp = virtualGuest.getPrimaryBackendIpAddress() != null;
|
||||||
boolean hasPrimaryIp = newGuest.getPrimaryIpAddress() != null;
|
boolean hasPrimaryIp = virtualGuest.getPrimaryIpAddress() != null;
|
||||||
boolean hasPasswords = newGuest.getOperatingSystem() != null
|
boolean hasPasswords = virtualGuest.getOperatingSystem() != null
|
||||||
&& !newGuest.getOperatingSystem().getPasswords().isEmpty();
|
&& !virtualGuest.getOperatingSystem().getPasswords().isEmpty();
|
||||||
|
|
||||||
return hasBackendIp && hasPrimaryIp && hasPasswords;
|
return virtualGuest.isPrivateNetworkOnly() ? hasBackendIp && hasPasswords : hasBackendIp && hasPrimaryIp && hasPasswords;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -25,7 +25,6 @@ import java.util.Set;
|
|||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.google.common.base.CaseFormat;
|
import com.google.common.base.CaseFormat;
|
||||||
import com.google.common.base.MoreObjects;
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
@ -103,7 +102,6 @@ public class VirtualGuest {
|
|||||||
|
|
||||||
protected int accountId;
|
protected int accountId;
|
||||||
protected Date createDate;
|
protected Date createDate;
|
||||||
protected boolean dedicatedAccountHostOnly;
|
|
||||||
protected String domain;
|
protected String domain;
|
||||||
protected String fullyQualifiedDomainName;
|
protected String fullyQualifiedDomainName;
|
||||||
protected String hostname;
|
protected String hostname;
|
||||||
@ -115,7 +113,6 @@ public class VirtualGuest {
|
|||||||
protected Date metricPollDate;
|
protected Date metricPollDate;
|
||||||
protected Date modifyDate;
|
protected Date modifyDate;
|
||||||
protected String notes;
|
protected String notes;
|
||||||
protected boolean privateNetworkOnly;
|
|
||||||
protected int startCpus;
|
protected int startCpus;
|
||||||
protected int statusId;
|
protected int statusId;
|
||||||
protected String uuid;
|
protected String uuid;
|
||||||
@ -129,10 +126,18 @@ public class VirtualGuest {
|
|||||||
protected SoftwareLicense softwareLicense;
|
protected SoftwareLicense softwareLicense;
|
||||||
protected int activeTransactionCount;
|
protected int activeTransactionCount;
|
||||||
protected List<VirtualGuestBlockDevice> blockDevices;
|
protected List<VirtualGuestBlockDevice> blockDevices;
|
||||||
|
protected boolean hourlyBillingFlag;
|
||||||
protected boolean localDiskFlag;
|
protected boolean localDiskFlag;
|
||||||
|
protected boolean dedicatedAccountHostOnlyFlag;
|
||||||
|
protected boolean privateNetworkOnlyFlag;
|
||||||
protected VirtualGuestBlockDeviceTemplateGroup blockDeviceTemplateGroup;
|
protected VirtualGuestBlockDeviceTemplateGroup blockDeviceTemplateGroup;
|
||||||
protected Set<VirtualGuestNetworkComponent> networkComponents;
|
protected Set<VirtualGuestNetworkComponent> networkComponents;
|
||||||
protected Set<TagReference> tagReferences;
|
protected Set<TagReference> tagReferences;
|
||||||
|
protected VirtualGuestNetworkComponent primaryNetworkComponent;
|
||||||
|
protected VirtualGuestNetworkComponent primaryBackendNetworkComponent;
|
||||||
|
protected String postInstallScriptUri;
|
||||||
|
protected VirtualGuestAttribute virtualGuestAttribute;
|
||||||
|
protected Set<SecuritySshKey> sshKeys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VirtualGuest#getAccountId()
|
* @see VirtualGuest#getAccountId()
|
||||||
@ -153,8 +158,8 @@ public class VirtualGuest {
|
|||||||
/**
|
/**
|
||||||
* @see VirtualGuest#isDedicatedAccountHostOnly()
|
* @see VirtualGuest#isDedicatedAccountHostOnly()
|
||||||
*/
|
*/
|
||||||
public T dedicatedAccountHostOnly(boolean dedicatedAccountHostOnly) {
|
public T dedicatedAccountHostOnly(boolean dedicatedAccountHostOnlyFlag) {
|
||||||
this.dedicatedAccountHostOnly = dedicatedAccountHostOnly;
|
this.dedicatedAccountHostOnlyFlag = dedicatedAccountHostOnlyFlag;
|
||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,14 +251,6 @@ public class VirtualGuest {
|
|||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see VirtualGuest#isPrivateNetworkOnly()
|
|
||||||
*/
|
|
||||||
public T privateNetworkOnly(boolean privateNetworkOnly) {
|
|
||||||
this.privateNetworkOnly = privateNetworkOnly;
|
|
||||||
return self();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VirtualGuest#getStartCpus()
|
* @see VirtualGuest#getStartCpus()
|
||||||
*/
|
*/
|
||||||
@ -362,21 +359,42 @@ public class VirtualGuest {
|
|||||||
return blockDevices(ImmutableList.copyOf(checkNotNull(in, "blockDevices")));
|
return blockDevices(ImmutableList.copyOf(checkNotNull(in, "blockDevices")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public T hourlyBillingFlag(boolean hourlyBillingFlag) {
|
||||||
|
this.hourlyBillingFlag = hourlyBillingFlag;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
public T localDiskFlag(boolean localDiskFlag) {
|
public T localDiskFlag(boolean localDiskFlag) {
|
||||||
this.localDiskFlag = localDiskFlag;
|
this.localDiskFlag = localDiskFlag;
|
||||||
return self();
|
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) {
|
public T blockDeviceTemplateGroup(VirtualGuestBlockDeviceTemplateGroup blockDeviceTemplateGroup) {
|
||||||
this.blockDeviceTemplateGroup = blockDeviceTemplateGroup;
|
this.blockDeviceTemplateGroup = blockDeviceTemplateGroup;
|
||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.softlayer.domain.VirtualGuest#getPrimaryBackendNetworkComponent() ()
|
||||||
|
*/
|
||||||
public T networkComponents(Set<VirtualGuestNetworkComponent> networkComponents) {
|
public T networkComponents(Set<VirtualGuestNetworkComponent> networkComponents) {
|
||||||
this.networkComponents = ImmutableSet.copyOf(checkNotNull(networkComponents, "networkComponents"));
|
this.networkComponents = ImmutableSet.copyOf(checkNotNull(networkComponents, "networkComponents"));
|
||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.softlayer.domain.VirtualGuest#getPrimaryBackendNetworkComponent() ()
|
||||||
|
*/
|
||||||
public T networkComponents(VirtualGuestNetworkComponent... in) {
|
public T networkComponents(VirtualGuestNetworkComponent... in) {
|
||||||
return networkComponents(ImmutableSet.copyOf(checkNotNull(in, "networkComponents")));
|
return networkComponents(ImmutableSet.copyOf(checkNotNull(in, "networkComponents")));
|
||||||
}
|
}
|
||||||
@ -390,13 +408,53 @@ public class VirtualGuest {
|
|||||||
return tagReferences(ImmutableSet.copyOf(checkNotNull(in, "tagReferences")));
|
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() {
|
public VirtualGuest build() {
|
||||||
return new VirtualGuest(accountId, createDate, dedicatedAccountHostOnly, domain, fullyQualifiedDomainName, hostname,
|
return new VirtualGuest(accountId, createDate, domain, fullyQualifiedDomainName, hostname,
|
||||||
id, lastVerifiedDate, maxCpu, maxCpuUnits, maxMemory, metricPollDate, modifyDate, notes, privateNetworkOnly,
|
id, lastVerifiedDate, maxCpu, maxCpuUnits, maxMemory, metricPollDate, modifyDate, notes,
|
||||||
startCpus, statusId, uuid, primaryBackendIpAddress, primaryIpAddress, new BillingItem(billingItemId),
|
startCpus, statusId, uuid, primaryBackendIpAddress, primaryIpAddress, new BillingItem(billingItemId),
|
||||||
operatingSystem, operatingSystemReferenceCode, datacenter, powerState, softwareLicense,
|
operatingSystem, operatingSystemReferenceCode, datacenter, powerState, softwareLicense,
|
||||||
activeTransactionCount, blockDevices, localDiskFlag, blockDeviceTemplateGroup, networkComponents,
|
activeTransactionCount, blockDevices, hourlyBillingFlag, localDiskFlag, dedicatedAccountHostOnlyFlag,
|
||||||
tagReferences );
|
privateNetworkOnlyFlag, blockDeviceTemplateGroup, networkComponents, tagReferences,
|
||||||
|
primaryNetworkComponent, primaryBackendNetworkComponent, postInstallScriptUri, virtualGuestAttribute,
|
||||||
|
sshKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T fromVirtualGuest(VirtualGuest in) {
|
public T fromVirtualGuest(VirtualGuest in) {
|
||||||
@ -415,7 +473,6 @@ public class VirtualGuest {
|
|||||||
.metricPollDate(in.getMetricPollDate())
|
.metricPollDate(in.getMetricPollDate())
|
||||||
.modifyDate(in.getModifyDate())
|
.modifyDate(in.getModifyDate())
|
||||||
.notes(in.getNotes())
|
.notes(in.getNotes())
|
||||||
.privateNetworkOnly(in.isPrivateNetworkOnly())
|
|
||||||
.startCpus(in.getStartCpus())
|
.startCpus(in.getStartCpus())
|
||||||
.statusId(in.getStatusId())
|
.statusId(in.getStatusId())
|
||||||
.uuid(in.getUuid())
|
.uuid(in.getUuid())
|
||||||
@ -427,10 +484,16 @@ public class VirtualGuest {
|
|||||||
.datacenter(in.getDatacenter())
|
.datacenter(in.getDatacenter())
|
||||||
.powerState(in.getPowerState())
|
.powerState(in.getPowerState())
|
||||||
.activeTransactionCount(in.getActiveTransactionCount())
|
.activeTransactionCount(in.getActiveTransactionCount())
|
||||||
|
.hourlyBillingFlag(in.isHourlyBillingFlag())
|
||||||
.localDiskFlag(in.isLocalDiskFlag())
|
.localDiskFlag(in.isLocalDiskFlag())
|
||||||
|
.dedicatedAccountHostOnlyFlag(in.isDedicatedAccountHostOnly())
|
||||||
|
.privateNetworkOnlyFlag(in.isPrivateNetworkOnly())
|
||||||
.blockDeviceTemplateGroup(in.getVirtualGuestBlockDeviceTemplateGroup())
|
.blockDeviceTemplateGroup(in.getVirtualGuestBlockDeviceTemplateGroup())
|
||||||
.networkComponents(in.getVirtualGuestNetworkComponents())
|
.networkComponents(in.getVirtualGuestNetworkComponents())
|
||||||
.tagReferences(in.getTagReferences());
|
.tagReferences(in.getTagReferences())
|
||||||
|
.postInstallScriptUri(in.getPostInstallScriptUri())
|
||||||
|
.virtualGuestAttribute(in.getVirtualGuestAttribute())
|
||||||
|
.sshKeys(in.getSshKeys());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,7 +506,6 @@ public class VirtualGuest {
|
|||||||
|
|
||||||
private final int accountId;
|
private final int accountId;
|
||||||
private final Date createDate;
|
private final Date createDate;
|
||||||
private final boolean dedicatedAccountHostOnly;
|
|
||||||
private final String domain;
|
private final String domain;
|
||||||
private final String fullyQualifiedDomainName;
|
private final String fullyQualifiedDomainName;
|
||||||
private final String hostname;
|
private final String hostname;
|
||||||
@ -455,7 +517,6 @@ public class VirtualGuest {
|
|||||||
private final Date metricPollDate;
|
private final Date metricPollDate;
|
||||||
private final Date modifyDate;
|
private final Date modifyDate;
|
||||||
private final String notes;
|
private final String notes;
|
||||||
private final boolean privateNetworkOnly;
|
|
||||||
private final int startCpus;
|
private final int startCpus;
|
||||||
private final int statusId;
|
private final int statusId;
|
||||||
private final String uuid;
|
private final String uuid;
|
||||||
@ -469,32 +530,45 @@ public class VirtualGuest {
|
|||||||
private final SoftwareLicense softwareLicense;
|
private final SoftwareLicense softwareLicense;
|
||||||
private final int activeTransactionCount;
|
private final int activeTransactionCount;
|
||||||
private final List<VirtualGuestBlockDevice> blockDevices;
|
private final List<VirtualGuestBlockDevice> blockDevices;
|
||||||
|
private final boolean hourlyBillingFlag;
|
||||||
private final boolean localDiskFlag;
|
private final boolean localDiskFlag;
|
||||||
|
private final boolean dedicatedAccountHostOnlyFlag;
|
||||||
|
private final boolean privateNetworkOnlyFlag;
|
||||||
private final VirtualGuestBlockDeviceTemplateGroup blockDeviceTemplateGroup;
|
private final VirtualGuestBlockDeviceTemplateGroup blockDeviceTemplateGroup;
|
||||||
private final Set<VirtualGuestNetworkComponent> networkComponents;
|
private final Set<VirtualGuestNetworkComponent> networkComponents;
|
||||||
private final Set<TagReference> tagReferences;
|
private final Set<TagReference> tagReferences;
|
||||||
|
private final VirtualGuestNetworkComponent primaryNetworkComponent;
|
||||||
|
private final VirtualGuestNetworkComponent primaryBackendNetworkComponent;
|
||||||
|
private final String postInstallScriptUri;
|
||||||
|
private final VirtualGuestAttribute virtualGuestAttribute;
|
||||||
|
private final Set<SecuritySshKey> sshKeys;
|
||||||
|
|
||||||
@ConstructorProperties({ "accountId", "createDate", "dedicatedAccountHostOnlyFlag", "domain",
|
@ConstructorProperties({"accountId", "createDate", "domain", "fullyQualifiedDomainName", "hostname", "id",
|
||||||
"fullyQualifiedDomainName", "hostname", "id", "lastVerifiedDate", "maxCpu", "maxCpuUnits", "maxMemory",
|
"lastVerifiedDate", "maxCpu", "maxCpuUnits", "maxMemory", "metricPollDate", "modifyDate", "notes",
|
||||||
"metricPollDate", "modifyDate", "notes", "privateNetworkOnlyFlag", "startCpus", "statusId", "uuid",
|
"startCpus", "statusId", "uuid", "primaryBackendIpAddress", "primaryIpAddress", "billingItem",
|
||||||
"primaryBackendIpAddress", "primaryIpAddress", "billingItem", "operatingSystem",
|
"operatingSystem", "operatingSystemReferenceCode", "datacenter", "powerState", "softwareLicense",
|
||||||
"operatingSystemReferenceCode", "datacenter", "powerState", "softwareLicense", "activeTransactionCount",
|
"activeTransactionCount", "blockDevices", "hourlyBillingFlag", "localDiskFlag",
|
||||||
"blockDevices", "localDiskFlag", "blockDeviceTemplateGroup", "networkComponents", "tagReferences"
|
"dedicatedAccountHostOnlyFlag", "privateNetworkOnlyFlag", "blockDeviceTemplateGroup", "networkComponents",
|
||||||
})
|
"tagReferences", "primaryNetworkComponent", "primaryBackendNetworkComponent", "postInstallScriptUri",
|
||||||
protected VirtualGuest(int accountId, @Nullable Date createDate, boolean dedicatedAccountHostOnly, @Nullable String domain,
|
"virtualGuestAttribute", "sshKeys"})
|
||||||
|
protected VirtualGuest(int accountId, @Nullable Date createDate, @Nullable String domain,
|
||||||
@Nullable String fullyQualifiedDomainName, @Nullable String hostname, int id, @Nullable Date lastVerifiedDate,
|
@Nullable String fullyQualifiedDomainName, @Nullable String hostname, int id, @Nullable Date lastVerifiedDate,
|
||||||
int maxCpu, @Nullable String maxCpuUnits, int maxMemory, @Nullable Date metricPollDate, @Nullable Date modifyDate,
|
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 String primaryBackendIpAddress, @Nullable String primaryIpAddress, @Nullable BillingItem billingItem,
|
||||||
@Nullable OperatingSystem operatingSystem, @Nullable String operatingSystemReferenceCode,
|
@Nullable OperatingSystem operatingSystem, @Nullable String operatingSystemReferenceCode,
|
||||||
@Nullable Datacenter datacenter, @Nullable PowerState powerState, @Nullable SoftwareLicense softwareLicense,
|
@Nullable Datacenter datacenter, @Nullable PowerState powerState, @Nullable SoftwareLicense softwareLicense,
|
||||||
int activeTransactionCount, @Nullable List<VirtualGuestBlockDevice> blockDevices,
|
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<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.accountId = accountId;
|
||||||
this.createDate = createDate;
|
this.createDate = createDate;
|
||||||
this.dedicatedAccountHostOnly = dedicatedAccountHostOnly;
|
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
this.fullyQualifiedDomainName = fullyQualifiedDomainName;
|
this.fullyQualifiedDomainName = fullyQualifiedDomainName;
|
||||||
this.hostname = hostname;
|
this.hostname = hostname;
|
||||||
@ -506,7 +580,6 @@ public class VirtualGuest {
|
|||||||
this.metricPollDate = metricPollDate;
|
this.metricPollDate = metricPollDate;
|
||||||
this.modifyDate = modifyDate;
|
this.modifyDate = modifyDate;
|
||||||
this.notes = notes;
|
this.notes = notes;
|
||||||
this.privateNetworkOnly = privateNetworkOnly;
|
|
||||||
this.startCpus = startCpus;
|
this.startCpus = startCpus;
|
||||||
this.statusId = statusId;
|
this.statusId = statusId;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
@ -520,10 +593,18 @@ public class VirtualGuest {
|
|||||||
this.powerState = powerState;
|
this.powerState = powerState;
|
||||||
this.softwareLicense = softwareLicense;
|
this.softwareLicense = softwareLicense;
|
||||||
this.activeTransactionCount = activeTransactionCount;
|
this.activeTransactionCount = activeTransactionCount;
|
||||||
|
this.hourlyBillingFlag = hourlyBillingFlag;
|
||||||
this.localDiskFlag = localDiskFlag;
|
this.localDiskFlag = localDiskFlag;
|
||||||
|
this.dedicatedAccountHostOnlyFlag = dedicatedAccountHostOnlyFlag;
|
||||||
|
this.privateNetworkOnlyFlag = privateNetworkOnlyFlag;
|
||||||
this.blockDeviceTemplateGroup = blockDeviceTemplateGroup;
|
this.blockDeviceTemplateGroup = blockDeviceTemplateGroup;
|
||||||
this.networkComponents = networkComponents;
|
this.networkComponents = networkComponents;
|
||||||
this.tagReferences = tagReferences;
|
this.tagReferences = tagReferences;
|
||||||
|
this.primaryNetworkComponent = primaryNetworkComponent;
|
||||||
|
this.primaryBackendNetworkComponent = primaryBackendNetworkComponent;
|
||||||
|
this.postInstallScriptUri = postInstallScriptUri;
|
||||||
|
this.virtualGuestAttribute = virtualGuestAttribute;
|
||||||
|
this.sshKeys = sshKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -541,14 +622,6 @@ public class VirtualGuest {
|
|||||||
return this.createDate;
|
return this.createDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @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
|
* @return A computing instance's domain name
|
||||||
*/
|
*/
|
||||||
@ -635,13 +708,6 @@ public class VirtualGuest {
|
|||||||
return this.notes;
|
return this.notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @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.
|
* @return The number of CPUs available to a computing instance upon startup.
|
||||||
*/
|
*/
|
||||||
@ -733,10 +799,30 @@ public class VirtualGuest {
|
|||||||
return blockDevices;
|
return blockDevices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isHourlyBillingFlag() {
|
||||||
|
return this.hourlyBillingFlag;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isLocalDiskFlag() {
|
public boolean isLocalDiskFlag() {
|
||||||
return localDiskFlag;
|
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() {
|
public VirtualGuestBlockDeviceTemplateGroup getVirtualGuestBlockDeviceTemplateGroup() {
|
||||||
return blockDeviceTemplateGroup;
|
return blockDeviceTemplateGroup;
|
||||||
}
|
}
|
||||||
@ -751,13 +837,35 @@ public class VirtualGuest {
|
|||||||
return tagReferences;
|
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
|
@Override
|
||||||
public int hashCode() {
|
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,
|
hostname, id, lastVerifiedDate, maxCpu, maxCpuUnits, maxMemory, metricPollDate, modifyDate, notes,
|
||||||
privateNetworkOnly, startCpus, statusId, uuid, primaryBackendIpAddress, primaryIpAddress,
|
startCpus, statusId, uuid, primaryBackendIpAddress, primaryIpAddress,
|
||||||
billingItemId, operatingSystem, datacenter, powerState, softwareLicense, blockDevices, localDiskFlag,
|
billingItemId, operatingSystem, datacenter, powerState, softwareLicense, blockDevices,
|
||||||
blockDeviceTemplateGroup, tagReferences);
|
hourlyBillingFlag, localDiskFlag, dedicatedAccountHostOnlyFlag, privateNetworkOnlyFlag,
|
||||||
|
blockDeviceTemplateGroup, tagReferences, primaryNetworkComponent, primaryBackendNetworkComponent,
|
||||||
|
postInstallScriptUri, virtualGuestAttribute, sshKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -767,7 +875,6 @@ public class VirtualGuest {
|
|||||||
VirtualGuest that = VirtualGuest.class.cast(obj);
|
VirtualGuest that = VirtualGuest.class.cast(obj);
|
||||||
return Objects.equal(this.accountId, that.accountId)
|
return Objects.equal(this.accountId, that.accountId)
|
||||||
&& Objects.equal(this.createDate, that.createDate)
|
&& Objects.equal(this.createDate, that.createDate)
|
||||||
&& Objects.equal(this.dedicatedAccountHostOnly, that.dedicatedAccountHostOnly)
|
|
||||||
&& Objects.equal(this.domain, that.domain)
|
&& Objects.equal(this.domain, that.domain)
|
||||||
&& Objects.equal(this.fullyQualifiedDomainName, that.fullyQualifiedDomainName)
|
&& Objects.equal(this.fullyQualifiedDomainName, that.fullyQualifiedDomainName)
|
||||||
&& Objects.equal(this.hostname, that.hostname)
|
&& Objects.equal(this.hostname, that.hostname)
|
||||||
@ -779,7 +886,6 @@ public class VirtualGuest {
|
|||||||
&& Objects.equal(this.metricPollDate, that.metricPollDate)
|
&& Objects.equal(this.metricPollDate, that.metricPollDate)
|
||||||
&& Objects.equal(this.modifyDate, that.modifyDate)
|
&& Objects.equal(this.modifyDate, that.modifyDate)
|
||||||
&& Objects.equal(this.notes, that.notes)
|
&& Objects.equal(this.notes, that.notes)
|
||||||
&& Objects.equal(this.privateNetworkOnly, that.privateNetworkOnly)
|
|
||||||
&& Objects.equal(this.startCpus, that.startCpus)
|
&& Objects.equal(this.startCpus, that.startCpus)
|
||||||
&& Objects.equal(this.statusId, that.statusId)
|
&& Objects.equal(this.statusId, that.statusId)
|
||||||
&& Objects.equal(this.uuid, that.uuid)
|
&& Objects.equal(this.uuid, that.uuid)
|
||||||
@ -792,18 +898,21 @@ public class VirtualGuest {
|
|||||||
&& Objects.equal(this.powerState, that.powerState)
|
&& Objects.equal(this.powerState, that.powerState)
|
||||||
&& Objects.equal(this.softwareLicense, that.softwareLicense)
|
&& Objects.equal(this.softwareLicense, that.softwareLicense)
|
||||||
&& Objects.equal(this.blockDevices, that.blockDevices)
|
&& Objects.equal(this.blockDevices, that.blockDevices)
|
||||||
|
&& Objects.equal(this.hourlyBillingFlag, that.hourlyBillingFlag)
|
||||||
&& Objects.equal(this.localDiskFlag, that.localDiskFlag)
|
&& 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.blockDeviceTemplateGroup, that.blockDeviceTemplateGroup)
|
||||||
&& Objects.equal(this.networkComponents, that.networkComponents)
|
&& 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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return MoreObjects.toStringHelper(this)
|
return Objects.toStringHelper(this)
|
||||||
.add("accountId", accountId)
|
.add("accountId", accountId)
|
||||||
.add("createDate", createDate)
|
.add("createDate", createDate)
|
||||||
.add("dedicatedAccountHostOnly", dedicatedAccountHostOnly)
|
|
||||||
.add("domain", domain)
|
.add("domain", domain)
|
||||||
.add("fullyQualifiedDomainName", fullyQualifiedDomainName)
|
.add("fullyQualifiedDomainName", fullyQualifiedDomainName)
|
||||||
.add("hostname", hostname)
|
.add("hostname", hostname)
|
||||||
@ -815,7 +924,6 @@ public class VirtualGuest {
|
|||||||
.add("metricPollDate", metricPollDate)
|
.add("metricPollDate", metricPollDate)
|
||||||
.add("modifyDate", modifyDate)
|
.add("modifyDate", modifyDate)
|
||||||
.add("notes", notes)
|
.add("notes", notes)
|
||||||
.add("privateNetworkOnly", privateNetworkOnly)
|
|
||||||
.add("startCpus", startCpus)
|
.add("startCpus", startCpus)
|
||||||
.add("statusId", statusId)
|
.add("statusId", statusId)
|
||||||
.add("uuid", uuid)
|
.add("uuid", uuid)
|
||||||
@ -829,10 +937,18 @@ public class VirtualGuest {
|
|||||||
.add("softwareLicense", softwareLicense)
|
.add("softwareLicense", softwareLicense)
|
||||||
.add("activeTransactionCount", activeTransactionCount)
|
.add("activeTransactionCount", activeTransactionCount)
|
||||||
.add("blockDevices", blockDevices)
|
.add("blockDevices", blockDevices)
|
||||||
|
.add("hourlyBillingFlag", hourlyBillingFlag)
|
||||||
.add("localDiskFlag", localDiskFlag)
|
.add("localDiskFlag", localDiskFlag)
|
||||||
|
.add("dedicatedAccountHostOnlyFlag", dedicatedAccountHostOnlyFlag)
|
||||||
|
.add("privateNetworkOnlyFlag", privateNetworkOnlyFlag)
|
||||||
.add("blockDeviceTemplateGroup", blockDeviceTemplateGroup)
|
.add("blockDeviceTemplateGroup", blockDeviceTemplateGroup)
|
||||||
.add("networkComponents", networkComponents)
|
.add("networkComponents", networkComponents)
|
||||||
.add("tagReferences", tagReferences)
|
.add("tagReferences", tagReferences)
|
||||||
|
.add("primaryNetworkComponent", primaryNetworkComponent)
|
||||||
|
.add("primaryBackendNetworkComponent", primaryBackendNetworkComponent)
|
||||||
|
.add("postInstallScriptUri", postInstallScriptUri)
|
||||||
|
.add("virtualGuestAttribute", virtualGuestAttribute)
|
||||||
|
.add("sshKeys", sshKeys)
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -50,6 +50,7 @@ public class VirtualGuestNetworkComponent {
|
|||||||
protected int port;
|
protected int port;
|
||||||
protected int speed;
|
protected int speed;
|
||||||
protected String status;
|
protected String status;
|
||||||
|
protected NetworkVlan networkVlan;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.jclouds.softlayer.domain.VirtualGuestNetworkComponent#getId()
|
* @see org.jclouds.softlayer.domain.VirtualGuestNetworkComponent#getId()
|
||||||
@ -120,9 +121,14 @@ public class VirtualGuestNetworkComponent {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder networkVlan(NetworkVlan networkVlan) {
|
||||||
|
this.networkVlan = networkVlan;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public VirtualGuestNetworkComponent build() {
|
public VirtualGuestNetworkComponent build() {
|
||||||
return new VirtualGuestNetworkComponent(id, uuid, guestId, networkId, macAddress, maxSpeed, name, port,
|
return new VirtualGuestNetworkComponent(id, uuid, guestId, networkId, macAddress, maxSpeed, name, port,
|
||||||
speed, status);
|
speed, status, networkVlan);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder fromVirtualGuestNetworkComponent(VirtualGuestNetworkComponent in) {
|
public Builder fromVirtualGuestNetworkComponent(VirtualGuestNetworkComponent in) {
|
||||||
@ -135,7 +141,8 @@ public class VirtualGuestNetworkComponent {
|
|||||||
.maxSpeed(in.getMaxSpeed())
|
.maxSpeed(in.getMaxSpeed())
|
||||||
.port(in.getPort())
|
.port(in.getPort())
|
||||||
.speed(in.getSpeed())
|
.speed(in.getSpeed())
|
||||||
.status(in.getStatus());
|
.status(in.getStatus())
|
||||||
|
.networkVlan(in.getNetworkVlan());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,11 +156,13 @@ public class VirtualGuestNetworkComponent {
|
|||||||
private final int port;
|
private final int port;
|
||||||
private final int speed;
|
private final int speed;
|
||||||
private final String status;
|
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,
|
protected VirtualGuestNetworkComponent(int id, String uuid, int guestId, int networkId, @Nullable String macAddress,
|
||||||
int maxSpeed, @Nullable String name, int port, int speed,
|
int maxSpeed, @Nullable String name, int port, int speed,
|
||||||
@Nullable String status) {
|
@Nullable String status, @Nullable NetworkVlan networkVlan) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.guestId = guestId;
|
this.guestId = guestId;
|
||||||
@ -164,6 +173,7 @@ public class VirtualGuestNetworkComponent {
|
|||||||
this.port = port;
|
this.port = port;
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
|
this.networkVlan = networkVlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
@ -206,6 +216,10 @@ public class VirtualGuestNetworkComponent {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NetworkVlan getNetworkVlan() {
|
||||||
|
return networkVlan;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
@ -222,13 +236,14 @@ public class VirtualGuestNetworkComponent {
|
|||||||
Objects.equal(this.name, that.name) &&
|
Objects.equal(this.name, that.name) &&
|
||||||
Objects.equal(this.port, that.port) &&
|
Objects.equal(this.port, that.port) &&
|
||||||
Objects.equal(this.speed, that.speed) &&
|
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
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(id, uuid, guestId, networkId, macAddress, maxSpeed,
|
return Objects.hashCode(id, uuid, guestId, networkId, macAddress, maxSpeed,
|
||||||
name, port, speed, status);
|
name, port, speed, status, networkVlan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -244,6 +259,7 @@ public class VirtualGuestNetworkComponent {
|
|||||||
.add("port", port)
|
.add("port", port)
|
||||||
.add("speed", speed)
|
.add("speed", speed)
|
||||||
.add("status", status)
|
.add("status", status)
|
||||||
|
.add("networkVlan", networkVlan)
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,331 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.google.common.base.Objects;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
public class TemplateObject {
|
||||||
|
private final String hostname;
|
||||||
|
private final String domain;
|
||||||
|
private final int startCpus;
|
||||||
|
private final int maxMemory;
|
||||||
|
private final boolean hourlyBillingFlag;
|
||||||
|
private final boolean localDiskFlag;
|
||||||
|
private final boolean dedicatedAccountHostOnlyFlag;
|
||||||
|
private final boolean privateNetworkOnlyFlag;
|
||||||
|
private final BlockDeviceTemplateGroup blockDeviceTemplateGroup;
|
||||||
|
private final String operatingSystemReferenceCode;
|
||||||
|
private final Datacenter datacenter;
|
||||||
|
private final Set<NetworkComponent> networkComponents;
|
||||||
|
private final List<BlockDevice> blockDevices;
|
||||||
|
private final String postInstallScriptUri;
|
||||||
|
private final PrimaryNetworkComponent primaryNetworkComponent;
|
||||||
|
private final PrimaryBackendNetworkComponent primaryBackendNetworkComponent;
|
||||||
|
private final Set<Map<String, String>> userData;
|
||||||
|
private final Set<Map<String, Integer>> sshKeys;
|
||||||
|
|
||||||
|
private TemplateObject(String hostname, String domain, int startCpus, int maxMemory, boolean hourlyBillingFlag,
|
||||||
|
boolean localDiskFlag, boolean dedicatedAccountHostOnlyFlag,
|
||||||
|
boolean privateNetworkOnlyFlag, String operatingSystemReferenceCode,
|
||||||
|
BlockDeviceTemplateGroup blockDeviceTemplateGroup, Datacenter datacenter,
|
||||||
|
Set<NetworkComponent> networkComponents, List<BlockDevice> blockDevices,
|
||||||
|
String postInstallScriptUri, PrimaryNetworkComponent primaryNetworkComponent,
|
||||||
|
PrimaryBackendNetworkComponent primaryBackendNetworkComponent, Set<Map<String,
|
||||||
|
String>> userData, Set<Map<String, Integer>> sshKeys) {
|
||||||
|
this.hostname = hostname;
|
||||||
|
this.domain = domain;
|
||||||
|
this.startCpus = startCpus;
|
||||||
|
this.maxMemory = maxMemory;
|
||||||
|
this.hourlyBillingFlag = hourlyBillingFlag;
|
||||||
|
this.localDiskFlag = localDiskFlag;
|
||||||
|
this.dedicatedAccountHostOnlyFlag = dedicatedAccountHostOnlyFlag;
|
||||||
|
this.privateNetworkOnlyFlag = privateNetworkOnlyFlag;
|
||||||
|
this.operatingSystemReferenceCode = operatingSystemReferenceCode;
|
||||||
|
this.blockDeviceTemplateGroup = blockDeviceTemplateGroup;
|
||||||
|
this.datacenter = datacenter;
|
||||||
|
this.networkComponents = networkComponents;
|
||||||
|
this.blockDevices = blockDevices;
|
||||||
|
this.postInstallScriptUri = postInstallScriptUri;
|
||||||
|
this.primaryNetworkComponent = primaryNetworkComponent;
|
||||||
|
this.primaryBackendNetworkComponent = primaryBackendNetworkComponent;
|
||||||
|
this.userData = userData;
|
||||||
|
this.sshKeys = sshKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHostname() {
|
||||||
|
return hostname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDomain() {
|
||||||
|
return domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStartCpus() {
|
||||||
|
return startCpus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxMemory() {
|
||||||
|
return maxMemory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHourlyBillingFlag() {
|
||||||
|
return hourlyBillingFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLocalDiskFlag() {
|
||||||
|
return localDiskFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDedicatedAccountHostOnlyFlag() {
|
||||||
|
return dedicatedAccountHostOnlyFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPrivateNetworkOnlyFlag() {
|
||||||
|
return privateNetworkOnlyFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockDeviceTemplateGroup getBlockDeviceTemplateGroup() {
|
||||||
|
return blockDeviceTemplateGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperatingSystemReferenceCode() {
|
||||||
|
return operatingSystemReferenceCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Datacenter getDatacenter() {
|
||||||
|
return datacenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<NetworkComponent> getNetworkComponents() {
|
||||||
|
return networkComponents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BlockDevice> getBlockDevices() {
|
||||||
|
return blockDevices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPostInstallScriptUri() {
|
||||||
|
return postInstallScriptUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrimaryNetworkComponent getPrimaryNetworkComponent() {
|
||||||
|
return primaryNetworkComponent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<Map<String, String>> getUserData() {
|
||||||
|
return userData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<Map<String, Integer>> getSshKeys() {
|
||||||
|
return sshKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrimaryBackendNetworkComponent getPrimaryBackendNetworkComponent() {
|
||||||
|
return primaryBackendNetworkComponent;
|
||||||
|
}
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return builder().fromTemplateObject(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
TemplateObject that = (TemplateObject) o;
|
||||||
|
|
||||||
|
return Objects.equal(this.hostname, that.hostname) &&
|
||||||
|
Objects.equal(this.domain, that.domain) &&
|
||||||
|
Objects.equal(this.startCpus, that.startCpus) &&
|
||||||
|
Objects.equal(this.maxMemory, that.maxMemory) &&
|
||||||
|
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.operatingSystemReferenceCode, that.operatingSystemReferenceCode) &&
|
||||||
|
Objects.equal(this.datacenter, that.datacenter) &&
|
||||||
|
Objects.equal(this.networkComponents, that.networkComponents) &&
|
||||||
|
Objects.equal(this.blockDevices, that.blockDevices) &&
|
||||||
|
Objects.equal(this.postInstallScriptUri, that.postInstallScriptUri) &&
|
||||||
|
Objects.equal(this.primaryNetworkComponent, that.primaryNetworkComponent) &&
|
||||||
|
Objects.equal(this.primaryBackendNetworkComponent, that.primaryBackendNetworkComponent) &&
|
||||||
|
Objects.equal(this.userData, that.userData) &&
|
||||||
|
Objects.equal(this.sshKeys, that.sshKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(hostname, domain, startCpus, maxMemory, hourlyBillingFlag, localDiskFlag,
|
||||||
|
dedicatedAccountHostOnlyFlag, privateNetworkOnlyFlag, blockDeviceTemplateGroup, operatingSystemReferenceCode, datacenter,
|
||||||
|
networkComponents, blockDevices, postInstallScriptUri, primaryNetworkComponent,
|
||||||
|
primaryBackendNetworkComponent, userData, sshKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
protected String hostname;
|
||||||
|
protected String domain;
|
||||||
|
protected int startCpus;
|
||||||
|
protected int maxMemory;
|
||||||
|
protected boolean hourlyBillingFlag;
|
||||||
|
protected boolean localDiskFlag;
|
||||||
|
protected boolean dedicatedAccountHostOnlyFlag;
|
||||||
|
protected boolean privateNetworkOnlyFlag;
|
||||||
|
protected String operatingSystemReferenceCode;
|
||||||
|
protected BlockDeviceTemplateGroup blockDeviceTemplateGroup;
|
||||||
|
protected Datacenter datacenter;
|
||||||
|
protected Set<NetworkComponent> networkComponents;
|
||||||
|
protected List<BlockDevice> blockDevices;
|
||||||
|
protected String postInstallScriptUri;
|
||||||
|
protected PrimaryNetworkComponent primaryNetworkComponent;
|
||||||
|
protected PrimaryBackendNetworkComponent primaryBackendNetworkComponent;
|
||||||
|
protected Set<Map<String, String>> userData;
|
||||||
|
protected Set<Map<String, Integer>> sshKeys;
|
||||||
|
|
||||||
|
public Builder hostname(String hostname) {
|
||||||
|
this.hostname = hostname;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder domain(String domain) {
|
||||||
|
this.domain = domain;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder startCpus(int startCpus) {
|
||||||
|
this.startCpus = startCpus;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder maxMemory(int maxMemory) {
|
||||||
|
this.maxMemory = maxMemory;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder hourlyBillingFlag(boolean hourlyBillingFlag) {
|
||||||
|
this.hourlyBillingFlag = hourlyBillingFlag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder localDiskFlag(boolean localDiskFlag) {
|
||||||
|
this.localDiskFlag = localDiskFlag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder dedicatedAccountHostOnlyFlag(boolean dedicatedAccountHostOnlyFlag) {
|
||||||
|
this.dedicatedAccountHostOnlyFlag = dedicatedAccountHostOnlyFlag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder privateNetworkOnlyFlag(boolean privateNetworkOnlyFlag) {
|
||||||
|
this.privateNetworkOnlyFlag = privateNetworkOnlyFlag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder operatingSystemReferenceCode(String operatingSystemReferenceCode) {
|
||||||
|
this.operatingSystemReferenceCode = operatingSystemReferenceCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder blockDeviceTemplateGroup(BlockDeviceTemplateGroup blockDeviceTemplateGroup) {
|
||||||
|
this.blockDeviceTemplateGroup = blockDeviceTemplateGroup;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder datacenter(Datacenter datacenter) {
|
||||||
|
this.datacenter = datacenter;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder networkComponents(Set<NetworkComponent> networkComponents) {
|
||||||
|
this.networkComponents = networkComponents;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder blockDevices(List<BlockDevice> blockDevices) {
|
||||||
|
this.blockDevices = blockDevices;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder postInstallScriptUri(String postInstallScriptUri) {
|
||||||
|
this.postInstallScriptUri = postInstallScriptUri;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder primaryNetworkComponent(PrimaryNetworkComponent primaryNetworkComponent) {
|
||||||
|
this.primaryNetworkComponent = primaryNetworkComponent;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder primaryBackendNetworkComponent(PrimaryBackendNetworkComponent primaryBackendNetworkComponent) {
|
||||||
|
this.primaryBackendNetworkComponent = primaryBackendNetworkComponent;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder userData(Set<Map<String, String>> userData) {
|
||||||
|
this.userData = ImmutableSet.copyOf(userData);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder sshKeys(Set<Map<String, Integer>> sshKeys) {
|
||||||
|
this.sshKeys = ImmutableSet.copyOf(sshKeys);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TemplateObject build() {
|
||||||
|
return new TemplateObject(hostname, domain, startCpus, maxMemory, hourlyBillingFlag, localDiskFlag,
|
||||||
|
dedicatedAccountHostOnlyFlag, privateNetworkOnlyFlag, operatingSystemReferenceCode,
|
||||||
|
blockDeviceTemplateGroup, datacenter, networkComponents, blockDevices, postInstallScriptUri,
|
||||||
|
primaryNetworkComponent, primaryBackendNetworkComponent, userData, sshKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromTemplateObject(TemplateObject in) {
|
||||||
|
return this
|
||||||
|
.hostname(in.getHostname())
|
||||||
|
.domain(in.getDomain())
|
||||||
|
.startCpus(in.getStartCpus())
|
||||||
|
.maxMemory(in.getMaxMemory())
|
||||||
|
.hourlyBillingFlag(in.isHourlyBillingFlag())
|
||||||
|
.localDiskFlag(in.isLocalDiskFlag())
|
||||||
|
.dedicatedAccountHostOnlyFlag(in.isDedicatedAccountHostOnlyFlag())
|
||||||
|
.privateNetworkOnlyFlag(in.isPrivateNetworkOnlyFlag())
|
||||||
|
.operatingSystemReferenceCode(in.getOperatingSystemReferenceCode())
|
||||||
|
.blockDeviceTemplateGroup(in.getBlockDeviceTemplateGroup())
|
||||||
|
.datacenter(in.getDatacenter())
|
||||||
|
.networkComponents(in.getNetworkComponents())
|
||||||
|
.blockDevices(in.getBlockDevices())
|
||||||
|
.postInstallScriptUri(in.getPostInstallScriptUri())
|
||||||
|
.primaryNetworkComponent(in.getPrimaryNetworkComponent())
|
||||||
|
.primaryBackendNetworkComponent(in.getPrimaryBackendNetworkComponent())
|
||||||
|
.userData(in.getUserData())
|
||||||
|
.sshKeys(in.getSshKeys());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -51,7 +51,7 @@ public interface VirtualGuestApi {
|
|||||||
|
|
||||||
String GUEST_MASK = "id;hostname;domain;fullyQualifiedDomainName;powerState;maxCpu;maxMemory;" +
|
String GUEST_MASK = "id;hostname;domain;fullyQualifiedDomainName;powerState;maxCpu;maxMemory;" +
|
||||||
"statusId;operatingSystem.passwords;primaryBackendIpAddress;primaryIpAddress;activeTransactionCount;" +
|
"statusId;operatingSystem.passwords;primaryBackendIpAddress;primaryIpAddress;activeTransactionCount;" +
|
||||||
"blockDevices.diskImage;datacenter;tagReferences";
|
"blockDevices.diskImage;datacenter;tagReferences;privateNetworkOnlyFlag;sshKeys";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables the creation of computing instances on an account.
|
* Enables the creation of computing instances on an account.
|
||||||
|
@ -60,30 +60,15 @@ public class VirtualGuestToJsonTest {
|
|||||||
|
|
||||||
request = binder.bindToRequest(request, virtualGuestWithOS);
|
request = binder.bindToRequest(request, virtualGuestWithOS);
|
||||||
|
|
||||||
assertEquals(request.getPayload().getRawContent(),
|
assertEquals(request.getPayload().getRawContent(), "{" +
|
||||||
"{" +
|
"\"parameters\":[{\"hostname\":\"hostname\",\"domain\":\"domain\",\"startCpus\":1,\"maxMemory\":1024,\"hourlyBillingFlag\":false,\"localDiskFlag\":true,\"dedicatedAccountHostOnlyFlag\":false,\"privateNetworkOnlyFlag\":false,\"operatingSystemReferenceCode\":\"UBUNTU_12_64\",\"datacenter\":{\"name\":\"datacenterName\"}}]}");
|
||||||
"\"parameters\":[" +
|
|
||||||
"{" +
|
|
||||||
"\"hostname\":\"hostname\"," +
|
|
||||||
"\"domain\":\"domain\"," +
|
|
||||||
"\"startCpus\":1," +
|
|
||||||
"\"maxMemory\":1024," +
|
|
||||||
"\"hourlyBillingFlag\":true," +
|
|
||||||
"\"operatingSystemReferenceCode\":\"UBUNTU_12_64\"," +
|
|
||||||
"\"localDiskFlag\":true," +
|
|
||||||
"\"datacenter\":{" +
|
|
||||||
"\"name\":\"datacenterName\"" +
|
|
||||||
"}" +
|
|
||||||
"}" +
|
|
||||||
"]" +
|
|
||||||
"}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testVirtualGuestWithVirtualGuestBlockDeviceTemplateGroup() {
|
public void testVirtualGuestWithVirtualGuestBlockDeviceTemplateGroup() {
|
||||||
HttpRequest request = HttpRequest.builder().method("POST").endpoint("https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest").build();
|
HttpRequest request = HttpRequest.builder().method("POST").endpoint("https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest").build();
|
||||||
VirtualGuestToJson binder = new VirtualGuestToJson(json);
|
VirtualGuestToJson binder = new VirtualGuestToJson(json);
|
||||||
VirtualGuest virtualGuestWithOS = VirtualGuest.builder()
|
VirtualGuest virtualGuestWithVirtualGuestBlockDeviceTemplateGroup = VirtualGuest.builder()
|
||||||
.hostname("hostname")
|
.hostname("hostname")
|
||||||
.domain("domain")
|
.domain("domain")
|
||||||
.startCpus(1)
|
.startCpus(1)
|
||||||
@ -97,26 +82,20 @@ public class VirtualGuestToJsonTest {
|
|||||||
.localDiskFlag(true)
|
.localDiskFlag(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
request = binder.bindToRequest(request, virtualGuestWithOS);
|
request = binder.bindToRequest(request, virtualGuestWithVirtualGuestBlockDeviceTemplateGroup);
|
||||||
|
|
||||||
assertEquals(request.getPayload().getRawContent(),
|
assertEquals(request.getPayload().getRawContent(), "{" +
|
||||||
"{" +
|
|
||||||
"\"parameters\":[{" +
|
"\"parameters\":[{" +
|
||||||
"\"hostname\":\"hostname\"," +
|
"\"hostname\":\"hostname\"," +
|
||||||
"\"domain\":\"domain\"," +
|
"\"domain\":\"domain\"," +
|
||||||
"\"startCpus\":1," +
|
"\"startCpus\":1," +
|
||||||
"\"maxMemory\":1024," +
|
"\"maxMemory\":1024," +
|
||||||
"\"hourlyBillingFlag\":true," +
|
"\"hourlyBillingFlag\":false," +
|
||||||
"\"blockDeviceTemplateGroup\":{" +
|
"\"localDiskFlag\":true," +
|
||||||
"\"globalIdentifier\":\"ffaafa98-4b4a-4fa7-b9f7-b1bad5ec50f0\"" +
|
"\"dedicatedAccountHostOnlyFlag\":false," +
|
||||||
"}," +
|
"\"privateNetworkOnlyFlag\":false," +
|
||||||
"\"localDiskFlag\":true," +
|
"\"blockDeviceTemplateGroup\":{\"globalIdentifier\":\"ffaafa98-4b4a-4fa7-b9f7-b1bad5ec50f0\"}," +
|
||||||
"\"datacenter\":{" +
|
"\"datacenter\":{\"name\":\"datacenterName\"}}]}");
|
||||||
"\"name\":\"datacenterName\"" +
|
|
||||||
"}" +
|
|
||||||
"}" +
|
|
||||||
"]" +
|
|
||||||
"}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import org.jclouds.domain.LoginCredentials;
|
|||||||
import org.jclouds.softlayer.SoftLayerApi;
|
import org.jclouds.softlayer.SoftLayerApi;
|
||||||
import org.jclouds.softlayer.compute.options.SoftLayerTemplateOptions;
|
import org.jclouds.softlayer.compute.options.SoftLayerTemplateOptions;
|
||||||
import org.jclouds.softlayer.compute.strategy.SoftLayerComputeServiceAdapter;
|
import org.jclouds.softlayer.compute.strategy.SoftLayerComputeServiceAdapter;
|
||||||
|
import org.jclouds.softlayer.domain.Datacenter;
|
||||||
import org.jclouds.softlayer.domain.VirtualGuest;
|
import org.jclouds.softlayer.domain.VirtualGuest;
|
||||||
import org.jclouds.softlayer.features.BaseSoftLayerApiLiveTest;
|
import org.jclouds.softlayer.features.BaseSoftLayerApiLiveTest;
|
||||||
import org.jclouds.ssh.SshClient;
|
import org.jclouds.ssh.SshClient;
|
||||||
@ -67,7 +68,8 @@ public class SoftLayerComputeServiceAdapterLiveTest extends BaseSoftLayerApiLive
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListLocations() {
|
public void testListLocations() {
|
||||||
assertFalse(Iterables.isEmpty(adapter.listLocations()), "locations must not be empty");
|
Iterable<Datacenter> locations = adapter.listLocations();
|
||||||
|
assertFalse(Iterables.isEmpty(locations), "locations must not be empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -33,10 +33,7 @@ import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
|||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
||||||
import org.jclouds.softlayer.SoftLayerApi;
|
|
||||||
import org.jclouds.softlayer.compute.options.SoftLayerTemplateOptions;
|
import org.jclouds.softlayer.compute.options.SoftLayerTemplateOptions;
|
||||||
import org.jclouds.softlayer.domain.VirtualGuest;
|
|
||||||
import org.jclouds.softlayer.domain.VirtualGuestBlockDevice;
|
|
||||||
import org.jclouds.ssh.SshClient;
|
import org.jclouds.ssh.SshClient;
|
||||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
@ -59,7 +56,6 @@ public class SoftLayerComputeServiceContextLiveTest extends BaseComputeServiceCo
|
|||||||
public void testLaunchClusterWithMinDisk() throws RunNodesException {
|
public void testLaunchClusterWithMinDisk() throws RunNodesException {
|
||||||
int numNodes = 1;
|
int numNodes = 1;
|
||||||
final String name = "node";
|
final String name = "node";
|
||||||
|
|
||||||
ComputeServiceContext context = ContextBuilder.newBuilder("softlayer").credentials(identity, credential)
|
ComputeServiceContext context = ContextBuilder.newBuilder("softlayer").credentials(identity, credential)
|
||||||
.modules(ImmutableSet.of(new SLF4JLoggingModule(),
|
.modules(ImmutableSet.of(new SLF4JLoggingModule(),
|
||||||
new SshjSshClientModule()))
|
new SshjSshClientModule()))
|
||||||
@ -67,10 +63,7 @@ public class SoftLayerComputeServiceContextLiveTest extends BaseComputeServiceCo
|
|||||||
|
|
||||||
TemplateBuilder templateBuilder = context.getComputeService().templateBuilder();
|
TemplateBuilder templateBuilder = context.getComputeService().templateBuilder();
|
||||||
templateBuilder.imageId("CENTOS_6_64");
|
templateBuilder.imageId("CENTOS_6_64");
|
||||||
//templateBuilder.imageVersionMatches("6.5");
|
templateBuilder.locationId("dal01");
|
||||||
templateBuilder.locationId("ams01");
|
|
||||||
// private image id should be a globalIdentifier of a VirtualGuestBlockDeviceTemplateGroup
|
|
||||||
//templateBuilder.imageId("3d7697d8-beef-437a-8921-5a2a18bc116f");
|
|
||||||
|
|
||||||
Template template = templateBuilder.build();
|
Template template = templateBuilder.build();
|
||||||
// test passing custom options
|
// test passing custom options
|
||||||
@ -81,7 +74,6 @@ public class SoftLayerComputeServiceContextLiveTest extends BaseComputeServiceCo
|
|||||||
//options.diskType("SAN");
|
//options.diskType("SAN");
|
||||||
//tags
|
//tags
|
||||||
options.tags(ImmutableList.of("jclouds"));
|
options.tags(ImmutableList.of("jclouds"));
|
||||||
|
|
||||||
Set<? extends NodeMetadata> nodes = context.getComputeService().createNodesInGroup(name, numNodes, template);
|
Set<? extends NodeMetadata> nodes = context.getComputeService().createNodesInGroup(name, numNodes, template);
|
||||||
assertEquals(numNodes, nodes.size(), "wrong number of nodes");
|
assertEquals(numNodes, nodes.size(), "wrong number of nodes");
|
||||||
for (NodeMetadata node : nodes) {
|
for (NodeMetadata node : nodes) {
|
||||||
@ -90,13 +82,6 @@ public class SoftLayerComputeServiceContextLiveTest extends BaseComputeServiceCo
|
|||||||
client.connect();
|
client.connect();
|
||||||
ExecResponse hello = client.exec("mount");
|
ExecResponse hello = client.exec("mount");
|
||||||
logger.debug(hello.getOutput().trim());
|
logger.debug(hello.getOutput().trim());
|
||||||
|
|
||||||
VirtualGuest virtualGuest = context.unwrapApi(SoftLayerApi.class).getVirtualGuestApi()
|
|
||||||
.getVirtualGuest(Long.parseLong(node.getId()));
|
|
||||||
for (VirtualGuestBlockDevice blockDevice : virtualGuest.getVirtualGuestBlockDevices()) {
|
|
||||||
logger.debug(blockDevice.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
context.getComputeService().destroyNode(node.getId());
|
context.getComputeService().destroyNode(node.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ package org.jclouds.softlayer.compute;
|
|||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
import org.jclouds.compute.domain.OsFamilyVersion64Bit;
|
import org.jclouds.compute.domain.OsFamilyVersion64Bit;
|
||||||
@ -163,7 +162,7 @@ public class SoftLayerTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTes
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Set<String> getIso3166Codes() {
|
protected Set<String> getIso3166Codes() {
|
||||||
return ImmutableSet.<String> of("SG", "US-CA", "US-TX", "US-VA", "US-WA", "NL", "HK", "NSFTW-IL");
|
return createProviderMetadata().getIso3166Codes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass(groups = "live")
|
@BeforeClass(groups = "live")
|
||||||
|
@ -42,7 +42,7 @@ public class VirtualGuestApiExpectTest extends BaseSoftLayerApiExpectTest {
|
|||||||
public void testGetVirtualGuestWhenResponseIs2xx() {
|
public void testGetVirtualGuestWhenResponseIs2xx() {
|
||||||
|
|
||||||
HttpRequest getVirtualGuest = HttpRequest.builder().method("GET")
|
HttpRequest getVirtualGuest = HttpRequest.builder().method("GET")
|
||||||
.endpoint("https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/3001812/getObject?objectMask=id%3Bhostname%3Bdomain%3BfullyQualifiedDomainName%3BpowerState%3BmaxCpu%3BmaxMemory%3BstatusId%3BoperatingSystem.passwords%3BprimaryBackendIpAddress%3BprimaryIpAddress%3BactiveTransactionCount%3BblockDevices.diskImage%3Bdatacenter%3BtagReferences")
|
.endpoint("https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/3001812/getObject?objectMask=id%3Bhostname%3Bdomain%3BfullyQualifiedDomainName%3BpowerState%3BmaxCpu%3BmaxMemory%3BstatusId%3BoperatingSystem.passwords%3BprimaryBackendIpAddress%3BprimaryIpAddress%3BactiveTransactionCount%3BblockDevices.diskImage%3Bdatacenter%3BtagReferences%3BprivateNetworkOnlyFlag%3BsshKeys")
|
||||||
.addHeader("Accept", "application/json")
|
.addHeader("Accept", "application/json")
|
||||||
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build();
|
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build();
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ public class VirtualGuestApiExpectTest extends BaseSoftLayerApiExpectTest {
|
|||||||
public void testGetVirtualGuestWhenResponseIs4xx() {
|
public void testGetVirtualGuestWhenResponseIs4xx() {
|
||||||
|
|
||||||
HttpRequest getObjectRequest = HttpRequest.builder().method("GET")
|
HttpRequest getObjectRequest = HttpRequest.builder().method("GET")
|
||||||
.endpoint("https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/3001812/getObject?objectMask=id%3Bhostname%3Bdomain%3BfullyQualifiedDomainName%3BpowerState%3BmaxCpu%3BmaxMemory%3BstatusId%3BoperatingSystem.passwords%3BprimaryBackendIpAddress%3BprimaryIpAddress%3BactiveTransactionCount%3BblockDevices.diskImage%3Bdatacenter%3BtagReferences")
|
.endpoint("https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/3001812/getObject?objectMask=id%3Bhostname%3Bdomain%3BfullyQualifiedDomainName%3BpowerState%3BmaxCpu%3BmaxMemory%3BstatusId%3BoperatingSystem.passwords%3BprimaryBackendIpAddress%3BprimaryIpAddress%3BactiveTransactionCount%3BblockDevices.diskImage%3Bdatacenter%3BtagReferences%3BprivateNetworkOnlyFlag%3BsshKeys")
|
||||||
.addHeader("Accept", "application/json")
|
.addHeader("Accept", "application/json")
|
||||||
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build();
|
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build();
|
||||||
|
|
||||||
|
@ -45,9 +45,8 @@ public class CreateVirtualGuestResponseTest extends BaseSoftLayerParseTest<Virtu
|
|||||||
.maxCpu(1)
|
.maxCpu(1)
|
||||||
.maxCpuUnits("CORE")
|
.maxCpuUnits("CORE")
|
||||||
.maxMemory(1024)
|
.maxMemory(1024)
|
||||||
.privateNetworkOnly(false)
|
.privateNetworkOnlyFlag(false)
|
||||||
.startCpus(1)
|
.startCpus(1)
|
||||||
.privateNetworkOnly(false)
|
|
||||||
.statusId(1001)
|
.statusId(1001)
|
||||||
.billingItemId(0)
|
.billingItemId(0)
|
||||||
.operatingSystem(null)
|
.operatingSystem(null)
|
||||||
|
@ -49,7 +49,7 @@ public class GetVirtualGuestResponseTest extends BaseSoftLayerParseTest<VirtualG
|
|||||||
.maxMemory(1024)
|
.maxMemory(1024)
|
||||||
.metricPollDate(null)
|
.metricPollDate(null)
|
||||||
.modifyDate(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T14:10:21.552-07:00"))
|
.modifyDate(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T14:10:21.552-07:00"))
|
||||||
.privateNetworkOnly(false)
|
.privateNetworkOnlyFlag(false)
|
||||||
.startCpus(1)
|
.startCpus(1)
|
||||||
.statusId(1001)
|
.statusId(1001)
|
||||||
.uuid("92102aff-93c9-05f1-b3f2-50787e865344")
|
.uuid("92102aff-93c9-05f1-b3f2-50787e865344")
|
||||||
|
@ -54,7 +54,7 @@ public class ListVirtualGuestsResponseTest extends BaseSoftLayerParseTest<Set<Vi
|
|||||||
.maxMemory(1024)
|
.maxMemory(1024)
|
||||||
.metricPollDate(null)
|
.metricPollDate(null)
|
||||||
.modifyDate(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T14:10:21.552-07:00"))
|
.modifyDate(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T14:10:21.552-07:00"))
|
||||||
.privateNetworkOnly(false)
|
.privateNetworkOnlyFlag(false)
|
||||||
.startCpus(1)
|
.startCpus(1)
|
||||||
.statusId(1001)
|
.statusId(1001)
|
||||||
.uuid("92102aff-93c9-05f1-b3f2-50787e865344")
|
.uuid("92102aff-93c9-05f1-b3f2-50787e865344")
|
||||||
|
@ -1 +1 @@
|
|||||||
{"parameters":[{"hostname":"host1","domain":"example.com","startCpus":1,"maxMemory":1024,"hourlyBillingFlag":true,"operatingSystemReferenceCode":"UBUNTU_LATEST","localDiskFlag":true,"datacenter":{"name":"test"}}]}
|
{"parameters":[{"hostname":"host1","domain":"example.com","startCpus":1,"maxMemory":1024,"hourlyBillingFlag":false,"localDiskFlag":true,"dedicatedAccountHostOnlyFlag":false,"privateNetworkOnlyFlag":false,"operatingSystemReferenceCode":"UBUNTU_LATEST","datacenter":{"name":"test"}}]}
|
Loading…
x
Reference in New Issue
Block a user