When I want to upgrade/downgrade virtual guest or create a new virtual guest, we need some configs options, but I don't know how to get these available configs?
On the same time, how about disk and network?
When I want to upgrade/downgrade virtual guest or create a new virtual guest, we need some configs options, but I don't know how to get these available configs?
On the same time, how about disk and network?
To create a virtual guest the control portal use several services and methods to identify the possible type configurations as you require, for this you`ll have to use a supported programming language and programmatically create your own script as there is no specific api to retrieve the config types in one or two api calls
To determine possible options available when creating a compute instance, you could use SoftLayer_Virtual_Guest::getCreateObjectOptions method along with these other methods.
There are two ways to create a virtual guest: SoftLayer_Virtual_Guest::createObject or SoftLayer_Product_Order::placeOrder, see the followings links to create a vm:
About to get the network vlans available for the "primaryNetworkComponent"(public) and "primaryBackendNetworkComponentyou"(private) to add to the vm, you can use the followings rest api:
Method: GET
https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Account/getPrivateNetworkVlans?objectMask=mask[billingItem[location]]
https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Account/getPublicNetworkVlans?objectMask=mask[billingItem[location]]
You have to keep in mind that the vlans that you are going to add to the vm must be in the same datacenter.
To get the item prices available e.g cpu, ram, os, disk,etc use this rest api:
Method: GET
https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/46/getItemPrices?objectMask=mask[pricingLocationGroup[locations]]
These items must be in the same datacenter.
Related to Upgrade/Downgrade, the method will be the same as placeOrder, only the structure will differ in the Json body, please see below for this example:
POST https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Order/placeOrder
body:
{
"parameters": [{
"virtualGuests": [{
"id": 49495232
}],
"prices": [{
"id": 2277,
"categories": [{
"categoryCode": "guest_disk1",
"complexType": "SoftLayer_Product_Item_Category"
}],
"complexType": "SoftLayer_Product_Item_Price"
},
{
"id": 2270,
"categories": [{
"categoryCode": "guest_disk2",
"complexType": "SoftLayer_Product_Item_Category"
}],
"complexType": "SoftLayer_Product_Item_Price"
}
],
"properties": [
{
"name": "NOTE_GENERAL",
"value": "adding disks"
},
{
"name": "MAINTENANCE_WINDOW",
"value": "2014-08-25T9:50:00-05:00"
}
],
"complexType": "SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade"
}]
}
How to add two or more disk to softlayer virtual server while provisioning
See these other examples:
New items for SoftLayer virtual server order?
How to get the proper list of SoftLayer datacenters for a given package?