upguard 0.0.6 → 0.0.17

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.
Files changed (49) hide show
  1. checksums.yaml +5 -5
  2. data/lib/upguard.rb +13 -0
  3. data/lib/upguard/Account.rb +192 -49
  4. data/lib/upguard/BaseObject.rb +8 -7
  5. data/lib/upguard/ChangeRequest.rb +55 -0
  6. data/lib/upguard/ChangeRequestList.rb +53 -0
  7. data/lib/upguard/ConnectionManager.rb +25 -1
  8. data/lib/upguard/ConnectionManagerGroup.rb +16 -6
  9. data/lib/upguard/ConnectionManagerGroupList.rb +17 -3
  10. data/lib/upguard/ConnectionManagerList.rb +17 -3
  11. data/lib/upguard/Environment.rb +16 -2
  12. data/lib/upguard/EnvironmentList.rb +17 -3
  13. data/lib/upguard/Event.rb +13 -1
  14. data/lib/upguard/EventAction.rb +10 -0
  15. data/lib/upguard/EventActionList.rb +17 -3
  16. data/lib/upguard/EventList.rb +53 -0
  17. data/lib/upguard/EventVariables.rb +43 -0
  18. data/lib/upguard/ExternalEvent.rb +36 -0
  19. data/lib/upguard/Incident.rb +10 -0
  20. data/lib/upguard/IncidentList.rb +17 -3
  21. data/lib/upguard/Job.rb +37 -0
  22. data/lib/upguard/JobList.rb +17 -3
  23. data/lib/upguard/MediumType.rb +3 -0
  24. data/lib/upguard/Node.rb +93 -5
  25. data/lib/upguard/NodeGroup.rb +82 -2
  26. data/lib/upguard/NodeGroupList.rb +28 -3
  27. data/lib/upguard/NodeGroupUser.rb +27 -0
  28. data/lib/upguard/NodeGroupUserList.rb +64 -0
  29. data/lib/upguard/NodeList.rb +17 -3
  30. data/lib/upguard/NodeMediumInfo.rb +49 -0
  31. data/lib/upguard/NodeScan.rb +78 -0
  32. data/lib/upguard/NodeScanList.rb +53 -0
  33. data/lib/upguard/NodeType.rb +10 -0
  34. data/lib/upguard/OperatingSystem.rb +9 -1
  35. data/lib/upguard/OperatingSystemFamily.rb +8 -2
  36. data/lib/upguard/OperatingSystemFamilyList.rb +17 -3
  37. data/lib/upguard/OperatingSystemList.rb +17 -3
  38. data/lib/upguard/Pluggable.rb +81 -0
  39. data/lib/upguard/PluggableList.rb +53 -0
  40. data/lib/upguard/Policy.rb +34 -0
  41. data/lib/upguard/PolicyList.rb +17 -3
  42. data/lib/upguard/ScheduledJob.rb +11 -1
  43. data/lib/upguard/ScheduledJobList.rb +17 -3
  44. data/lib/upguard/SystemMetric.rb +7 -0
  45. data/lib/upguard/SystemMetricList.rb +17 -3
  46. data/lib/upguard/User.rb +37 -0
  47. data/lib/upguard/UserList.rb +39 -3
  48. data/lib/upguard/Version.rb +21 -0
  49. metadata +21 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a48de6f627011308b5e15643cf59434dc4a5165a
4
- data.tar.gz: fe28ac17cb16733dfa0770a32b828f00080ba490
2
+ SHA256:
3
+ metadata.gz: 1130831c374a901bdfae30e7ca82ef2b5911753192f464bf80adeb3bfbfb12e1
4
+ data.tar.gz: d7c726622dddf3b5a262db3a361557857f0d25354494194c8ea0224a3234b067
5
5
  SHA512:
6
- metadata.gz: 7539d483e269ef662af049a551144768d28dfbc2fa3a3a1c59ae3ae28ec38a6af0c9cec9a3134fb7267fab45d667a046b1ae9aa36e54b0f19f09298e589f31f0
7
- data.tar.gz: fd669c2bc3a8897092cfc8aef5c913f1af4976c1756739eb12d47e7e8a594e523b2d1f27daf75b498e647f3e5162dfe476ef314d59f6910b9edcad64dc907539
6
+ metadata.gz: 53166ffbfa4ea2f490da92e0a6d21ae876214e507c3d5dfad7f8de1bff6a66466cc67460366bfe47cb1f65c5fc235692fe281ffd57f6a86cb74a683149f2bdc4
7
+ data.tar.gz: 8ac4b765ddd3f27ebdebb142755da298b09b62a58749f1bb4786ccd8b1fa20425934a8eafaf45573310c890207deac439fd76faef7187cd98534efc0b9169326
@@ -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'
@@ -18,11 +24,18 @@ require_relative 'upguard/Node'
18
24
  require_relative 'upguard/NodeList'
19
25
  require_relative 'upguard/NodeGroup'
20
26
  require_relative 'upguard/NodeGroupList'
27
+ require_relative 'upguard/NodeGroupUser'
28
+ require_relative 'upguard/NodeGroupUserList'
29
+ require_relative 'upguard/NodeMediumInfo'
30
+ require_relative 'upguard/NodeScan'
31
+ require_relative 'upguard/NodeScanList'
21
32
  require_relative 'upguard/NodeType'
22
33
  require_relative 'upguard/OperatingSystem'
23
34
  require_relative 'upguard/OperatingSystemList'
24
35
  require_relative 'upguard/OperatingSystemFamily'
25
36
  require_relative 'upguard/OperatingSystemFamilyList'
37
+ require_relative 'upguard/Pluggable'
38
+ require_relative 'upguard/PluggableList'
26
39
  require_relative 'upguard/Policy'
27
40
  require_relative 'upguard/PolicyList'
28
41
  require_relative 'upguard/ScheduledJob'
@@ -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')
@@ -19,7 +25,7 @@ module UpGuard
19
25
 
20
26
  def change_request_by_id(id)
21
27
  obj = http_get("/api/v2/change_requests/#{id}.json")
22
- elem = ChangeRequest.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
28
+ elem = ChangeRequest.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
23
29
  elem.external_id = obj["external_id"]
24
30
  elem.id = obj["id"]
25
31
  elem.planned_end_date = obj["planned_end_date"]
@@ -33,9 +39,9 @@ module UpGuard
33
39
 
34
40
  def change_requests
35
41
  obj = http_get("/api/v2/change_requests.json")
36
- the_list = ChangeRequestList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
42
+ the_list = ChangeRequestList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
37
43
  obj.each do |x|
38
- elem = ChangeRequest.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
44
+ elem = ChangeRequest.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
39
45
  elem.external_id = x["external_id"] if x.include?("external_id")
40
46
  elem.id = x["id"] if x.include?("id")
41
47
  elem.planned_end_date = x["planned_end_date"] if x.include?("planned_end_date")
@@ -48,17 +54,24 @@ module UpGuard
48
54
  return the_list
49
55
  end
50
56
 
57
+ def new_connection_manager_group
58
+ return ConnectionManagerGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
59
+ end
60
+
51
61
 
52
62
  def connection_managers
53
63
  obj = http_get("/api/v2/connection_managers.json")
54
- the_list = ConnectionManagerList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
64
+ the_list = ConnectionManagerList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
55
65
  obj.each do |x|
56
- elem = ConnectionManager.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
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")
57
69
  elem.channels = x["channels"] if x.include?("channels")
58
70
  elem.connection_manager_group_id = x["connection_manager_group_id"] if x.include?("connection_manager_group_id")
59
71
  elem.created_at = x["created_at"] if x.include?("created_at")
60
72
  elem.hostname = x["hostname"] if x.include?("hostname")
61
73
  elem.id = x["id"] if x.include?("id")
74
+ elem.ip_address = x["ip_address"] if x.include?("ip_address")
62
75
  elem.last_contact = x["last_contact"] if x.include?("last_contact")
63
76
  elem.stats = x["stats"] if x.include?("stats")
64
77
  elem.updated_at = x["updated_at"] if x.include?("updated_at")
@@ -70,12 +83,12 @@ module UpGuard
70
83
 
71
84
  def connection_manager_groups
72
85
  obj = http_get("/api/v2/connection_manager_groups.json")
73
- the_list = ConnectionManagerGroupList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
86
+ the_list = ConnectionManagerGroupList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
74
87
  obj.each do |x|
75
- elem = ConnectionManagerGroup.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
88
+ elem = ConnectionManagerGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
76
89
  elem.id = x["id"] if x.include?("id")
77
90
  elem.name = x["name"] if x.include?("name")
78
- elem.organisation_id = x["organisation_id"] if x.include?("organisation_id")
91
+ elem.api_key = x["api_key"] if x.include?("api_key")
79
92
  elem.status = x["status"] if x.include?("status")
80
93
  the_list << elem
81
94
  end
@@ -83,13 +96,13 @@ module UpGuard
83
96
  end
84
97
 
85
98
  def new_environment
86
- return Environment.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
99
+ return Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
87
100
  end
88
101
 
89
102
 
90
103
  def environment_by_id(id)
91
104
  obj = http_get("/api/v2/environments/#{id}.json")
92
- elem = Environment.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
105
+ elem = Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
93
106
  elem.id = obj["id"]
94
107
  elem.name = obj["name"]
95
108
  return elem
@@ -98,9 +111,9 @@ module UpGuard
98
111
 
99
112
  def environments
100
113
  obj = http_get("/api/v2/environments.json")
101
- the_list = EnvironmentList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
114
+ the_list = EnvironmentList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
102
115
  obj.each do |x|
103
- elem = Environment.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
116
+ elem = Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
104
117
  elem.description = x["description"] if x.include?("description")
105
118
  elem.id = x["id"] if x.include?("id")
106
119
  elem.name = x["name"] if x.include?("name")
@@ -111,12 +124,16 @@ module UpGuard
111
124
  return the_list
112
125
  end
113
126
 
127
+ def new_external_event
128
+ return ExternalEvent.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
129
+ end
130
+
114
131
  def events_with_view_name(view_name)
115
- url = "/api/v2/events.json?view_name=#{view_name}"
132
+ url = "/api/v2/events.json?view_name=#{view_name}"
116
133
  obj = http_get(url)
117
- the_list = []
134
+ the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
118
135
  obj.each do |x|
119
- elem = Event.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
136
+ elem = Event.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
120
137
  elem.id = x["id"]
121
138
  elem.type_id = x["type_id"]
122
139
  elem.environment_id = x["environment_id"]
@@ -127,11 +144,11 @@ module UpGuard
127
144
  end
128
145
 
129
146
  def events_with_query(query)
130
- url = "/api/v2/events.json?query=#{query}"
147
+ url = "/api/v2/events.json?query=#{query}"
131
148
  obj = http_get(url)
132
- the_list = []
149
+ the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
133
150
  obj.each do |x|
134
- elem = Event.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
151
+ elem = Event.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
135
152
  elem.id = x["id"]
136
153
  elem.type_id = x["type_id"]
137
154
  elem.environment_id = x["environment_id"]
@@ -144,7 +161,7 @@ module UpGuard
144
161
 
145
162
  def event_action_by_id(id)
146
163
  obj = http_get("/api/v2/event_actions/#{id}.json")
147
- elem = EventAction.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
164
+ elem = EventAction.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
148
165
  elem.id = obj["id"]
149
166
  elem.name = obj["name"]
150
167
  return elem
@@ -153,9 +170,9 @@ module UpGuard
153
170
 
154
171
  def event_types
155
172
  obj = http_get("/api/v2/events/types.json")
156
- the_list = EventTypeList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
173
+ the_list = EventTypeList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
157
174
  obj.each do |x|
158
- elem = EventType.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
175
+ elem = EventType.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
159
176
  elem.id = x["id"] if x.include?("id")
160
177
  elem.name = x["name"] if x.include?("name")
161
178
  the_list << elem
@@ -166,9 +183,9 @@ module UpGuard
166
183
 
167
184
  def event_actions
168
185
  obj = http_get("/api/v2/event_actions.json")
169
- the_list = EventActionList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
186
+ the_list = EventActionList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
170
187
  obj.each do |x|
171
- elem = EventAction.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
188
+ elem = EventAction.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
172
189
  elem.id = x["id"] if x.include?("id")
173
190
  elem.name = x["name"] if x.include?("name")
174
191
  elem.status = x["status"] if x.include?("status")
@@ -183,9 +200,9 @@ module UpGuard
183
200
 
184
201
  def incidents
185
202
  obj = http_get("/api/v2/incidents.json")
186
- the_list = IncidentList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
203
+ the_list = IncidentList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
187
204
  obj.each do |x|
188
- elem = Incident.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
205
+ elem = Incident.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
189
206
  elem.id = x["id"] if x.include?("id")
190
207
  elem.external_id = x["external_id"] if x.include?("external_id")
191
208
  elem.short_description = x["short_description"] if x.include?("short_description")
@@ -198,13 +215,25 @@ module UpGuard
198
215
  end
199
216
 
200
217
 
218
+ def incident_by_id(id)
219
+ obj = http_get("/api/v2/incidents/#{id}.json")
220
+ elem = Incident.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
221
+ elem.id = obj["id"]
222
+ elem.external_id = obj["external_id"]
223
+ elem.short_description = obj["short_description"]
224
+ elem.started_at = obj["started_at"]
225
+ elem.ended_at = obj["ended_at"]
226
+ elem.url = obj["url"]
227
+ return elem
228
+ end
229
+
230
+
201
231
  def jobs
202
232
  obj = http_get("/api/v2/jobs.json")
203
- the_list = JobList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
233
+ the_list = JobList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
204
234
  obj.each do |x|
205
- elem = Job.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
235
+ elem = Job.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
206
236
  elem.id = x["id"] if x.include?("id")
207
- elem.organisation_id = x["organisation_id"] if x.include?("organisation_id")
208
237
  elem.source_id = x["source_id"] if x.include?("source_id")
209
238
  elem.source_name = x["source_name"] if x.include?("source_name")
210
239
  elem.source_type = x["source_type"] if x.include?("source_type")
@@ -214,28 +243,47 @@ module UpGuard
214
243
  return the_list
215
244
  end
216
245
 
246
+
247
+ def job_by_id(id)
248
+ obj = http_get("/api/v2/jobs/#{id}.json")
249
+ elem = Job.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
250
+ elem.id = obj["id"]
251
+ elem.source_id = obj["source_id"]
252
+ elem.source_name = obj["source_name"]
253
+ elem.source_type = obj["source_type"]
254
+ elem.status = obj["status"]
255
+ return elem
256
+ end
257
+
217
258
  def new_node
218
- return Node.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
259
+ return Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
219
260
  end
220
261
 
221
262
 
222
263
  def nodes
223
264
  obj = http_get("/api/v2/nodes.json")
224
- the_list = NodeList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
265
+ the_list = NodeList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
225
266
  obj.each do |x|
226
- elem = Node.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
267
+ elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
268
+ elem.connection_manager_group_id = x["connection_manager_group_id"] if x.include?("connection_manager_group_id")
227
269
  elem.external_id = x["external_id"] if x.include?("external_id")
228
270
  elem.environment_id = x["environment_id"] if x.include?("environment_id")
229
271
  elem.id = x["id"] if x.include?("id")
272
+ elem.ip_address = x["ip_address"] if x.include?("ip_address")
230
273
  elem.last_scan_status = x["last_scan_status"] if x.include?("last_scan_status")
231
274
  elem.last_scan_status_string = x["last_scan_status_string"] if x.include?("last_scan_status_string")
232
275
  elem.mac_address = x["mac_address"] if x.include?("mac_address")
276
+ elem.medium_hostname = x["medium_hostname"] if x.include?("medium_hostname")
277
+ elem.medium_port = x["medium_port"] if x.include?("medium_port")
278
+ elem.medium_type = x["medium_type"] if x.include?("medium_type")
279
+ elem.medium_username = x["medium_username"] if x.include?("medium_username")
233
280
  elem.name = x["name"] if x.include?("name")
234
281
  elem.node_type = x["node_type"] if x.include?("node_type")
235
282
  elem.online = x["online"] if x.include?("online")
236
283
  elem.operating_system_family_id = x["operating_system_family_id"] if x.include?("operating_system_family_id")
237
284
  elem.operating_system_id = x["operating_system_id"] if x.include?("operating_system_id")
238
285
  elem.short_description = x["short_description"] if x.include?("short_description")
286
+ elem.medium_info.from_hash(x["medium_info"]) if x.include?("medium_info")
239
287
  the_list << elem
240
288
  end
241
289
  return the_list
@@ -245,7 +293,7 @@ module UpGuard
245
293
  url = "/api/v2/nodes/lookup.json?external_id=#{external_id}"
246
294
  obj = http_get(url)
247
295
  id = obj["node_id"]
248
- elem = Node.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
296
+ elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
249
297
  elem.id = id
250
298
  elem.load
251
299
  return elem
@@ -255,7 +303,7 @@ module UpGuard
255
303
  url = "/api/v2/nodes/lookup.json?name=#{name}"
256
304
  obj = http_get(url)
257
305
  id = obj["node_id"]
258
- elem = Node.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
306
+ elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
259
307
  elem.id = id
260
308
  elem.load
261
309
  return elem
@@ -264,18 +312,22 @@ module UpGuard
264
312
 
265
313
  def node_by_id(id)
266
314
  obj = http_get("/api/v2/nodes/#{id}.json")
267
- elem = Node.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
315
+ elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
268
316
  elem.id = obj["id"]
269
317
  elem.name = obj["name"]
270
318
  return elem
271
319
  end
272
320
 
321
+ def new_node_group
322
+ return NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
323
+ end
324
+
273
325
 
274
326
  def node_groups
275
327
  obj = http_get("/api/v2/node_groups.json")
276
- the_list = NodeGroupList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
328
+ the_list = NodeGroupList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
277
329
  obj.each do |x|
278
- elem = NodeGroup.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
330
+ elem = NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
279
331
  elem.description = x["description"] if x.include?("description")
280
332
  elem.id = x["id"] if x.include?("id")
281
333
  elem.name = x["name"] if x.include?("name")
@@ -287,11 +339,48 @@ module UpGuard
287
339
  end
288
340
 
289
341
 
342
+ def node_group_by_id(id)
343
+ obj = http_get("/api/v2/node_groups/#{id}.json")
344
+ elem = NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
345
+ elem.id = obj["id"]
346
+ elem.name = obj["name"]
347
+ return elem
348
+ end
349
+
350
+ def node_group_by_name(name)
351
+ url = "/api/v2/node_groups/lookup.json?name=#{name}"
352
+ obj = http_get(url)
353
+ id = obj["node_group_id"]
354
+ elem = NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
355
+ elem.id = id
356
+ elem.load
357
+ return elem
358
+ end
359
+
360
+
361
+ def node_scan_by_id(id)
362
+ obj = http_get("/api/v2/node_scans/#{id}.json")
363
+ elem = NodeScan.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
364
+ elem.id = obj["id"]
365
+ elem.node_id = obj["node_id"]
366
+ elem.data = obj["data"]
367
+ elem.scan_options = obj["scan_options"]
368
+ elem.created_at = obj["created_at"]
369
+ elem.updated_at = obj["updated_at"]
370
+ elem.task_id = obj["task_id"]
371
+ elem.associated_id = obj["associated_id"]
372
+ elem.category = obj["category"]
373
+ elem.label = obj["label"]
374
+ elem.tsv = obj["tsv"]
375
+ return elem
376
+ end
377
+
378
+
290
379
  def operating_system_families
291
380
  obj = http_get("/api/v2/operating_system_families.json")
292
- the_list = OperatingSystemFamilyList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
381
+ the_list = OperatingSystemFamilyList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
293
382
  obj.each do |x|
294
- elem = OperatingSystemFamily.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
383
+ elem = OperatingSystemFamily.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
295
384
  elem.id = x["id"] if x.include?("id")
296
385
  elem.name = x["name"] if x.include?("name")
297
386
  the_list << elem
@@ -302,9 +391,9 @@ module UpGuard
302
391
 
303
392
  def operating_systems
304
393
  obj = http_get("/api/v2/operating_systems.json")
305
- the_list = OperatingSystemList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
394
+ the_list = OperatingSystemList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
306
395
  obj.each do |x|
307
- elem = OperatingSystem.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
396
+ elem = OperatingSystem.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
308
397
  elem.id = x["id"] if x.include?("id")
309
398
  elem.name = x["name"] if x.include?("name")
310
399
  elem.operating_system_family_id = x["operating_system_family_id"] if x.include?("operating_system_family_id")
@@ -314,14 +403,41 @@ module UpGuard
314
403
  return the_list
315
404
  end
316
405
 
406
+ def new_pluggable
407
+ return Pluggable.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
408
+ end
409
+
410
+
411
+ def pluggables
412
+ obj = http_get("/api/v2/pluggables.json")
413
+ the_list = PluggableList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
414
+ obj.each do |x|
415
+ elem = Pluggable.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
416
+ elem.description = x["description"] if x.include?("description")
417
+ elem.id = x["id"] if x.include?("id")
418
+ elem.name = x["name"] if x.include?("name")
419
+ elem.operating_system_family = x["operating_system_family"] if x.include?("operating_system_family")
420
+ elem.operating_system_family_id = x["operating_system_family_id"] if x.include?("operating_system_family_id")
421
+ elem.script = x["script"] if x.include?("script")
422
+ the_list << elem
423
+ end
424
+ return the_list
425
+ end
426
+
427
+ def new_policy
428
+ return Policy.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
429
+ end
430
+
317
431
 
318
432
  def policies
319
433
  obj = http_get("/api/v2/policies.json")
320
- the_list = PolicyList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
434
+ the_list = PolicyList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
321
435
  obj.each do |x|
322
- elem = Policy.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
436
+ elem = Policy.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
437
+ elem.description = x["description"] if x.include?("description")
323
438
  elem.id = x["id"] if x.include?("id")
324
439
  elem.name = x["name"] if x.include?("name")
440
+ elem.short_description = x["short_description"] if x.include?("short_description")
325
441
  the_list << elem
326
442
  end
327
443
  return the_list
@@ -330,9 +446,9 @@ module UpGuard
330
446
 
331
447
  def scheduled_jobs
332
448
  obj = http_get("/api/v2/scheduled_jobs.json")
333
- the_list = ScheduledJobList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
449
+ the_list = ScheduledJobList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
334
450
  obj.each do |x|
335
- elem = ScheduledJob.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
451
+ elem = ScheduledJob.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
336
452
  elem.data = x["data"] if x.include?("data")
337
453
  elem.id = x["id"] if x.include?("id")
338
454
  elem.source_id = x["source_id"] if x.include?("source_id")
@@ -347,9 +463,9 @@ module UpGuard
347
463
 
348
464
  def system_metrics
349
465
  obj = http_get("/api/v2/system_metrics.json")
350
- the_list = SystemMetricList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
466
+ the_list = SystemMetricList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
351
467
  obj.each do |x|
352
- elem = SystemMetric.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
468
+ elem = SystemMetric.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
353
469
  elem.metric = x["metric"] if x.include?("metric")
354
470
  elem.value = x["value"] if x.include?("value")
355
471
  elem.timestamp = x["timestamp"] if x.include?("timestamp")
@@ -361,7 +477,7 @@ module UpGuard
361
477
 
362
478
  def text_file_by_id(id)
363
479
  obj = http_get("/api/v2/text_files/#{id}.json")
364
- elem = TextFile.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
480
+ elem = TextFile.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
365
481
  elem.category = obj["category"]
366
482
  elem.checksum = obj["checksum"]
367
483
  elem.created_at = obj["created_at"]
@@ -375,15 +491,36 @@ module UpGuard
375
491
 
376
492
  def users
377
493
  obj = http_get("/api/v2/users.json")
378
- the_list = UserList.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
494
+ the_list = UserList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
379
495
  obj.each do |x|
380
- elem = User.new(self.appliance_url, self.api_key, self.sec_key, self.insecure)
496
+ elem = User.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
381
497
  elem.email = x["email"] if x.include?("email")
382
498
  elem.id = x["id"] if x.include?("id")
383
499
  elem.last_sign_in_at = x["last_sign_in_at"] if x.include?("last_sign_in_at")
384
500
  elem.name = x["name"] if x.include?("name")
385
501
  elem.role = x["role"] if x.include?("role")
386
502
  elem.surname = x["surname"] if x.include?("surname")
503
+ elem.external_id = x["external_id"] if x.include?("external_id")
504
+ the_list << elem
505
+ end
506
+ return the_list
507
+ end
508
+
509
+
510
+ def users_and_invitees
511
+ obj = http_get("/api/v2/users.json?invited=true")
512
+ the_list = UserList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
513
+ obj.each do |x|
514
+ elem = User.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
515
+ elem.email = x["email"] if x.include?("email")
516
+ elem.expiry = x["expiry"] if x.include?("expiry")
517
+ elem.id = x["id"] if x.include?("id")
518
+ elem.invited = x["invited"] if x.include?("invited")
519
+ elem.last_sign_in_at = x["last_sign_in_at"] if x.include?("last_sign_in_at")
520
+ elem.name = x["name"] if x.include?("name")
521
+ elem.role = x["role"] if x.include?("role")
522
+ elem.surname = x["surname"] if x.include?("surname")
523
+ elem.external_id = x["external_id"] if x.include?("external_id")
387
524
  the_list << elem
388
525
  end
389
526
  return the_list
@@ -395,6 +532,12 @@ module UpGuard
395
532
  return obj
396
533
  end
397
534
 
535
+ def remove_user(email)
536
+ url = "/api/v2/users/remove.json?email=#{email}"
537
+ obj = http_put(url, nil)
538
+ return obj
539
+ end
540
+
398
541
 
399
542
  end
400
543
  end