我是softlayer的新手。我们需要为用户提供所有的性能存储,这样通过选择其中的任何一个,我们就可以获得相应的虚拟机Id来授权存储。请帮帮我,因为我在过去的4-5天里在同样的地方挣扎。提前谢谢。
发布于 2016-03-07 21:57:42
请尝试以下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 for Performance and Endurance storage(Block storage)
更新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 Backup。如果你想要一个特定的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 Storage”项目:
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
https://stackoverflow.com/questions/35838651
复制相似问题