awful 0.0.134 → 0.0.135

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: e03a6a7b0b1b46bd9ea30ba88401a20c07363e1d
4
- data.tar.gz: b44afdc965fd132abb21165c08b3c501f01bc73c
3
+ metadata.gz: 58d83a279090cf5d30c21d57fddd942bd56d8124
4
+ data.tar.gz: cbd9a07005eaafde070e069c7f1d4d7a03f58c6c
5
5
  SHA512:
6
- metadata.gz: 29893181e85f861b0162c44434e2109cd45a1e44b6d3dc830b998620a8e4bcf2eac07d3e389f2a1358589c0834a67fae0976b4c2191dd3106cac6c692c117f8e
7
- data.tar.gz: bc4a04e79deb969f90e626685da4a4cc8f78eed7d071e7ded5b540e2758605449c1f452fb656975cb28ff1206c31e32a2fab6c12a60e08e04cfad7c7f14917b3
6
+ metadata.gz: 6b99430490b98b315df24ce39c217a51b9a608ef9c48491e0f8fd50ddb52191e4e627e33d555d5f79ab4ca51da4c8f24662c80cef49cceef6dc6643b1f45f4a7
7
+ data.tar.gz: 9675cd3d6bcbac08755cd6fef86356ceb7690cca55d9b3de6c2e55b392c7f8aafdb1fe7971f1f3a768de3a42c914b4f56ea45bc65fd1e701baa1eaf3ea544621
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.2.20')
24
+ spec.add_dependency('aws-sdk', '>= 2.4.3')
25
25
  spec.add_dependency('thor')
26
26
  spec.add_dependency('dotenv')
27
- end
27
+ end
data/bin/cloudfront ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby
2
+ #-*- mode: ruby; -*-
3
+
4
+ require 'awful'
5
+ require 'awful/cloudfront'
6
+
7
+ Awful::CloudFront.start(ARGV)
data/lib/awful.rb CHANGED
@@ -49,7 +49,7 @@ module Awful
49
49
 
50
50
  ## to use dynamodb-local, set DYNAMO_ENDPOINT or DYNAMODB_ENDPOINT to e.g. http://localhost:8000
51
51
  def dynamodb
52
- options = {endpoint: ENV['DYNAMO_ENDPOINT'] || ENV['DYNAMODB_ENDPOINT']}.reject { |_,v| v.nil? }
52
+ options = {endpoint: ENV['DYNAMO_ENDPOINT'] || ENV['DYNAMODB_ENDPOINT']}.reject { |_,v| v.to_s.empty? }
53
53
  @dynamodb ||= Aws::DynamoDB::Client.new(options)
54
54
  end
55
55
 
@@ -93,6 +93,15 @@ module Awful
93
93
  end
94
94
  end
95
95
 
96
+ desc 'parameters NAME', 'return stack parameters as a hash'
97
+ def parameters(name)
98
+ cf.describe_stacks(stack_name: name).stacks.first.parameters.each_with_object({}) do |p, h|
99
+ h[p.parameter_key] = p.parameter_value
100
+ end.output do |hash|
101
+ print_table hash.sort
102
+ end
103
+ end
104
+
96
105
  desc 'outputs NAME [KEY]', 'get stack outputs as a ruby hash, or individual value'
97
106
  def outputs(name, key = nil)
98
107
  output_hash = cf.describe_stacks(stack_name: name).stacks.first.outputs.each_with_object({}) do |o, hash|
@@ -0,0 +1,66 @@
1
+ module Awful
2
+ module Short
3
+ def cloudfront(*args)
4
+ Awful::CloudFront.new.invoke(*args)
5
+ end
6
+ end
7
+
8
+ class CloudFront < Cli
9
+
10
+ COLORS = {
11
+ enabled: :green,
12
+ disabled: :red,
13
+ }
14
+
15
+ no_commands do
16
+ def cloudfront
17
+ @cloudfront ||= Aws::CloudFront::Client.new
18
+ end
19
+
20
+ def color(string)
21
+ set_color(string, COLORS.fetch(string.downcase.to_sym, :blue))
22
+ end
23
+ end
24
+
25
+ desc 'ls', 'list distributions'
26
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
27
+ def ls
28
+ marker = nil
29
+ items = []
30
+ loop do
31
+ response = cloudfront.list_distributions(marker: marker).distribution_list
32
+ items += response.items
33
+ marker = response.next_marker
34
+ break unless marker
35
+ end
36
+
37
+ items.output do |list|
38
+ if options[:long]
39
+ print_table list.map { |i|
40
+ origins = i.origins.items.map(&:domain_name).join(',')
41
+ state = i.enabled ? :Enabled : :Disabled
42
+ [ i.id, i.domain_name, origins, i.status, color(state), i.last_modified_time ]
43
+ }
44
+ else
45
+ puts list.map(&:id).sort
46
+ end
47
+ end
48
+ end
49
+
50
+ desc 'origins ID', 'list origins for distribution with ID'
51
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
52
+ def origins(id)
53
+ cloudfront.get_distribution(id: id).distribution.distribution_config.origins.items.output do |list|
54
+ if options[:long]
55
+ print_table list.map { |o|
56
+ c = o.custom_origin_config
57
+ config = o.s3_origin_config ? [ 's3' ] : [ 'custom', c.origin_protocol_policy, c.http_port, c.https_port ]
58
+ [ o.id, o.domain_name, o.origin_path ] + config
59
+ }
60
+ else
61
+ puts list.map(&:id).sort
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -1,3 +1,4 @@
1
+ require 'json'
1
2
  require 'awful/dynamodb_streams'
2
3
 
3
4
  module Awful
data/lib/awful/ecr.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'json'
1
2
  require 'base64'
2
3
 
3
4
  module Awful
data/lib/awful/ecs.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'json'
2
+
1
3
  module Awful
2
4
  module Short
3
5
  def ecs(*args)
data/lib/awful/iam.rb CHANGED
@@ -1,5 +1,6 @@
1
- module Awful
1
+ require 'json'
2
2
 
3
+ module Awful
3
4
  class IAM < Cli
4
5
 
5
6
  no_commands do
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.134'
2
+ VERSION = '0.0.135'
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.134
4
+ version: 0.0.135
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-07-25 00:00:00.000000000 Z
11
+ date: 2016-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 2.2.20
47
+ version: 2.4.3
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.2.20
54
+ version: 2.4.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: thor
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -89,6 +89,7 @@ executables:
89
89
  - asg
90
90
  - asgn
91
91
  - cf
92
+ - cloudfront
92
93
  - cwevents
93
94
  - cwlogs
94
95
  - dp
@@ -126,6 +127,7 @@ files:
126
127
  - bin/asg
127
128
  - bin/asgn
128
129
  - bin/cf
130
+ - bin/cloudfront
129
131
  - bin/cwevents
130
132
  - bin/cwlogs
131
133
  - bin/dp
@@ -160,6 +162,7 @@ files:
160
162
  - lib/awful/auto_scaling_notifications.rb
161
163
  - lib/awful/changesets.rb
162
164
  - lib/awful/cloudformation.rb
165
+ - lib/awful/cloudfront.rb
163
166
  - lib/awful/cloudwatch_events.rb
164
167
  - lib/awful/cloudwatch_logs.rb
165
168
  - lib/awful/datapipeline.rb