upguard 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '06679ecfa282618bea5b8a05e75eff18d0bc5c34403dc2f2f2f3001e233beb6c'
4
- data.tar.gz: b509b89d06ff8c41cc7d1369fcb1982e83543427e4c70aafd7ec162976647538
3
+ metadata.gz: 1130831c374a901bdfae30e7ca82ef2b5911753192f464bf80adeb3bfbfb12e1
4
+ data.tar.gz: d7c726622dddf3b5a262db3a361557857f0d25354494194c8ea0224a3234b067
5
5
  SHA512:
6
- metadata.gz: 7911df3507c5a8f3af2a5212cfd5cf5a37a6f26cbba6c8db6807df67d28ede93d13f88c44ac4c75b4160ddcc2e9541957f5aa8493316aebcafd872bb2bb0d289
7
- data.tar.gz: dace744985449ded8d772b5bdc7879080dee8ee619194be293b69eec0c8466de29a40e5b7e9a569761cbf8e6fa4d3e46b73eb1533f400d9b660fbe0d512afb8b
6
+ metadata.gz: 53166ffbfa4ea2f490da92e0a6d21ae876214e507c3d5dfad7f8de1bff6a66466cc67460366bfe47cb1f65c5fc235692fe281ffd57f6a86cb74a683149f2bdc4
7
+ data.tar.gz: 8ac4b765ddd3f27ebdebb142755da298b09b62a58749f1bb4786ccd8b1fa20425934a8eafaf45573310c890207deac439fd76faef7187cd98534efc0b9169326
@@ -27,6 +27,8 @@ require_relative 'upguard/NodeGroupList'
27
27
  require_relative 'upguard/NodeGroupUser'
28
28
  require_relative 'upguard/NodeGroupUserList'
29
29
  require_relative 'upguard/NodeMediumInfo'
30
+ require_relative 'upguard/NodeScan'
31
+ require_relative 'upguard/NodeScanList'
30
32
  require_relative 'upguard/NodeType'
31
33
  require_relative 'upguard/OperatingSystem'
32
34
  require_relative 'upguard/OperatingSystemList'
@@ -88,7 +88,7 @@ module UpGuard
88
88
  elem = ConnectionManagerGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
89
89
  elem.id = x["id"] if x.include?("id")
90
90
  elem.name = x["name"] if x.include?("name")
91
- elem.organisation_id = x["organisation_id"] if x.include?("organisation_id")
91
+ elem.api_key = x["api_key"] if x.include?("api_key")
92
92
  elem.status = x["status"] if x.include?("status")
93
93
  the_list << elem
94
94
  end
@@ -129,7 +129,7 @@ module UpGuard
129
129
  end
130
130
 
131
131
  def events_with_view_name(view_name)
132
- url = "/api/v2/events.json?view_name=#{view_name}"
132
+ url = "/api/v2/events.json?view_name=#{view_name}"
133
133
  obj = http_get(url)
134
134
  the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
135
135
  obj.each do |x|
@@ -144,7 +144,7 @@ module UpGuard
144
144
  end
145
145
 
146
146
  def events_with_query(query)
147
- url = "/api/v2/events.json?query=#{query}"
147
+ url = "/api/v2/events.json?query=#{query}"
148
148
  obj = http_get(url)
149
149
  the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
150
150
  obj.each do |x|
@@ -159,12 +159,29 @@ module UpGuard
159
159
  return elem
160
160
  end
161
161
 
162
- def start_scan()
162
+ def start_scan
163
163
  url = "/api/v2/nodes/#{self.id}/start_scan.json"
164
164
  obj = http_post(url, nil)
165
165
  return obj
166
166
  end
167
167
 
168
+ def node_scans
169
+ url = "/api/v2/node_scans.json?node_id=#{self.id}&per_page=5000"
170
+ obj = http_get(url)
171
+ the_list = NodeScanList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
172
+ obj.each do |x|
173
+ elem = NodeScan.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
174
+ elem.id = x["id"]
175
+ elem.node_id = x["node_id"]
176
+ elem.created_at = x["created_at"]
177
+ elem.updated_at = x["updated_at"]
178
+ elem.scan_options = x["scan_options"]
179
+ the_list << elem
180
+ end
181
+ return the_list
182
+ end
183
+
184
+
168
185
 
169
186
  def node_groups
170
187
  obj = http_get("/api/v2/nodes/#{self.id}/node_groups.json")
@@ -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
@@ -70,7 +70,7 @@ module UpGuard
70
70
  http_delete("/api/v2/scheduled_jobs/#{self.id}.json")
71
71
  end
72
72
 
73
- def cancel_jobs()
73
+ def cancel_jobs
74
74
  url = "/api/v2/scheduled_jobs/#{self.id}/cancel_jobs.json"
75
75
  obj = http_post(url, nil)
76
76
  return obj
@@ -12,7 +12,7 @@ module UpGuard
12
12
  end
13
13
 
14
14
  def version
15
- return "0.0.16"
15
+ return "0.0.17"
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.16
4
+ version: 0.0.17
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-08-05 00:00:00.000000000 Z
11
+ date: 2020-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -74,6 +74,8 @@ files:
74
74
  - lib/upguard/NodeGroupUserList.rb
75
75
  - lib/upguard/NodeList.rb
76
76
  - lib/upguard/NodeMediumInfo.rb
77
+ - lib/upguard/NodeScan.rb
78
+ - lib/upguard/NodeScanList.rb
77
79
  - lib/upguard/NodeType.rb
78
80
  - lib/upguard/OperatingSystem.rb
79
81
  - lib/upguard/OperatingSystemFamily.rb