https://api.softlayer.com/rest/v3/SoftLayer_Product_Package/0/getCategories
Мне интересно, почему приведенный выше результат запроса не включает global_ipv6 / global_ipv4?
Кто-нибудь может предоставить пример кода php для заказа подсети Portable Public IPv6 «64_BLOCK_PORTABLE_PUBLIC_IPV6_ADDRESSES» и «GLOBAL_IPV6»?
В SoftLayer_Network_Vlan есть следующие свойства:
primarySubnet
primarySubnetVersion6]
Будет ли IPV6 Vlan иметь значение свойства только в primarySubnetVersion6 вместо primarySubnet?
Спасибо
Пример заказа новой подсети Global IPv4 / IPv6:
<?php
/**
* Order a new Global IPv4/IPv6 subnet
*
* Important manual pages:
* http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/placeOrder/
* http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/verifyOrder/
* http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Product_Order_Network_Subnet
* http://sldn.softlayer.com/reference/services/SoftLayer_Network_Subnet
*
* @license <http://sldn.softlayer.com/wiki/index.php/License>
* @author SoftLayer Technologies, Inc. <[email protected]>
*/
require_once(dirname(__FILE__) . '/SoftLayer/SoapClient.class.php');
/**
* Set your SoftLayer API username and key.
*/
$apiUsername = 'set me';
$apiKey = 'set me';
/**
* Set the service to use
*/
$serviceName ='SoftLayer_Product_Order';
/**
* The number of subnets you want to order
*
* @var int;
*/
$quantity = 1;
$packageId = 0;
$packageService ='SoftLayer_Product_Package';
$orderService ='SoftLayer_Product_Order';
/**
* Create a client to the API services to use.
*/
$packageClient = SoftLayer_SoapClient::getClient($packageService, $packageId, $apiUsername, $apiKey);
$orderClient = SoftLayer_SoapClient::getClient($orderService, null, $apiUsername, $apiKey);
/**
* Declaring an object filter to get specific subnet type to order e.g. GLOBAL_IPV6, GLOBAL_IPV4
*/
$filter = new stdClass();
$filter->itemPrices = new stdClass();
$filter->itemPrices->item = new stdClass();
$filter->itemPrices->item->keyName = new stdClass();
$filter->itemPrices->item->keyName->operation = new stdClass();
$filter->itemPrices->item->keyName->operation = "GLOBAL_IPV6";
try {
$packageClient->setObjectFilter($filter);
$packageResult = $packageClient->getItemPrices();
print_r($packageResult);
/**
* Get the price ID
*/
$priceId = $packageResult[0]->id;
$orderTemplate = new stdClass();
$orderTemplate->packageId = $packageId;
$orderTemplate->prices = array();
$orderTemplate->prices[0] = new stdClass();
$orderTemplate->prices[0]->id = $priceId;
$orderTemplate->quantity = $quantity;
// Create a SoftLayer API client object to the SoftLayer_Product_Order service.
$orderClient = SoftLayer_SoapClient::getClient
(
'SoftLayer_Product_Order',
null,
$apiUsername,
$apiKey
);
/**
* Place the order for the new subnet.
*/
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_Network_Subnet',
'http://api.service.softlayer.com/soap/v3/'
);
$receipt = $orderClient->verifyOrder($orderTemplate);
print_r($receipt);
} catch (Exception $e) {
echo 'Unable to place subnet order: ' . $e->getMessage();
}
} catch (Exception $e) {
echo 'Failed ... Unable to get the item prices: ' . $e->getMessage();
}
Пример заказа нового публичного статического IPv6:
<?php
/**
* Order a new Public Static IPv6.
*
* Important manual pages:
* http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/placeOrder/
* http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/verifyOrder/
* http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Product_Order_Network_Subnet
*
* @license <http://sldn.softlayer.com/wiki/index.php/License>
* @author SoftLayer Technologies, Inc. <[email protected]>
*/
require_once(dirname(__FILE__) . '/SoftLayer/SoapClient.class.php');
/**
* Set your SoftLayer API username and key.
*/
$apiUsername = 'set me';
$apiKey = 'set me';
/**
* Set the service to use
*/
$serviceName ='SoftLayer_Product_Order';
$priceId = 1481;
/**
* The id of the IP address that you want to route a static subnet to.
*
* @var int
*/
$endPointIpAddressId = 18263116;
/**
* The number of subnets you want to order
*
* @var int;
*/
$quantity = 1;
/**
* Build a SoftLayer_Container_Product_Order_Network_Subnet object containing
* the order you wish to place. Subnet's don't have a package, so set packageId
* to 0. Since this order is for one item with no sub-options you only have to
* set a single price id in this order.
*/
$orderTemplate = new stdClass();
$orderTemplate->packageId = 0;
$orderTemplate->prices = array();
$orderTemplate->prices[0] = new stdClass();
$orderTemplate->prices[0]->id = $priceId;
$orderTemplate->endPointIpAddressId = $endPointIpAddressId;
$orderTemplate->quantity = $quantity;
/**
* Create a client to the API service.
*/
$client = SoftLayer_SoapClient::getClient($serviceName, null, $apiUsername, $apiKey);
/**
* Create a SoftLayer API client object to the SoftLayer_Product_Order service.
*/
$client = SoftLayer_SoapClient::getClient
(
'SoftLayer_Product_Order',
null,
$apiUsername,
$apiKey
);
/**
* Place the order for the new subnet.
*/
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_Network_Subnet',
'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. When it's done you'll have a new
* SoftLayer_Network_Subnet object ready to use.
*/
$receipt = $client->verifyOrder($orderTemplate);
print_r($receipt);
} catch (Exception $e) {
echo 'Unable to place subnet order: ' . $e->getMessage();
}
Чтобы получить действительные идентификаторы цены товара, выполните:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/0/getItemPrices?objectMask=mask[id,item[keyName,description],locationGroupId ,pricingLocationGroup[locations[id, name, longName]]]
Других решений пока нет …