I have a Virtual Server and an EVault that's associated with Virtual Server. Looks like to use EVault easily, I need to order one of the EVault Plugins such as EVault Plugin for Oracle. How do I programmatically order one of these EVault plugins and how do I programmatically cancel it?
Is it kind of like an upgrade to EVault where I make one of SoftLayer_Network_Storage_Backup_Evault API calls such as upgradeVolumeCapacity() to upgrade the disk size?
Or is it more like placing a brand new order for plug-in and the order needs to know about the EVault instance and maybe the host?
Some sample code (php preferred) to order one of these EVault plugins and cancelling will be really appreciated. Thank you.
PS. If the process/API/input is different for Bare Metal server, please include that information as well.
You need to order the plugin using the placeOrder method here the code:
<?php
require_once ('/SoftLayer/SoapClient.class.php');
$username = 'set me';
$key = 'set me';
// Create a SoftLayer API client object
$softLayer_product_order = SoftLayer_SoapClient::getClient('SoftLayer_Product_Order', null, $username, $key);
# Build a skeleton SoftLayer_Hardware object.
# The object contains the hardware ID of the
# Bare Metal server wich will contain the Evault
# If you want use a Virtual Server instead a
# Bare Metal server build a skeleton SoftLayer_Virtual_Guest object
$virtualGuests = new stdClass();
$virtualGuests->id = 9066729;
$orderVirtualGuest = array
(
$virtualGuests,
);
# The current location where the Evault is.
$location = "449494";
$packageId = 0;
// Build a skeleton SoftLayer_Product_Item_Price object.
// The object contains the price ID of the Evaul plugin
// you wish order.
// To get the list of prices call the Softlayer_Product_Package::getItems method
$prices = array
(
1146,
);
// Convert our item list into an array of skeleton
// SoftLayer_Product_Item_Price objects. These objects contain much more than
// ids, but SoftLayer's ordering system only needs the price's id to know what
// you want to order.
$orderPrices = array();
foreach ($prices as $priceId){
$price = new stdClass();
$price->id = $priceId;
$orderPrices[] = $price;
}
// Build a SoftLayer_Container_Product_Order_Network_Storage_Backup_Evault_Vault object containing
// the order you wish to place.
$orderTemplate = new stdClass();
$orderTemplate->location = $location;
$orderTemplate->packageId = $packageId;
$orderTemplate->prices = $orderPrices;
$orderTemplate->virtualGuests = $orderVirtualGuest;
print_r($orderTemplate);
// Place the order.
try {
// Re-declare the order template as a SOAP variable, so the SoftLayer
// ordering system knows what type of order you're placing.
$orderTemplate = new SoapVar
(
$orderTemplate,
SOAP_ENC_OBJECT,
'SoftLayer_Container_Product_Order',
'http://api.service.softlayer.com/soap/v3/'
);
// verifyOrder() will check your order for errors. Replace this with a call
// to placeOrder() when you're ready to order. Both calls return a receipt
// object that you can use for your records.
//
// Once your order is placed it'll go through SoftLayer's approval and
// provisioning process.
$receipt = $softLayer_product_order->verifyOrder($orderTemplate);
print_r($receipt);
} catch (Exception $e) {
echo 'Unable to place server order: ' . $e->getMessage();
}
Cancel the plugin is more complex, it only can be cancel via ticket. If you try to cancel the billingItem it will not work. You can create an standart ticket and ask to cancel the plugin. To create tickets here an example:
<?php
/**
* Create Standard Ticket
*
* This script creates a standard support ticket and It is assigned to master User.
* The ticket is created with the subject Id:1001 (Accounting Request)
*
* Important manual pages:
* @see http://sldn.softlayer.com/reference/services/SoftLayer_Ticket/createStandardTicket
* @see http://sldn.softlayer.com/reference/datatypes/SoftLayer_Ticket
* @see http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Utility_File_Attachment
*
* @license <http://sldn.softlayer.com/wiki/index.php/license>
* @author SoftLayer Technologies, Inc. <sldn@softlayer.com>
*/
require_once "C:/Php/SoftLayer/SoftLayer/SoapClient.class.php";
/**
* Your SoftLayer API username
* @var string
*/
$username = "set me";
/**
* Your SoftLayer API key
* Generate one at: https://control.softlayer.com/account/users
* @var string
*/
$apiKey = "set me";
/**
* Declare parameters for the ticket
* @var string $contents
* @var int $attachmentId
* @var string $rootPassword
* @var string $controlPanelPassword
* @var string $accessPort
* @var string $attachmentType
* @var int $subjectId
* @var string $title
*/
$contents = "This is for test";
$attachmentId = null;
$rootPassword = "";
$controlPanelPassword = "";
$accessPort = "";
$attachmentType = "";
$subjectId = 1001;
$title = "This is for test";
// Create a SoftLayer API client object for "SoftLayer_Account" and "SoftLayer_Ticket" services
$accountService = SoftLayer_SoapClient::getClient("SoftLayer_Account", null, $username, $apiKey);
$ticketService = SoftLayer_SoapClient::getClient("SoftLayer_Ticket", null, $username, $apiKey);
// Get Id for the Master User
$accountService -> setObjectMask("mask[masterUser]");
$account = $accountService -> getObject();
// Build a skeleton SoftLayer_Ticket object containing the data of the ticket to submit.
$templateObject = new stdClass();
$templateObject -> assignedUserId = $account -> masterUser -> id;
$templateObject -> subjectId = $subjectId;
$templateObject -> title = $title;
try {
$standardTicket = $ticketService -> createStandardTicket($templateObject, $contents, $attachmentId, $rootPassword, $controlPanelPassword, $accessPort, $attachmentType);
print_r($standardTicket);
} catch(Exception $e) {
echo "Unable to create standard ticket: " . $e -> getMessage();
}
You can send the following content in your ticket: Please initiate cancellation of Evault plugin:
Billing ID: 000000 Cancellation Date: Immediate Cancellation Note
To get the billing item of the plugin you can use this code:
<?php
require_once ('/SoftLayer/SoapClient.class.php');
$username = 'set me';
$key = 'set me';
# The orderid of your evault plugin
$orderId = 6566891;
// Create a SoftLayer API client object
$accountClient = SoftLayer_SoapClient::getClient('SoftLayer_Account', null, $username, $key);
$cancelClient = SoftLayer_SoapClient::getClient('SoftLayer_Billing_Item', null, $username, $key);
// setting a filter to get the billling items which category code is evault_plugin
$filter = new stdClass();
$filter->allBillingItems = new stdClass();
$filter->allBillingItems->categoryCode = new stdClass();
$filter->allBillingItems->categoryCode->operation = 'evault_plugin';
$accountClient->setObjectFilter($filter);
# Declaring an object mask to get the order id
$objectMask = "mask[orderItem[order]]";
$accountClient->setObjectMask($objectMask);
# Getting the billing items
$billingItems = $accountClient->getAllBillingItems();
# looking for the billing item to cancel
$billingItemToCancel = null;
foreach ($billingItems as &$billingItem) {
if ($billingItem->orderItem->order->id == $orderId){
$billingItemToCancel = $billingItem;
break;
}
}
print_r($billingItemToCancel);