applb 0.1.3 → 0.1.4
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/README.md +3 -3
- data/applb.gemspec +2 -2
- data/lib/applb/client.rb +2 -2
- data/lib/applb/client_wrapper.rb +4 -1
- data/lib/applb/dsl/target_group.rb +22 -2
- data/lib/applb/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86fee79fad0f566fda95a3cf048d5a46c1a223b8
|
4
|
+
data.tar.gz: 67f3349fb1f006771309674e89ef7f0dd259a38d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18ffb205d52bc0566cc404ed5fae54a68193b479d4305588967a6ade7bf5370ccf11dea585b135c0ffeb2ef623821d6a0945cece2f0e94956cffc1990059138f
|
7
|
+
data.tar.gz: b8487809f7eadb685e143490516d4c336881b89705926b32b21d3c10ec3e78ab7505250badf270abc2a484aa049b53150f219d85d6e57f193a7a1353c27a872f
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Applb
|
2
2
|
|
3
|
-
[](https://travis-ci.org/codenize-tools/applb)
|
4
4
|
|
5
5
|
Applb is a tool to manage ELB v2(ALB).
|
6
6
|
It defines the state of ELB v2(ALB) using DSL, and updates ELB v2(ALB) according to DSL.
|
@@ -238,7 +238,7 @@ end
|
|
238
238
|
|
239
239
|
## Test
|
240
240
|
|
241
|
-
set your AWS arn for [spec/aws_config.yml.sample](https://github.com/
|
241
|
+
set your AWS arn for [spec/aws_config.yml.sample](https://github.com/codenize-tools/applb/blob/master/spec/aws_config.yml.sample) and rename to spec/aws_config.yml.
|
242
242
|
|
243
243
|
## Similar tools
|
244
244
|
|
@@ -246,7 +246,7 @@ set your AWS arn for [spec/aws_config.yml.sample](https://github.com/wata-gh/app
|
|
246
246
|
|
247
247
|
## Contributing
|
248
248
|
|
249
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
249
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/codenize-tools/applb.
|
250
250
|
|
251
251
|
|
252
252
|
## License
|
data/applb.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{Codenize ELB v2 (ALB)}
|
13
13
|
spec.description = %q{Manage ALB by DSL}
|
14
|
-
spec.homepage = '
|
14
|
+
spec.homepage = 'https://github.com/codenize-tools/applb'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.add_dependency 'aws-sdk', '
|
24
|
+
spec.add_dependency 'aws-sdk-elasticloadbalancingv2', '>= 1.6.0'
|
25
25
|
spec.add_dependency 'hashie'
|
26
26
|
spec.add_dependency 'diffy'
|
27
27
|
spec.add_dependency 'term-ansicolor'
|
data/lib/applb/client.rb
CHANGED
@@ -369,9 +369,9 @@ module Applb
|
|
369
369
|
when 'access_logs.s3.enabled' then
|
370
370
|
(result['access_logs'] ||= {s3: {}})[:s3][:enabled] = attr.value
|
371
371
|
when 'access_logs.s3.prefix' then
|
372
|
-
result['access_logs'] ||= {s3: {}}[:s3][:prefix] = attr.value
|
372
|
+
(result['access_logs'] ||= {s3: {}})[:s3][:prefix] = attr.value
|
373
373
|
when 'access_logs.s3.bucket' then
|
374
|
-
result['access_logs'] ||= {s3: {}}[:s3][:bucket] = attr.value
|
374
|
+
(result['access_logs'] ||= {s3: {}})[:s3][:bucket] = attr.value
|
375
375
|
else
|
376
376
|
result[attr.key] = attr.value
|
377
377
|
end
|
data/lib/applb/client_wrapper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'forwardable'
|
2
|
-
require 'aws-sdk'
|
2
|
+
require 'aws-sdk-elasticloadbalancingv2'
|
3
3
|
|
4
4
|
module Applb
|
5
5
|
class ClientWrapper
|
@@ -40,6 +40,7 @@ module Applb
|
|
40
40
|
begin
|
41
41
|
resp = @client.describe_target_groups(*argv)
|
42
42
|
results.push(*resp.target_groups)
|
43
|
+
next_marker = resp.next_marker
|
43
44
|
end while next_marker
|
44
45
|
results
|
45
46
|
end
|
@@ -50,6 +51,7 @@ module Applb
|
|
50
51
|
begin
|
51
52
|
resp = @client.describe_listeners(*argv)
|
52
53
|
results.push(*resp.listeners)
|
54
|
+
next_marker = resp.next_marker
|
53
55
|
end while next_marker
|
54
56
|
results
|
55
57
|
end
|
@@ -60,6 +62,7 @@ module Applb
|
|
60
62
|
begin
|
61
63
|
resp = @client.describe_rules(*argv)
|
62
64
|
results.push(*resp.rules)
|
65
|
+
next_marker = resp.next_marker
|
63
66
|
end while next_marker
|
64
67
|
results
|
65
68
|
end
|
@@ -11,7 +11,7 @@ module Applb
|
|
11
11
|
ATTRIBUTES = %i/
|
12
12
|
name protocol port vpc_id health_check_protocol health_check_port health_check_path
|
13
13
|
health_check_interval_seconds health_check_timeout_seconds healthy_threshold_count
|
14
|
-
unhealthy_threshold_count matcher
|
14
|
+
unhealthy_threshold_count matcher target_type
|
15
15
|
/
|
16
16
|
|
17
17
|
attr_accessor *ATTRIBUTES
|
@@ -43,6 +43,10 @@ module Applb
|
|
43
43
|
|
44
44
|
Applb.logger.info("Modify target group #{name}")
|
45
45
|
Applb.logger.info("<diff>\n#{Applb::Utils.diff(aws_hash, dsl_hash, color: @options[:color])}")
|
46
|
+
if unmodifiable_attributes_updated?(dsl_hash, aws_hash)
|
47
|
+
raise 'Can not modify unmodifiable attributes.'
|
48
|
+
end
|
49
|
+
|
46
50
|
return if @options[:dry_run]
|
47
51
|
|
48
52
|
client.modify_target_group(modify_option).target_groups.first
|
@@ -54,13 +58,24 @@ module Applb
|
|
54
58
|
to_h
|
55
59
|
end
|
56
60
|
|
57
|
-
UNMODIFIABLE_ATTRIBUTES = %i/name port protocol vpc_id/
|
61
|
+
UNMODIFIABLE_ATTRIBUTES = %i/name port protocol vpc_id target_type/
|
58
62
|
def modify_option
|
59
63
|
options = to_h.
|
60
64
|
merge(target_group_arn: @aws_tg.target_group_arn).
|
61
65
|
reject! { |k, v| UNMODIFIABLE_ATTRIBUTES.include?(k) }
|
62
66
|
end
|
63
67
|
|
68
|
+
def unmodifiable_attributes_updated?(dsl_hash, aws_hash)
|
69
|
+
updated = false
|
70
|
+
UNMODIFIABLE_ATTRIBUTES.each do |n|
|
71
|
+
if dsl_hash[n] != aws_hash[n]
|
72
|
+
updated = true
|
73
|
+
Applb.logger.error("can not modify target_group `#{n}'")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
updated
|
77
|
+
end
|
78
|
+
|
64
79
|
def to_diff_h
|
65
80
|
hash = to_h
|
66
81
|
hash.delete(:target_group_arn)
|
@@ -85,6 +100,7 @@ module Applb
|
|
85
100
|
@lb_name = lb_name
|
86
101
|
@result = Result.new(@context)
|
87
102
|
@result.name = name
|
103
|
+
@result.target_type = 'instance' # default value
|
88
104
|
|
89
105
|
instance_eval(&block)
|
90
106
|
end
|
@@ -147,6 +163,10 @@ module Applb
|
|
147
163
|
def matcher(http_code:)
|
148
164
|
@result.matcher = { http_code: http_code }
|
149
165
|
end
|
166
|
+
|
167
|
+
def target_type(target_type)
|
168
|
+
@result.target_type = target_type
|
169
|
+
end
|
150
170
|
end
|
151
171
|
end
|
152
172
|
end
|
data/lib/applb/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: applb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: aws-sdk
|
14
|
+
name: aws-sdk-elasticloadbalancingv2
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.6.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: hashie
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,7 +165,7 @@ files:
|
|
165
165
|
- lib/applb/template_helper.rb
|
166
166
|
- lib/applb/utils.rb
|
167
167
|
- lib/applb/version.rb
|
168
|
-
homepage:
|
168
|
+
homepage: https://github.com/codenize-tools/applb
|
169
169
|
licenses:
|
170
170
|
- MIT
|
171
171
|
metadata: {}
|
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
185
|
version: '0'
|
186
186
|
requirements: []
|
187
187
|
rubyforge_project:
|
188
|
-
rubygems_version: 2.
|
188
|
+
rubygems_version: 2.6.13
|
189
189
|
signing_key:
|
190
190
|
specification_version: 4
|
191
191
|
summary: Codenize ELB v2 (ALB)
|