upguard 0.0.16 → 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.
- checksums.yaml +4 -4
- data/lib/upguard.rb +2 -0
- data/lib/upguard/Account.rb +3 -3
- data/lib/upguard/Node.rb +18 -1
- data/lib/upguard/NodeScan.rb +78 -0
- data/lib/upguard/NodeScanList.rb +53 -0
- data/lib/upguard/ScheduledJob.rb +1 -1
- data/lib/upguard/Version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1130831c374a901bdfae30e7ca82ef2b5911753192f464bf80adeb3bfbfb12e1
|
4
|
+
data.tar.gz: d7c726622dddf3b5a262db3a361557857f0d25354494194c8ea0224a3234b067
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53166ffbfa4ea2f490da92e0a6d21ae876214e507c3d5dfad7f8de1bff6a66466cc67460366bfe47cb1f65c5fc235692fe281ffd57f6a86cb74a683149f2bdc4
|
7
|
+
data.tar.gz: 8ac4b765ddd3f27ebdebb142755da298b09b62a58749f1bb4786ccd8b1fa20425934a8eafaf45573310c890207deac439fd76faef7187cd98534efc0b9169326
|
data/lib/upguard.rb
CHANGED
@@ -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'
|
data/lib/upguard/Account.rb
CHANGED
@@ -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.
|
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
|
-
|
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
|
-
|
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|
|
data/lib/upguard/Node.rb
CHANGED
@@ -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
|
data/lib/upguard/ScheduledJob.rb
CHANGED
data/lib/upguard/Version.rb
CHANGED
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.
|
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-
|
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
|