radiosonde 0.0.3 → 0.0.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/lib/radiosonde/dsl/converter.rb +0 -19
- data/lib/radiosonde/exporter.rb +5 -5
- data/lib/radiosonde/version.rb +1 -1
- data/lib/radiosonde/wrapper/alarm.rb +6 -6
- data/lib/radiosonde/wrapper/alarm_collection.rb +5 -5
- data/lib/radiosonde/wrapper/cloud_watch.rb +4 -4
- 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: da5136a90c659fd5537d71399d04878d4acc60e7
|
4
|
+
data.tar.gz: 9fa694b83f15d1483f0f879607a8857dc99da51a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f74993879f16de832bfa07d768c0deb3380146002cbae0e52903c8be5402a8b72f0074648b18a2ea9eab5fd7235c5e71e5a7d2b521c38d39e617c270abbd86e
|
7
|
+
data.tar.gz: ba74b657ade215675465a3a0f1c34410adc1f2258c7fe502041058a36d4920094ba63d0a9a70cb6341c29119a702654c35cd8bee3a9225d5ee3763de6fb0e059
|
@@ -90,25 +90,6 @@ end
|
|
90
90
|
].join(', ')
|
91
91
|
end
|
92
92
|
|
93
|
-
def output_actions(attrs, opts = {})
|
94
|
-
prefix = opts[:prefix]
|
95
|
-
enabled = attrs[:actions_enabled].inspect
|
96
|
-
alarm_actions = attrs[:alarm_actions].inspect
|
97
|
-
ok_actions = attrs[:ok_actions].inspect
|
98
|
-
insufficient_data_actions = attrs[:insufficient_data_actions].inspect
|
99
|
-
|
100
|
-
[
|
101
|
-
'actions {',
|
102
|
-
" :enabled => #{enabled},",
|
103
|
-
" :alarm => #{alarm_actions},",
|
104
|
-
" :ok => #{ok_actions},",
|
105
|
-
" :insufficient => #{insufficient_data_actions},",
|
106
|
-
'}',
|
107
|
-
].join("\n#{prefix}")
|
108
|
-
end
|
109
|
-
|
110
|
-
private
|
111
|
-
|
112
93
|
def unbrace(str)
|
113
94
|
str.sub(/\A\s*\{/, '').sub(/\}\s*\z/, '')
|
114
95
|
end
|
data/lib/radiosonde/exporter.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
class Radiosonde::Exporter
|
2
2
|
class << self
|
3
|
-
def export(
|
4
|
-
self.new(
|
3
|
+
def export(cloud_watch, opts = {})
|
4
|
+
self.new(cloud_watch, opts).export
|
5
5
|
end
|
6
6
|
end # of class methods
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
@
|
8
|
+
def initialize(cloud_watch, options = {})
|
9
|
+
@cloud_watch = cloud_watch
|
10
10
|
@options = options
|
11
11
|
end
|
12
12
|
|
13
13
|
def export
|
14
14
|
result = {}
|
15
15
|
|
16
|
-
@
|
16
|
+
@cloud_watch.alarms.each do |alarm|
|
17
17
|
export_alarm(alarm, result)
|
18
18
|
end
|
19
19
|
|
data/lib/radiosonde/version.rb
CHANGED
@@ -44,8 +44,8 @@ class Radiosonde::Wrapper::Alarm
|
|
44
44
|
end
|
45
45
|
end # of class methods
|
46
46
|
|
47
|
-
def initialize(
|
48
|
-
@
|
47
|
+
def initialize(cloud_watch, alarm, options = {})
|
48
|
+
@cloud_watch = cloud_watch
|
49
49
|
@alarm = alarm
|
50
50
|
@options = options
|
51
51
|
end
|
@@ -56,12 +56,12 @@ class Radiosonde::Wrapper::Alarm
|
|
56
56
|
|
57
57
|
def update(dsl)
|
58
58
|
delta = diff(dsl)
|
59
|
-
log(:info, 'Update Alarm', :green, "#{self.alarm_name}
|
59
|
+
log(:info, 'Update Alarm', :green, "#{self.alarm_name}: #{format_delta(delta)}")
|
60
60
|
|
61
61
|
unless @options[:dry_run]
|
62
62
|
opts = self.class.normalize_attrs(dsl)
|
63
63
|
@alarm.update(opts)
|
64
|
-
@
|
64
|
+
@cloud_watch.modify!
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -70,7 +70,7 @@ class Radiosonde::Wrapper::Alarm
|
|
70
70
|
|
71
71
|
unless @options[:dry_run]
|
72
72
|
@alarm.delete
|
73
|
-
@
|
73
|
+
@cloud_watch.modify!
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -93,7 +93,7 @@ class Radiosonde::Wrapper::Alarm
|
|
93
93
|
|
94
94
|
def format_delta(delta)
|
95
95
|
delta.map {|name, values|
|
96
|
-
"#{name}(#{values[:old]}=>#{values[:new]})"
|
96
|
+
"#{name}(#{values[:old].inspect}=>#{values[:new].inspect})"
|
97
97
|
}.join(', ')
|
98
98
|
end
|
99
99
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
class Radiosonde::Wrapper::AlarmCollection
|
2
2
|
include Radiosonde::Logger::Helper
|
3
3
|
|
4
|
-
def initialize(
|
5
|
-
@
|
4
|
+
def initialize(cloud_watch, alarms, options = {})
|
5
|
+
@cloud_watch = cloud_watch
|
6
6
|
@alarms = alarms
|
7
7
|
@options = options
|
8
8
|
end
|
9
9
|
|
10
10
|
def each
|
11
11
|
@alarms.each do |alarm|
|
12
|
-
yield(Radiosonde::Wrapper::Alarm.new(@
|
12
|
+
yield(Radiosonde::Wrapper::Alarm.new(@cloud_watch, alarm, @options))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -21,9 +21,9 @@ class Radiosonde::Wrapper::AlarmCollection
|
|
21
21
|
alarm = OpenStruct.new(opts.merge(:alarm_name => name))
|
22
22
|
else
|
23
23
|
alarm = @alarms.create(name, opts)
|
24
|
-
@
|
24
|
+
@cloud_watch.modify!
|
25
25
|
end
|
26
26
|
|
27
|
-
Radiosonde::Wrapper::Alarm.new(@
|
27
|
+
Radiosonde::Wrapper::Alarm.new(@cloud_watch, alarm, @options)
|
28
28
|
end
|
29
29
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
class Radiosonde::Wrapper::CloudWatch
|
2
|
-
def initialize(
|
3
|
-
@
|
2
|
+
def initialize(cloud_watch, options = {})
|
3
|
+
@cloud_watch = cloud_watch
|
4
4
|
@options = options
|
5
5
|
end
|
6
6
|
|
7
7
|
def alarms
|
8
|
-
Radiosonde::Wrapper::AlarmCollection.new(@
|
8
|
+
Radiosonde::Wrapper::AlarmCollection.new(@cloud_watch, @cloud_watch.alarms, @options)
|
9
9
|
end
|
10
10
|
|
11
11
|
def modified?
|
12
|
-
@
|
12
|
+
@cloud_watch.modified?
|
13
13
|
end
|
14
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiosonde
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|