awful 0.0.80 → 0.0.81

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: 43078b98ef014badfaafc6f3131158790368fc19
4
- data.tar.gz: 46d94310f776c245ad74bc39fa9aa3a9faec1ed5
3
+ metadata.gz: 1a9405b380fa06ab1bd50740ad5831e107a66caa
4
+ data.tar.gz: 71e8d90a5d2d6b03784a6cddcf9b739d388a28fe
5
5
  SHA512:
6
- metadata.gz: 319f74dee650f5cd086870258777d54d54d189fd0a4780e9eb8408c8ed4e8c8e496b37f69d8884fb704d689d2900a135144a66b7c95697f7aced2993060b2814
7
- data.tar.gz: 82ce207b60082aabc1a3acae11548d4248cd8cd4f33d1d6802cf671dc3a538451ff74d7e66ced5fb2b9e02da1825f3ced3568db546f0cc197ed498ec18c4299c
6
+ metadata.gz: 93ac568edb2335d5cdfff269ec2f94114e93a8ab55d10928935343d33046b0e0579bc476fe8353824491063ade92da957acb311e5dd17fb2ed5780596afa76a5
7
+ data.tar.gz: fb2822a01616f3abbf052a2f9e1035ff25b2809ec839c6c0c22108191cfb10db0405656597604a835a819d0604d6823add75de330314f796cec62fb10e25441f
@@ -43,19 +43,32 @@ module Awful
43
43
  end
44
44
 
45
45
  desc 'records ZONE', 'list records for given ZONE'
46
- method_option :long, aliases: '-l', default: false, desc: 'Long listing'
46
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'Long listing'
47
+ method_option :type, aliases: '-t', type: :array, default: nil, desc: 'List of record types to match'
48
+ method_option :name, aliases: '-n', type: :array, default: nil, desc: 'List of names to match'
49
+ method_option :max_items, aliases: '-m', type: :numeric, default: nil, desc: 'Max number of records to check'
47
50
  def records(zone)
48
- route53.list_resource_record_sets(hosted_zone_id: get_zone_by_name(zone)).resource_record_sets.tap do |records|
51
+ ## match on given record types
52
+ include_type = options[:type] ? ->(type) { options[:type].include?(type) } : ->(_) { true }
53
+
54
+ ## match on given record names
55
+ names = options.fetch('name', []).map { |name| name.gsub(/([^\.])$/, '\1.') } # append . to names if missing
56
+ include_name = options[:name] ? ->(name) { names.include?(name) } : ->(_) { true }
57
+
58
+ route53.list_resource_record_sets(
59
+ hosted_zone_id: get_zone_by_name(zone),
60
+ max_items: options[:max_items]
61
+ ).resource_record_sets.select do |rrset|
62
+ include_type.call(rrset.type) and include_name.call(rrset.name)
63
+ end.tap do |records|
49
64
  if options[:long]
50
- records.map do |r|
65
+ print_table records.map { |r|
51
66
  dns_name = r.alias_target.nil? ? [] : ['ALIAS ' + r.alias_target.dns_name]
52
67
  values = r.resource_records.map(&:value)
53
68
  [r.name, r.type, (dns_name + values).join(', ')]
54
- end.tap do |list|
55
- print_table list.sort
56
- end
69
+ }
57
70
  else
58
- puts records.map(&:name).sort
71
+ puts records.map(&:name)
59
72
  end
60
73
  end
61
74
  end
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.80'
2
+ VERSION = '0.0.81'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.80
4
+ version: 0.0.81
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-09 00:00:00.000000000 Z
11
+ date: 2016-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler