servers = conn.servers.all().to_json filtering

9 views
Skip to first unread message

sreenivas narayan

unread,
Jun 5, 2018, 5:40:23 AM6/5/18
to ruby-fog
Hi Guys,

How to add filter on this.

servers = conn.servers.all().to_json

I want to list all running instances and pass it to json

Thanks
Sreenivas

Benjamin Manns

unread,
Jun 5, 2018, 3:39:05 PM6/5/18
to ruby...@googlegroups.com
Hi Sreenivas,

Pass the filters in as a hash to the all call. E.g. conn.servers.all('instance-state-name' => 'running').to_json

This is assuming AWS (here's AWS's list of filters) - you'll have to check the docs for your specific provider if you're using a different one.

Ben

--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

sreenivas narayan

unread,
Jun 7, 2018, 4:30:23 AM6/7/18
to ruby-fog
Thanks Benhamin
Reply all
Reply to author
Forward
0 new messages