本文介绍了SoftLayer 中的 ObjectFilter 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 ObjectFilter 在 SoftLayer 中不起作用.

I find ObjectFilter doesn't work in SoftLayer.

我什至尝试了此处 SoftLayer 网页中提供的示例:

I even tried the example provided in the SoftLayer webpage here:

https://sldn.softlayer.com/article/object-filters

休息:

列出dal05

https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectMask=mask[id,hostname]&objectFilter={"datacenter":{"name":{"operation":"dal05"}}}

当我运行此命令时,它仍会返回所有虚拟来宾,无论该虚拟来宾属于哪个数据中心.

When I ran this command, it still returns all the virtual guests, regardless what data center that virtual guest belongs to.

推荐答案

试试这个请求:

GET https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectMask=mask[id,hostname,datacenter]&objectFilter={"virtualGuests":{"datacenter":{"name":{"operation":"dal05"}}}}

您的请求的问题在于您缺少virtualGuests"属性,请记住,objectFilter 正在过滤数据库中的数据,因此您需要告诉它哪些表在工作以及哪些记录是表工作.例如使用SoftLayer_Account"意味着所有工作都将在SoftLayer_Account"表上进行,现在您需要告诉 id 该表的哪些属性/记录工作在这种情况下,您需要在virtualGuests"上工作等等.请记住这一点,并查看有关有效属性/记录的文档,例如这些是 Softlayer_Account 的有效属性/记录:

The issue with your request is that you are missing the "virtualGuests" property, keep in mind that the objectFilter is filtering over the data in the database, so you need to tell it over what table work and over what record of the table work. e.g. using the "SoftLayer_Account" that implies that all the work will be over the "SoftLayer_Account" table now you need to tell id over what property/record of that table work in this case you need to work over the "virtualGuests" and so on. Please keep in mind that and you review the documentation about the valid properties/records e.g. these are the valid properties/record for Softlayer_Account:

http://sldn.softlayer.com/reference/datatypes/SoftLayer_Account

问候

这篇关于SoftLayer 中的 ObjectFilter 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 18:57