lib/ec2/host/host_data.rb in ec2-host-0.0.6 vs lib/ec2/host/host_data.rb in ec2-host-0.0.7
- old
+ new
@@ -1,7 +1,8 @@
require 'forwardable'
require 'hashie/mash'
+require 'json'
class EC2
class Host
# Represents each host
class HostData < Hashie::Mash
@@ -68,9 +69,20 @@
info << "{#{service}}" unless service.empty?
info
else
HashUtil.except(self, :instance).to_s
end
+ end
+
+ def json
+ HashUtil.except(self, :instance).merge(
+ instance_id: instance_id,
+ private_ip_address: private_ip_address,
+ public_ip_address: public_ip_address,
+ launch_time: launch_time,
+ state: state.name,
+ monitoring: monitoring.state,
+ ).to_json
end
# private
def role_match?(condition)