cfdef 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +83 -0
- data/cfdef.gemspec +1 -0
- data/lib/cfdef.rb +1 -0
- data/lib/cfdef/exporter.rb +7 -3
- data/lib/cfdef/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d55a0bdee6a2bbaf9db699f83615a3d328bd8b8
|
4
|
+
data.tar.gz: 559139e452bf7b33c00ed77eb7064104eaf64aec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b036a409ca0ea2b99aa613b72c12437217d8718c6559353d583a54dc67e90db3950c6e1b4d39ee0ecb0f4dc735ebfcc0709cf99e61b701ecafc18d0090f18a9
|
7
|
+
data.tar.gz: 0e90921ba73ce3d379f7a11bd84bf16ace05c9dc3ce1b58fc7dba16348cad07c68941d22a485c308bb8d694d76f6a19d8d36a9ff840feddb80b9a589d340b228
|
data/README.md
CHANGED
@@ -181,6 +181,89 @@ $ cat CFfile
|
|
181
181
|
$ cfdef -a
|
182
182
|
```
|
183
183
|
|
184
|
+
## Use braces
|
185
|
+
|
186
|
+
Export with `--use-braces` option.
|
187
|
+
|
188
|
+
```ruby
|
189
|
+
distribution("EXAMPLEID") {
|
190
|
+
aliases {
|
191
|
+
quantity 0
|
192
|
+
}
|
193
|
+
origins {
|
194
|
+
quantity 1
|
195
|
+
items {|*|
|
196
|
+
id "Custom-example.com"
|
197
|
+
domain_name "example.com"
|
198
|
+
origin_path ""
|
199
|
+
custom_headers {
|
200
|
+
quantity 0
|
201
|
+
}
|
202
|
+
custom_origin_config {
|
203
|
+
http_port 80
|
204
|
+
https_port 443
|
205
|
+
origin_protocol_policy "http-only"
|
206
|
+
origin_ssl_protocols {
|
207
|
+
quantity 3
|
208
|
+
items ["TLSv1", "TLSv1.1", "TLSv1.2"]
|
209
|
+
}
|
210
|
+
}
|
211
|
+
}
|
212
|
+
}
|
213
|
+
default_cache_behavior {
|
214
|
+
target_origin_id "Custom-example.com"
|
215
|
+
forwarded_values {
|
216
|
+
query_string false
|
217
|
+
cookies {
|
218
|
+
forward "none"
|
219
|
+
}
|
220
|
+
headers {
|
221
|
+
quantity 0
|
222
|
+
}
|
223
|
+
}
|
224
|
+
trusted_signers {
|
225
|
+
enabled false
|
226
|
+
quantity 0
|
227
|
+
}
|
228
|
+
viewer_protocol_policy "allow-all"
|
229
|
+
min_ttl 0
|
230
|
+
allowed_methods {
|
231
|
+
quantity 2
|
232
|
+
items ["GET", "HEAD"]
|
233
|
+
cached_methods {
|
234
|
+
quantity 2
|
235
|
+
items ["GET", "HEAD"]
|
236
|
+
}
|
237
|
+
}
|
238
|
+
smooth_streaming false
|
239
|
+
default_ttl 86400
|
240
|
+
max_ttl 31536000
|
241
|
+
compress false
|
242
|
+
}
|
243
|
+
cache_behaviors {
|
244
|
+
quantity 0
|
245
|
+
}
|
246
|
+
custom_error_responses {
|
247
|
+
quantity 0
|
248
|
+
}
|
249
|
+
comment ""
|
250
|
+
price_class "PriceClass_All"
|
251
|
+
enabled true
|
252
|
+
viewer_certificate {
|
253
|
+
cloud_front_default_certificate true
|
254
|
+
minimum_protocol_version "SSLv3"
|
255
|
+
certificate_source "cloudfront"
|
256
|
+
}
|
257
|
+
restrictions {
|
258
|
+
geo_restriction {
|
259
|
+
restriction_type "none"
|
260
|
+
quantity 0
|
261
|
+
}
|
262
|
+
}
|
263
|
+
web_acl_id ""
|
264
|
+
}
|
265
|
+
```
|
266
|
+
|
184
267
|
## ToDo
|
185
268
|
|
186
269
|
* Support Streaming Distribution
|
data/cfdef.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency 'diffy'
|
24
24
|
spec.add_dependency 'dslh', '>= 0.3.6'
|
25
25
|
spec.add_dependency 'term-ansicolor'
|
26
|
+
spec.add_dependency 'parallel'
|
26
27
|
|
27
28
|
spec.add_development_dependency 'bundler'
|
28
29
|
spec.add_development_dependency 'rake'
|
data/lib/cfdef.rb
CHANGED
data/lib/cfdef/exporter.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
class Cfdef::Exporter
|
2
2
|
include Cfdef::Utils::Helper
|
3
3
|
|
4
|
+
CONCURRENCY = 8
|
5
|
+
|
4
6
|
def initialize(client, options = {})
|
5
7
|
@client = client
|
6
8
|
@options = options
|
@@ -19,10 +21,12 @@ class Cfdef::Exporter
|
|
19
21
|
def export_distributions
|
20
22
|
result = {}
|
21
23
|
|
22
|
-
|
24
|
+
distribution_ids = @client.list_distributions.flat_map(&:distribution_list).flat_map(&:items).map(&:id)
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
+
Parallel.each(distribution_ids, in_threads: CONCURRENCY) do |distribution_id|
|
27
|
+
resp = @client.get_distribution_config(id: distribution_id)
|
28
|
+
distribution = resp.distribution_config.to_h
|
29
|
+
distribution.delete(:caller_reference)
|
26
30
|
origin_ids = distribution.fetch(:origins).fetch(:items).map {|i| i[:id] }.sort
|
27
31
|
next unless origin_ids.any?{|i| matched?(i) }
|
28
32
|
result[distribution_id] = remove_status!(distribution)
|
data/lib/cfdef/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfdef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- winebarrel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: parallel
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|