【发布时间】:2018-06-28 07:28:41
【问题描述】:
当我想升级/降级虚拟访客或创建新的虚拟访客时,我们需要一些配置选项,但我不知道如何获取这些可用配置?
同时,磁盘和网络呢?
【问题讨论】:
标签: api ibm-cloud-infrastructure nim-lang
当我想升级/降级虚拟访客或创建新的虚拟访客时,我们需要一些配置选项,但我不知道如何获取这些可用配置?
同时,磁盘和网络呢?
【问题讨论】:
标签: api ibm-cloud-infrastructure nim-lang
要创建虚拟访客,控制门户使用多种服务和方法来根据需要识别可能的类型配置,为此,您必须使用受支持的编程语言并以编程方式创建自己的脚本,因为没有特定的 api在一个或两个 api 调用中检索配置类型
要确定创建计算实例时可用的可能选项,您可以将SoftLayer_Virtual_Guest::getCreateObjectOptions 方法与这些其他方法一起使用。
创建虚拟机有两种方式:SoftLayer_Virtual_Guest::createObject或SoftLayer_Product_Order::placeOrder,创建vm的链接如下:
关于获取“primaryNetworkComponent”(公共)和“primaryBackendNetworkComponentyou”(私有)可用的网络vlan添加到vm,您可以使用以下rest api:
方法:获取
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]]
您必须记住,您要添加到虚拟机的 vlan 必须位于同一个数据中心。
要获得可用的项目价格,例如 cpu、ram、os、disk 等,请使用这个 rest api:
方法:获取
https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/46/getItemPrices?objectMask=mask[pricingLocationGroup[locations]]
这些项目必须位于同一个数据中心。
Upgrade/Downgrade相关,方法同placeOrder,只是Json主体结构不同,示例见下:
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
查看其他示例:
New items for SoftLayer virtual server order?
How to get the proper list of SoftLayer datacenters for a given package?
【讨论】: