rackspace-monitoring 0.1.1 → 0.1.2
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.
- data/VERSION +1 -1
- data/lib/rackspace-monitoring.rb +4 -2
- data/lib/rackspace-monitoring/monitoring/models/base.rb +1 -1
- data/lib/rackspace-monitoring/monitoring/models/entity.rb +20 -1
- data/lib/rackspace-monitoring/monitoring/requests/create_entity.rb +1 -4
- data/lib/rackspace-monitoring/monitoring/requests/delete_entity.rb +17 -0
- data/lib/rackspace-monitoring/monitoring/requests/update_entity.rb +3 -7
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/rackspace-monitoring.rb
CHANGED
@@ -26,11 +26,13 @@ module Fog
|
|
26
26
|
request :list_alarms
|
27
27
|
request :list_overview
|
28
28
|
request :get_entity
|
29
|
-
request :create_entity
|
30
29
|
request :get_check
|
31
|
-
request :create_check
|
32
30
|
request :get_alarm
|
31
|
+
request :create_entity
|
32
|
+
request :create_check
|
33
33
|
request :create_alarm
|
34
|
+
request :update_entity
|
35
|
+
request :delete_entity
|
34
36
|
|
35
37
|
|
36
38
|
class Mock
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
|
11
11
|
def hash
|
12
12
|
attrs = attributes.dup
|
13
|
-
attrs.delete_if {|key, value| [:created_at, :updated_at].include?(key)}
|
13
|
+
attrs.delete_if {|key, value| [:created_at, :updated_at, :id].include?(key)}
|
14
14
|
attrs.delete_if {|key, value| value.kind_of?(Base) }
|
15
15
|
keys = attrs.keys.map{|sym| sym.to_s}.sort.join ''
|
16
16
|
values = attrs.values.map{|sym| sym.to_s}.sort.join ''
|
@@ -12,8 +12,10 @@ module Fog
|
|
12
12
|
attribute :metadata
|
13
13
|
attribute :ip_addresses
|
14
14
|
attribute :agent_id
|
15
|
+
attribute :managed, :default => false
|
16
|
+
attribute :uri
|
15
17
|
|
16
|
-
def
|
18
|
+
def prep
|
17
19
|
options = {
|
18
20
|
'label' => label,
|
19
21
|
'metadata' => metadata,
|
@@ -21,6 +23,11 @@ module Fog
|
|
21
23
|
'agent_id' => agent_id
|
22
24
|
}
|
23
25
|
options = options.reject {|key, value| value.nil?}
|
26
|
+
options
|
27
|
+
end
|
28
|
+
|
29
|
+
def save
|
30
|
+
options = prep
|
24
31
|
if identity then
|
25
32
|
data = connection.update_entity(identity, options)
|
26
33
|
else
|
@@ -46,6 +53,18 @@ module Fog
|
|
46
53
|
)
|
47
54
|
end
|
48
55
|
end
|
56
|
+
|
57
|
+
def destroy
|
58
|
+
requires :id
|
59
|
+
connection.delete_entity(id)
|
60
|
+
end
|
61
|
+
|
62
|
+
def compare?(b)
|
63
|
+
a_o = prep
|
64
|
+
b_o = b.prep
|
65
|
+
remain = a_o.reject {|key, value| b_o[key] === value}
|
66
|
+
remain.empty?
|
67
|
+
end
|
49
68
|
end
|
50
69
|
end
|
51
70
|
end
|
@@ -4,10 +4,7 @@ module Fog
|
|
4
4
|
class Real
|
5
5
|
|
6
6
|
def create_entity(options = {})
|
7
|
-
data =
|
8
|
-
data['label'] = options['label']
|
9
|
-
data['metadata'] = options['metadata']
|
10
|
-
data['ip_addresses'] = options['ip_addresses']
|
7
|
+
data = options.dup
|
11
8
|
request(
|
12
9
|
:body => MultiJson.encode(data),
|
13
10
|
:expects => [201],
|
@@ -3,14 +3,10 @@ module Fog
|
|
3
3
|
class Rackspace
|
4
4
|
class Real
|
5
5
|
|
6
|
-
def update_entity(entity_id, options
|
7
|
-
data = {}
|
8
|
-
data['label'] = options['label']
|
9
|
-
data['metadata'] = options['metadata']
|
10
|
-
data['ip_addresses'] = options['ip_addresses']
|
6
|
+
def update_entity(entity_id, options)
|
11
7
|
request(
|
12
|
-
:body => MultiJson.encode(
|
13
|
-
:expects => [
|
8
|
+
:body => MultiJson.encode(options),
|
9
|
+
:expects => [204],
|
14
10
|
:method => 'PUT',
|
15
11
|
:path => "entities/#{entity_id}"
|
16
12
|
)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rackspace-monitoring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/rackspace-monitoring/monitoring/requests/create_alarm.rb
|
117
117
|
- lib/rackspace-monitoring/monitoring/requests/create_check.rb
|
118
118
|
- lib/rackspace-monitoring/monitoring/requests/create_entity.rb
|
119
|
+
- lib/rackspace-monitoring/monitoring/requests/delete_entity.rb
|
119
120
|
- lib/rackspace-monitoring/monitoring/requests/get_alarm.rb
|
120
121
|
- lib/rackspace-monitoring/monitoring/requests/get_check.rb
|
121
122
|
- lib/rackspace-monitoring/monitoring/requests/get_entity.rb
|
@@ -141,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
142
|
version: '0'
|
142
143
|
segments:
|
143
144
|
- 0
|
144
|
-
hash:
|
145
|
+
hash: 1039074049877710307
|
145
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
147
|
none: false
|
147
148
|
requirements:
|