ec2-host 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/ec2-host.gemspec +1 -1
- data/lib/ec2/host/cli.rb +8 -1
- data/lib/ec2/host/host_data.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 851fe69dd2022fdf092d8da07aa385ac46f0596c
|
4
|
+
data.tar.gz: 398cb4bfeb3ccbc336d718c59e7a80692c5a8caa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e24bbafc3aa90f728761c53604342a0d7de772b9dc4ae561b6e11736b7000e6e3aae3d46721f572be93826e0f930471929192e7598448deb761b89d81a3c3310
|
7
|
+
data.tar.gz: 6eef10592f5ae93c2bc6441b096365a275946ea89b383ba469d0caabc93445a816e6378279c35429b2789d206028d56bfc67479c6f50bf1cf88d156c5ab31f49
|
data/CHANGELOG.md
CHANGED
data/ec2-host.gemspec
CHANGED
data/lib/ec2/host/cli.rb
CHANGED
@@ -41,6 +41,9 @@ class EC2
|
|
41
41
|
:aliases => %w[-i],
|
42
42
|
:type => :boolean,
|
43
43
|
:desc => "show host info, not only hostname"
|
44
|
+
option :json,
|
45
|
+
:type => :boolean,
|
46
|
+
:desc => "show detailed host info in json"
|
44
47
|
option :debug,
|
45
48
|
:type => :boolean,
|
46
49
|
:desc => "debug mode"
|
@@ -49,6 +52,10 @@ class EC2
|
|
49
52
|
EC2::Host.new(condition).each do |host|
|
50
53
|
$stdout.puts host.info
|
51
54
|
end
|
55
|
+
elsif options[:json]
|
56
|
+
EC2::Host.new(condition).each do |host|
|
57
|
+
$stdout.puts host.json
|
58
|
+
end
|
52
59
|
elsif options[:private_ip]
|
53
60
|
EC2::Host.new(condition).each do |host|
|
54
61
|
$stdout.puts host.private_ip_address
|
@@ -68,7 +75,7 @@ class EC2
|
|
68
75
|
|
69
76
|
def condition
|
70
77
|
return @condition if @condition
|
71
|
-
_condition = HashUtil.except(options, :info, :debug, :private_ip, :public_ip)
|
78
|
+
_condition = HashUtil.except(options, :info, :json, :debug, :private_ip, :public_ip)
|
72
79
|
@condition = {}
|
73
80
|
_condition.each do |key, val|
|
74
81
|
if tag = Config.optional_options[key.to_s]
|
data/lib/ec2/host/host_data.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'forwardable'
|
2
2
|
require 'hashie/mash'
|
3
|
+
require 'json'
|
3
4
|
|
4
5
|
class EC2
|
5
6
|
class Host
|
@@ -72,6 +73,17 @@ class EC2
|
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
76
|
+
def json
|
77
|
+
HashUtil.except(self, :instance).merge(
|
78
|
+
instance_id: instance_id,
|
79
|
+
private_ip_address: private_ip_address,
|
80
|
+
public_ip_address: public_ip_address,
|
81
|
+
launch_time: launch_time,
|
82
|
+
state: state.name,
|
83
|
+
monitoring: monitoring.state,
|
84
|
+
).to_json
|
85
|
+
end
|
86
|
+
|
75
87
|
# private
|
76
88
|
|
77
89
|
def role_match?(condition)
|