Order a vyatta server with placeOrder
Orders a vyatta server. The priceIds may be invalid now, please double check them before running.
Hey, listen!
This example contains deprecated methods or syntax and needs to be updated. Please use caution when using.
<?php
require_once './vendor/autoload.php';
$apiUsername = getenv('SOFTLAYER_USERNAME');
$apiKey = getenv('SOFTLAYER_API_KEY');
$client = \SoftLayer\SoapClient::getClient('SoftLayer_Product_Order', null, $apiUser, $key);
$template = new stdClass();
$template_extra = new stdClass();
$template->packageId = 174;
$template->location = 224092;
$template->quantity = 1;
$template_extra->os = 21;
$template_extra->hostname = 'foo-vga-small';
$template_extra->domain = 'softlayer-singapore-test.com';
$template_extra->price_id = array(13739,
21010,
878,
1267,
274,
342,
56,
57,
);
$my_template = new stdClass();
for ($cnt = 0; $cnt < $template->quantity; $cnt++) {
$domain = new stdClass();
$domain->hostname = "$template_extra->hostname-$cnt";
$domain->domain = $template_extra->domain;
$template->hardware[] = $domain;
}
if (empty($template->imageTemplateGlobalIdentifier))
{
$template_extra->price_id[] = $template_extra->os;
}
foreach ($template_extra->price_id as $id) {
$price = new stdClass();
$price->id = $id;
$template->prices[] = $price;
}
$my_template->orderContainers = array();
$my_template->orderContainers[0]->prices = $template->prices;
$my_template->orderContainers[0]->hardware = $template->hardware;
$my_template->orderContainers[0]->quantity = $template->quantity;
$my_template->orderContainers[0]->location = $template->location;
$my_template->orderContainers[0]->packageId = $template->packageId;
print_r($my_template);
$result = $client->verifyOrder($my_template);
print_r($result);