awful 0.0.146 → 0.0.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/awful/cloudfront.rb +34 -3
- data/lib/awful/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4cf58f0a62021dee6eba8a3ac79bbc5a603f65c6
|
|
4
|
+
data.tar.gz: 7723196a12129362a056ed5f77e693dfd8f2337a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27efda1c6409cdb2e4ee231e50bd74ff590a49a92aadb6aef976abf05101f9e241109c9c16f68a9ecfe8b5b2fef76b92c7667ece59f0c03747941515a03256a9
|
|
7
|
+
data.tar.gz: 40aca640f79a9cf8679e30292749ac2c51fb5700199c4a5329fd563c66a681adafb2ed673eccad5a0651bf4b59ae652e940872a2ed49ba7805460c7b466b8c4a
|
data/lib/awful/cloudfront.rb
CHANGED
|
@@ -8,8 +8,10 @@ module Awful
|
|
|
8
8
|
class CloudFront < Cli
|
|
9
9
|
|
|
10
10
|
COLORS = {
|
|
11
|
-
enabled:
|
|
12
|
-
disabled:
|
|
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
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.
|
|
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-
|
|
11
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|