awful 0.0.157 → 0.0.158

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: 99c05896c178d666894061616bd3be84723558a0
4
- data.tar.gz: b93e53d0adbb16b05775c6d51fd2d9e6dbbc6687
3
+ metadata.gz: b64a33d63741aa2b4eced60d8e54255ca2b7fce1
4
+ data.tar.gz: 7c03f2f2db06f75724898fea0b80e8344bdbc08c
5
5
  SHA512:
6
- metadata.gz: 17a626a26ac67317a14dd5ba156bd9f67a2ffac41a2323cce9d9428b92bd0bad2f3d42f8cc6824e9ee537c41edd34305ca86a8df1c23b7a4d3fefe87ef379277
7
- data.tar.gz: efa5ee2168f77efd3da46f30cf212412f6674696beafd12c1ad9484f65c10fdfeae547b0d517fb86bf8ff059435bd266f8ce9adca6709c8129f9647f9a8ed231
6
+ metadata.gz: a05d120601d21ef058a76ef1eab81cef24c8170ebffe2004682b29398bd1736ef90fd5b63a4d32c88b4d7c092d7913e9d684bd66ad5c77b0bdd5ea8922e36777
7
+ data.tar.gz: 64d8328c03f27cabae26fca56f99b395344980f98f1e772e81d019d90c9d2ae1f193b3f58f06925484575210efff7784092467b3563afd40ca300ce30fdb707a
data/awful.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake"
23
23
 
24
- spec.add_dependency('aws-sdk', '>= 2.4.3')
25
- spec.add_dependency('thor')
24
+ spec.add_dependency('aws-sdk', '>= 2.7.2')
25
+ spec.add_dependency('thor', '< 0.19.2')
26
26
  spec.add_dependency('dotenv')
27
27
  end
data/bin/acm ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby
2
+ #-*- mode: ruby; -*-
3
+
4
+ require 'awful'
5
+ require 'awful/acm'
6
+
7
+ Awful::Acm.start(ARGV)
data/lib/awful/acm.rb ADDED
@@ -0,0 +1,74 @@
1
+ require 'yaml'
2
+
3
+ module Awful
4
+ module Short
5
+ def acm(*args)
6
+ Awful::Acm.new.invoke(*args)
7
+ end
8
+ end
9
+
10
+ class Acm < Cli
11
+ no_commands do
12
+ def acm
13
+ @_acm ||= Aws::ACM::Client.new
14
+ end
15
+
16
+ def find_cert(n)
17
+ paginate(:certificate_summary_list) do |next_token|
18
+ acm.list_certificates(next_token: next_token)
19
+ end.find do |cert|
20
+ (n == cert.domain_name) || (n == cert.certificate_arn)
21
+ end
22
+ end
23
+ end
24
+
25
+ desc 'ls', 'stuff'
26
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
27
+ method_option :arn, aliases: '-a', type: :boolean, default: false, desc: 'list ARNs for certs'
28
+ method_option :statuses, aliases: '-s', type: :array, default: [], desc: 'pending_validation,issued,inactive,expired,validation_timed_out,revoked,failed'
29
+ def ls
30
+ paginate(:certificate_summary_list) do |next_token|
31
+ acm.list_certificates(
32
+ certificate_statuses: options[:statuses].map(&:upcase),
33
+ next_token: next_token
34
+ )
35
+ end.output do |certs|
36
+ if options[:long]
37
+ print_table certs.map { |cert|
38
+ c = acm.describe_certificate(certificate_arn: cert.certificate_arn).certificate
39
+ [c.domain_name, c.subject_alternative_names.join(','), c.status, c.type, (c.in_use_by.empty? ? 'in use' : 'not in use')]
40
+ }
41
+ elsif options[:arn]
42
+ print_table certs.map { |c| [c.domain_name, c.certificate_arn] }
43
+ else
44
+ puts certs.map(&:domain_name)
45
+ end
46
+ end
47
+ end
48
+
49
+ desc 'dump CERT', 'get cert details by ARN or domain name'
50
+ def dump(n)
51
+ acm.describe_certificate(certificate_arn: find_cert(n).certificate_arn).certificate.output do |cert|
52
+ puts YAML.dump(stringify_keys(cert.to_hash))
53
+ end
54
+ end
55
+
56
+ desc 'get CERT', 'get ACM cert and chain'
57
+ method_option :chain, type: :boolean, default: false, desc: 'print cert chain instead of cert'
58
+ def get(n)
59
+ acm.get_certificate(certificate_arn: find_cert(n).certificate_arn).output do |cert|
60
+ if options[:chain]
61
+ puts cert.certificate_chain
62
+ else
63
+ puts cert.certificate
64
+ end
65
+ end
66
+ end
67
+
68
+ desc 'delete CERT', 'delete certificate from ACM'
69
+ def delete(n)
70
+ acm.delete_certificate(certificate_arn: find_cert(n).certificate_arn)
71
+ end
72
+
73
+ end
74
+ end
@@ -36,6 +36,14 @@ module Awful
36
36
  end
37
37
  tables
38
38
  end
39
+
40
+ def get_arn(name)
41
+ if name.start_with?('arn:aws:dynamodb:') # already an arn
42
+ name
43
+ else
44
+ dynamodb.describe_table(table_name: name).table.table_arn
45
+ end
46
+ end
39
47
  end
40
48
 
41
49
  desc 'ls [PATTERN]', 'list dynamodb tables [matching PATTERN]'
@@ -338,6 +346,26 @@ module Awful
338
346
  p r
339
347
  end
340
348
 
349
+ desc 'tags TABLE', 'list tags for table'
350
+ def tags(name)
351
+ paginate(:tags) do |token|
352
+ dynamodb.list_tags_of_resource(resource_arn: get_arn(name), next_token: token)
353
+ end.output do |tags|
354
+ print_table tags.map { |t| [t.key, t.value] }
355
+ end
356
+ end
357
+
358
+ desc 'tag TABLE KEY', 'tag a table'
359
+ def tag(name, *tags)
360
+ dynamodb.tag_resource(
361
+ resource_arn: get_arn(name),
362
+ tags: tags.map { |t|
363
+ k, v = t.split(/[=:]/)
364
+ {key: k, value: v}
365
+ }
366
+ )
367
+ end
368
+
341
369
  ## see lambda_events.rb for subcommands
342
370
  desc 'streams SUBCOMMANDS', 'subcommands for dynamodb streams'
343
371
  subcommand 'streams', Streams
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.157'
2
+ VERSION = '0.0.158'
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.157
4
+ version: 0.0.158
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 2.4.3
47
+ version: 2.7.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 2.4.3
54
+ version: 2.7.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: thor
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "<"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.19.2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "<"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 0.19.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: dotenv
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -84,6 +84,7 @@ description: AWS cmdline and yaml loader.
84
84
  email:
85
85
  - rlister+gh@gmail.com
86
86
  executables:
87
+ - acm
87
88
  - alb
88
89
  - ami
89
90
  - apigw
@@ -127,6 +128,7 @@ files:
127
128
  - README.md
128
129
  - Rakefile
129
130
  - awful.gemspec
131
+ - bin/acm
130
132
  - bin/alb
131
133
  - bin/ami
132
134
  - bin/apigw
@@ -162,6 +164,7 @@ files:
162
164
  - bin/vpc
163
165
  - bin/waf
164
166
  - lib/awful.rb
167
+ - lib/awful/acm.rb
165
168
  - lib/awful/alb.rb
166
169
  - lib/awful/ami.rb
167
170
  - lib/awful/api_gateway.rb