In setting a computing instance for auto scale option, there are public and private network uplinks. When I set the network component, I am setting a speed only. How can I set Private & Public network along with the speed ?
// Network Components
Component networkComponent = new Component();
networkComponent.setMaxSpeed(speed);
virtualGuestMemberTemplate.getNetworkComponents().add(networkComponent);
I should've been more explicit with my previous answer, I'm adding the script used for creating a Scale group with the modifications required for setting up a Virtual Guest Network Component.
I hope this help you.
package SoftLayer_Java_Scripts.Examples;
import com.google.gson.Gson;
import com.softlayer.api.*;
import com.softlayer.api.service.Location;
import com.softlayer.api.service.scale.Group;
import com.softlayer.api.service.virtual.Guest;
import com.softlayer.api.service.virtual.guest.network.Component;
public class CreateScaleGroup {
private static String user = "set me";
private static String apiKey = "set me";
private static ApiClient client = new RestApiClient().withCredentials(user, apiKey);
public static void main(String[] args) {
Group.Service scaleGroupService = Group.service(client);
Location location = new Location();
location.setName("hkg02");
// Standard Virtual Guest configuration.
Guest guest = new Guest();
guest.setDomain("softlayer.com");
guest.setHostname("hostnametest");
guest.setPostInstallScriptUri("https://www.softlayer.com/script");
guest.setStartCpus(new Long (1));
guest.setDatacenter(location);
guest.setHourlyBillingFlag(true);
guest.setLocalDiskFlag(false);
guest.setOperatingSystemReferenceCode("CENTOS_LATEST");
guest.setMaxMemory(new Long (1));
/*
* The configuration for SoftLayer_Virtual_Guest_Network_Component
* depends on combinations of the network component max speed
* and the virtual guest privateNetworkOnlyFlag.
*
* The available configurations are:
* 1.- Network maxSpeed ( 10) Guest privateNetworkOnlyFlag (false) for "10 Mbps Public & Private Network Uplinks"
* 2.- Network maxSpeed ( 100) Guest privateNetworkOnlyFlag (false) for "100 Mbps Public & Private Network Uplinks"
* 3.- Network maxSpeed (1000) Guest privateNetworkOnlyFlag (false) for "1 Gbps Public & Private Network Uplinks"
* 4.- Network maxSpeed ( 10) Guest privateNetworkOnlyFlag ( true) for "10 Mbps Private Network Uplink"
* 5.- Network maxSpeed ( 100) Guest privateNetworkOnlyFlag ( true) for "100 Mbps Private Network Uplink"
* 6.- Network maxSpeed (1000) Guest privateNetworkOnlyFlag ( true) for "1 Gbps Private Network Uplink"
*/
Component networkComponent = new Component();
networkComponent.setMaxSpeed(new Long(100));
guest.getNetworkComponents().add(networkComponent);
guest.setPrivateNetworkOnlyFlag(false);
// Standard scale group configuration.
Group scaleGroup = new Group();
scaleGroup.setCooldown(new Long(1800));
scaleGroup.setMaximumMemberCount(new Long(5));
scaleGroup.setMinimumMemberCount(new Long(1));
scaleGroup.setName("testVSI");
scaleGroup.setRegionalGroupId(new Long(102));
scaleGroup.setSuspendedFlag(false);
scaleGroup.setTerminationPolicyId(new Long(2));
scaleGroup.setVirtualGuestMemberTemplate(guest);
scaleGroup.setVirtualGuestMemberCount(new Long(0));
Gson gson = new Gson();
System.out.println(gson.toJson(scaleGroupService.createObject(scaleGroup)));
}
}