如何通过api创建softlayer公共图像?

时间:2018-06-07 15:09:50

标签: ibm-cloud-infrastructure

我想自动执行以下ui过程:

  1. 设备 - > Manage->图像
  2. 选择图片
  3. 操作 - >创建公共图片
  4. 填写字段,选择所有位置
  5. 点击创建
  6. 可以通过api完成吗?你能指点我一些详细说明这个的文件吗?

1 个答案:

答案 0 :(得分:1)

要通过api创建公共图像,您可以使用以下rest api:

方法:POST

https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest_Block_Device_Template_Group/[imageId]/createPublicArchiveTransaction

身体:Json

{
  "parameters": [
      "groupName",
      "summary",
      "note",
        [
          {
            "id": 265592
          },
          {
            "id": 1555995
          }
        ]
  ]
}

参考: https://softlayer.github.io/reference/services/SoftLayer_Virtual_Guest_Block_Device_Template_Group/createPublicArchiveTransaction/

要获取帐户中可用的私人images ID,请使用以下示例:

方法:GET

https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Account/getPrivateBlockDeviceTemplateGroups

要获取图像的location ID,请使用以下其他api:

方法:GET

https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest_Block_Device_Template_Group/[imageId]/getStorageLocations

或者您可以使用此其他休息示例来获取位置:

方法:GET

https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Location/getDatacenters