我是软层的新手。我们需要拥有用户的所有性能存储,以便通过选择其中任何一个,我们可以获得相应的虚拟机 ID 以进行存储授权。请帮助我,因为我在过去 4-5 天内一直在挣扎。提前谢谢。
以下 Rest 请求:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkStorage?objectMask=mask[id,username,nasType,storageType, allowedVirtualGuests,billingItem[orderItem[id,order[id,userRecord.username]],description,location[id,longName]]]&objectFilter={ "networkStorage": { "nasType": { "operation": "ISCSI" }, "billingItem": { "description": { "operation": "Block Storage (Performance)" }, "orderItem": { "order": { "userRecord": { "username": { "operation": "myUsername" } } } } } } }
Method: GET
哪里:此请求将帮助您获取按type
(块存储(性能))和”username”
过滤的”Network Storage”
项目。此外,为了获得有效的可用虚拟来宾进行授权,”allowedVirtualGuests”
属性添加到对象掩码中。
一些参考资料:
SoftLayer_Account::getNetworkStorage
用于性能和耐久性存储的 API(块存储)
更新 1:
上述请求允许您根据需要应用多个过滤器。您只需要根据需要添加/删除过滤器。如果仅通过过滤"user"需要关联的存储卷,则应将某些筛选器删除到以前的请求中,例如:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkStorage?objectMask=mask[id,username,nasType,storageType, billingItem[orderItem[id,order[id,userRecord.username]],description,location[id,longName]]]&objectFilter={ "networkStorage": { "billingItem": { "orderItem": { "order": { "userRecord": { "username": { "operation": "myUsername" } } } } } } }
Method: GET
请注意,所有关联的存储卷都是一组:文件存储、块存储、对象存储、Evault 备份。如果要使用特定Storage type
,可以添加其他筛选器。
此外,如果您只想列出按user
过滤的"块存储"项目,您也可以使用其他方法:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getIscsiNetworkStorage?objectFilter={ "iscsiNetworkStorage": { "billingItem": { "orderItem": { "order": { "userRecord": { "username": { "operation": "myUserName" } } } } } } }
Method: GET
列出按用户筛选的"Filke 存储"项目:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getNasNetworkStorage?objectFilter={ "nasNetworkStorage": { "billingItem": { "orderItem": { "order": { "userRecord": { "username": { "operation": "myUserName" } } } } } } }
Method: GET
引用:
SoftLayer_Account::getIscsiNetworkStorage
SoftLayer_Account::getNasNetworkStorage