Class: CloudhouseGuardian::Account
Instance Attribute Summary collapse
Attributes inherited from BaseObject
#appliance_api_key, #appliance_url, #insecure, #sec_key
Instance Method Summary
collapse
Methods inherited from BaseObject
#http_delete, #http_get, #http_post, #http_put, #make_headers
Constructor Details
#initialize(appliance_url, appliance_api_key, sec_key, insecure = false) ⇒ Account
Returns a new instance of Account.
5
6
7
8
9
|
# File 'lib/cloudhouse_guardian/Account.rb', line 5
def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
super(appliance_url, appliance_api_key, sec_key, insecure)
self.id = nil
self.name = nil
end
|
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3
4
5
|
# File 'lib/cloudhouse_guardian/Account.rb', line 3
def id
@id
end
|
#name ⇒ Object
Returns the value of attribute name.
4
5
6
|
# File 'lib/cloudhouse_guardian/Account.rb', line 4
def name
@name
end
|
Instance Method Details
#change_request_by_id(id) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/cloudhouse_guardian/Account.rb', line 26
def change_request_by_id(id)
obj = http_get("/api/v2/change_requests/#{id}.json")
elem = ChangeRequest.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.external_id = obj["external_id"]
elem.id = obj["id"]
elem.planned_end_date = obj["planned_end_date"]
elem.planned_start_date = obj["planned_start_date"]
elem.short_description = obj["short_description"]
elem.started_at = obj["started_at"]
elem.ended_at = obj["ended_at"]
return elem
end
|
#change_requests ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/cloudhouse_guardian/Account.rb', line 40
def change_requests
obj = http_get("/api/v2/change_requests.json")
the_list = ChangeRequestList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = ChangeRequest.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.external_id = x["external_id"] if x.include?("external_id")
elem.id = x["id"] if x.include?("id")
elem.planned_end_date = x["planned_end_date"] if x.include?("planned_end_date")
elem.planned_start_date = x["planned_start_date"] if x.include?("planned_start_date")
elem.short_description = x["short_description"] if x.include?("short_description")
elem.started_at = x["started_at"] if x.include?("started_at")
elem.ended_at = x["ended_at"] if x.include?("ended_at")
the_list << elem
end
return the_list
end
|
#connection_manager_groups ⇒ Object
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/cloudhouse_guardian/Account.rb', line 84
def connection_manager_groups
obj = http_get("/api/v2/connection_manager_groups.json")
the_list = ConnectionManagerGroupList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = ConnectionManagerGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = x["id"] if x.include?("id")
elem.name = x["name"] if x.include?("name")
elem.api_key = x["api_key"] if x.include?("api_key")
elem.status = x["status"] if x.include?("status")
the_list << elem
end
return the_list
end
|
#connection_managers ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/cloudhouse_guardian/Account.rb', line 62
def connection_managers
obj = http_get("/api/v2/connection_managers.json")
the_list = ConnectionManagerList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = ConnectionManager.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.agent_version = x["agent_version"] if x.include?("agent_version")
elem.agent_type = x["agent_type"] if x.include?("agent_type")
elem.channels = x["channels"] if x.include?("channels")
elem.connection_manager_group_id = x["connection_manager_group_id"] if x.include?("connection_manager_group_id")
elem.created_at = x["created_at"] if x.include?("created_at")
elem.hostname = x["hostname"] if x.include?("hostname")
elem.id = x["id"] if x.include?("id")
elem.ip_address = x["ip_address"] if x.include?("ip_address")
elem.last_contact = x["last_contact"] if x.include?("last_contact")
elem.stats = x["stats"] if x.include?("stats")
elem.updated_at = x["updated_at"] if x.include?("updated_at")
the_list << elem
end
return the_list
end
|
#environment_by_id(id) ⇒ Object
103
104
105
106
107
108
109
|
# File 'lib/cloudhouse_guardian/Account.rb', line 103
def environment_by_id(id)
obj = http_get("/api/v2/environments/#{id}.json")
elem = Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = obj["id"]
elem.name = obj["name"]
return elem
end
|
#environment_by_name(name) ⇒ Object
111
112
113
114
115
116
117
118
119
|
# File 'lib/cloudhouse_guardian/Account.rb', line 111
def environment_by_name(name)
url = "/api/v2/environments/lookup.json?name=#{name}"
obj = http_get(url)
id = obj["environment_id"]
elem = Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = id
elem.load
return elem
end
|
#environments ⇒ Object
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'lib/cloudhouse_guardian/Account.rb', line 122
def environments
obj = http_get("/api/v2/environments.json")
the_list = EnvironmentList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.description = x["description"] if x.include?("description")
elem.id = x["id"] if x.include?("id")
elem.name = x["name"] if x.include?("name")
elem.node_rules = x["node_rules"] if x.include?("node_rules")
elem.short_description = x["short_description"] if x.include?("short_description")
the_list << elem
end
return the_list
end
|
#event_action_by_id(id) ⇒ Object
172
173
174
175
176
177
178
|
# File 'lib/cloudhouse_guardian/Account.rb', line 172
def event_action_by_id(id)
obj = http_get("/api/v2/event_actions/#{id}.json")
elem = EventAction.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = obj["id"]
elem.name = obj["name"]
return elem
end
|
#event_actions ⇒ Object
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
# File 'lib/cloudhouse_guardian/Account.rb', line 194
def event_actions
obj = http_get("/api/v2/event_actions.json")
the_list = EventActionList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = EventAction.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = x["id"] if x.include?("id")
elem.name = x["name"] if x.include?("name")
elem.status = x["status"] if x.include?("status")
elem.type = x["type"] if x.include?("type")
elem.variables = x["variables"] if x.include?("variables")
elem.view = x["view"] if x.include?("view")
the_list << elem
end
return the_list
end
|
#event_types ⇒ Object
181
182
183
184
185
186
187
188
189
190
191
|
# File 'lib/cloudhouse_guardian/Account.rb', line 181
def event_types
obj = http_get("/api/v2/events/types.json")
the_list = EventTypeList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = EventType.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = x["id"] if x.include?("id")
elem.name = x["name"] if x.include?("name")
the_list << elem
end
return the_list
end
|
#events_with_query(query) ⇒ Object
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
# File 'lib/cloudhouse_guardian/Account.rb', line 156
def events_with_query(query)
url = "/api/v2/events.json?query=#{query}"
obj = http_get(url)
the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = Event.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = x["id"]
elem.type_id = x["type_id"]
elem.environment_id = x["environment_id"]
elem.created_at = x["created_at"]
the_list << elem
end
return the_list
end
|
#events_with_view_name(view_name) ⇒ Object
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
# File 'lib/cloudhouse_guardian/Account.rb', line 141
def events_with_view_name(view_name)
url = "/api/v2/events.json?view_name=#{view_name}"
obj = http_get(url)
the_list = EventList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = Event.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = x["id"]
elem.type_id = x["type_id"]
elem.environment_id = x["environment_id"]
elem.created_at = x["created_at"]
the_list << elem
end
return the_list
end
|
#from_hash(h) ⇒ Object
11
12
13
14
|
# File 'lib/cloudhouse_guardian/Account.rb', line 11
def from_hash(h)
self.id = h['id'] if h.include?('id')
self.name = h['name'] if h.include?('name')
end
|
#incident_by_id(id) ⇒ Object
228
229
230
231
232
233
234
235
236
237
238
|
# File 'lib/cloudhouse_guardian/Account.rb', line 228
def incident_by_id(id)
obj = http_get("/api/v2/incidents/#{id}.json")
elem = Incident.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = obj["id"]
elem.external_id = obj["external_id"]
elem.short_description = obj["short_description"]
elem.started_at = obj["started_at"]
elem.ended_at = obj["ended_at"]
elem.url = obj["url"]
return elem
end
|
#incidents ⇒ Object
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
# File 'lib/cloudhouse_guardian/Account.rb', line 211
def incidents
obj = http_get("/api/v2/incidents.json")
the_list = IncidentList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = Incident.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = x["id"] if x.include?("id")
elem.external_id = x["external_id"] if x.include?("external_id")
elem.short_description = x["short_description"] if x.include?("short_description")
elem.started_at = x["started_at"] if x.include?("started_at")
elem.ended_at = x["ended_at"] if x.include?("ended_at")
elem.url = x["url"] if x.include?("url")
the_list << elem
end
return the_list
end
|
#invite_user(email, role) ⇒ Object
539
540
541
542
543
|
# File 'lib/cloudhouse_guardian/Account.rb', line 539
def invite_user(email, role)
url = "/api/v2/users/invite.json?email=#{email}&role=#{role}"
obj = http_post(url, nil)
return obj
end
|
#job_by_id(id) ⇒ Object
257
258
259
260
261
262
263
264
265
266
|
# File 'lib/cloudhouse_guardian/Account.rb', line 257
def job_by_id(id)
obj = http_get("/api/v2/jobs/#{id}.json")
elem = Job.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = obj["id"]
elem.source_id = obj["source_id"]
elem.source_name = obj["source_name"]
elem.source_type = obj["source_type"]
elem.status = obj["status"]
return elem
end
|
#jobs ⇒ Object
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
# File 'lib/cloudhouse_guardian/Account.rb', line 241
def jobs
obj = http_get("/api/v2/jobs.json")
the_list = JobList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = Job.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = x["id"] if x.include?("id")
elem.source_id = x["source_id"] if x.include?("source_id")
elem.source_name = x["source_name"] if x.include?("source_name")
elem.source_type = x["source_type"] if x.include?("source_type")
elem.status = x["status"] if x.include?("status")
the_list << elem
end
return the_list
end
|
#new_connection_manager_group ⇒ Object
57
58
59
|
# File 'lib/cloudhouse_guardian/Account.rb', line 57
def new_connection_manager_group
return ConnectionManagerGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
end
|
#new_environment ⇒ Object
98
99
100
|
# File 'lib/cloudhouse_guardian/Account.rb', line 98
def new_environment
return Environment.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
end
|
#new_external_event ⇒ Object
137
138
139
|
# File 'lib/cloudhouse_guardian/Account.rb', line 137
def new_external_event
return ExternalEvent.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
end
|
#new_node ⇒ Object
268
269
270
|
# File 'lib/cloudhouse_guardian/Account.rb', line 268
def new_node
return Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
end
|
#new_node_group ⇒ Object
331
332
333
|
# File 'lib/cloudhouse_guardian/Account.rb', line 331
def new_node_group
return NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
end
|
#new_pluggable ⇒ Object
416
417
418
|
# File 'lib/cloudhouse_guardian/Account.rb', line 416
def new_pluggable
return Pluggable.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
end
|
#new_policy ⇒ Object
437
438
439
|
# File 'lib/cloudhouse_guardian/Account.rb', line 437
def new_policy
return Policy.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
end
|
#node_by_external_id(external_id) ⇒ Object
302
303
304
305
306
307
308
309
310
|
# File 'lib/cloudhouse_guardian/Account.rb', line 302
def node_by_external_id(external_id)
url = "/api/v2/nodes/lookup.json?external_id=#{external_id}"
obj = http_get(url)
id = obj["node_id"]
elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = id
elem.load
return elem
end
|
#node_by_id(id) ⇒ Object
323
324
325
326
327
328
329
|
# File 'lib/cloudhouse_guardian/Account.rb', line 323
def node_by_id(id)
obj = http_get("/api/v2/nodes/#{id}.json")
elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = obj["id"]
elem.name = obj["name"]
return elem
end
|
#node_by_name(name) ⇒ Object
312
313
314
315
316
317
318
319
320
|
# File 'lib/cloudhouse_guardian/Account.rb', line 312
def node_by_name(name)
url = "/api/v2/nodes/lookup.json?name=#{name}"
obj = http_get(url)
id = obj["node_id"]
elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = id
elem.load
return elem
end
|
#node_group_by_id(id) ⇒ Object
352
353
354
355
356
357
358
|
# File 'lib/cloudhouse_guardian/Account.rb', line 352
def node_group_by_id(id)
obj = http_get("/api/v2/node_groups/#{id}.json")
elem = NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = obj["id"]
elem.name = obj["name"]
return elem
end
|
#node_group_by_name(name) ⇒ Object
360
361
362
363
364
365
366
367
368
|
# File 'lib/cloudhouse_guardian/Account.rb', line 360
def node_group_by_name(name)
url = "/api/v2/node_groups/lookup.json?name=#{name}"
obj = http_get(url)
id = obj["node_group_id"]
elem = NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = id
elem.load
return elem
end
|
#node_groups ⇒ Object
336
337
338
339
340
341
342
343
344
345
346
347
348
349
|
# File 'lib/cloudhouse_guardian/Account.rb', line 336
def node_groups
obj = http_get("/api/v2/node_groups.json")
the_list = NodeGroupList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = NodeGroup.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.description = x["description"] if x.include?("description")
elem.id = x["id"] if x.include?("id")
elem.name = x["name"] if x.include?("name")
elem.node_rules = x["node_rules"] if x.include?("node_rules")
elem.search_query = x["search_query"] if x.include?("search_query")
the_list << elem
end
return the_list
end
|
#node_scan_by_id(id) ⇒ Object
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
# File 'lib/cloudhouse_guardian/Account.rb', line 371
def node_scan_by_id(id)
obj = http_get("/api/v2/node_scans/#{id}.json")
elem = NodeScan.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = obj["id"]
elem.node_id = obj["node_id"]
elem.data = obj["data"]
elem.scan_options = obj["scan_options"]
elem.created_at = obj["created_at"]
elem.updated_at = obj["updated_at"]
elem.task_id = obj["task_id"]
elem.associated_id = obj["associated_id"]
elem.category = obj["category"]
elem.label = obj["label"]
elem.tsv = obj["tsv"]
return elem
end
|
#nodes ⇒ Object
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
# File 'lib/cloudhouse_guardian/Account.rb', line 273
def nodes
obj = http_get("/api/v2/nodes.json")
the_list = NodeList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = Node.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.connection_manager_group_id = x["connection_manager_group_id"] if x.include?("connection_manager_group_id")
elem.external_id = x["external_id"] if x.include?("external_id")
elem.environment_id = x["environment_id"] if x.include?("environment_id")
elem.id = x["id"] if x.include?("id")
elem.ip_address = x["ip_address"] if x.include?("ip_address")
elem.last_scan_status = x["last_scan_status"] if x.include?("last_scan_status")
elem.last_scan_status_string = x["last_scan_status_string"] if x.include?("last_scan_status_string")
elem.mac_address = x["mac_address"] if x.include?("mac_address")
elem.medium_hostname = x["medium_hostname"] if x.include?("medium_hostname")
elem.medium_port = x["medium_port"] if x.include?("medium_port")
elem.medium_type = x["medium_type"] if x.include?("medium_type")
elem.medium_username = x["medium_username"] if x.include?("medium_username")
elem.name = x["name"] if x.include?("name")
elem.node_type = x["node_type"] if x.include?("node_type")
elem.online = x["online"] if x.include?("online")
elem.operating_system_family_id = x["operating_system_family_id"] if x.include?("operating_system_family_id")
elem.operating_system_id = x["operating_system_id"] if x.include?("operating_system_id")
elem.short_description = x["short_description"] if x.include?("short_description")
elem.medium_info.from_hash(x["medium_info"]) if x.include?("medium_info")
the_list << elem
end
return the_list
end
|
#operating_system_families ⇒ Object
389
390
391
392
393
394
395
396
397
398
399
|
# File 'lib/cloudhouse_guardian/Account.rb', line 389
def operating_system_families
obj = http_get("/api/v2/operating_system_families.json")
the_list = OperatingSystemFamilyList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = OperatingSystemFamily.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = x["id"] if x.include?("id")
elem.name = x["name"] if x.include?("name")
the_list << elem
end
return the_list
end
|
#operating_systems ⇒ Object
402
403
404
405
406
407
408
409
410
411
412
413
414
|
# File 'lib/cloudhouse_guardian/Account.rb', line 402
def operating_systems
obj = http_get("/api/v2/operating_systems.json")
the_list = OperatingSystemList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = OperatingSystem.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.id = x["id"] if x.include?("id")
elem.name = x["name"] if x.include?("name")
elem.operating_system_family_id = x["operating_system_family_id"] if x.include?("operating_system_family_id")
elem.description = x["description"] if x.include?("description")
the_list << elem
end
return the_list
end
|
#pluggables ⇒ Object
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
|
# File 'lib/cloudhouse_guardian/Account.rb', line 421
def pluggables
obj = http_get("/api/v2/pluggables.json")
the_list = PluggableList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = Pluggable.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.description = x["description"] if x.include?("description")
elem.id = x["id"] if x.include?("id")
elem.name = x["name"] if x.include?("name")
elem.operating_system_family = x["operating_system_family"] if x.include?("operating_system_family")
elem.operating_system_family_id = x["operating_system_family_id"] if x.include?("operating_system_family_id")
elem.script = x["script"] if x.include?("script")
the_list << elem
end
return the_list
end
|
#policies ⇒ Object
442
443
444
445
446
447
448
449
450
451
452
453
454
|
# File 'lib/cloudhouse_guardian/Account.rb', line 442
def policies
obj = http_get("/api/v2/policies.json")
the_list = PolicyList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = Policy.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.description = x["description"] if x.include?("description")
elem.id = x["id"] if x.include?("id")
elem.name = x["name"] if x.include?("name")
elem.short_description = x["short_description"] if x.include?("short_description")
the_list << elem
end
return the_list
end
|
#remove_user(email) ⇒ Object
545
546
547
548
549
|
# File 'lib/cloudhouse_guardian/Account.rb', line 545
def remove_user(email)
url = "/api/v2/users/remove.json?email=#{email}"
obj = http_put(url, nil)
return obj
end
|
#scheduled_jobs ⇒ Object
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
|
# File 'lib/cloudhouse_guardian/Account.rb', line 457
def scheduled_jobs
obj = http_get("/api/v2/scheduled_jobs.json")
the_list = ScheduledJobList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = ScheduledJob.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.data = x["data"] if x.include?("data")
elem.id = x["id"] if x.include?("id")
elem.source_id = x["source_id"] if x.include?("source_id")
elem.source_name = x["source_name"] if x.include?("source_name")
elem.source_type = x["source_type"] if x.include?("source_type")
elem.status = x["status"] if x.include?("status")
the_list << elem
end
return the_list
end
|
#system_metrics ⇒ Object
474
475
476
477
478
479
480
481
482
483
484
485
|
# File 'lib/cloudhouse_guardian/Account.rb', line 474
def system_metrics
obj = http_get("/api/v2/system_metrics.json")
the_list = SystemMetricList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = SystemMetric.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.metric = x["metric"] if x.include?("metric")
elem.value = x["value"] if x.include?("value")
elem.timestamp = x["timestamp"] if x.include?("timestamp")
the_list << elem
end
return the_list
end
|
#text_file_by_id(id) ⇒ Object
488
489
490
491
492
493
494
495
496
497
498
499
|
# File 'lib/cloudhouse_guardian/Account.rb', line 488
def text_file_by_id(id)
obj = http_get("/api/v2/text_files/#{id}.json")
elem = TextFile.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.category = obj["category"]
elem.checksum = obj["checksum"]
elem.created_at = obj["created_at"]
elem.data = obj["data"]
elem.id = obj["id"]
elem.name = obj["name"]
elem.updated_at = obj["updated_at"]
return elem
end
|
#to_hash ⇒ Object
15
16
17
18
19
20
|
# File 'lib/cloudhouse_guardian/Account.rb', line 15
def to_hash
h = {}
h['id'] = self.id
h['name'] = self.name
return h
end
|
#to_json(options = nil) ⇒ Object
21
22
23
24
|
# File 'lib/cloudhouse_guardian/Account.rb', line 21
def to_json(options = nil)
h = to_hash
return h.to_json(options)
end
|
#users ⇒ Object
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
|
# File 'lib/cloudhouse_guardian/Account.rb', line 502
def users
obj = http_get("/api/v2/users.json")
the_list = UserList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = User.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.email = x["email"] if x.include?("email")
elem.id = x["id"] if x.include?("id")
elem.last_sign_in_at = x["last_sign_in_at"] if x.include?("last_sign_in_at")
elem.name = x["name"] if x.include?("name")
elem.role = x["role"] if x.include?("role")
elem.surname = x["surname"] if x.include?("surname")
elem.external_id = x["external_id"] if x.include?("external_id")
the_list << elem
end
return the_list
end
|
#users_and_invitees ⇒ Object
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
|
# File 'lib/cloudhouse_guardian/Account.rb', line 520
def users_and_invitees
obj = http_get("/api/v2/users.json?invited=true")
the_list = UserList.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
obj.each do |x|
elem = User.new(self.appliance_url, self.appliance_api_key, self.sec_key, self.insecure)
elem.email = x["email"] if x.include?("email")
elem.expiry = x["expiry"] if x.include?("expiry")
elem.id = x["id"] if x.include?("id")
elem.invited = x["invited"] if x.include?("invited")
elem.last_sign_in_at = x["last_sign_in_at"] if x.include?("last_sign_in_at")
elem.name = x["name"] if x.include?("name")
elem.role = x["role"] if x.include?("role")
elem.surname = x["surname"] if x.include?("surname")
elem.external_id = x["external_id"] if x.include?("external_id")
the_list << elem
end
return the_list
end
|