Softlayer API:how 获取我们可以与 softlayer api 一起使用的所有 Virtual_Guest 配置类型

Softlayer API:how to get all Virtual_Guest config types that we can use with softlayer apis

当我想upgrade/downgrade虚拟来宾或创建一个新的虚拟来宾时,我们需要一些配置选项,但我不知道如何获得这些可用的配置?

同时,磁盘和网络呢?

要创建虚拟访客,控制门户使用多种服务和方法来根据需要识别 possible 类型配置,为此您必须使用受支持的编程语言并以编程方式创建您的自己的脚本,因为没有特定的 api 在一两次 api 调用中检索配置类型

要确定创建计算实例时可用的 possible 选项,您可以将 SoftLayer_Virtual_Guest::getCreateObjectOptions 方法与这些其他方法一起使用。

有两种创建虚拟来宾的方法:SoftLayer_Virtual_Guest::createObject or SoftLayer_Product_Order::placeOrder,请参阅以下链接创建虚拟机:

关于获取可用于 "primaryNetworkComponent"(public) 和 "primaryBackendNetworkComponentyou"(private) 的网络 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、内存、os、磁盘等,请使用此剩余 api:

方法:获取

https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/46/getItemPrices?objectMask=mask[pricingLocationGroup[locations]]

这些项目必须在同一个数据中心。

与Upgrade/Downgrade相关,方法与placeOrder相同,只是Jsonbody的结构不同,例子见下:

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 get the proper list of SoftLayer datacenters for a given package?

Creating a vGPU device with second disk