awsm 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9a7f34771e24d7ec46acbc1f7536c9c7d082c93
4
- data.tar.gz: 1caff56b7563e5653f17287196f981473bac700d
3
+ metadata.gz: 059a7ddc0821863abf79fce6d5c5177ebd20e828
4
+ data.tar.gz: 847f851e2d3cc69b95257416f2133dc1bab52ce1
5
5
  SHA512:
6
- metadata.gz: 61748a8c4095bbae326006bdc9fb75b1b6b908c4979f42d78776e6c41d84a10760c2300ffac346c0b56e92248c2a4f6f7a2e1d42bc34c9c4cee742427b4878b8
7
- data.tar.gz: b6866f43ecf51429ce3ca4f7d55a77f2c40bfc7f29734570346670e501c96839703291ece96ace64be507a6c84bede15cdc38a3dfe8993f2d251e989e5d84824
6
+ metadata.gz: 5dac952265d424612e1f9af3b11c77dafa053177f92b605621559186e6227ce3956d91a653c3135a094669f4a109a22ef6a0d906021b35f25f9cfd276ada30b9
7
+ data.tar.gz: 926f4ce4d1878150df34d08cfee5770fc7a1e47d5d7e99c68b55380075504201658e69c2c2ed37aacd8d14cc5954fa25fb0e3283f983f103b3032df500301d50
@@ -21,8 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.add_runtime_dependency 'thor', '~> 0.19'
22
22
  spec.add_runtime_dependency 'aws-sdk', '~> 2'
23
23
  spec.add_runtime_dependency 'terminal-table', '~> 1.4'
24
- spec.add_runtime_dependency 'vcr', '~> 2.9'
25
- spec.add_runtime_dependency 'fakeweb', '~> 1.3'
26
24
 
27
25
  spec.add_development_dependency 'bundler', '~> 1.6'
28
26
  spec.add_development_dependency "pry", '~> 0.10'
@@ -1,3 +1,4 @@
1
+ require 'aws-sdk'
1
2
  require 'yaml'
2
3
  require 'thor'
3
4
  require 'terminal-table'
@@ -9,7 +10,6 @@ require 'awsm/configure'
9
10
 
10
11
  require 'awsm/loadbalancers'
11
12
  require 'awsm/autoscalinggroups'
12
- require 'awsm/dns'
13
13
  require 'awsm/instances'
14
14
 
15
15
  require 'awsm/tablebase'
@@ -18,6 +18,7 @@ require 'awsm/table/image'
18
18
 
19
19
  require 'awsm/clibase'
20
20
  require 'awsm/cli/tag'
21
+ require 'awsm/cli/dns'
21
22
  require 'awsm/cli/unused'
22
23
  require 'awsm/cli/spin'
23
24
  require 'awsm/cli/main'
@@ -0,0 +1,51 @@
1
+ module Awsm
2
+ module CLI
3
+ class Dns < Clibase
4
+
5
+ desc 'list', 'list'
6
+ method_option :type, :type => :string, :default => 'A,AAAA,CNAME'
7
+ method_option :record, :type => :string, :default => nil
8
+ def list
9
+ r53 = Aws::Route53::Client.new
10
+
11
+ record_sets = []
12
+ r53.list_hosted_zones_by_name.hosted_zones.each do |hz|
13
+ r53.list_resource_record_sets( hosted_zone_id: hz.id )
14
+ .resource_record_sets.each do |rrs|
15
+ record_sets << rrs
16
+ end
17
+ end
18
+
19
+ types = []
20
+ unless options[:type].nil?
21
+ types = options[:type].dup.upcase.split( ',' )
22
+ record_sets.select! do |rrs|
23
+ types.include?( rrs.type )
24
+ end
25
+ end
26
+
27
+ records = []
28
+ unless options[:record].nil?
29
+ records = options[:record].dup.split( ',' )
30
+ record_sets.select! do |rrs|
31
+ records.include?( rrs.name )
32
+ end
33
+ end
34
+
35
+ record_sets.each do |rrs|
36
+ say "#{rrs.name} ", :green
37
+ say "(#{rrs.type})", :yellow
38
+ unless rrs.alias_target.nil?
39
+ say "\t #{rrs.alias_target.dns_name}"
40
+ else
41
+ rrs.resource_records.each do |rr|
42
+ say "\t #{rr.value}"
43
+ end
44
+ end
45
+ end
46
+
47
+ end
48
+
49
+ end
50
+ end
51
+ end
@@ -19,6 +19,9 @@ module Awsm
19
19
  desc 'tag', 'Search by tags'
20
20
  subcommand 'tag', Awsm::CLI::Tag
21
21
 
22
+ desc 'dns', 'DNS tools'
23
+ subcommand 'dns', Awsm::CLI::Dns
24
+
22
25
  desc "specific <comma-separated-elb-names>",
23
26
  "Only find specific ELBs named in a comma-separated list."
24
27
  def specific( elb_names )
@@ -37,25 +40,6 @@ module Awsm
37
40
  results.each { |elb| print_result(elb) }
38
41
  end
39
42
 
40
- desc "r53 [dns-name]",
41
- "Show me what <dns-name> points at."
42
- def r53( dns_name )
43
- dns_len = dns_name.length
44
-
45
- say "#{dns_name} ", :yellow
46
- say "=> ", :bold
47
- dns.get_by_record( dns_name ).each_with_index do |r, i|
48
- if i > 0
49
- say " " * ( dns_len + 4 )
50
- end
51
- say "(#{r.type}) ", :green
52
- case r.type
53
- when "A"
54
- say "#{r.alias_target.dns_name}", :cyan
55
- end
56
- end
57
- end
58
-
59
43
  no_commands do
60
44
  def load_balancers
61
45
  Awsm::LoadBalancers.new
@@ -65,10 +49,6 @@ module Awsm
65
49
  Awsm::Instances.new
66
50
  end
67
51
 
68
- def dns
69
- Awsm::Dns.new
70
- end
71
-
72
52
  def asg
73
53
  Awsm::AutoScalingGroups.new
74
54
  end
@@ -1,3 +1,3 @@
1
1
  module Awsm
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Kendell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-15 00:00:00.000000000 Z
11
+ date: 2015-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -52,34 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.4'
55
- - !ruby/object:Gem::Dependency
56
- name: vcr
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '2.9'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '2.9'
69
- - !ruby/object:Gem::Dependency
70
- name: fakeweb
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.3'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.3'
83
55
  - !ruby/object:Gem::Dependency
84
56
  name: bundler
85
57
  requirement: !ruby/object:Gem::Requirement
@@ -128,13 +100,13 @@ files:
128
100
  - bin/awsm
129
101
  - lib/awsm.rb
130
102
  - lib/awsm/autoscalinggroups.rb
103
+ - lib/awsm/cli/dns.rb
131
104
  - lib/awsm/cli/main.rb
132
105
  - lib/awsm/cli/spin.rb
133
106
  - lib/awsm/cli/tag.rb
134
107
  - lib/awsm/cli/unused.rb
135
108
  - lib/awsm/clibase.rb
136
109
  - lib/awsm/configure.rb
137
- - lib/awsm/dns.rb
138
110
  - lib/awsm/instances.rb
139
111
  - lib/awsm/loadbalancers.rb
140
112
  - lib/awsm/table/image.rb
@@ -1,45 +0,0 @@
1
- require 'aws-sdk-core'
2
-
3
- module Awsm
4
- class Dns
5
- def initialize
6
- @client = Aws::Route53::Client.new
7
- @dns_map_by_target = {}
8
- @records = []
9
- load_dns_records
10
- end
11
-
12
- def find_for( target )
13
- @dns_map_by_target[ target ]
14
- end
15
-
16
- def get_by_record( record )
17
- @records.select do |r|
18
- r.name =~ /^#{record}/
19
- end
20
- end
21
-
22
- def load_dns_records
23
- paged_response = @client.list_resource_record_sets(
24
- hosted_zone_id: Awsm::dns_config.hosted_zone
25
- )
26
-
27
- paged_response.each_page do |p|
28
- records = p.resource_record_sets.select do |r|
29
- r.type == 'A' || r.type == 'CNAME'
30
- end
31
-
32
- records.each do |r|
33
- if r.resource_records == []
34
- target = r.alias_target.dns_name
35
- else
36
- target = r.resource_records[0].value
37
- end
38
-
39
- @dns_map_by_target[target] = r.name
40
- @records << r
41
- end
42
- end
43
- end
44
- end
45
- end