upguard 0.0.9 → 0.0.18
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 +5 -2
- data/lib/upguard.rb +11 -0
- data/lib/upguard/Account.rb +87 -5
- data/lib/upguard/ChangeRequest.rb +55 -0
- data/lib/upguard/ChangeRequestList.rb +53 -0
- data/lib/upguard/ConnectionManager.rb +24 -0
- data/lib/upguard/ConnectionManagerGroup.rb +10 -0
- data/lib/upguard/ConnectionManagerGroupList.rb +11 -5
- data/lib/upguard/ConnectionManagerList.rb +11 -5
- data/lib/upguard/Environment.rb +14 -0
- data/lib/upguard/EnvironmentList.rb +11 -5
- data/lib/upguard/Event.rb +12 -0
- data/lib/upguard/EventAction.rb +10 -0
- data/lib/upguard/EventActionList.rb +11 -5
- data/lib/upguard/EventList.rb +53 -0
- data/lib/upguard/EventVariables.rb +43 -0
- data/lib/upguard/ExternalEvent.rb +36 -0
- data/lib/upguard/Incident.rb +10 -0
- data/lib/upguard/IncidentList.rb +11 -5
- data/lib/upguard/Job.rb +10 -0
- data/lib/upguard/JobList.rb +11 -5
- data/lib/upguard/MediumType.rb +3 -0
- data/lib/upguard/Node.rb +59 -1
- data/lib/upguard/NodeGroup.rb +17 -0
- data/lib/upguard/NodeGroupList.rb +22 -5
- data/lib/upguard/NodeGroupUser.rb +6 -0
- data/lib/upguard/NodeGroupUserList.rb +11 -5
- data/lib/upguard/NodeList.rb +11 -5
- data/lib/upguard/NodeMediumInfo.rb +49 -0
- data/lib/upguard/NodeScan.rb +78 -0
- data/lib/upguard/NodeScanList.rb +53 -0
- data/lib/upguard/NodeType.rb +10 -0
- data/lib/upguard/OperatingSystem.rb +8 -0
- data/lib/upguard/OperatingSystemFamily.rb +6 -0
- data/lib/upguard/OperatingSystemFamilyList.rb +11 -5
- data/lib/upguard/OperatingSystemList.rb +11 -5
- data/lib/upguard/Pluggable.rb +81 -0
- data/lib/upguard/PluggableList.rb +53 -0
- data/lib/upguard/Policy.rb +8 -0
- data/lib/upguard/PolicyList.rb +11 -5
- data/lib/upguard/ScheduledJob.rb +11 -1
- data/lib/upguard/ScheduledJobList.rb +11 -5
- data/lib/upguard/SystemMetric.rb +7 -0
- data/lib/upguard/SystemMetricList.rb +11 -5
- data/lib/upguard/User.rb +37 -0
- data/lib/upguard/UserList.rb +22 -5
- data/lib/upguard/Version.rb +21 -0
- metadata +19 -8
checksums.yaml
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b97f1c85f0c7f95e03b8aec8b7de1d41b79ee756818387bd15770973e4165d4c
|
4
|
+
data.tar.gz: 17b1c5d0678e3642b18368fa2284fead8098c4b81a618382954ddbd61d8eb1d1
|
2
5
|
SHA512:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48183b6ed9399e94ee6b0af1bae684ce9ac9f31730424efb398840fd4273fcdce7f8341aa2f3320247bb7c57e2841ec8de72d7e2cc184f7c70ed0b9d4b00fcb3
|
7
|
+
data.tar.gz: 3a6d486660819d1acc5eaa44c937e5c37896e2389deba3adb9f41825267baa42b0e0c45d1977565820f3225cca93966df75f0301649e899cf69e34f711cbb645
|
data/lib/upguard.rb
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
require_relative 'upguard/BaseObject'
|
2
|
+
require_relative 'upguard/Version'
|
2
3
|
require_relative 'upguard/Account'
|
4
|
+
require_relative 'upguard/ChangeRequest'
|
5
|
+
require_relative 'upguard/ChangeRequestList'
|
3
6
|
require_relative 'upguard/ConnectionManager'
|
4
7
|
require_relative 'upguard/ConnectionManagerList'
|
5
8
|
require_relative 'upguard/ConnectionManagerGroup'
|
6
9
|
require_relative 'upguard/ConnectionManagerGroupList'
|
7
10
|
require_relative 'upguard/Environment'
|
8
11
|
require_relative 'upguard/EnvironmentList'
|
12
|
+
require_relative 'upguard/ExternalEvent'
|
9
13
|
require_relative 'upguard/Event'
|
14
|
+
require_relative 'upguard/EventList'
|
15
|
+
require_relative 'upguard/EventVariables'
|
10
16
|
require_relative 'upguard/EventAction'
|
11
17
|
require_relative 'upguard/EventActionList'
|
12
18
|
require_relative 'upguard/Incident'
|
@@ -20,11 +26,16 @@ require_relative 'upguard/NodeGroup'
|
|
20
26
|
require_relative 'upguard/NodeGroupList'
|
21
27
|
require_relative 'upguard/NodeGroupUser'
|
22
28
|
require_relative 'upguard/NodeGroupUserList'
|
29
|
+
require_relative 'upguard/NodeMediumInfo'
|
30
|
+
require_relative 'upguard/NodeScan'
|
31
|
+
require_relative 'upguard/NodeScanList'
|
23
32
|
require_relative 'upguard/NodeType'
|
24
33
|
require_relative 'upguard/OperatingSystem'
|
25
34
|
require_relative 'upguard/OperatingSystemList'
|
26
35
|
require_relative 'upguard/OperatingSystemFamily'
|
27
36
|
require_relative 'upguard/OperatingSystemFamilyList'
|
37
|
+
require_relative 'upguard/Pluggable'
|
38
|
+
require_relative 'upguard/PluggableList'
|
28
39
|
require_relative 'upguard/Policy'
|
29
40
|
require_relative 'upguard/PolicyList'
|
30
41
|
require_relative 'upguard/ScheduledJob'
|
data/lib/upguard/Account.rb
CHANGED
@@ -2,6 +2,12 @@ module UpGuard
|
|
2
2
|
class Account < BaseObject
|
3
3
|
attr_accessor :id
|
4
4
|
attr_accessor :name
|
5
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
|
6
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
7
|
+
self.id = nil
|
8
|
+
self.name = nil
|
9
|
+
end
|
10
|
+
|
5
11
|
def from_hash(h)
|
6
12
|
self.id = h['id'] if h.include?('id')
|
7
13
|
self.name = h['name'] if h.include?('name')
|
@@ -58,11 +64,14 @@ module UpGuard
|
|
58
64
|
the_list = ConnectionManagerList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
59
65
|
obj.each do |x|
|
60
66
|
elem = ConnectionManager.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
67
|
+
elem.agent_version = x["agent_version"] if x.include?("agent_version")
|
68
|
+
elem.agent_type = x["agent_type"] if x.include?("agent_type")
|
61
69
|
elem.channels = x["channels"] if x.include?("channels")
|
62
70
|
elem.connection_manager_group_id = x["connection_manager_group_id"] if x.include?("connection_manager_group_id")
|
63
71
|
elem.created_at = x["created_at"] if x.include?("created_at")
|
64
72
|
elem.hostname = x["hostname"] if x.include?("hostname")
|
65
73
|
elem.id = x["id"] if x.include?("id")
|
74
|
+
elem.ip_address = x["ip_address"] if x.include?("ip_address")
|
66
75
|
elem.last_contact = x["last_contact"] if x.include?("last_contact")
|
67
76
|
elem.stats = x["stats"] if x.include?("stats")
|
68
77
|
elem.updated_at = x["updated_at"] if x.include?("updated_at")
|
@@ -79,7 +88,7 @@ module UpGuard
|
|
79
88
|
elem = ConnectionManagerGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
80
89
|
elem.id = x["id"] if x.include?("id")
|
81
90
|
elem.name = x["name"] if x.include?("name")
|
82
|
-
elem.
|
91
|
+
elem.api_key = x["api_key"] if x.include?("api_key")
|
83
92
|
elem.status = x["status"] if x.include?("status")
|
84
93
|
the_list << elem
|
85
94
|
end
|
@@ -99,6 +108,16 @@ module UpGuard
|
|
99
108
|
return elem
|
100
109
|
end
|
101
110
|
|
111
|
+
def environment_by_name(name)
|
112
|
+
url = "/api/v2/environments/lookup.json?name=#{name}"
|
113
|
+
obj = http_get(url)
|
114
|
+
id = obj["environment_id"]
|
115
|
+
elem = Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
116
|
+
elem.id = id
|
117
|
+
elem.load
|
118
|
+
return elem
|
119
|
+
end
|
120
|
+
|
102
121
|
|
103
122
|
def environments
|
104
123
|
obj = http_get("/api/v2/environments.json")
|
@@ -115,10 +134,14 @@ module UpGuard
|
|
115
134
|
return the_list
|
116
135
|
end
|
117
136
|
|
137
|
+
def new_external_event
|
138
|
+
return ExternalEvent.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
139
|
+
end
|
140
|
+
|
118
141
|
def events_with_view_name(view_name)
|
119
|
-
|
142
|
+
url = "/api/v2/events.json?view_name=#{view_name}"
|
120
143
|
obj = http_get(url)
|
121
|
-
the_list =
|
144
|
+
the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
122
145
|
obj.each do |x|
|
123
146
|
elem = Event.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
124
147
|
elem.id = x["id"]
|
@@ -131,9 +154,9 @@ module UpGuard
|
|
131
154
|
end
|
132
155
|
|
133
156
|
def events_with_query(query)
|
134
|
-
|
157
|
+
url = "/api/v2/events.json?query=#{query}"
|
135
158
|
obj = http_get(url)
|
136
|
-
the_list =
|
159
|
+
the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
137
160
|
obj.each do |x|
|
138
161
|
elem = Event.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
139
162
|
elem.id = x["id"]
|
@@ -252,18 +275,25 @@ module UpGuard
|
|
252
275
|
the_list = NodeList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
253
276
|
obj.each do |x|
|
254
277
|
elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
278
|
+
elem.connection_manager_group_id = x["connection_manager_group_id"] if x.include?("connection_manager_group_id")
|
255
279
|
elem.external_id = x["external_id"] if x.include?("external_id")
|
256
280
|
elem.environment_id = x["environment_id"] if x.include?("environment_id")
|
257
281
|
elem.id = x["id"] if x.include?("id")
|
282
|
+
elem.ip_address = x["ip_address"] if x.include?("ip_address")
|
258
283
|
elem.last_scan_status = x["last_scan_status"] if x.include?("last_scan_status")
|
259
284
|
elem.last_scan_status_string = x["last_scan_status_string"] if x.include?("last_scan_status_string")
|
260
285
|
elem.mac_address = x["mac_address"] if x.include?("mac_address")
|
286
|
+
elem.medium_hostname = x["medium_hostname"] if x.include?("medium_hostname")
|
287
|
+
elem.medium_port = x["medium_port"] if x.include?("medium_port")
|
288
|
+
elem.medium_type = x["medium_type"] if x.include?("medium_type")
|
289
|
+
elem.medium_username = x["medium_username"] if x.include?("medium_username")
|
261
290
|
elem.name = x["name"] if x.include?("name")
|
262
291
|
elem.node_type = x["node_type"] if x.include?("node_type")
|
263
292
|
elem.online = x["online"] if x.include?("online")
|
264
293
|
elem.operating_system_family_id = x["operating_system_family_id"] if x.include?("operating_system_family_id")
|
265
294
|
elem.operating_system_id = x["operating_system_id"] if x.include?("operating_system_id")
|
266
295
|
elem.short_description = x["short_description"] if x.include?("short_description")
|
296
|
+
elem.medium_info.from_hash(x["medium_info"]) if x.include?("medium_info")
|
267
297
|
the_list << elem
|
268
298
|
end
|
269
299
|
return the_list
|
@@ -327,6 +357,16 @@ module UpGuard
|
|
327
357
|
return elem
|
328
358
|
end
|
329
359
|
|
360
|
+
def node_group_by_name(name)
|
361
|
+
url = "/api/v2/node_groups/lookup.json?name=#{name}"
|
362
|
+
obj = http_get(url)
|
363
|
+
id = obj["node_group_id"]
|
364
|
+
elem = NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
365
|
+
elem.id = id
|
366
|
+
elem.load
|
367
|
+
return elem
|
368
|
+
end
|
369
|
+
|
330
370
|
|
331
371
|
def node_scan_by_id(id)
|
332
372
|
obj = http_get("/api/v2/node_scans/#{id}.json")
|
@@ -373,6 +413,27 @@ module UpGuard
|
|
373
413
|
return the_list
|
374
414
|
end
|
375
415
|
|
416
|
+
def new_pluggable
|
417
|
+
return Pluggable.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
418
|
+
end
|
419
|
+
|
420
|
+
|
421
|
+
def pluggables
|
422
|
+
obj = http_get("/api/v2/pluggables.json")
|
423
|
+
the_list = PluggableList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
424
|
+
obj.each do |x|
|
425
|
+
elem = Pluggable.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
426
|
+
elem.description = x["description"] if x.include?("description")
|
427
|
+
elem.id = x["id"] if x.include?("id")
|
428
|
+
elem.name = x["name"] if x.include?("name")
|
429
|
+
elem.operating_system_family = x["operating_system_family"] if x.include?("operating_system_family")
|
430
|
+
elem.operating_system_family_id = x["operating_system_family_id"] if x.include?("operating_system_family_id")
|
431
|
+
elem.script = x["script"] if x.include?("script")
|
432
|
+
the_list << elem
|
433
|
+
end
|
434
|
+
return the_list
|
435
|
+
end
|
436
|
+
|
376
437
|
def new_policy
|
377
438
|
return Policy.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
378
439
|
end
|
@@ -449,6 +510,27 @@ module UpGuard
|
|
449
510
|
elem.name = x["name"] if x.include?("name")
|
450
511
|
elem.role = x["role"] if x.include?("role")
|
451
512
|
elem.surname = x["surname"] if x.include?("surname")
|
513
|
+
elem.external_id = x["external_id"] if x.include?("external_id")
|
514
|
+
the_list << elem
|
515
|
+
end
|
516
|
+
return the_list
|
517
|
+
end
|
518
|
+
|
519
|
+
|
520
|
+
def users_and_invitees
|
521
|
+
obj = http_get("/api/v2/users.json?invited=true")
|
522
|
+
the_list = UserList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
523
|
+
obj.each do |x|
|
524
|
+
elem = User.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
525
|
+
elem.email = x["email"] if x.include?("email")
|
526
|
+
elem.expiry = x["expiry"] if x.include?("expiry")
|
527
|
+
elem.id = x["id"] if x.include?("id")
|
528
|
+
elem.invited = x["invited"] if x.include?("invited")
|
529
|
+
elem.last_sign_in_at = x["last_sign_in_at"] if x.include?("last_sign_in_at")
|
530
|
+
elem.name = x["name"] if x.include?("name")
|
531
|
+
elem.role = x["role"] if x.include?("role")
|
532
|
+
elem.surname = x["surname"] if x.include?("surname")
|
533
|
+
elem.external_id = x["external_id"] if x.include?("external_id")
|
452
534
|
the_list << elem
|
453
535
|
end
|
454
536
|
return the_list
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class ChangeRequest < BaseObject
|
3
|
+
attr_accessor :data
|
4
|
+
attr_accessor :ended_at
|
5
|
+
attr_accessor :external_id
|
6
|
+
attr_accessor :id
|
7
|
+
attr_accessor :planned_end_at
|
8
|
+
attr_accessor :planned_start_at
|
9
|
+
attr_accessor :short_description
|
10
|
+
attr_accessor :started_at
|
11
|
+
attr_accessor :url
|
12
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
|
13
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
14
|
+
self.data = nil
|
15
|
+
self.ended_at = nil
|
16
|
+
self.external_id = nil
|
17
|
+
self.id = nil
|
18
|
+
self.planned_end_at = nil
|
19
|
+
self.planned_start_at = nil
|
20
|
+
self.short_description = nil
|
21
|
+
self.started_at = nil
|
22
|
+
self.url = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def from_hash(h)
|
26
|
+
self.data = h['data'] if h.include?('data')
|
27
|
+
self.ended_at = h['ended_at'] if h.include?('ended_at')
|
28
|
+
self.external_id = h['external_id'] if h.include?('external_id')
|
29
|
+
self.id = h['id'] if h.include?('id')
|
30
|
+
self.planned_end_at = h['planned_end_at'] if h.include?('planned_end_at')
|
31
|
+
self.planned_start_at = h['planned_start_at'] if h.include?('planned_start_at')
|
32
|
+
self.short_description = h['short_description'] if h.include?('short_description')
|
33
|
+
self.started_at = h['started_at'] if h.include?('started_at')
|
34
|
+
self.url = h['url'] if h.include?('url')
|
35
|
+
end
|
36
|
+
def to_hash
|
37
|
+
h = {}
|
38
|
+
h['data'] = self.data
|
39
|
+
h['ended_at'] = self.ended_at
|
40
|
+
h['external_id'] = self.external_id
|
41
|
+
h['id'] = self.id
|
42
|
+
h['planned_end_at'] = self.planned_end_at
|
43
|
+
h['planned_start_at'] = self.planned_start_at
|
44
|
+
h['short_description'] = self.short_description
|
45
|
+
h['started_at'] = self.started_at
|
46
|
+
h['url'] = self.url
|
47
|
+
return h
|
48
|
+
end
|
49
|
+
def to_json(options = nil)
|
50
|
+
h = to_hash
|
51
|
+
return h.to_json(options)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module UpGuard
|
2
|
+
class ChangeRequestList < BaseObject
|
3
|
+
def from_hash(h)
|
4
|
+
end
|
5
|
+
def to_hash
|
6
|
+
h = {}
|
7
|
+
return h
|
8
|
+
end
|
9
|
+
def to_json(options = nil)
|
10
|
+
h = to_hash
|
11
|
+
return h.to_json(options)
|
12
|
+
end
|
13
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure)
|
14
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
15
|
+
@inner_list = []
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def [](idx)
|
20
|
+
return @inner_list[idx]
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def count
|
25
|
+
return @inner_list.count
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
def each(&block)
|
31
|
+
@inner_list.each(&block)
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
def <<(obj)
|
37
|
+
if ["ChangeRequest", "UpGuard::ChangeRequest"].include?(obj.class.name)
|
38
|
+
@inner_list << obj
|
39
|
+
else
|
40
|
+
raise "Can only append 'ChangeRequest' to 'ChangeRequestList'"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
def to_json
|
47
|
+
return @inner_list.to_json
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
@@ -1,18 +1,39 @@
|
|
1
1
|
module UpGuard
|
2
2
|
class ConnectionManager < BaseObject
|
3
|
+
attr_accessor :agent_version
|
4
|
+
attr_accessor :agent_type
|
3
5
|
attr_accessor :channels
|
4
6
|
attr_accessor :connection_manager_group_id
|
5
7
|
attr_accessor :created_at
|
6
8
|
attr_accessor :id
|
9
|
+
attr_accessor :ip_address
|
7
10
|
attr_accessor :hostname
|
8
11
|
attr_accessor :last_contact
|
9
12
|
attr_accessor :stats
|
10
13
|
attr_accessor :updated_at
|
14
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
|
15
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
16
|
+
self.agent_version = nil
|
17
|
+
self.agent_type = nil
|
18
|
+
self.channels = nil
|
19
|
+
self.connection_manager_group_id = nil
|
20
|
+
self.created_at = nil
|
21
|
+
self.id = nil
|
22
|
+
self.ip_address = nil
|
23
|
+
self.hostname = nil
|
24
|
+
self.last_contact = nil
|
25
|
+
self.stats = nil
|
26
|
+
self.updated_at = nil
|
27
|
+
end
|
28
|
+
|
11
29
|
def from_hash(h)
|
30
|
+
self.agent_version = h['agent_version'] if h.include?('agent_version')
|
31
|
+
self.agent_type = h['agent_type'] if h.include?('agent_type')
|
12
32
|
self.channels = h['channels'] if h.include?('channels')
|
13
33
|
self.connection_manager_group_id = h['connection_manager_group_id'] if h.include?('connection_manager_group_id')
|
14
34
|
self.created_at = h['created_at'] if h.include?('created_at')
|
15
35
|
self.id = h['id'] if h.include?('id')
|
36
|
+
self.ip_address = h['ip_address'] if h.include?('ip_address')
|
16
37
|
self.hostname = h['hostname'] if h.include?('hostname')
|
17
38
|
self.last_contact = h['last_contact'] if h.include?('last_contact')
|
18
39
|
self.stats = h['stats'] if h.include?('stats')
|
@@ -20,10 +41,13 @@ module UpGuard
|
|
20
41
|
end
|
21
42
|
def to_hash
|
22
43
|
h = {}
|
44
|
+
h['agent_version'] = self.agent_version
|
45
|
+
h['agent_type'] = self.agent_type
|
23
46
|
h['channels'] = self.channels
|
24
47
|
h['connection_manager_group_id'] = self.connection_manager_group_id
|
25
48
|
h['created_at'] = self.created_at
|
26
49
|
h['id'] = self.id
|
50
|
+
h['ip_address'] = self.ip_address
|
27
51
|
h['hostname'] = self.hostname
|
28
52
|
h['last_contact'] = self.last_contact
|
29
53
|
h['stats'] = self.stats
|
@@ -4,6 +4,14 @@ module UpGuard
|
|
4
4
|
attr_accessor :id
|
5
5
|
attr_accessor :name
|
6
6
|
attr_accessor :status
|
7
|
+
def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
|
8
|
+
super(appliance_url, appliance_api_key, sec_key, insecure)
|
9
|
+
self.api_key = nil
|
10
|
+
self.id = nil
|
11
|
+
self.name = nil
|
12
|
+
self.status = nil
|
13
|
+
end
|
14
|
+
|
7
15
|
def from_hash(h)
|
8
16
|
self.api_key = h['api_key'] if h.include?('api_key')
|
9
17
|
self.id = h['id'] if h.include?('id')
|
@@ -22,6 +30,8 @@ module UpGuard
|
|
22
30
|
h = to_hash
|
23
31
|
return h.to_json(options)
|
24
32
|
end
|
33
|
+
STATUS_DISABLED = 0
|
34
|
+
STATUS_ACTIVE = 1
|
25
35
|
|
26
36
|
def connection_managers
|
27
37
|
obj = http_get("/api/v2/connection_manager_groups/#{self.id}/connection_managers.json")
|
@@ -15,15 +15,17 @@ module UpGuard
|
|
15
15
|
@inner_list = []
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
return @inner_list.count
|
20
|
-
end
|
21
|
-
|
18
|
+
|
22
19
|
def [](idx)
|
23
20
|
return @inner_list[idx]
|
24
21
|
end
|
25
22
|
|
26
23
|
|
24
|
+
def count
|
25
|
+
return @inner_list.count
|
26
|
+
end
|
27
|
+
|
28
|
+
|
27
29
|
|
28
30
|
def each(&block)
|
29
31
|
@inner_list.each(&block)
|
@@ -32,7 +34,11 @@ module UpGuard
|
|
32
34
|
|
33
35
|
|
34
36
|
def <<(obj)
|
35
|
-
|
37
|
+
if ["ConnectionManagerGroup", "UpGuard::ConnectionManagerGroup"].include?(obj.class.name)
|
38
|
+
@inner_list << obj
|
39
|
+
else
|
40
|
+
raise "Can only append 'ConnectionManagerGroup' to 'ConnectionManagerGroupList'"
|
41
|
+
end
|
36
42
|
end
|
37
43
|
|
38
44
|
|
@@ -15,15 +15,17 @@ module UpGuard
|
|
15
15
|
@inner_list = []
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
return @inner_list.count
|
20
|
-
end
|
21
|
-
|
18
|
+
|
22
19
|
def [](idx)
|
23
20
|
return @inner_list[idx]
|
24
21
|
end
|
25
22
|
|
26
23
|
|
24
|
+
def count
|
25
|
+
return @inner_list.count
|
26
|
+
end
|
27
|
+
|
28
|
+
|
27
29
|
|
28
30
|
def each(&block)
|
29
31
|
@inner_list.each(&block)
|
@@ -32,7 +34,11 @@ module UpGuard
|
|
32
34
|
|
33
35
|
|
34
36
|
def <<(obj)
|
35
|
-
|
37
|
+
if ["ConnectionManager", "UpGuard::ConnectionManager"].include?(obj.class.name)
|
38
|
+
@inner_list << obj
|
39
|
+
else
|
40
|
+
raise "Can only append 'ConnectionManager' to 'ConnectionManagerList'"
|
41
|
+
end
|
36
42
|
end
|
37
43
|
|
38
44
|
|