CancelGlobalIpAddress.php
CancelGlobalIpAddress.php
<?php
require_once(dirname(__FILE__) . '/SoftLayer/SoapClient.class.php');
$apiUsername = 'set me';
$apiKey = 'set me';
$subnetService ='SoftLayer_Network_Subnet';
$billingItemService = 'SoftLayer_Billing_Item';
$subnetId = 880777;
$subnetClient = SoftLayer_SoapClient::getClient($subnetService, $subnetId, $apiUsername, $apiKey);
$mask = new SoftLayer_ObjectMask();
$mask = 'mask[id,billingItem.id]';
$subnetClient->setObjectMask($mask);
try {
$globalIpRecord = $subnetClient->getGlobalIpRecord();
$billingItemId = $globalIpRecord->billingItem->id;
try {
$billingItemClient = SoftLayer_SoapClient::getClient($billingItemService, $billingItemId, $apiUsername, $apiKey);
$result = $billingItemClient->cancelItem( False,
False,
'No longer needed',
'Api test');
print_r($result);
} catch(Exception $e) {
echo 'Unable to cancel the Global IP Address Subnet: ' . $e->getMessage();
}
} catch (Exception $e) {
echo 'Failed ... Unable to get Global IP record: ' . $e->getMessage();
}