upguard 0.0.14 → 0.0.16

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/upguard.rb +2 -0
  3. data/lib/upguard/Account.rb +33 -3
  4. data/lib/upguard/ChangeRequest.rb +13 -0
  5. data/lib/upguard/ChangeRequestList.rb +4 -3
  6. data/lib/upguard/ConnectionManager.rb +24 -0
  7. data/lib/upguard/ConnectionManagerGroup.rb +10 -0
  8. data/lib/upguard/ConnectionManagerGroupList.rb +4 -3
  9. data/lib/upguard/ConnectionManagerList.rb +4 -3
  10. data/lib/upguard/Environment.rb +14 -0
  11. data/lib/upguard/EnvironmentList.rb +4 -3
  12. data/lib/upguard/Event.rb +9 -0
  13. data/lib/upguard/EventAction.rb +10 -0
  14. data/lib/upguard/EventActionList.rb +4 -3
  15. data/lib/upguard/EventList.rb +4 -3
  16. data/lib/upguard/EventVariables.rb +3 -3
  17. data/lib/upguard/ExternalEvent.rb +6 -0
  18. data/lib/upguard/Incident.rb +10 -0
  19. data/lib/upguard/IncidentList.rb +4 -3
  20. data/lib/upguard/Job.rb +10 -0
  21. data/lib/upguard/JobList.rb +4 -3
  22. data/lib/upguard/Node.rb +23 -0
  23. data/lib/upguard/NodeGroup.rb +17 -0
  24. data/lib/upguard/NodeGroupList.rb +4 -3
  25. data/lib/upguard/NodeGroupUser.rb +6 -0
  26. data/lib/upguard/NodeGroupUserList.rb +4 -3
  27. data/lib/upguard/NodeList.rb +4 -3
  28. data/lib/upguard/NodeMediumInfo.rb +4 -4
  29. data/lib/upguard/OperatingSystem.rb +8 -0
  30. data/lib/upguard/OperatingSystemFamily.rb +6 -0
  31. data/lib/upguard/OperatingSystemFamilyList.rb +4 -3
  32. data/lib/upguard/OperatingSystemList.rb +4 -3
  33. data/lib/upguard/Pluggable.rb +81 -0
  34. data/lib/upguard/PluggableList.rb +53 -0
  35. data/lib/upguard/Policy.rb +8 -0
  36. data/lib/upguard/PolicyList.rb +4 -3
  37. data/lib/upguard/ScheduledJob.rb +10 -0
  38. data/lib/upguard/ScheduledJobList.rb +4 -3
  39. data/lib/upguard/SystemMetric.rb +7 -0
  40. data/lib/upguard/SystemMetricList.rb +4 -3
  41. data/lib/upguard/User.rb +13 -0
  42. data/lib/upguard/UserList.rb +4 -3
  43. data/lib/upguard/Version.rb +1 -1
  44. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02c8e4f7f0d117e6f9f7e396b7188c7f0a75221dd4ba8bea61633e3405e3e56a
4
- data.tar.gz: 610294a9da4ecbd52eacba9b92c0b6eed17e38a10d0531955e9dd435fed5b53c
3
+ metadata.gz: '06679ecfa282618bea5b8a05e75eff18d0bc5c34403dc2f2f2f3001e233beb6c'
4
+ data.tar.gz: b509b89d06ff8c41cc7d1369fcb1982e83543427e4c70aafd7ec162976647538
5
5
  SHA512:
6
- metadata.gz: 80857243f93931a9d59229f966a3c997a790c03a923112d3b26425106cae64832eb0778cbf3c70ffb24464f74f0f715ae31f22138744acf45add1877435d1aa7
7
- data.tar.gz: 6cdb09dffdeeb6c662442b676c14fe94b85648d9bf9df928689860a268f08171f94105585434792e62632e06eaf82467a05a373dbfcebddcad7efa5db96d08f9
6
+ metadata.gz: 7911df3507c5a8f3af2a5212cfd5cf5a37a6f26cbba6c8db6807df67d28ede93d13f88c44ac4c75b4160ddcc2e9541957f5aa8493316aebcafd872bb2bb0d289
7
+ data.tar.gz: dace744985449ded8d772b5bdc7879080dee8ee619194be293b69eec0c8466de29a40e5b7e9a569761cbf8e6fa4d3e46b73eb1533f400d9b660fbe0d512afb8b
@@ -32,6 +32,8 @@ require_relative 'upguard/OperatingSystem'
32
32
  require_relative 'upguard/OperatingSystemList'
33
33
  require_relative 'upguard/OperatingSystemFamily'
34
34
  require_relative 'upguard/OperatingSystemFamilyList'
35
+ require_relative 'upguard/Pluggable'
36
+ require_relative 'upguard/PluggableList'
35
37
  require_relative 'upguard/Policy'
36
38
  require_relative 'upguard/PolicyList'
37
39
  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')
@@ -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")
@@ -122,7 +131,7 @@ module UpGuard
122
131
  def events_with_view_name(view_name)
123
132
  url = "/api/v2/events.json?view_name=#{view_name}"
124
133
  obj = http_get(url)
125
- the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure
134
+ the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
126
135
  obj.each do |x|
127
136
  elem = Event.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
128
137
  elem.id = x["id"]
@@ -137,7 +146,7 @@ module UpGuard
137
146
  def events_with_query(query)
138
147
  url = "/api/v2/events.json?query=#{query}"
139
148
  obj = http_get(url)
140
- the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure
149
+ the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
141
150
  obj.each do |x|
142
151
  elem = Event.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
143
152
  elem.id = x["id"]
@@ -274,7 +283,7 @@ module UpGuard
274
283
  elem.operating_system_family_id = x["operating_system_family_id"] if x.include?("operating_system_family_id")
275
284
  elem.operating_system_id = x["operating_system_id"] if x.include?("operating_system_id")
276
285
  elem.short_description = x["short_description"] if x.include?("short_description")
277
- elem.medium_info.from_dict(x["medium_info"]) if x.include?("medium_info")
286
+ elem.medium_info.from_hash(x["medium_info"]) if x.include?("medium_info")
278
287
  the_list << elem
279
288
  end
280
289
  return the_list
@@ -394,6 +403,27 @@ module UpGuard
394
403
  return the_list
395
404
  end
396
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
+
397
427
  def new_policy
398
428
  return Policy.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
399
429
  end
@@ -9,6 +9,19 @@ module UpGuard
9
9
  attr_accessor :short_description
10
10
  attr_accessor :started_at
11
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
+
12
25
  def from_hash(h)
13
26
  self.data = h['data'] if h.include?('data')
14
27
  self.ended_at = h['ended_at'] if h.include?('ended_at')
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "ChangeRequest"
38
- raise "Can only append 'ChangeRequest' to 'ChangeRequestList'
37
+ if ["ChangeRequest", "UpGuard::ChangeRequest"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'ChangeRequest' to 'ChangeRequestList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -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")
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "ConnectionManagerGroup"
38
- raise "Can only append 'ConnectionManagerGroup' to 'ConnectionManagerGroupList'
37
+ if ["ConnectionManagerGroup", "UpGuard::ConnectionManagerGroup"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'ConnectionManagerGroup' to 'ConnectionManagerGroupList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "ConnectionManager"
38
- raise "Can only append 'ConnectionManager' to 'ConnectionManagerList'
37
+ if ["ConnectionManager", "UpGuard::ConnectionManager"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'ConnectionManager' to 'ConnectionManagerList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -10,6 +10,20 @@ module UpGuard
10
10
  attr_accessor :updated_at
11
11
  attr_accessor :created_at
12
12
  attr_accessor :weight
13
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
14
+ super(appliance_url, appliance_api_key, sec_key, insecure)
15
+ self.description = nil
16
+ self.id = nil
17
+ self.name = nil
18
+ self.node_rules = nil
19
+ self.short_description = nil
20
+ self.updated_by = nil
21
+ self.created_by = nil
22
+ self.updated_at = nil
23
+ self.created_at = nil
24
+ self.weight = nil
25
+ end
26
+
13
27
  def from_hash(h)
14
28
  self.description = h['description'] if h.include?('description')
15
29
  self.id = h['id'] if h.include?('id')
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "Environment"
38
- raise "Can only append 'Environment' to 'EnvironmentList'
37
+ if ["Environment", "UpGuard::Environment"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'Environment' to 'EnvironmentList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -5,6 +5,15 @@ module UpGuard
5
5
  attr_accessor :environment_id
6
6
  attr_accessor :created_at
7
7
  attr_accessor :variables
8
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
9
+ super(appliance_url, appliance_api_key, sec_key, insecure)
10
+ self.id = nil
11
+ self.type_id = nil
12
+ self.environment_id = nil
13
+ self.created_at = nil
14
+ self.variables = EventVariables.new(appliance_url, appliance_api_key, sec_key, insecure)
15
+ end
16
+
8
17
  def from_hash(h)
9
18
  self.id = h['id'] if h.include?('id')
10
19
  self.type_id = h['type_id'] if h.include?('type_id')
@@ -6,6 +6,16 @@ module UpGuard
6
6
  attr_accessor :type
7
7
  attr_accessor :variables
8
8
  attr_accessor :view
9
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
10
+ super(appliance_url, appliance_api_key, sec_key, insecure)
11
+ self.id = nil
12
+ self.name = nil
13
+ self.status = nil
14
+ self.type = nil
15
+ self.variables = nil
16
+ self.view = nil
17
+ end
18
+
9
19
  def from_hash(h)
10
20
  self.id = h['id'] if h.include?('id')
11
21
  self.name = h['name'] if h.include?('name')
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "EventAction"
38
- raise "Can only append 'EventAction' to 'EventActionList'
37
+ if ["EventAction", "UpGuard::EventAction"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'EventAction' to 'EventActionList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "Event"
38
- raise "Can only append 'Event' to 'EventList'
37
+ if ["Event", "UpGuard::Event"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'Event' to 'EventList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -27,14 +27,14 @@ module UpGuard
27
27
 
28
28
 
29
29
 
30
- def to_json
31
- return @inner_map.to_json
30
+ def to_json(options = nil)
31
+ return @inner_map.to_json(options)
32
32
  end
33
33
 
34
34
 
35
35
 
36
36
  def to_hash
37
- return self.inner_map
37
+ return @inner_map
38
38
  end
39
39
 
40
40
 
@@ -2,6 +2,12 @@ module UpGuard
2
2
  class ExternalEvent < BaseObject
3
3
  attr_accessor :type
4
4
  attr_accessor :variables
5
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
6
+ super(appliance_url, appliance_api_key, sec_key, insecure)
7
+ self.type = nil
8
+ self.variables = EventVariables.new(appliance_url, appliance_api_key, sec_key, insecure)
9
+ end
10
+
5
11
  def from_hash(h)
6
12
  self.type = h['type'] if h.include?('type')
7
13
  self.variables = h['variables'] if h.include?('variables')
@@ -6,6 +6,16 @@ module UpGuard
6
6
  attr_accessor :short_description
7
7
  attr_accessor :started_at
8
8
  attr_accessor :url
9
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
10
+ super(appliance_url, appliance_api_key, sec_key, insecure)
11
+ self.ended_at = nil
12
+ self.external_id = nil
13
+ self.id = nil
14
+ self.short_description = nil
15
+ self.started_at = nil
16
+ self.url = nil
17
+ end
18
+
9
19
  def from_hash(h)
10
20
  self.ended_at = h['ended_at'] if h.include?('ended_at')
11
21
  self.external_id = h['external_id'] if h.include?('external_id')
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "Incident"
38
- raise "Can only append 'Incident' to 'IncidentList'
37
+ if ["Incident", "UpGuard::Incident"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'Incident' to 'IncidentList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -6,6 +6,16 @@ module UpGuard
6
6
  attr_accessor :source_name
7
7
  attr_accessor :source_type
8
8
  attr_accessor :status
9
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
10
+ super(appliance_url, appliance_api_key, sec_key, insecure)
11
+ self.id = nil
12
+ self.organisation_id = nil
13
+ self.source_id = nil
14
+ self.source_name = nil
15
+ self.source_type = nil
16
+ self.status = nil
17
+ end
18
+
9
19
  def from_hash(h)
10
20
  self.id = h['id'] if h.include?('id')
11
21
  self.organisation_id = h['organisation_id'] if h.include?('organisation_id')
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "Job"
38
- raise "Can only append 'Job' to 'JobList'
37
+ if ["Job", "UpGuard::Job"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'Job' to 'JobList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -19,6 +19,29 @@ module UpGuard
19
19
  attr_accessor :operating_system_family_id
20
20
  attr_accessor :operating_system_id
21
21
  attr_accessor :short_description
22
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
23
+ super(appliance_url, appliance_api_key, sec_key, insecure)
24
+ self.connection_manager_group_id = nil
25
+ self.environment_id = nil
26
+ self.external_id = nil
27
+ self.id = nil
28
+ self.ip_address = nil
29
+ self.last_scan_status = nil
30
+ self.last_scan_status_string = nil
31
+ self.mac_address = nil
32
+ self.medium_hostname = nil
33
+ self.medium_info = NodeMediumInfo.new(appliance_url, appliance_api_key, sec_key, insecure)
34
+ self.medium_port = nil
35
+ self.medium_type = nil
36
+ self.medium_username = nil
37
+ self.name = nil
38
+ self.node_type = nil
39
+ self.online = nil
40
+ self.operating_system_family_id = nil
41
+ self.operating_system_id = nil
42
+ self.short_description = nil
43
+ end
44
+
22
45
  def from_hash(h)
23
46
  self.connection_manager_group_id = h['connection_manager_group_id'] if h.include?('connection_manager_group_id')
24
47
  self.environment_id = h['environment_id'] if h.include?('environment_id')
@@ -13,6 +13,23 @@ module UpGuard
13
13
  attr_accessor :status
14
14
  attr_accessor :updated_at
15
15
  attr_accessor :updated_by
16
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
17
+ super(appliance_url, appliance_api_key, sec_key, insecure)
18
+ self.created_at = nil
19
+ self.created_by = nil
20
+ self.description = nil
21
+ self.diff_notify = nil
22
+ self.external_id = nil
23
+ self.id = nil
24
+ self.name = nil
25
+ self.node_rules = nil
26
+ self.scan_options = nil
27
+ self.search_query = nil
28
+ self.status = nil
29
+ self.updated_at = nil
30
+ self.updated_by = nil
31
+ end
32
+
16
33
  def from_hash(h)
17
34
  self.created_at = h['created_at'] if h.include?('created_at')
18
35
  self.created_by = h['created_by'] if h.include?('created_by')
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "NodeGroup"
38
- raise "Can only append 'NodeGroup' to 'NodeGroupList'
37
+ if ["NodeGroup", "UpGuard::NodeGroup"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'NodeGroup' to 'NodeGroupList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -2,6 +2,12 @@ module UpGuard
2
2
  class NodeGroupUser < BaseObject
3
3
  attr_accessor :email
4
4
  attr_accessor :user_id
5
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
6
+ super(appliance_url, appliance_api_key, sec_key, insecure)
7
+ self.email = nil
8
+ self.user_id = nil
9
+ end
10
+
5
11
  def from_hash(h)
6
12
  self.email = h['email'] if h.include?('email')
7
13
  self.user_id = h['user_id'] if h.include?('user_id')
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "NodeGroupUser"
38
- raise "Can only append 'NodeGroupUser' to 'NodeGroupUserList'
37
+ if ["NodeGroupUser", "UpGuard::NodeGroupUser"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'NodeGroupUser' to 'NodeGroupUserList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "Node"
38
- raise "Can only append 'Node' to 'NodeList'
37
+ if ["Node", "UpGuard::Node"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'Node' to 'NodeList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -27,20 +27,20 @@ module UpGuard
27
27
 
28
28
 
29
29
 
30
- def to_json
31
- return @inner_map.to_json
30
+ def to_json(options = nil)
31
+ return @inner_map.to_json(options)
32
32
  end
33
33
 
34
34
 
35
35
 
36
36
  def to_hash
37
- return self.inner_map
37
+ return @inner_map
38
38
  end
39
39
 
40
40
 
41
41
 
42
42
  def from_hash(h)
43
- self.inner_map = h
43
+ @inner_map = h
44
44
  end
45
45
 
46
46
 
@@ -4,6 +4,14 @@ module UpGuard
4
4
  attr_accessor :id
5
5
  attr_accessor :name
6
6
  attr_accessor :operating_system_family_id
7
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
8
+ super(appliance_url, appliance_api_key, sec_key, insecure)
9
+ self.description = nil
10
+ self.id = nil
11
+ self.name = nil
12
+ self.operating_system_family_id = nil
13
+ end
14
+
7
15
  def from_hash(h)
8
16
  self.description = h['description'] if h.include?('description')
9
17
  self.id = h['id'] if h.include?('id')
@@ -2,6 +2,12 @@ module UpGuard
2
2
  class OperatingSystemFamily < 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')
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "OperatingSystemFamily"
38
- raise "Can only append 'OperatingSystemFamily' to 'OperatingSystemFamilyList'
37
+ if ["OperatingSystemFamily", "UpGuard::OperatingSystemFamily"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'OperatingSystemFamily' to 'OperatingSystemFamilyList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "OperatingSystem"
38
- raise "Can only append 'OperatingSystem' to 'OperatingSystemList'
37
+ if ["OperatingSystem", "UpGuard::OperatingSystem"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'OperatingSystem' to 'OperatingSystemList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -0,0 +1,81 @@
1
+ module UpGuard
2
+ class Pluggable < BaseObject
3
+ attr_accessor :description
4
+ attr_accessor :id
5
+ attr_accessor :name
6
+ attr_accessor :operating_system_family
7
+ attr_accessor :operating_system_family_id
8
+ attr_accessor :operating_system_id
9
+ attr_accessor :script
10
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
11
+ super(appliance_url, appliance_api_key, sec_key, insecure)
12
+ self.description = nil
13
+ self.id = nil
14
+ self.name = nil
15
+ self.operating_system_family = nil
16
+ self.operating_system_family_id = nil
17
+ self.operating_system_id = nil
18
+ self.script = nil
19
+ end
20
+
21
+ def from_hash(h)
22
+ self.description = h['description'] if h.include?('description')
23
+ self.id = h['id'] if h.include?('id')
24
+ self.name = h['name'] if h.include?('name')
25
+ self.operating_system_family = h['operating_system_family'] if h.include?('operating_system_family')
26
+ self.operating_system_family_id = h['operating_system_family_id'] if h.include?('operating_system_family_id')
27
+ self.operating_system_id = h['operating_system_id'] if h.include?('operating_system_id')
28
+ self.script = h['script'] if h.include?('script')
29
+ end
30
+ def to_hash
31
+ h = {}
32
+ h['description'] = self.description
33
+ h['id'] = self.id
34
+ h['name'] = self.name
35
+ h['operating_system_family'] = self.operating_system_family
36
+ h['operating_system_family_id'] = self.operating_system_family_id
37
+ h['operating_system_id'] = self.operating_system_id
38
+ h['script'] = self.script
39
+ return h
40
+ end
41
+ def to_json(options = nil)
42
+ h = to_hash
43
+ return h.to_json(options)
44
+ end
45
+
46
+ def load
47
+ obj = http_get("/api/v2/pluggables/#{self.operating_system_id}.json")
48
+ from_hash(obj)
49
+ end
50
+
51
+
52
+ def save
53
+ if self.id.to_i == 0
54
+ return create
55
+ else
56
+ return update
57
+ end
58
+ end
59
+
60
+
61
+ def create
62
+ h = to_hash
63
+ out = http_post("/api/v2/pluggables.json", h)
64
+ from_hash(out)
65
+ end
66
+
67
+
68
+ def update
69
+ h = to_hash
70
+ h.delete("operating_system_family_id")
71
+ h.delete("operating_system_id")
72
+ http_put("/api/v2/pluggables/#{self.operating_system_id}.json", h)
73
+ end
74
+
75
+ def delete
76
+ http_delete("/api/v2/pluggables/#{self.operating_system_id}.json")
77
+ end
78
+
79
+
80
+ end
81
+ end
@@ -0,0 +1,53 @@
1
+ module UpGuard
2
+ class PluggableList < 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 ["Pluggable", "UpGuard::Pluggable"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'Pluggable' to 'PluggableList'"
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
@@ -4,6 +4,14 @@ module UpGuard
4
4
  attr_accessor :name
5
5
  attr_accessor :short_description
6
6
  attr_accessor :description
7
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
8
+ super(appliance_url, appliance_api_key, sec_key, insecure)
9
+ self.id = nil
10
+ self.name = nil
11
+ self.short_description = nil
12
+ self.description = nil
13
+ end
14
+
7
15
  def from_hash(h)
8
16
  self.id = h['id'] if h.include?('id')
9
17
  self.name = h['name'] if h.include?('name')
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "Policy"
38
- raise "Can only append 'Policy' to 'PolicyList'
37
+ if ["Policy", "UpGuard::Policy"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'Policy' to 'PolicyList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -6,6 +6,16 @@ module UpGuard
6
6
  attr_accessor :source_name
7
7
  attr_accessor :source_type
8
8
  attr_accessor :status
9
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
10
+ super(appliance_url, appliance_api_key, sec_key, insecure)
11
+ self.data = nil
12
+ self.id = nil
13
+ self.source_id = nil
14
+ self.source_name = nil
15
+ self.source_type = nil
16
+ self.status = nil
17
+ end
18
+
9
19
  def from_hash(h)
10
20
  self.data = h['data'] if h.include?('data')
11
21
  self.id = h['id'] if h.include?('id')
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "ScheduledJob"
38
- raise "Can only append 'ScheduledJob' to 'ScheduledJobList'
37
+ if ["ScheduledJob", "UpGuard::ScheduledJob"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'ScheduledJob' to 'ScheduledJobList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -3,6 +3,13 @@ module UpGuard
3
3
  attr_accessor :metric
4
4
  attr_accessor :value
5
5
  attr_accessor :timestamp
6
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
7
+ super(appliance_url, appliance_api_key, sec_key, insecure)
8
+ self.metric = nil
9
+ self.value = nil
10
+ self.timestamp = nil
11
+ end
12
+
6
13
  def from_hash(h)
7
14
  self.metric = h['metric'] if h.include?('metric')
8
15
  self.value = h['value'] if h.include?('value')
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "SystemMetric"
38
- raise "Can only append 'SystemMetric' to 'SystemMetricList'
37
+ if ["SystemMetric", "UpGuard::SystemMetric"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'SystemMetric' to 'SystemMetricList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -9,6 +9,19 @@ module UpGuard
9
9
  attr_accessor :last_sign_in_at
10
10
  attr_accessor :expiry
11
11
  attr_accessor :external_id
12
+ def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
13
+ super(appliance_url, appliance_api_key, sec_key, insecure)
14
+ self.id = nil
15
+ self.name = nil
16
+ self.surname = nil
17
+ self.email = nil
18
+ self.role = nil
19
+ self.invited = nil
20
+ self.last_sign_in_at = nil
21
+ self.expiry = nil
22
+ self.external_id = nil
23
+ end
24
+
12
25
  def from_hash(h)
13
26
  self.id = h['id'] if h.include?('id')
14
27
  self.name = h['name'] if h.include?('name')
@@ -34,10 +34,11 @@ module UpGuard
34
34
 
35
35
 
36
36
  def <<(obj)
37
- if obj.class.name != "User"
38
- raise "Can only append 'User' to 'UserList'
37
+ if ["User", "UpGuard::User"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'User' to 'UserList'"
39
41
  end
40
- @inner_list << obj
41
42
  end
42
43
 
43
44
 
@@ -12,7 +12,7 @@ module UpGuard
12
12
  end
13
13
 
14
14
  def version
15
- return "0.0.14"
15
+ return "0.0.16"
16
16
  end
17
17
 
18
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upguard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - UpGuard Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-31 00:00:00.000000000 Z
11
+ date: 2020-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -79,6 +79,8 @@ files:
79
79
  - lib/upguard/OperatingSystemFamily.rb
80
80
  - lib/upguard/OperatingSystemFamilyList.rb
81
81
  - lib/upguard/OperatingSystemList.rb
82
+ - lib/upguard/Pluggable.rb
83
+ - lib/upguard/PluggableList.rb
82
84
  - lib/upguard/Policy.rb
83
85
  - lib/upguard/PolicyList.rb
84
86
  - lib/upguard/ScheduledJob.rb