2016-06-17 8 views
-5

Kann jemand bitte Probe-PHP-Code zur Überprüfung der Bestellung für Power-8-Server (Paket Id 242) liefern.SoftLayer API: PHP-Beispielcode zur Überprüfung der Bestellung für Power 8-Server (Paket-ID 242) erforderlich

Der Power8-Server scheint PresetIds zu verwenden. Sind die Parameter für SoftLayer_Product_Order.verifyOder (...) ähnlich denen für stündliche Barmetal Server?

+0

Wir reparieren Code SIE haben geschrieben, wir finden/schreiben keinen Code für Sie. –

Antwort

1

Stundenpreis ist nicht verfügbar für Paket-ID: 242 Dieses Skript kann Ihnen helfen, eine Bestellung für Power8 Server zu überprüfen.

<?php 
/** 
* This script verify an order for a Power8 Server using a preset Id. 
* 
* The presets are used to simplify ordering by eliminating the need 
* for price ids when submitting orders. 
* Also when the order contains a preset id, it is not possible 
* to configure VLANs in the order. 
* 
* Important manual pages: 
* @see http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/verifyOrder 
* @see http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getItemPrices 
* @see http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Product_Order_Hardware_Server 
* 
* @license <http://sldn.softlayer.com/wiki/index.php/License> 
* @author SoftLayer Technologies, Inc. <[email protected]> 
*/ 
// Change the path of your PHP client 
require_once ('C:\softlayer-api-php-client-master\src\SoapClient.php'); 

// Your SoftLayer API username and key. 
$username = 'set me'; 
$key = 'set me'; 

$service = 'SoftLayer_Product_Order'; 

$client = \SoftLayer\SoapClient::getClient($service, null, $username, $key); 

// The hostname and domain values required for the server. 
$hardwareNode = new \stdClass(); 
$hardwareNode->hostname = 'tested_power8_server'; 
$hardwareNode->domain = 'test.com'; 
$orderHardware = array 
(
    $hardwareNode 
); 

// The items used for this server. 
// The items can be obtained using the next method: SoftLayer_Product_Package::getItemPrices 
$prices = array 
(
     50357, // bandwidth id needs to be filled since its not part of the preset configuration 
     641  // port-speed id needs to be filled since its not part of the preset configuration 
); 
$orderPrices = array(); 
foreach ($prices as $priceId){ 
    $price = new \stdClass(); 
    $price->id = $priceId; 
    $orderPrices[] = $price; 
} 

// The values used for the container (i.e. Power8 server) that's going to be verified. 
$location = 'DALLAS09'; 
$packageId = 242; 
/* 
* To get the list of presets run the SoftLayer_Product_Packag::getActivePresets method 
* The values for preset Id are: 
* 80 for POWER8 C812L-S 
* 82 for POWER8 C812L-M 
* 84 for POWER8 C812L-L 
* 86 for POWER8 C812L- SSD 
*/ 
$presetId = 80; 
$quantity = 1; 
$primaryDiskPartitionId = 1; 
$useHourlyPricing = false; // Hourly pricing is not available 
$complexType = 'SoftLayer_Container_Product_Order_Hardware_Server'; 

$orderContainer = new \stdClass(); 
$orderContainer->location    = $location; 
$orderContainer->packageId    = $packageId; 
$orderContainer->presetId    = $presetId; 
$orderContainer->prices     = $orderPrices; 
$orderContainer->quantity    = $quantity; 
$orderContainer->hardware    = $orderHardware; 
$orderContainer->primaryDiskPartitionId = $primaryDiskPartitionId; 
$orderContainer->useHourlyPricing  = $useHourlyPricing; 
$orderContainer->complexType   = $complexType; 

try 
{ 
    $verifiedOrderContainer = $client->verifyOrder($orderContainer); 
    print_r($verifiedOrderContainer); 
} 
catch (\Exception $e) 
{ 
    die('Unable to verify order: ' . $e->getMessage()); 
} 
+0

Vielen Dank Marcelo. Ich habe auf SoftLayer-Kundenportal Preset 86 gefunden hat sowohl Stundensatz und monatliche Rate. Kannst du bitte bestätigen ? – mnnmountain

+0

Preset 84 und 86 haben dieselben Werte, mit der Ausnahme, dass Preset 86 SSD-Disks erlaubt. Dennoch sind die 4 verfügbaren Voreinstellungen für die monatliche Rate. Derzeit unterstützt Softlayer keine Stundensätze für Power8-Server. –

+0

Sie können die Details der Server sehen, um mit dieser Methode http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package_Server/getAllObjects zu bestellen, es wird die Konfiguration, die PresetID auflisten und ob es stündlich bestellt werden kann oder nicht –