cloudformation-ruby-dsl 1.0.4 → 1.0.5
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 +7 -0
- data/LICENSE +13 -0
- data/OWNERS +4 -0
- data/README.md +6 -1
- data/cloudformation-ruby-dsl.gemspec +1 -0
- data/examples/cloudformation-ruby-script.rb +16 -0
- data/examples/maps/domains.txt +4 -0
- data/lib/cloudformation-ruby-dsl/cfntemplate.rb +47 -6
- data/lib/cloudformation-ruby-dsl/table.rb +18 -0
- data/lib/cloudformation-ruby-dsl/version.rb +1 -1
- metadata +36 -34
- data/LICENSE.txt +0 -201
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 99f3a404577b576209fe2a83f92b4049a2c25afd
|
4
|
+
data.tar.gz: 9e5f806014c4fcbd40e03dd9eb80a69fb99fa41b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fd36efe1f07eb08b84c8cc2d96c846dffb1b8188ee5eebd367fd3d4288b833443909fdfa1182919238412eaf543701cd0b120fa82c160d32eac49ea441a5d3f7
|
7
|
+
data.tar.gz: 32eb81ebf63a1927b1cce3d63cbf3a0e27e00e82201cdc5b922af3f84045094d2473418f08990b305b2a50eb8537cd35d46cecc1a0fd4e369958473c719fe513
|
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2015 Bazaarvoice, Inc.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/OWNERS
ADDED
data/README.md
CHANGED
@@ -38,10 +38,15 @@ You may need to preface this with `bundle exec` if you installed via Bundler.
|
|
38
38
|
|
39
39
|
Make the resulting file executable (`chmod +x [NEW_NAME.rb]`). It can respond to the following subcommands (which are listed if you run without parameters):
|
40
40
|
- `expand`: output the JSON template to the command line (takes optional `--nopretty` to minimize the output)
|
41
|
-
- `diff`: compare
|
41
|
+
- `diff`: compare an existing stack with your template
|
42
42
|
- `validate`: run validation against the stack definition
|
43
43
|
- `create`: create a new stack from the output
|
44
44
|
- `update`: update an existing stack from the output
|
45
|
+
- `cancel-update`: cancel updating a stack
|
46
|
+
- `delete`: delete a stack (with prompt)
|
47
|
+
- `describe`: get output of an existing stack and output it (takes optional `--nopretty` to minimize output)
|
48
|
+
- `describe-resource`: given two arguments: stack-name and logical-resource-id, get output from a stack concerning the specific resource (takes optional `--nopretty` to minimize output)
|
49
|
+
- `get-template`: get entire template output of an existing stack
|
45
50
|
|
46
51
|
Below are the various functions currently available in the DSL. See [the example script](examples/cloudformation-ruby-script.rb) for more usage information.
|
47
52
|
|
@@ -94,6 +94,22 @@ template do
|
|
94
94
|
mapping 'TableExampleMultimap',
|
95
95
|
vpc.get_multimap({ :visibility => 'private', :zone => ['a', 'c'] }, :env, :region, :subnet)
|
96
96
|
|
97
|
+
# Shows how to use a table for iterative processing.
|
98
|
+
domains = Table.load 'maps/domains.txt'
|
99
|
+
domains.get_multihash(:purpose, {:product => 'demo', :alias => 'true'}, :prefix, :target, :alias_hosted_zone_id).each_pair do |key, value|
|
100
|
+
resource key+'Route53RecordSet', :Type => 'AWS::Route53::RecordSet', :Properties => {
|
101
|
+
:Comment => '',
|
102
|
+
:HostedZoneName => 'bazaarvoice.com',
|
103
|
+
:Name => value[:prefix]+'.bazaarvoice.com',
|
104
|
+
:Type => 'A',
|
105
|
+
:AliasTarget => {
|
106
|
+
:DNSName => value[:target],
|
107
|
+
:HostedZoneId => value[:alias_hosted_zone_id]
|
108
|
+
}
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
|
97
113
|
# The tag type is a DSL extension; it is not a property of actual CloudFormation templates.
|
98
114
|
# These tags are excised from the template and used to generate a series of --tag arguments which are passed to CloudFormation when a stack is created.
|
99
115
|
# They do not ultimately appear in the expanded CloudFormation template.
|
@@ -0,0 +1,4 @@
|
|
1
|
+
purpose product prefix target alias alias_hosted_zone_id has_origin_domain origin_target
|
2
|
+
CDN demo code dabc123.cloudfront.net true Z2FDTNDATAQYW2 false
|
3
|
+
Assets demo assets ddef456.cloudfront.net true Z2FDTNDATAQYW2 false
|
4
|
+
API demo api prod-api false false prod-api-origin.whatever.net.
|
@@ -262,13 +262,22 @@ def cfn(template)
|
|
262
262
|
|
263
263
|
when 'create'
|
264
264
|
begin
|
265
|
-
|
265
|
+
|
266
|
+
# default options (not overridable)
|
267
|
+
create_stack_opts = {
|
266
268
|
stack_name: stack_name,
|
267
269
|
template_body: template_string,
|
268
270
|
parameters: template.parameters.map { |k,v| {parameter_key: k, parameter_value: v}}.to_a,
|
269
271
|
tags: cfn_tags.map { |k,v| {"key" => k.to_s, "value" => v} }.to_a,
|
270
272
|
capabilities: ["CAPABILITY_IAM"],
|
271
|
-
|
273
|
+
}
|
274
|
+
|
275
|
+
# fill in options from the command line
|
276
|
+
extra_options = parse_arg_array_as_hash(options)
|
277
|
+
create_stack_opts = extra_options.merge(create_stack_opts)
|
278
|
+
|
279
|
+
# create stack
|
280
|
+
create_result = cfn_client.create_stack(create_stack_opts)
|
272
281
|
if create_result.successful?
|
273
282
|
puts create_result.stack_id
|
274
283
|
exit(true)
|
@@ -329,7 +338,11 @@ def cfn(template)
|
|
329
338
|
})
|
330
339
|
}
|
331
340
|
describe_stack.stacks.each { |stack| stacks[stack.stack_name] = stack.to_map.merge!({resources: stack_resources[stack.stack_name]}) }
|
332
|
-
|
341
|
+
unless template.nopretty
|
342
|
+
puts JSON.pretty_generate(stacks)
|
343
|
+
else
|
344
|
+
puts JSON.generate(stacks)
|
345
|
+
end
|
333
346
|
exit(true)
|
334
347
|
end
|
335
348
|
rescue Aws::CloudFormation::Errors::ServiceError => e
|
@@ -359,8 +372,13 @@ def cfn(template)
|
|
359
372
|
when 'get-template'
|
360
373
|
begin
|
361
374
|
get_template_result = cfn_client.get_template({stack_name: stack_name})
|
375
|
+
template_body = JSON.parse(get_template_result.template_body)
|
362
376
|
if get_template_result.successful?
|
363
|
-
|
377
|
+
unless template.nopretty
|
378
|
+
puts JSON.pretty_generate(template_body)
|
379
|
+
else
|
380
|
+
puts JSON.generate(template_body)
|
381
|
+
end
|
364
382
|
exit(true)
|
365
383
|
end
|
366
384
|
rescue Aws::CloudFormation::Errors::ServiceError => e
|
@@ -410,12 +428,21 @@ def cfn(template)
|
|
410
428
|
|
411
429
|
# update the stack
|
412
430
|
begin
|
413
|
-
|
431
|
+
|
432
|
+
# default options (not overridable)
|
433
|
+
update_stack_opts = {
|
414
434
|
stack_name: stack_name,
|
415
435
|
template_body: template_string,
|
416
436
|
parameters: template.parameters.map { |k,v| {parameter_key: k, parameter_value: v}}.to_a,
|
417
437
|
capabilities: ["CAPABILITY_IAM"],
|
418
|
-
|
438
|
+
}
|
439
|
+
|
440
|
+
# fill in options from the command line
|
441
|
+
extra_options = parse_arg_array_as_hash(options)
|
442
|
+
update_stack_opts = extra_options.merge(update_stack_opts)
|
443
|
+
|
444
|
+
# update the stack
|
445
|
+
update_result = cfn_client.update_stack(update_stack_opts)
|
419
446
|
if update_result.successful?
|
420
447
|
puts update_result.stack_id
|
421
448
|
exit(true)
|
@@ -464,6 +491,20 @@ def extract_options(args, opts_no_val, opts_1_val)
|
|
464
491
|
[opts, rest]
|
465
492
|
end
|
466
493
|
|
494
|
+
# convert an array of option strings to a hash
|
495
|
+
# example input: ["--option", "value", "--optionwithnovalue"]
|
496
|
+
# example output: {:option => "value", :optionwithnovalue: true}
|
497
|
+
def parse_arg_array_as_hash(options)
|
498
|
+
result = {}
|
499
|
+
options.slice_before(/\A--[a-zA-Z_-]\S/).each { |o|
|
500
|
+
key = ((o[0].sub '--', '').gsub '-', '_').downcase.to_sym
|
501
|
+
value = if o.length > 1 then o.drop(1) else true end
|
502
|
+
value = value[0] if value.is_a?(Array) and value.length == 1
|
503
|
+
result[key] = value
|
504
|
+
}
|
505
|
+
result
|
506
|
+
end
|
507
|
+
|
467
508
|
##################################### Additional dsl logic
|
468
509
|
# Core interpreter for the DSL
|
469
510
|
class TemplateDSL < JsonObjectDSL
|
@@ -37,6 +37,13 @@ class Table
|
|
37
37
|
distinct_values(filter(predicate), key, true)
|
38
38
|
end
|
39
39
|
|
40
|
+
# Selects all rows in the table which match the name/value pairs of the predicate object and returns a
|
41
|
+
# hash of hashes, where the key for the top-level hash is the key paramter and the second-level hash keys are
|
42
|
+
# those in the keys paramter. This is useful when you want multiple column values for a given row.
|
43
|
+
def get_multihash(key, predicate, *keys)
|
44
|
+
build_nested_hash(filter(predicate), key, keys)
|
45
|
+
end
|
46
|
+
|
40
47
|
# Selects all rows in the table which match the name/value pairs of the predicate object and returns a
|
41
48
|
# set of nested maps, where the key for the map at level n is the key at index n in the specified keys,
|
42
49
|
# except for the last key in the specified keys which is used to determine the value of the leaf-level map.
|
@@ -68,6 +75,17 @@ class Table
|
|
68
75
|
@records.select { |record| predicate.all? { |key, value| matches(value, record[key]) } }
|
69
76
|
end
|
70
77
|
|
78
|
+
def build_nested_hash(records, key, keys)
|
79
|
+
hash = {}
|
80
|
+
records.each do |record|
|
81
|
+
hash[record[key]] = {}
|
82
|
+
keys.each do |hash_key|
|
83
|
+
hash[record[key]][hash_key] = record[hash_key]
|
84
|
+
end
|
85
|
+
end
|
86
|
+
return hash
|
87
|
+
end
|
88
|
+
|
71
89
|
def build_nested_map(records, path, multi)
|
72
90
|
key, *rest = path
|
73
91
|
if rest.empty?
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudformation-ruby-dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Shawn Smith
|
@@ -16,102 +15,104 @@ authors:
|
|
16
15
|
autorequire:
|
17
16
|
bindir: bin
|
18
17
|
cert_chain: []
|
19
|
-
date: 2015-
|
18
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: detabulator
|
23
22
|
requirement: !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
23
|
requirements:
|
26
|
-
- -
|
24
|
+
- - '>='
|
27
25
|
- !ruby/object:Gem::Version
|
28
26
|
version: '0'
|
29
27
|
type: :runtime
|
30
28
|
prerelease: false
|
31
29
|
version_requirements: !ruby/object:Gem::Requirement
|
32
|
-
none: false
|
33
30
|
requirements:
|
34
|
-
- -
|
31
|
+
- - '>='
|
35
32
|
- !ruby/object:Gem::Version
|
36
33
|
version: '0'
|
37
34
|
- !ruby/object:Gem::Dependency
|
38
35
|
name: json
|
39
36
|
requirement: !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
37
|
requirements:
|
42
|
-
- -
|
38
|
+
- - '>='
|
43
39
|
- !ruby/object:Gem::Version
|
44
40
|
version: '0'
|
45
41
|
type: :runtime
|
46
42
|
prerelease: false
|
47
43
|
version_requirements: !ruby/object:Gem::Requirement
|
48
|
-
none: false
|
49
44
|
requirements:
|
50
|
-
- -
|
45
|
+
- - '>='
|
51
46
|
- !ruby/object:Gem::Version
|
52
47
|
version: '0'
|
53
48
|
- !ruby/object:Gem::Dependency
|
54
49
|
name: bundler
|
55
50
|
requirement: !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
51
|
requirements:
|
58
|
-
- -
|
52
|
+
- - '>='
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: '0'
|
61
55
|
type: :runtime
|
62
56
|
prerelease: false
|
63
57
|
version_requirements: !ruby/object:Gem::Requirement
|
64
|
-
none: false
|
65
58
|
requirements:
|
66
|
-
- -
|
59
|
+
- - '>='
|
67
60
|
- !ruby/object:Gem::Version
|
68
61
|
version: '0'
|
69
62
|
- !ruby/object:Gem::Dependency
|
70
63
|
name: aws-sdk
|
71
64
|
requirement: !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
65
|
requirements:
|
74
|
-
- -
|
66
|
+
- - '>='
|
75
67
|
- !ruby/object:Gem::Version
|
76
68
|
version: '0'
|
77
69
|
type: :runtime
|
78
70
|
prerelease: false
|
79
71
|
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
72
|
requirements:
|
82
|
-
- -
|
73
|
+
- - '>='
|
83
74
|
- !ruby/object:Gem::Version
|
84
75
|
version: '0'
|
85
76
|
- !ruby/object:Gem::Dependency
|
86
77
|
name: diffy
|
87
78
|
requirement: !ruby/object:Gem::Requirement
|
88
|
-
none: false
|
89
79
|
requirements:
|
90
|
-
- -
|
80
|
+
- - '>='
|
91
81
|
- !ruby/object:Gem::Version
|
92
82
|
version: '0'
|
93
83
|
type: :runtime
|
94
84
|
prerelease: false
|
95
85
|
version_requirements: !ruby/object:Gem::Requirement
|
96
|
-
none: false
|
97
86
|
requirements:
|
98
|
-
- -
|
87
|
+
- - '>='
|
99
88
|
- !ruby/object:Gem::Version
|
100
89
|
version: '0'
|
101
90
|
- !ruby/object:Gem::Dependency
|
102
91
|
name: highline
|
103
92
|
requirement: !ruby/object:Gem::Requirement
|
104
|
-
none: false
|
105
93
|
requirements:
|
106
|
-
- -
|
94
|
+
- - '>='
|
107
95
|
- !ruby/object:Gem::Version
|
108
96
|
version: '0'
|
109
97
|
type: :runtime
|
110
98
|
prerelease: false
|
111
99
|
version_requirements: !ruby/object:Gem::Requirement
|
112
|
-
none: false
|
113
100
|
requirements:
|
114
|
-
- -
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: rake
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
type: :runtime
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
115
116
|
- !ruby/object:Gem::Version
|
116
117
|
version: '0'
|
117
118
|
description: Ruby DSL library that provides a wrapper around the CloudFormation.
|
@@ -131,7 +132,8 @@ extra_rdoc_files: []
|
|
131
132
|
files:
|
132
133
|
- .gitignore
|
133
134
|
- Gemfile
|
134
|
-
- LICENSE
|
135
|
+
- LICENSE
|
136
|
+
- OWNERS
|
135
137
|
- README.md
|
136
138
|
- Rakefile
|
137
139
|
- bin/cfntemplate-to-ruby
|
@@ -139,6 +141,7 @@ files:
|
|
139
141
|
- docs/Contributing.md
|
140
142
|
- docs/Releasing.md
|
141
143
|
- examples/cloudformation-ruby-script.rb
|
144
|
+
- examples/maps/domains.txt
|
142
145
|
- examples/maps/map.json
|
143
146
|
- examples/maps/map.rb
|
144
147
|
- examples/maps/map.yaml
|
@@ -157,28 +160,27 @@ files:
|
|
157
160
|
- lib/cloudformation-ruby-dsl/version.rb
|
158
161
|
homepage: http://github.com/bazaarvoice/cloudformation-ruby-dsl
|
159
162
|
licenses: []
|
163
|
+
metadata: {}
|
160
164
|
post_install_message:
|
161
165
|
rdoc_options: []
|
162
166
|
require_paths:
|
163
167
|
- lib
|
164
168
|
- bin
|
165
169
|
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
-
none: false
|
167
170
|
requirements:
|
168
|
-
- -
|
171
|
+
- - '>='
|
169
172
|
- !ruby/object:Gem::Version
|
170
173
|
version: '0'
|
171
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
-
none: false
|
173
175
|
requirements:
|
174
|
-
- -
|
176
|
+
- - '>='
|
175
177
|
- !ruby/object:Gem::Version
|
176
178
|
version: '0'
|
177
179
|
requirements: []
|
178
180
|
rubyforge_project:
|
179
|
-
rubygems_version:
|
181
|
+
rubygems_version: 2.0.14
|
180
182
|
signing_key:
|
181
|
-
specification_version:
|
183
|
+
specification_version: 4
|
182
184
|
summary: Ruby DSL library that provides a wrapper around the CloudFormation. Written
|
183
185
|
by [Bazaarvoice](http://www.bazaarvoice.com).
|
184
186
|
test_files: []
|
data/LICENSE.txt
DELETED
@@ -1,201 +0,0 @@
|
|
1
|
-
Apache License
|
2
|
-
Version 2.0, January 2004
|
3
|
-
http://www.apache.org/licenses/
|
4
|
-
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
-
|
7
|
-
1. Definitions.
|
8
|
-
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
-
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
-
the copyright owner that is granting the License.
|
14
|
-
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
-
other entities that control, are controlled by, or are under common
|
17
|
-
control with that entity. For the purposes of this definition,
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
19
|
-
direction or management of such entity, whether by contract or
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
-
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
-
exercising permissions granted by this License.
|
25
|
-
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
27
|
-
including but not limited to software source code, documentation
|
28
|
-
source, and configuration files.
|
29
|
-
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
31
|
-
transformation or translation of a Source form, including but
|
32
|
-
not limited to compiled object code, generated documentation,
|
33
|
-
and conversions to other media types.
|
34
|
-
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
36
|
-
Object form, made available under the License, as indicated by a
|
37
|
-
copyright notice that is included in or attached to the work
|
38
|
-
(an example is provided in the Appendix below).
|
39
|
-
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
-
the Work and Derivative Works thereof.
|
47
|
-
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
49
|
-
the original version of the Work and any modifications or additions
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
-
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
64
|
-
subsequently incorporated within the Work.
|
65
|
-
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
72
|
-
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
-
where such license applies only to those patent claims licensable
|
79
|
-
by such Contributor that are necessarily infringed by their
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
82
|
-
institute patent litigation against any entity (including a
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
85
|
-
or contributory patent infringement, then any patent licenses
|
86
|
-
granted to You under this License for that Work shall terminate
|
87
|
-
as of the date such litigation is filed.
|
88
|
-
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
91
|
-
modifications, and in Source or Object form, provided that You
|
92
|
-
meet the following conditions:
|
93
|
-
|
94
|
-
(a) You must give any other recipients of the Work or
|
95
|
-
Derivative Works a copy of this License; and
|
96
|
-
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
98
|
-
stating that You changed the files; and
|
99
|
-
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
102
|
-
attribution notices from the Source form of the Work,
|
103
|
-
excluding those notices that do not pertain to any part of
|
104
|
-
the Derivative Works; and
|
105
|
-
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
108
|
-
include a readable copy of the attribution notices contained
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
111
|
-
of the following places: within a NOTICE text file distributed
|
112
|
-
as part of the Derivative Works; within the Source form or
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
114
|
-
within a display generated by the Derivative Works, if and
|
115
|
-
wherever such third-party notices normally appear. The contents
|
116
|
-
of the NOTICE file are for informational purposes only and
|
117
|
-
do not modify the License. You may add Your own attribution
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
120
|
-
that such additional attribution notices cannot be construed
|
121
|
-
as modifying the License.
|
122
|
-
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
124
|
-
may provide additional or different license terms and conditions
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
128
|
-
the conditions stated in this License.
|
129
|
-
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
133
|
-
this License, without any additional terms or conditions.
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
-
the terms of any separate license agreement you may have executed
|
136
|
-
with Licensor regarding such Contributions.
|
137
|
-
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
140
|
-
except as required for reasonable and customary use in describing the
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
-
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
152
|
-
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
158
|
-
incidental, or consequential damages of any character arising as a
|
159
|
-
result of this License or out of the use or inability to use the
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
162
|
-
other commercial damages or losses), even if such Contributor
|
163
|
-
has been advised of the possibility of such damages.
|
164
|
-
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
-
or other liability obligations and/or rights consistent with this
|
169
|
-
License. However, in accepting such obligations, You may act only
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
174
|
-
of your accepting any such warranty or additional liability.
|
175
|
-
|
176
|
-
END OF TERMS AND CONDITIONS
|
177
|
-
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
179
|
-
|
180
|
-
To apply the Apache License to your work, attach the following
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
-
replaced with your own identifying information. (Don't include
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
184
|
-
comment syntax for the file format. We also recommend that a
|
185
|
-
file or class name and description of purpose be included on the
|
186
|
-
same "printed page" as the copyright notice for easier
|
187
|
-
identification within third-party archives.
|
188
|
-
|
189
|
-
Copyright 2014 Bazaarvoice
|
190
|
-
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
-
you may not use this file except in compliance with the License.
|
193
|
-
You may obtain a copy of the License at
|
194
|
-
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
-
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
-
See the License for the specific language governing permissions and
|
201
|
-
limitations under the License.
|