SoftLayer_Account::getOperatingSystemReloadImages

SoftLayer_Account::getOperatingSystemReloadImages

我想在 OSReload 期间使用 API 获取可用的 OS 列表。 我发现方法 SoftLayer_Account::getOperatingSystemReloadImages 是 mentioned.But 找不到关于此方法的用法。 谁能帮我解决这个问题? 谢谢

我找不到这个方法 getOperatingSystemReloadImages。但是我找到了一种获取 OS 重新加载选项的方法:

首先,我们需要知道用于订购服务器的包。例如 Virtual Guests,使用的包是 46。但是如果你想确认这一点,请执行以下 Rest 请求:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[vsi_id]/getBillingItem?objectMask=mask[package]

Method: GET

然后,要得到”Reload options”,执行:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/46/getItemPrices?objectFilter={   "itemPrices": {     "categories": {       "categoryCode": {         "operation": "os"       }     }   } }&objectMask=mask[id,item[softwareDescription], categories[categoryCode]]

Method: GET

参考文献:

SoftLayer_Virtual_Guest::getBillingItem

SoftLayer_Product_Package::getItemPrices

编辑:

现在,为了使用 ” SoftLayer_Virtual_Guest::reloadOperatingSystem”,我们需要在 Json 主体配置中添加一些参数:“token”和“config”(参考:SoftLayer_Virtual_Guest::reloadOperatingSystem

下面是一个 REST 示例:

URL:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[virtual_Guest_ID]/reloadOperatingSystem

方法:POST

Json:

{
  "parameters": [
    "FORCE",
    {
      "itemPrices": [
        {
          "id": 45466
        }
      ]
    }
  ]
}

其中:45466 是 OS

的新 priceId

查看此示例以重新加载 OS https://gist.github.com/softlayer/407058