awful 0.0.146 → 0.0.147

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: 67e76830d6ca11e1b34442199e55587c816dfe61
4
- data.tar.gz: f75d5135c848e592dffa10100307a93ab8134165
3
+ metadata.gz: 4cf58f0a62021dee6eba8a3ac79bbc5a603f65c6
4
+ data.tar.gz: 7723196a12129362a056ed5f77e693dfd8f2337a
5
5
  SHA512:
6
- metadata.gz: 48860bfd4fdda8282da19281ed40215b7e253067c32149b973545c2cc9948e71aabe553e6b9da3d546eaf65b43b7194170ca5e7641e4ac752541a405414f9b33
7
- data.tar.gz: eedaaa3d216ca79f26e3f763a00511e4141dd9bf1862d82812ca12963a157d34000b9851a54e74cb5f68117c9e00c4bcc48e3a262f7205131f7eeb99d602307d
6
+ metadata.gz: 27efda1c6409cdb2e4ee231e50bd74ff590a49a92aadb6aef976abf05101f9e241109c9c16f68a9ecfe8b5b2fef76b92c7667ece59f0c03747941515a03256a9
7
+ data.tar.gz: 40aca640f79a9cf8679e30292749ac2c51fb5700199c4a5329fd563c66a681adafb2ed673eccad5a0651bf4b59ae652e940872a2ed49ba7805460c7b466b8c4a
@@ -8,8 +8,10 @@ module Awful
8
8
  class CloudFront < Cli
9
9
 
10
10
  COLORS = {
11
- enabled: :green,
12
- disabled: :red,
11
+ enabled: :green,
12
+ disabled: :red,
13
+ deployed: :green,
14
+ inprogress: :yellow,
13
15
  }
14
16
 
15
17
  no_commands do
@@ -39,7 +41,7 @@ module Awful
39
41
  print_table list.map { |i|
40
42
  origins = i.origins.items.map(&:domain_name).join(',')
41
43
  state = i.enabled ? :Enabled : :Disabled
42
- [ i.id, i.domain_name, origins, i.status, color(state), i.last_modified_time ]
44
+ [ i.id, i.domain_name, origins, color(i.status), color(state), i.last_modified_time ]
43
45
  }
44
46
  else
45
47
  puts list.map(&:id).sort
@@ -47,6 +49,35 @@ module Awful
47
49
  end
48
50
  end
49
51
 
52
+ desc 'get ID', 'dump out config for distribution'
53
+ def get(id)
54
+ cloudfront.get_distribution(id: id).distribution.output do |dist|
55
+ puts YAML.dump(stringify_keys(dist.to_hash))
56
+ end
57
+ end
58
+
59
+ desc 'aliases ID [LIST]', 'get/set aliases for distribution'
60
+ method_option :add, aliases: '-a', type: :boolean, default: false, desc: 'add list to existing aliases'
61
+ method_option :delete, aliases: '-d', type: :boolean, default: false, desc: 'delete list from existing aliases'
62
+ def aliases(id, *list)
63
+ if list.empty?
64
+ cloudfront.get_distribution(id: id).distribution.distribution_config.aliases.items.output(&method(:puts))
65
+ else
66
+ response = cloudfront.get_distribution(id: id) # get current config
67
+ config = response.distribution.distribution_config
68
+ new = config[:aliases][:items]
69
+ if options[:add]
70
+ new += list # append to existing
71
+ elsif options[:delete]
72
+ new -= list # remove from existing
73
+ else
74
+ new = list # replace existing
75
+ end
76
+ config[:aliases] = {quantity: new.count, items: new}
77
+ cloudfront.update_distribution(id: id, distribution_config: config, if_match: response.etag)
78
+ end
79
+ end
80
+
50
81
  desc 'origins ID', 'list origins for distribution with ID'
51
82
  method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
52
83
  def origins(id)
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.146'
2
+ VERSION = '0.0.147'
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.146
4
+ version: 0.0.147
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-10-12 00:00:00.000000000 Z
11
+ date: 2016-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler