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.
Files changed (48) hide show
  1. checksums.yaml +5 -2
  2. data/lib/upguard.rb +11 -0
  3. data/lib/upguard/Account.rb +87 -5
  4. data/lib/upguard/ChangeRequest.rb +55 -0
  5. data/lib/upguard/ChangeRequestList.rb +53 -0
  6. data/lib/upguard/ConnectionManager.rb +24 -0
  7. data/lib/upguard/ConnectionManagerGroup.rb +10 -0
  8. data/lib/upguard/ConnectionManagerGroupList.rb +11 -5
  9. data/lib/upguard/ConnectionManagerList.rb +11 -5
  10. data/lib/upguard/Environment.rb +14 -0
  11. data/lib/upguard/EnvironmentList.rb +11 -5
  12. data/lib/upguard/Event.rb +12 -0
  13. data/lib/upguard/EventAction.rb +10 -0
  14. data/lib/upguard/EventActionList.rb +11 -5
  15. data/lib/upguard/EventList.rb +53 -0
  16. data/lib/upguard/EventVariables.rb +43 -0
  17. data/lib/upguard/ExternalEvent.rb +36 -0
  18. data/lib/upguard/Incident.rb +10 -0
  19. data/lib/upguard/IncidentList.rb +11 -5
  20. data/lib/upguard/Job.rb +10 -0
  21. data/lib/upguard/JobList.rb +11 -5
  22. data/lib/upguard/MediumType.rb +3 -0
  23. data/lib/upguard/Node.rb +59 -1
  24. data/lib/upguard/NodeGroup.rb +17 -0
  25. data/lib/upguard/NodeGroupList.rb +22 -5
  26. data/lib/upguard/NodeGroupUser.rb +6 -0
  27. data/lib/upguard/NodeGroupUserList.rb +11 -5
  28. data/lib/upguard/NodeList.rb +11 -5
  29. data/lib/upguard/NodeMediumInfo.rb +49 -0
  30. data/lib/upguard/NodeScan.rb +78 -0
  31. data/lib/upguard/NodeScanList.rb +53 -0
  32. data/lib/upguard/NodeType.rb +10 -0
  33. data/lib/upguard/OperatingSystem.rb +8 -0
  34. data/lib/upguard/OperatingSystemFamily.rb +6 -0
  35. data/lib/upguard/OperatingSystemFamilyList.rb +11 -5
  36. data/lib/upguard/OperatingSystemList.rb +11 -5
  37. data/lib/upguard/Pluggable.rb +81 -0
  38. data/lib/upguard/PluggableList.rb +53 -0
  39. data/lib/upguard/Policy.rb +8 -0
  40. data/lib/upguard/PolicyList.rb +11 -5
  41. data/lib/upguard/ScheduledJob.rb +11 -1
  42. data/lib/upguard/ScheduledJobList.rb +11 -5
  43. data/lib/upguard/SystemMetric.rb +7 -0
  44. data/lib/upguard/SystemMetricList.rb +11 -5
  45. data/lib/upguard/User.rb +37 -0
  46. data/lib/upguard/UserList.rb +22 -5
  47. data/lib/upguard/Version.rb +21 -0
  48. metadata +19 -8
@@ -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')
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
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
- @inner_list << obj
37
+ if ["NodeGroup", "UpGuard::NodeGroup"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'NodeGroup' to 'NodeGroupList'"
41
+ end
36
42
  end
37
43
 
38
44
 
@@ -42,6 +48,17 @@ module UpGuard
42
48
  end
43
49
 
44
50
 
51
+
52
+ def find_by_id(id)
53
+ @inner_list.each do |x|
54
+ if x.id.to_s == id.to_s
55
+ return x
56
+ end
57
+ end
58
+ return nil
59
+ end
60
+
61
+
45
62
 
46
63
  end
47
64
  end
@@ -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')
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
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
- @inner_list << obj
37
+ if ["NodeGroupUser", "UpGuard::NodeGroupUser"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'NodeGroupUser' to 'NodeGroupUserList'"
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
- def count
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
- @inner_list << obj
37
+ if ["Node", "UpGuard::Node"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'Node' to 'NodeList'"
41
+ end
36
42
  end
37
43
 
38
44
 
@@ -0,0 +1,49 @@
1
+ module UpGuard
2
+ class NodeMediumInfo < 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_map = {}
16
+ end
17
+
18
+
19
+ def [](key)
20
+ return @inner_map[key]
21
+ end
22
+
23
+
24
+ def []=(key, value)
25
+ @inner_map[key] = value
26
+ end
27
+
28
+
29
+
30
+ def to_json(options = nil)
31
+ return @inner_map.to_json(options)
32
+ end
33
+
34
+
35
+
36
+ def to_hash
37
+ return @inner_map
38
+ end
39
+
40
+
41
+
42
+ def from_hash(h)
43
+ @inner_map = h
44
+ end
45
+
46
+
47
+
48
+ end
49
+ end
@@ -0,0 +1,78 @@
1
+ module UpGuard
2
+ class NodeScan < BaseObject
3
+ attr_accessor :associated_id
4
+ attr_accessor :category
5
+ attr_accessor :created_at
6
+ attr_accessor :data
7
+ attr_accessor :id
8
+ attr_accessor :label
9
+ attr_accessor :node_id
10
+ attr_accessor :scan_options
11
+ attr_accessor :task_id
12
+ attr_accessor :tsv
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.associated_id = nil
17
+ self.category = nil
18
+ self.created_at = nil
19
+ self.data = nil
20
+ self.id = nil
21
+ self.label = nil
22
+ self.node_id = nil
23
+ self.scan_options = nil
24
+ self.task_id = nil
25
+ self.tsv = nil
26
+ self.updated_at = nil
27
+ end
28
+
29
+ def from_hash(h)
30
+ self.associated_id = h['associated_id'] if h.include?('associated_id')
31
+ self.category = h['category'] if h.include?('category')
32
+ self.created_at = h['created_at'] if h.include?('created_at')
33
+ self.data = h['data'] if h.include?('data')
34
+ self.id = h['id'] if h.include?('id')
35
+ self.label = h['label'] if h.include?('label')
36
+ self.node_id = h['node_id'] if h.include?('node_id')
37
+ self.scan_options = h['scan_options'] if h.include?('scan_options')
38
+ self.task_id = h['task_id'] if h.include?('task_id')
39
+ self.tsv = h['tsv'] if h.include?('tsv')
40
+ self.updated_at = h['updated_at'] if h.include?('updated_at')
41
+ end
42
+ def to_hash
43
+ h = {}
44
+ h['associated_id'] = self.associated_id
45
+ h['category'] = self.category
46
+ h['created_at'] = self.created_at
47
+ h['data'] = self.data
48
+ h['id'] = self.id
49
+ h['label'] = self.label
50
+ h['node_id'] = self.node_id
51
+ h['scan_options'] = self.scan_options
52
+ h['task_id'] = self.task_id
53
+ h['tsv'] = self.tsv
54
+ h['updated_at'] = self.updated_at
55
+ return h
56
+ end
57
+ def to_json(options = nil)
58
+ h = to_hash
59
+ return h.to_json(options)
60
+ end
61
+
62
+ def load
63
+ obj = http_get("/api/v2/node_scans/#{self.id}.json")
64
+ from_hash(obj)
65
+ end
66
+
67
+
68
+ def node
69
+ obj = http_get("/api/v2/nodes/{node_id}.json")
70
+ elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
71
+ elem.id = obj["id"]
72
+ elem.name = obj["name"]
73
+ return elem
74
+ end
75
+
76
+
77
+ end
78
+ end
@@ -0,0 +1,53 @@
1
+ module UpGuard
2
+ class NodeScanList < 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 ["NodeScan", "UpGuard::NodeScan"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'NodeScan' to 'NodeScanList'"
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
@@ -10,7 +10,17 @@ module UpGuard
10
10
  h = to_hash
11
11
  return h.to_json(options)
12
12
  end
13
+ SERVICE = "SC"
13
14
  SERVER = "SV"
15
+ DATABASE = "DB"
16
+ DESKTOP = "DT"
17
+ SWITCH = "SW"
18
+ FIREWALL = "FW"
19
+ ROUTER = "RT"
20
+ SMART_PHONE = "PH"
21
+ ROBOT = "RB"
22
+ SAN_STORAGE = "SS"
23
+ WEBSITE = "WS"
14
24
 
15
25
  end
16
26
  end
@@ -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')
@@ -15,15 +15,17 @@ module UpGuard
15
15
  @inner_list = []
16
16
  end
17
17
 
18
- def count
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
- @inner_list << obj
37
+ if ["OperatingSystemFamily", "UpGuard::OperatingSystemFamily"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'OperatingSystemFamily' to 'OperatingSystemFamilyList'"
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
- def count
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
- @inner_list << obj
37
+ if ["OperatingSystem", "UpGuard::OperatingSystem"].include?(obj.class.name)
38
+ @inner_list << obj
39
+ else
40
+ raise "Can only append 'OperatingSystem' to 'OperatingSystemList'"
41
+ end
36
42
  end
37
43
 
38
44