upguard 0.0.4 → 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.
- checksums.yaml +5 -5
- data/lib/upguard.rb +27 -0
- data/lib/upguard/Account.rb +404 -129
- data/lib/upguard/BaseObject.rb +23 -22
- data/lib/upguard/ChangeRequest.rb +55 -0
- data/lib/upguard/ChangeRequestList.rb +53 -0
- data/lib/upguard/ConnectionManager.rb +42 -3
- data/lib/upguard/ConnectionManagerGroup.rb +41 -9
- data/lib/upguard/ConnectionManagerGroupList.rb +53 -0
- data/lib/upguard/ConnectionManagerList.rb +53 -0
- data/lib/upguard/Environment.rb +48 -11
- data/lib/upguard/EnvironmentList.rb +53 -0
- data/lib/upguard/Event.rb +15 -3
- data/lib/upguard/EventAction.rb +18 -2
- data/lib/upguard/EventActionList.rb +53 -0
- data/lib/upguard/EventList.rb +53 -0
- data/lib/upguard/EventVariables.rb +43 -0
- data/lib/upguard/ExternalEvent.rb +36 -0
- data/lib/upguard/Incident.rb +12 -2
- data/lib/upguard/IncidentList.rb +53 -0
- data/lib/upguard/Job.rb +70 -0
- data/lib/upguard/JobList.rb +53 -0
- data/lib/upguard/MediumType.rb +5 -2
- data/lib/upguard/Node.rb +86 -9
- data/lib/upguard/NodeGroup.rb +97 -8
- data/lib/upguard/NodeGroupList.rb +64 -0
- data/lib/upguard/NodeGroupUser.rb +27 -0
- data/lib/upguard/NodeGroupUserList.rb +64 -0
- data/lib/upguard/NodeList.rb +53 -0
- data/lib/upguard/NodeMediumInfo.rb +49 -0
- data/lib/upguard/NodeType.rb +12 -2
- data/lib/upguard/OperatingSystem.rb +11 -3
- data/lib/upguard/OperatingSystemFamily.rb +14 -8
- data/lib/upguard/OperatingSystemFamilyList.rb +53 -0
- data/lib/upguard/OperatingSystemList.rb +53 -0
- data/lib/upguard/Pluggable.rb +81 -0
- data/lib/upguard/PluggableList.rb +53 -0
- data/lib/upguard/Policy.rb +87 -0
- data/lib/upguard/PolicyList.rb +53 -0
- data/lib/upguard/ScheduledJob.rb +16 -3
- data/lib/upguard/ScheduledJobList.rb +53 -0
- data/lib/upguard/SystemMetric.rb +9 -2
- data/lib/upguard/SystemMetricList.rb +53 -0
- data/lib/upguard/User.rb +39 -2
- data/lib/upguard/UserList.rb +75 -0
- data/lib/upguard/Version.rb +21 -0
- metadata +37 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '06679ecfa282618bea5b8a05e75eff18d0bc5c34403dc2f2f2f3001e233beb6c'
|
4
|
+
data.tar.gz: b509b89d06ff8c41cc7d1369fcb1982e83543427e4c70aafd7ec162976647538
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7911df3507c5a8f3af2a5212cfd5cf5a37a6f26cbba6c8db6807df67d28ede93d13f88c44ac4c75b4160ddcc2e9541957f5aa8493316aebcafd872bb2bb0d289
|
7
|
+
data.tar.gz: dace744985449ded8d772b5bdc7879080dee8ee619194be293b69eec0c8466de29a40e5b7e9a569761cbf8e6fa4d3e46b73eb1533f400d9b660fbe0d512afb8b
|
data/lib/upguard.rb
CHANGED
@@ -1,17 +1,44 @@
|
|
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'
|
7
|
+
require_relative 'upguard/ConnectionManagerList'
|
4
8
|
require_relative 'upguard/ConnectionManagerGroup'
|
9
|
+
require_relative 'upguard/ConnectionManagerGroupList'
|
5
10
|
require_relative 'upguard/Environment'
|
11
|
+
require_relative 'upguard/EnvironmentList'
|
12
|
+
require_relative 'upguard/ExternalEvent'
|
6
13
|
require_relative 'upguard/Event'
|
14
|
+
require_relative 'upguard/EventList'
|
15
|
+
require_relative 'upguard/EventVariables'
|
7
16
|
require_relative 'upguard/EventAction'
|
17
|
+
require_relative 'upguard/EventActionList'
|
8
18
|
require_relative 'upguard/Incident'
|
19
|
+
require_relative 'upguard/IncidentList'
|
20
|
+
require_relative 'upguard/Job'
|
21
|
+
require_relative 'upguard/JobList'
|
9
22
|
require_relative 'upguard/MediumType'
|
10
23
|
require_relative 'upguard/Node'
|
24
|
+
require_relative 'upguard/NodeList'
|
11
25
|
require_relative 'upguard/NodeGroup'
|
26
|
+
require_relative 'upguard/NodeGroupList'
|
27
|
+
require_relative 'upguard/NodeGroupUser'
|
28
|
+
require_relative 'upguard/NodeGroupUserList'
|
29
|
+
require_relative 'upguard/NodeMediumInfo'
|
12
30
|
require_relative 'upguard/NodeType'
|
13
31
|
require_relative 'upguard/OperatingSystem'
|
32
|
+
require_relative 'upguard/OperatingSystemList'
|
14
33
|
require_relative 'upguard/OperatingSystemFamily'
|
34
|
+
require_relative 'upguard/OperatingSystemFamilyList'
|
35
|
+
require_relative 'upguard/Pluggable'
|
36
|
+
require_relative 'upguard/PluggableList'
|
37
|
+
require_relative 'upguard/Policy'
|
38
|
+
require_relative 'upguard/PolicyList'
|
15
39
|
require_relative 'upguard/ScheduledJob'
|
40
|
+
require_relative 'upguard/ScheduledJobList'
|
16
41
|
require_relative 'upguard/SystemMetric'
|
42
|
+
require_relative 'upguard/SystemMetricList'
|
17
43
|
require_relative 'upguard/User'
|
44
|
+
require_relative 'upguard/UserList'
|
data/lib/upguard/Account.rb
CHANGED
@@ -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')
|
@@ -12,221 +18,512 @@ module UpGuard
|
|
12
18
|
h['name'] = self.name
|
13
19
|
return h
|
14
20
|
end
|
15
|
-
def to_json
|
21
|
+
def to_json(options = nil)
|
16
22
|
h = to_hash
|
17
|
-
return h.to_json
|
23
|
+
return h.to_json(options)
|
18
24
|
end
|
19
25
|
|
26
|
+
def change_request_by_id(id)
|
27
|
+
obj = http_get("/api/v2/change_requests/#{id}.json")
|
28
|
+
elem = ChangeRequest.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
29
|
+
elem.external_id = obj["external_id"]
|
30
|
+
elem.id = obj["id"]
|
31
|
+
elem.planned_end_date = obj["planned_end_date"]
|
32
|
+
elem.planned_start_date = obj["planned_start_date"]
|
33
|
+
elem.short_description = obj["short_description"]
|
34
|
+
elem.started_at = obj["started_at"]
|
35
|
+
elem.ended_at = obj["ended_at"]
|
36
|
+
return elem
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
def change_requests
|
41
|
+
obj = http_get("/api/v2/change_requests.json")
|
42
|
+
the_list = ChangeRequestList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
43
|
+
obj.each do |x|
|
44
|
+
elem = ChangeRequest.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
45
|
+
elem.external_id = x["external_id"] if x.include?("external_id")
|
46
|
+
elem.id = x["id"] if x.include?("id")
|
47
|
+
elem.planned_end_date = x["planned_end_date"] if x.include?("planned_end_date")
|
48
|
+
elem.planned_start_date = x["planned_start_date"] if x.include?("planned_start_date")
|
49
|
+
elem.short_description = x["short_description"] if x.include?("short_description")
|
50
|
+
elem.started_at = x["started_at"] if x.include?("started_at")
|
51
|
+
elem.ended_at = x["ended_at"] if x.include?("ended_at")
|
52
|
+
the_list << elem
|
53
|
+
end
|
54
|
+
return the_list
|
55
|
+
end
|
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
|
+
|
61
|
+
|
20
62
|
def connection_managers
|
21
63
|
obj = http_get("/api/v2/connection_managers.json")
|
22
|
-
|
64
|
+
the_list = ConnectionManagerList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
23
65
|
obj.each do |x|
|
24
|
-
elem = ConnectionManager.new(self.
|
25
|
-
elem.
|
26
|
-
elem.
|
27
|
-
elem.
|
28
|
-
|
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")
|
69
|
+
elem.channels = x["channels"] if x.include?("channels")
|
70
|
+
elem.connection_manager_group_id = x["connection_manager_group_id"] if x.include?("connection_manager_group_id")
|
71
|
+
elem.created_at = x["created_at"] if x.include?("created_at")
|
72
|
+
elem.hostname = x["hostname"] if x.include?("hostname")
|
73
|
+
elem.id = x["id"] if x.include?("id")
|
74
|
+
elem.ip_address = x["ip_address"] if x.include?("ip_address")
|
75
|
+
elem.last_contact = x["last_contact"] if x.include?("last_contact")
|
76
|
+
elem.stats = x["stats"] if x.include?("stats")
|
77
|
+
elem.updated_at = x["updated_at"] if x.include?("updated_at")
|
78
|
+
the_list << elem
|
29
79
|
end
|
30
|
-
return
|
80
|
+
return the_list
|
31
81
|
end
|
32
82
|
|
33
83
|
|
34
84
|
def connection_manager_groups
|
35
85
|
obj = http_get("/api/v2/connection_manager_groups.json")
|
36
|
-
|
86
|
+
the_list = ConnectionManagerGroupList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
37
87
|
obj.each do |x|
|
38
|
-
elem = ConnectionManagerGroup.new(self.
|
39
|
-
elem.id = x["id"]
|
40
|
-
elem.name = x["name"]
|
41
|
-
|
88
|
+
elem = ConnectionManagerGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
89
|
+
elem.id = x["id"] if x.include?("id")
|
90
|
+
elem.name = x["name"] if x.include?("name")
|
91
|
+
elem.organisation_id = x["organisation_id"] if x.include?("organisation_id")
|
92
|
+
elem.status = x["status"] if x.include?("status")
|
93
|
+
the_list << elem
|
42
94
|
end
|
43
|
-
return
|
95
|
+
return the_list
|
44
96
|
end
|
45
97
|
|
46
98
|
def new_environment
|
47
|
-
return Environment.new(self.
|
99
|
+
return Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
def environment_by_id(id)
|
104
|
+
obj = http_get("/api/v2/environments/#{id}.json")
|
105
|
+
elem = Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
106
|
+
elem.id = obj["id"]
|
107
|
+
elem.name = obj["name"]
|
108
|
+
return elem
|
48
109
|
end
|
49
110
|
|
50
111
|
|
51
112
|
def environments
|
52
113
|
obj = http_get("/api/v2/environments.json")
|
53
|
-
|
114
|
+
the_list = EnvironmentList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
54
115
|
obj.each do |x|
|
55
|
-
elem = Environment.new(self.
|
56
|
-
elem.
|
57
|
-
elem.
|
58
|
-
|
116
|
+
elem = Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
117
|
+
elem.description = x["description"] if x.include?("description")
|
118
|
+
elem.id = x["id"] if x.include?("id")
|
119
|
+
elem.name = x["name"] if x.include?("name")
|
120
|
+
elem.node_rules = x["node_rules"] if x.include?("node_rules")
|
121
|
+
elem.short_description = x["short_description"] if x.include?("short_description")
|
122
|
+
the_list << elem
|
59
123
|
end
|
60
|
-
return
|
124
|
+
return the_list
|
125
|
+
end
|
126
|
+
|
127
|
+
def new_external_event
|
128
|
+
return ExternalEvent.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
61
129
|
end
|
62
130
|
|
63
131
|
def events_with_view_name(view_name)
|
64
132
|
url = "/api/v2/events.json?view_name=#{view_name}"
|
65
133
|
obj = http_get(url)
|
66
|
-
|
134
|
+
the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
67
135
|
obj.each do |x|
|
68
|
-
elem = Event.new(self.
|
136
|
+
elem = Event.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
69
137
|
elem.id = x["id"]
|
70
138
|
elem.type_id = x["type_id"]
|
71
139
|
elem.environment_id = x["environment_id"]
|
72
140
|
elem.created_at = x["created_at"]
|
73
|
-
|
141
|
+
the_list << elem
|
74
142
|
end
|
75
|
-
return
|
143
|
+
return the_list
|
76
144
|
end
|
77
145
|
|
78
146
|
def events_with_query(query)
|
79
147
|
url = "/api/v2/events.json?query=#{query}"
|
80
148
|
obj = http_get(url)
|
81
|
-
|
149
|
+
the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
82
150
|
obj.each do |x|
|
83
|
-
elem = Event.new(self.
|
151
|
+
elem = Event.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
84
152
|
elem.id = x["id"]
|
85
153
|
elem.type_id = x["type_id"]
|
86
154
|
elem.environment_id = x["environment_id"]
|
87
155
|
elem.created_at = x["created_at"]
|
88
|
-
|
156
|
+
the_list << elem
|
157
|
+
end
|
158
|
+
return the_list
|
159
|
+
end
|
160
|
+
|
161
|
+
|
162
|
+
def event_action_by_id(id)
|
163
|
+
obj = http_get("/api/v2/event_actions/#{id}.json")
|
164
|
+
elem = EventAction.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
165
|
+
elem.id = obj["id"]
|
166
|
+
elem.name = obj["name"]
|
167
|
+
return elem
|
168
|
+
end
|
169
|
+
|
170
|
+
|
171
|
+
def event_types
|
172
|
+
obj = http_get("/api/v2/events/types.json")
|
173
|
+
the_list = EventTypeList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
174
|
+
obj.each do |x|
|
175
|
+
elem = EventType.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
176
|
+
elem.id = x["id"] if x.include?("id")
|
177
|
+
elem.name = x["name"] if x.include?("name")
|
178
|
+
the_list << elem
|
89
179
|
end
|
90
|
-
return
|
180
|
+
return the_list
|
91
181
|
end
|
92
182
|
|
93
183
|
|
94
184
|
def event_actions
|
95
185
|
obj = http_get("/api/v2/event_actions.json")
|
96
|
-
|
186
|
+
the_list = EventActionList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
97
187
|
obj.each do |x|
|
98
|
-
elem = EventAction.new(self.
|
99
|
-
elem.id = x["id"]
|
100
|
-
elem.name = x["name"]
|
101
|
-
elem.status = x["status"]
|
102
|
-
elem.type = x["type"]
|
103
|
-
|
188
|
+
elem = EventAction.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
189
|
+
elem.id = x["id"] if x.include?("id")
|
190
|
+
elem.name = x["name"] if x.include?("name")
|
191
|
+
elem.status = x["status"] if x.include?("status")
|
192
|
+
elem.type = x["type"] if x.include?("type")
|
193
|
+
elem.variables = x["variables"] if x.include?("variables")
|
194
|
+
elem.view = x["view"] if x.include?("view")
|
195
|
+
the_list << elem
|
104
196
|
end
|
105
|
-
return
|
197
|
+
return the_list
|
106
198
|
end
|
107
199
|
|
108
200
|
|
109
201
|
def incidents
|
110
202
|
obj = http_get("/api/v2/incidents.json")
|
111
|
-
|
203
|
+
the_list = IncidentList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
112
204
|
obj.each do |x|
|
113
|
-
elem = Incident.new(self.
|
114
|
-
elem.id = x["id"]
|
115
|
-
elem.external_id = x["external_id"]
|
116
|
-
elem.short_description = x["short_description"]
|
117
|
-
elem.started_at = x["started_at"]
|
118
|
-
elem.ended_at = x["ended_at"]
|
119
|
-
elem.url = x["url"]
|
120
|
-
|
205
|
+
elem = Incident.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
206
|
+
elem.id = x["id"] if x.include?("id")
|
207
|
+
elem.external_id = x["external_id"] if x.include?("external_id")
|
208
|
+
elem.short_description = x["short_description"] if x.include?("short_description")
|
209
|
+
elem.started_at = x["started_at"] if x.include?("started_at")
|
210
|
+
elem.ended_at = x["ended_at"] if x.include?("ended_at")
|
211
|
+
elem.url = x["url"] if x.include?("url")
|
212
|
+
the_list << elem
|
121
213
|
end
|
122
|
-
return
|
214
|
+
return the_list
|
215
|
+
end
|
216
|
+
|
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
|
123
228
|
end
|
124
229
|
|
125
230
|
|
126
231
|
def jobs
|
127
232
|
obj = http_get("/api/v2/jobs.json")
|
128
|
-
|
233
|
+
the_list = JobList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
129
234
|
obj.each do |x|
|
130
|
-
elem = Job.new(self.
|
131
|
-
elem.id = x["id"]
|
132
|
-
elem.
|
133
|
-
elem.
|
134
|
-
elem.source_type = x["source_type"]
|
135
|
-
elem.status = x["status"]
|
136
|
-
|
235
|
+
elem = Job.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
236
|
+
elem.id = x["id"] if x.include?("id")
|
237
|
+
elem.source_id = x["source_id"] if x.include?("source_id")
|
238
|
+
elem.source_name = x["source_name"] if x.include?("source_name")
|
239
|
+
elem.source_type = x["source_type"] if x.include?("source_type")
|
240
|
+
elem.status = x["status"] if x.include?("status")
|
241
|
+
the_list << elem
|
137
242
|
end
|
138
|
-
return
|
243
|
+
return the_list
|
244
|
+
end
|
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
|
139
256
|
end
|
140
257
|
|
141
258
|
def new_node
|
142
|
-
return Node.new(self.
|
259
|
+
return Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
143
260
|
end
|
144
261
|
|
145
262
|
|
146
263
|
def nodes
|
147
264
|
obj = http_get("/api/v2/nodes.json")
|
148
|
-
|
265
|
+
the_list = NodeList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
149
266
|
obj.each do |x|
|
150
|
-
elem = Node.new(self.
|
151
|
-
elem.
|
152
|
-
elem.
|
153
|
-
elem.
|
154
|
-
elem.
|
155
|
-
elem.
|
156
|
-
elem.
|
157
|
-
|
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")
|
269
|
+
elem.external_id = x["external_id"] if x.include?("external_id")
|
270
|
+
elem.environment_id = x["environment_id"] if x.include?("environment_id")
|
271
|
+
elem.id = x["id"] if x.include?("id")
|
272
|
+
elem.ip_address = x["ip_address"] if x.include?("ip_address")
|
273
|
+
elem.last_scan_status = x["last_scan_status"] if x.include?("last_scan_status")
|
274
|
+
elem.last_scan_status_string = x["last_scan_status_string"] if x.include?("last_scan_status_string")
|
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")
|
280
|
+
elem.name = x["name"] if x.include?("name")
|
281
|
+
elem.node_type = x["node_type"] if x.include?("node_type")
|
282
|
+
elem.online = x["online"] if x.include?("online")
|
283
|
+
elem.operating_system_family_id = x["operating_system_family_id"] if x.include?("operating_system_family_id")
|
284
|
+
elem.operating_system_id = x["operating_system_id"] if x.include?("operating_system_id")
|
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")
|
287
|
+
the_list << elem
|
158
288
|
end
|
159
|
-
return
|
289
|
+
return the_list
|
290
|
+
end
|
291
|
+
|
292
|
+
def node_by_external_id(external_id)
|
293
|
+
url = "/api/v2/nodes/lookup.json?external_id=#{external_id}"
|
294
|
+
obj = http_get(url)
|
295
|
+
id = obj["node_id"]
|
296
|
+
elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
297
|
+
elem.id = id
|
298
|
+
elem.load
|
299
|
+
return elem
|
300
|
+
end
|
301
|
+
|
302
|
+
def node_by_name(name)
|
303
|
+
url = "/api/v2/nodes/lookup.json?name=#{name}"
|
304
|
+
obj = http_get(url)
|
305
|
+
id = obj["node_id"]
|
306
|
+
elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
307
|
+
elem.id = id
|
308
|
+
elem.load
|
309
|
+
return elem
|
310
|
+
end
|
311
|
+
|
312
|
+
|
313
|
+
def node_by_id(id)
|
314
|
+
obj = http_get("/api/v2/nodes/#{id}.json")
|
315
|
+
elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
316
|
+
elem.id = obj["id"]
|
317
|
+
elem.name = obj["name"]
|
318
|
+
return elem
|
319
|
+
end
|
320
|
+
|
321
|
+
def new_node_group
|
322
|
+
return NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
160
323
|
end
|
161
324
|
|
162
325
|
|
163
326
|
def node_groups
|
164
327
|
obj = http_get("/api/v2/node_groups.json")
|
165
|
-
|
328
|
+
the_list = NodeGroupList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
166
329
|
obj.each do |x|
|
167
|
-
elem =
|
168
|
-
elem.
|
169
|
-
elem.
|
170
|
-
|
330
|
+
elem = NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
331
|
+
elem.description = x["description"] if x.include?("description")
|
332
|
+
elem.id = x["id"] if x.include?("id")
|
333
|
+
elem.name = x["name"] if x.include?("name")
|
334
|
+
elem.node_rules = x["node_rules"] if x.include?("node_rules")
|
335
|
+
elem.search_query = x["search_query"] if x.include?("search_query")
|
336
|
+
the_list << elem
|
171
337
|
end
|
172
|
-
return
|
338
|
+
return the_list
|
339
|
+
end
|
340
|
+
|
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
|
173
376
|
end
|
174
377
|
|
175
378
|
|
176
379
|
def operating_system_families
|
177
380
|
obj = http_get("/api/v2/operating_system_families.json")
|
178
|
-
|
381
|
+
the_list = OperatingSystemFamilyList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
179
382
|
obj.each do |x|
|
180
|
-
elem = OperatingSystemFamily.new(self.
|
181
|
-
elem.id = x["id"]
|
182
|
-
elem.name = x["name"]
|
183
|
-
|
383
|
+
elem = OperatingSystemFamily.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
384
|
+
elem.id = x["id"] if x.include?("id")
|
385
|
+
elem.name = x["name"] if x.include?("name")
|
386
|
+
the_list << elem
|
184
387
|
end
|
185
|
-
return
|
388
|
+
return the_list
|
186
389
|
end
|
187
390
|
|
188
391
|
|
189
392
|
def operating_systems
|
190
393
|
obj = http_get("/api/v2/operating_systems.json")
|
191
|
-
|
394
|
+
the_list = OperatingSystemList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
192
395
|
obj.each do |x|
|
193
|
-
elem = OperatingSystem.new(self.
|
194
|
-
elem.id = x["id"]
|
195
|
-
elem.name = x["name"]
|
196
|
-
elem.operating_system_family_id = x["operating_system_family_id"]
|
197
|
-
|
396
|
+
elem = OperatingSystem.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
397
|
+
elem.id = x["id"] if x.include?("id")
|
398
|
+
elem.name = x["name"] if x.include?("name")
|
399
|
+
elem.operating_system_family_id = x["operating_system_family_id"] if x.include?("operating_system_family_id")
|
400
|
+
elem.description = x["description"] if x.include?("description")
|
401
|
+
the_list << elem
|
198
402
|
end
|
199
|
-
return
|
403
|
+
return the_list
|
404
|
+
end
|
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
|
+
|
431
|
+
|
432
|
+
def policies
|
433
|
+
obj = http_get("/api/v2/policies.json")
|
434
|
+
the_list = PolicyList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
435
|
+
obj.each do |x|
|
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")
|
438
|
+
elem.id = x["id"] if x.include?("id")
|
439
|
+
elem.name = x["name"] if x.include?("name")
|
440
|
+
elem.short_description = x["short_description"] if x.include?("short_description")
|
441
|
+
the_list << elem
|
442
|
+
end
|
443
|
+
return the_list
|
444
|
+
end
|
445
|
+
|
446
|
+
|
447
|
+
def scheduled_jobs
|
448
|
+
obj = http_get("/api/v2/scheduled_jobs.json")
|
449
|
+
the_list = ScheduledJobList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
450
|
+
obj.each do |x|
|
451
|
+
elem = ScheduledJob.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
452
|
+
elem.data = x["data"] if x.include?("data")
|
453
|
+
elem.id = x["id"] if x.include?("id")
|
454
|
+
elem.source_id = x["source_id"] if x.include?("source_id")
|
455
|
+
elem.source_name = x["source_name"] if x.include?("source_name")
|
456
|
+
elem.source_type = x["source_type"] if x.include?("source_type")
|
457
|
+
elem.status = x["status"] if x.include?("status")
|
458
|
+
the_list << elem
|
459
|
+
end
|
460
|
+
return the_list
|
200
461
|
end
|
201
462
|
|
202
463
|
|
203
464
|
def system_metrics
|
204
465
|
obj = http_get("/api/v2/system_metrics.json")
|
205
|
-
|
466
|
+
the_list = SystemMetricList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
206
467
|
obj.each do |x|
|
207
|
-
elem = SystemMetric.new(self.
|
208
|
-
elem.metric = x["metric"]
|
209
|
-
elem.value = x["value"]
|
210
|
-
elem.timestamp = x["timestamp"]
|
211
|
-
|
468
|
+
elem = SystemMetric.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
469
|
+
elem.metric = x["metric"] if x.include?("metric")
|
470
|
+
elem.value = x["value"] if x.include?("value")
|
471
|
+
elem.timestamp = x["timestamp"] if x.include?("timestamp")
|
472
|
+
the_list << elem
|
212
473
|
end
|
213
|
-
return
|
474
|
+
return the_list
|
475
|
+
end
|
476
|
+
|
477
|
+
|
478
|
+
def text_file_by_id(id)
|
479
|
+
obj = http_get("/api/v2/text_files/#{id}.json")
|
480
|
+
elem = TextFile.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
481
|
+
elem.category = obj["category"]
|
482
|
+
elem.checksum = obj["checksum"]
|
483
|
+
elem.created_at = obj["created_at"]
|
484
|
+
elem.data = obj["data"]
|
485
|
+
elem.id = obj["id"]
|
486
|
+
elem.name = obj["name"]
|
487
|
+
elem.updated_at = obj["updated_at"]
|
488
|
+
return elem
|
214
489
|
end
|
215
490
|
|
216
491
|
|
217
492
|
def users
|
218
493
|
obj = http_get("/api/v2/users.json")
|
219
|
-
|
494
|
+
the_list = UserList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
220
495
|
obj.each do |x|
|
221
|
-
elem = User.new(self.
|
222
|
-
elem.
|
223
|
-
elem.
|
224
|
-
elem.
|
225
|
-
elem.
|
226
|
-
elem.role = x["role"]
|
227
|
-
|
496
|
+
elem = User.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
|
497
|
+
elem.email = x["email"] if x.include?("email")
|
498
|
+
elem.id = x["id"] if x.include?("id")
|
499
|
+
elem.last_sign_in_at = x["last_sign_in_at"] if x.include?("last_sign_in_at")
|
500
|
+
elem.name = x["name"] if x.include?("name")
|
501
|
+
elem.role = x["role"] if x.include?("role")
|
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
|
228
505
|
end
|
229
|
-
return
|
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")
|
524
|
+
the_list << elem
|
525
|
+
end
|
526
|
+
return the_list
|
230
527
|
end
|
231
528
|
|
232
529
|
def invite_user(email, role)
|
@@ -235,32 +532,10 @@ module UpGuard
|
|
235
532
|
return obj
|
236
533
|
end
|
237
534
|
|
238
|
-
def
|
239
|
-
url = "/api/v2/
|
240
|
-
obj =
|
241
|
-
|
242
|
-
elem = Node.new(self.appliance_hostname, self.api_key, self.sec_key, self.insecure)
|
243
|
-
elem.id = id
|
244
|
-
elem.load
|
245
|
-
return elem
|
246
|
-
end
|
247
|
-
|
248
|
-
def find_node_by_name(name)
|
249
|
-
url = "/api/v2/nodes/lookup.json?name=#{name}"
|
250
|
-
obj = http_get(url)
|
251
|
-
id = obj["node_id"]
|
252
|
-
elem = Node.new(self.appliance_hostname, self.api_key, self.sec_key, self.insecure)
|
253
|
-
elem.id = id
|
254
|
-
elem.load
|
255
|
-
return elem
|
256
|
-
end
|
257
|
-
|
258
|
-
def find_node_by_id(id)
|
259
|
-
url = "/api/v2/nodes/#{self.id}.json?id=#{id}"
|
260
|
-
obj = http_get(url)
|
261
|
-
elem = Node.new(self.appliance_hostname, self.api_key, self.sec_key, self.insecure)
|
262
|
-
elem.from_hash(obj)
|
263
|
-
return elem
|
535
|
+
def remove_user(email)
|
536
|
+
url = "/api/v2/users/remove.json?email=#{email}"
|
537
|
+
obj = http_put(url, nil)
|
538
|
+
return obj
|
264
539
|
end
|
265
540
|
|
266
541
|
|