我可以通过" id"," hostname"," primaryIpAddress"等掩码获得虚拟客人。等等 但是,我需要使用特定标记来获取虚拟客户端。 用于检索已标记虚拟客户的掩码是什么?
答案 0 :(得分:0)
你需要使用Objectfilter:
https://sldn.softlayer.com/article/object-filters
使用RESTFul请求
查看此示例URL : https://$USERNAME:$APIKEY@api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectFilter={"virtualGuests":{"tagReferences":{"tag":{"name":{"operation":"in","options":[{"name":"data","value":["$tag1","$tag2"]}]}}}}}
Method: GET
Note: replace $tag1 and $tag2 with the tags you wish
此致
答案 1 :(得分:0)
我得到了一些帮助。以下是执行此操作的Ruby代码:
client = SoftLayer::Client.new(username: USERNAME, api_key: API_KEY)
account_service = client['SoftLayer_Account']
object_filter = SoftLayer::ObjectFilter.new
object_filter.set_criteria_for_key_path(
'virtualGuests.tagReferences.tag.name', 'operation' => 'in',
'options' => [{
'name' => 'data',
'value' => tagsToFind
}])
mask = 'mask[tagReferences[tag[name]]]'
result = account_service.object_mask(mask).
object_filter(object_filter).getVirtualGuests