Closed jeunito closed 9 years ago
Returning the full list is the default behavior when the filter is not applied. Let me look into the problem a little bit more. You can solve the same problem a different way with:
softlayer_client = SoftLayer::Client.new()
servers = SoftLayer::BareMetalServer.find_servers(:hostname => "server_hostname", :domain => "server_domain.com", :client=> softlayer_client)
servers.each { |server| puts server.id, server.fullyQualifiedDomainName }
Because the fullyQualifiedDomainName
is a computed property (formed by jamming together the host and domain information) it cannot be used in an Object Filter.
You can however, add "accept" clauses to your filter for the hostname and domain name separately (as is done in my example).
It works! Thanks @SLsthompson
Updated code for others:
obj_filter = SoftLayer::ObjectFilter.new do |filter|
filter.accept("hardware.hostname").when_it is(hostname)
end
accounts = sl.service_named("Account")
hardware_list =accounts.object_filter(obj_filter).object_mask("mask[id,fullyQualifiedDomainName]").getHardware
puts hardware_list
Hi
I am trying to filter the result set of Account.getHardware. Is this possible?
However I get the full list every time