MovableInkAWS 0.3.2 → 0.3.3
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/movable_ink/aws/ec2.rb +29 -34
- data/lib/movable_ink/aws/route53.rb +21 -0
- data/lib/movable_ink/aws.rb +1 -0
- data/lib/movable_ink/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71c6b935514942f31b17b7c3bad0c8e0a856eb3586b977c20a6721ddd6623b8a
|
4
|
+
data.tar.gz: 63144d8ef0655a3df7a5f5768624f2500964a213529de972b286b16d63cc901e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 430fd3b181252e7c3bc538afd4a621ae8a0ec39e98b2329d03266ccbd06d787f91f2065ba9a68ce09b6b45e79cb8f275fec29e367f056d9296e7d0d1dd345ba9
|
7
|
+
data.tar.gz: 28e155f91856f6bc291aa253cc2c35aa259cf941c7290dda27fd917f8139bc0adbf4e45aa452057ebc817e4ae743a5a1ba10770b1496e6807e92d92655176b55
|
data/lib/movable_ink/aws/ec2.rb
CHANGED
@@ -28,29 +28,23 @@ module MovableInk
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
32
|
-
|
31
|
+
def thopter_filter
|
32
|
+
[{
|
33
|
+
name: 'tag:mi:roles',
|
34
|
+
values: ['*thopter*']
|
35
|
+
},
|
36
|
+
{
|
37
|
+
name: 'tag:mi:env',
|
38
|
+
values: [mi_env]
|
39
|
+
},
|
40
|
+
{
|
41
|
+
name: 'instance-state-name',
|
42
|
+
values: ['running']
|
43
|
+
}]
|
33
44
|
end
|
34
45
|
|
35
|
-
def
|
36
|
-
|
37
|
-
ec2(region: 'us-east-1').describe_instances(filters: [
|
38
|
-
{
|
39
|
-
name: 'tag:mi:roles',
|
40
|
-
values: ['*thopter*']
|
41
|
-
},
|
42
|
-
{
|
43
|
-
name: 'tag:mi:env',
|
44
|
-
values: [mi_env]
|
45
|
-
},
|
46
|
-
{
|
47
|
-
name: 'instance-state-name',
|
48
|
-
values: ['running']
|
49
|
-
}
|
50
|
-
])
|
51
|
-
.reservations
|
52
|
-
.flat_map(&:instances)
|
53
|
-
end
|
46
|
+
def thopter_instance
|
47
|
+
@thopter_instance ||= load_all_instances('us-east-1', filter: thopter_filter)
|
54
48
|
end
|
55
49
|
|
56
50
|
def all_instances(region: my_region, no_filter: false)
|
@@ -58,19 +52,20 @@ module MovableInk
|
|
58
52
|
@all_instances[region] ||= load_all_instances(region, no_filter: no_filter)
|
59
53
|
end
|
60
54
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
55
|
+
def default_filter
|
56
|
+
[{
|
57
|
+
name: 'instance-state-name',
|
58
|
+
values: ['running']
|
59
|
+
},
|
60
|
+
{
|
61
|
+
name: 'tag:mi:env',
|
62
|
+
values: [mi_env]
|
63
|
+
}]
|
64
|
+
end
|
65
|
+
|
66
|
+
def load_all_instances(region, no_filter: false, filter: nil)
|
67
|
+
filters = no_filter ? nil : (filter || default_filter)
|
68
|
+
|
74
69
|
run_with_backoff do
|
75
70
|
ec2(region: region).describe_instances(filters: filters).flat_map do |resp|
|
76
71
|
resp.reservations.flat_map(&:instances)
|
@@ -34,6 +34,27 @@ module MovableInk
|
|
34
34
|
}).flat_map(&:resource_record_sets)
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
def list_health_checks
|
39
|
+
run_with_backoff do
|
40
|
+
route53.list_health_checks().flat_map(&:health_checks)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def get_health_check_tags(health_check_id)
|
45
|
+
run_with_backoff do
|
46
|
+
route53.list_tags_for_resource({
|
47
|
+
resource_type: 'healthcheck',
|
48
|
+
resource_id: health_check_id
|
49
|
+
}).resource_tag_set.tags
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def find_health_check_by_tag(key, value)
|
54
|
+
list_health_checks.detect do |health_check|
|
55
|
+
get_health_check_tags(health_check.id).detect { |tag| tag.key == key && tag.value.include?(value) }
|
56
|
+
end
|
57
|
+
end
|
37
58
|
end
|
38
59
|
end
|
39
60
|
end
|
data/lib/movable_ink/aws.rb
CHANGED
@@ -50,6 +50,7 @@ module MovableInk
|
|
50
50
|
Aws::SNS::Errors::ThrottledException,
|
51
51
|
Aws::AutoScaling::Errors::ThrottledException,
|
52
52
|
Aws::S3::Errors::SlowDown,
|
53
|
+
Aws::Route53::Errors::Throttling,
|
53
54
|
Aws::Route53::Errors::ThrottlingException,
|
54
55
|
Aws::Route53::Errors::PriorRequestNotComplete,
|
55
56
|
Aws::SSM::Errors::TooManyUpdates,
|
data/lib/movable_ink/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: MovableInkAWS
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Chesler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|