Skip to content

Instantly share code, notes, and snippets.

@ryanrhanson
Last active January 4, 2016 20:59
Show Gist options
  • Save ryanrhanson/8678097 to your computer and use it in GitHub Desktop.
Save ryanrhanson/8678097 to your computer and use it in GitHub Desktop.
Lists out all operating system reference codes available for ccis.
<?php
// apiconfig.php needs to have apiUsername, apiKey, and the path to the SLApi file that used to be in this script.
require_once('configuration/apiconfig.php');
$guestClient = SoftLayer_SoapClient::getClient('SoftLayer_Virtual_Guest', null, $apiUsername, $apiKey);
$objectMask = new SoftLayer_ObjectMask();
$objectMask->operatingSystems->itemPrice;
$guestClient->setObjectMask($objectMask);
$hwlist = $guestClient->getCreateObjectOptions();
foreach ($hwlist->operatingSystems as $oslist) {
echo "\n\r=====================================================================================================\n\r";
echo "Operating System available: " . $oslist->itemPrice->item->description . ".\n\r";
if (isset($oslist->itemPrice->hourlyRecurringFee)){
echo "OS Hourly Cost: " . $oslist->itemPrice->hourlyRecurringFee . ".\n\r";
}
echo "OS Monthly Cost: " . $oslist->itemPrice->recurringFee . ".\n\r";
echo "Reference Code: " . $oslist->template->operatingSystemReferenceCode . ".\n\r";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment