api - Softlayer API:如何获取我们可以与 softlayer api 一起使用的所有 Virtual_Guest 配置类型
问题描述
当我想升级/降级虚拟客户或创建一个新的虚拟客户时,我们需要一些配置选项,但我不知道如何获得这些可用配置?
同时,磁盘和网络呢?
解决方案
要创建虚拟访客,控制门户使用多种服务和方法来根据需要识别可能的类型配置,为此,您必须使用受支持的编程语言并以编程方式创建自己的脚本,因为没有特定的 api 来检索在一两个 API 调用中配置类型
要确定创建计算实例时可用的可能选项,您可以将SoftLayer_Virtual_Guest::getCreateObjectOptions方法与这些其他方法一起使用。
创建虚拟机有两种方法:SoftLayer_Virtual_Guest::createObject或SoftLayer_Product_Order::placeOrder,创建虚拟机的链接如下:
关于获取可用于“primaryNetworkComponent”(公共)和“primaryBackendNetworkComponentyou”(私有)添加到虚拟机的网络vlan,您可以使用以下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]]
您必须记住,要添加到 vm 的 vlan 必须位于同一个数据中心。
要获得可用的项目价格,例如 cpu、ram、os、disk 等,请使用以下 api:
方法:获取
https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/46/getItemPrices?objectMask=mask[pricingLocationGroup[locations]]
这些项目必须位于同一个数据中心。
升级/降级相关,方法与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"
}]
}
如何在配置时将两个或更多磁盘添加到 softlayer 虚拟服务器
请参阅这些其他示例:
推荐阅读
- python - Python:根据 Python 中的多个条件更改 pandas DataFrame 列中的值
- sympy - Sympy 中有没有办法定义一个与 pi 类似的常量?
- javascript - 构建后如何在移动设备上诊断 React 白屏?
- python - 使用 aiohttp 获取数据时得到一个空响应
- webpack - 混合 6 不包括 CSS 文件
- python - Buildozer 编译的 apk 不保持字体大小
- azure-ad-graph-api - 如何从 Microsoft Graph 中找到 Azure 应用注册的 AppId
- r - 如何在不使用 rshiny 目录中的 www 文件夹的情况下从不同的文件夹加载不同的图像?
- google-cloud-platform - GCP 计算磁盘 - 了解克隆限制
- node.js - 为什么 cloudflare 会阻止来自 heroku 服务器的 cookie?