April 28, 2016

Adding/Removing Servers in a Bandwidth Pool

Adding and removing Virtual Guests and Bare Metal Servers in an exising Bandwidth Pool

The following script allows you to add and remove servers in an existing bandwidth pool. The script requires empty arrays when not specifying a Bare Metal or Virtual Guest Id.


/* You can use the getenv() module to pull your exported Username
and API key to keep from having to store them in your files */

require_once './vendor/autoload.php';
$apiUsername = getenv('SOFTLAYER_USERNAME');
$apiKey = getenv('SOFTLAYER_API_KEY');
$pool_id = 316749;

$template = new stdClass();
$template->hardwareToAdd = array();
$template->hardwareToRemove  = array();
$vm = new stdClass();
$vm->id =22983449;
$template -> cloudsToAdd[] = $vm;
$template -> cloudsToRemove = array();

try {
  $client = \SoftLayer\SoapClient::getClient('SoftLayer_Network_Bandwidth_Version1_Allotment', $pool_id, $apiUsername, $apiKey);
  $response = $client->requestVdrContentUpdates($template);


 } catch(Exception $e) {
     echo 'Cannot compute. Error is: ' . $e->getMessage();



We would love to hear it
Open an issue