Class: CtdDocumentation::Alert

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/ctd_documentation/models/alert.rb

Overview

Alert Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(resource_id = SKIP, id = SKIP, site_id = SKIP, is_qualified = SKIP, actionable_diffs = SKIP, actionable_suspicious_files = SKIP, actionable_information = SKIP, actionable_policies = SKIP, actionable_assets = SKIP, actionable_caps = SKIP, significant_indicators = SKIP, alert_indicators = SKIP, threat_type = SKIP, category_number = SKIP, category_name = SKIP, description = SKIP, network = SKIP, score = SKIP, severity_number = SKIP, severity_name = SKIP, resolution_number = SKIP, resolution_name = SKIP, resolved = SKIP, relevant = SKIP, protocol = SKIP, network_id = SKIP, story_id = SKIP, actionable_virtual_zones_names = SKIP, story_group_name = SKIP, timestamp = SKIP, last_updated = SKIP, type_number = SKIP, type_name = SKIP) ⇒ Alert

Returns a new instance of Alert.



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
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/ctd_documentation/models/alert.rb', line 228

def initialize(resource_id = SKIP,
               id = SKIP,
               site_id = SKIP,
               is_qualified = SKIP,
               actionable_diffs = SKIP,
               actionable_suspicious_files = SKIP,
               actionable_information = SKIP,
               actionable_policies = SKIP,
               actionable_assets = SKIP,
               actionable_caps = SKIP,
               significant_indicators = SKIP,
               alert_indicators = SKIP,
               threat_type = SKIP,
               category_number = SKIP,
               category_name = SKIP,
               description = SKIP,
               network = SKIP,
               score = SKIP,
               severity_number = SKIP,
               severity_name = SKIP,
               resolution_number = SKIP,
               resolution_name = SKIP,
               resolved = SKIP,
               relevant = SKIP,
               protocol = SKIP,
               network_id = SKIP,
               story_id = SKIP,
               actionable_virtual_zones_names = SKIP,
               story_group_name = SKIP,
               timestamp = SKIP,
               last_updated = SKIP,
               type_number = SKIP,
               type_name = SKIP)
  @resource_id = resource_id unless resource_id == SKIP
  @id = id unless id == SKIP
  @site_id = site_id unless site_id == SKIP
  @is_qualified = is_qualified unless is_qualified == SKIP
  @actionable_diffs = actionable_diffs unless actionable_diffs == SKIP
  unless actionable_suspicious_files == SKIP
    @actionable_suspicious_files =
      actionable_suspicious_files
  end
  @actionable_information = actionable_information unless actionable_information == SKIP
  @actionable_policies = actionable_policies unless actionable_policies == SKIP
  @actionable_assets = actionable_assets unless actionable_assets == SKIP
  @actionable_caps = actionable_caps unless actionable_caps == SKIP
  @significant_indicators = significant_indicators unless significant_indicators == SKIP
  @alert_indicators = alert_indicators unless alert_indicators == SKIP
  @threat_type = threat_type unless threat_type == SKIP
  @category_number = category_number unless category_number == SKIP
  @category_name = category_name unless category_name == SKIP
  @description = description unless description == SKIP
  @network = network unless network == SKIP
  @score = score unless score == SKIP
  @severity_number = severity_number unless severity_number == SKIP
  @severity_name = severity_name unless severity_name == SKIP
  @resolution_number = resolution_number unless resolution_number == SKIP
  @resolution_name = resolution_name unless resolution_name == SKIP
  @resolved = resolved unless resolved == SKIP
  @relevant = relevant unless relevant == SKIP
  @protocol = protocol unless protocol == SKIP
  @network_id = network_id unless network_id == SKIP
  @story_id = story_id unless story_id == SKIP
  unless actionable_virtual_zones_names == SKIP
    @actionable_virtual_zones_names =
      actionable_virtual_zones_names
  end
  @story_group_name = story_group_name unless story_group_name == SKIP
  @timestamp = timestamp unless timestamp == SKIP
  @last_updated = last_updated unless last_updated == SKIP
  @type_number = type_number unless type_number == SKIP
  @type_name = type_name unless type_name == SKIP
end

Instance Attribute Details

#actionable_assetsList of ActionableAsset

TODO: Write general description for this method

Returns:



46
47
48
# File 'lib/ctd_documentation/models/alert.rb', line 46

def actionable_assets
  @actionable_assets
end

#actionable_capsList of ActionableCap

TODO: Write general description for this method

Returns:



50
51
52
# File 'lib/ctd_documentation/models/alert.rb', line 50

def actionable_caps
  @actionable_caps
end

#actionable_diffsList of Actionable

TODO: Write general description for this method

Returns:



30
31
32
# File 'lib/ctd_documentation/models/alert.rb', line 30

def actionable_diffs
  @actionable_diffs
end

#actionable_informationList of ActionableInformation

TODO: Write general description for this method

Returns:



38
39
40
# File 'lib/ctd_documentation/models/alert.rb', line 38

def actionable_information
  @actionable_information
end

#actionable_policiesList of ActionablePolicy

TODO: Write general description for this method

Returns:



42
43
44
# File 'lib/ctd_documentation/models/alert.rb', line 42

def actionable_policies
  @actionable_policies
end

#actionable_suspicious_filesList of Actionable

TODO: Write general description for this method

Returns:



34
35
36
# File 'lib/ctd_documentation/models/alert.rb', line 34

def actionable_suspicious_files
  @actionable_suspicious_files
end

#actionable_virtual_zones_namesList of String

TODO: Write general description for this method

Returns:

  • (List of String)


122
123
124
# File 'lib/ctd_documentation/models/alert.rb', line 122

def actionable_virtual_zones_names
  @actionable_virtual_zones_names
end

#alert_indicatorsList of Indicators

TODO: Write general description for this method

Returns:



58
59
60
# File 'lib/ctd_documentation/models/alert.rb', line 58

def alert_indicators
  @alert_indicators
end

#category_nameString

TODO: Write general description for this method

Returns:

  • (String)


70
71
72
# File 'lib/ctd_documentation/models/alert.rb', line 70

def category_name
  @category_name
end

#category_numberInteger

TODO: Write general description for this method

Returns:

  • (Integer)


66
67
68
# File 'lib/ctd_documentation/models/alert.rb', line 66

def category_number
  @category_number
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


74
75
76
# File 'lib/ctd_documentation/models/alert.rb', line 74

def description
  @description
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


18
19
20
# File 'lib/ctd_documentation/models/alert.rb', line 18

def id
  @id
end

#is_qualifiedTrueClass|FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass|FalseClass)


26
27
28
# File 'lib/ctd_documentation/models/alert.rb', line 26

def is_qualified
  @is_qualified
end

#last_updatedString

TODO: Write general description for this method

Returns:

  • (String)


134
135
136
# File 'lib/ctd_documentation/models/alert.rb', line 134

def last_updated
  @last_updated
end

#networkNetwork

TODO: Write general description for this method

Returns:



78
79
80
# File 'lib/ctd_documentation/models/alert.rb', line 78

def network
  @network
end

#network_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


114
115
116
# File 'lib/ctd_documentation/models/alert.rb', line 114

def network_id
  @network_id
end

#protocolString

TODO: Write general description for this method

Returns:

  • (String)


110
111
112
# File 'lib/ctd_documentation/models/alert.rb', line 110

def protocol
  @protocol
end

#relevantTrueClass|FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass|FalseClass)


106
107
108
# File 'lib/ctd_documentation/models/alert.rb', line 106

def relevant
  @relevant
end

#resolution_nameString

TODO: Write general description for this method

Returns:

  • (String)


98
99
100
# File 'lib/ctd_documentation/models/alert.rb', line 98

def resolution_name
  @resolution_name
end

#resolution_numberInteger

TODO: Write general description for this method

Returns:

  • (Integer)


94
95
96
# File 'lib/ctd_documentation/models/alert.rb', line 94

def resolution_number
  @resolution_number
end

#resolvedTrueClass|FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass|FalseClass)


102
103
104
# File 'lib/ctd_documentation/models/alert.rb', line 102

def resolved
  @resolved
end

#resource_idString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/ctd_documentation/models/alert.rb', line 14

def resource_id
  @resource_id
end

#scoreInteger

TODO: Write general description for this method

Returns:

  • (Integer)


82
83
84
# File 'lib/ctd_documentation/models/alert.rb', line 82

def score
  @score
end

#severity_nameString

TODO: Write general description for this method

Returns:

  • (String)


90
91
92
# File 'lib/ctd_documentation/models/alert.rb', line 90

def severity_name
  @severity_name
end

#severity_numberInteger

TODO: Write general description for this method

Returns:

  • (Integer)


86
87
88
# File 'lib/ctd_documentation/models/alert.rb', line 86

def severity_number
  @severity_number
end

#significant_indicatorsList of Indicators

TODO: Write general description for this method

Returns:



54
55
56
# File 'lib/ctd_documentation/models/alert.rb', line 54

def significant_indicators
  @significant_indicators
end

#site_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


22
23
24
# File 'lib/ctd_documentation/models/alert.rb', line 22

def site_id
  @site_id
end

#story_group_nameList of String

TODO: Write general description for this method

Returns:

  • (List of String)


126
127
128
# File 'lib/ctd_documentation/models/alert.rb', line 126

def story_group_name
  @story_group_name
end

#story_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


118
119
120
# File 'lib/ctd_documentation/models/alert.rb', line 118

def story_id
  @story_id
end

#threat_typeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


62
63
64
# File 'lib/ctd_documentation/models/alert.rb', line 62

def threat_type
  @threat_type
end

#timestampString

TODO: Write general description for this method

Returns:

  • (String)


130
131
132
# File 'lib/ctd_documentation/models/alert.rb', line 130

def timestamp
  @timestamp
end

#type_nameString

TODO: Write general description for this method

Returns:

  • (String)


142
143
144
# File 'lib/ctd_documentation/models/alert.rb', line 142

def type_name
  @type_name
end

#type_numberInteger

TODO: Write general description for this method

Returns:

  • (Integer)


138
139
140
# File 'lib/ctd_documentation/models/alert.rb', line 138

def type_number
  @type_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/ctd_documentation/models/alert.rb', line 303

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  resource_id = hash.key?('resource_id') ? hash['resource_id'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  is_qualified = hash.key?('is_qualified') ? hash['is_qualified'] : SKIP
  # Parameter is an array, so we need to iterate through it
  actionable_diffs = nil
  unless hash['actionable_diffs'].nil?
    actionable_diffs = []
    hash['actionable_diffs'].each do |structure|
      actionable_diffs << (Actionable.from_hash(structure) if structure)
    end
  end

  actionable_diffs = SKIP unless hash.key?('actionable_diffs')
  # Parameter is an array, so we need to iterate through it
  actionable_suspicious_files = nil
  unless hash['actionable_suspicious_files'].nil?
    actionable_suspicious_files = []
    hash['actionable_suspicious_files'].each do |structure|
      actionable_suspicious_files << (Actionable.from_hash(structure) if structure)
    end
  end

  actionable_suspicious_files = SKIP unless hash.key?('actionable_suspicious_files')
  # Parameter is an array, so we need to iterate through it
  actionable_information = nil
  unless hash['actionable_information'].nil?
    actionable_information = []
    hash['actionable_information'].each do |structure|
      actionable_information << (ActionableInformation.from_hash(structure) if structure)
    end
  end

  actionable_information = SKIP unless hash.key?('actionable_information')
  # Parameter is an array, so we need to iterate through it
  actionable_policies = nil
  unless hash['actionable_policies'].nil?
    actionable_policies = []
    hash['actionable_policies'].each do |structure|
      actionable_policies << (ActionablePolicy.from_hash(structure) if structure)
    end
  end

  actionable_policies = SKIP unless hash.key?('actionable_policies')
  # Parameter is an array, so we need to iterate through it
  actionable_assets = nil
  unless hash['actionable_assets'].nil?
    actionable_assets = []
    hash['actionable_assets'].each do |structure|
      actionable_assets << (ActionableAsset.from_hash(structure) if structure)
    end
  end

  actionable_assets = SKIP unless hash.key?('actionable_assets')
  # Parameter is an array, so we need to iterate through it
  actionable_caps = nil
  unless hash['actionable_caps'].nil?
    actionable_caps = []
    hash['actionable_caps'].each do |structure|
      actionable_caps << (ActionableCap.from_hash(structure) if structure)
    end
  end

  actionable_caps = SKIP unless hash.key?('actionable_caps')
  # Parameter is an array, so we need to iterate through it
  significant_indicators = nil
  unless hash['significant_indicators'].nil?
    significant_indicators = []
    hash['significant_indicators'].each do |structure|
      significant_indicators << (Indicators.from_hash(structure) if structure)
    end
  end

  significant_indicators = SKIP unless hash.key?('significant_indicators')
  # Parameter is an array, so we need to iterate through it
  alert_indicators = nil
  unless hash['alert_indicators'].nil?
    alert_indicators = []
    hash['alert_indicators'].each do |structure|
      alert_indicators << (Indicators.from_hash(structure) if structure)
    end
  end

  alert_indicators = SKIP unless hash.key?('alert_indicators')
  threat_type = hash.key?('threat_type') ? hash['threat_type'] : SKIP
  category_number =
    hash.key?('category_number') ? hash['category_number'] : SKIP
  category_name = hash.key?('category_name') ? hash['category_name'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  network = Network.from_hash(hash['network']) if hash['network']
  score = hash.key?('score') ? hash['score'] : SKIP
  severity_number =
    hash.key?('severity_number') ? hash['severity_number'] : SKIP
  severity_name = hash.key?('severity_name') ? hash['severity_name'] : SKIP
  resolution_number =
    hash.key?('resolution_number') ? hash['resolution_number'] : SKIP
  resolution_name =
    hash.key?('resolution_name') ? hash['resolution_name'] : SKIP
  resolved = hash.key?('resolved') ? hash['resolved'] : SKIP
  relevant = hash.key?('relevant') ? hash['relevant'] : SKIP
  protocol = hash.key?('protocol') ? hash['protocol'] : SKIP
  network_id = hash.key?('network_id') ? hash['network_id'] : SKIP
  story_id = hash.key?('story_id') ? hash['story_id'] : SKIP
  actionable_virtual_zones_names =
    hash.key?('actionable_virtual_zones_names') ? hash['actionable_virtual_zones_names'] : SKIP
  story_group_name =
    hash.key?('story_group_name') ? hash['story_group_name'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  last_updated = hash.key?('last_updated') ? hash['last_updated'] : SKIP
  type_number = hash.key?('type_number') ? hash['type_number'] : SKIP
  type_name = hash.key?('type_name') ? hash['type_name'] : SKIP

  # Create object from extracted values.
  Alert.new(resource_id,
            id,
            site_id,
            is_qualified,
            actionable_diffs,
            actionable_suspicious_files,
            actionable_information,
            actionable_policies,
            actionable_assets,
            actionable_caps,
            significant_indicators,
            alert_indicators,
            threat_type,
            category_number,
            category_name,
            description,
            network,
            score,
            severity_number,
            severity_name,
            resolution_number,
            resolution_name,
            resolved,
            relevant,
            protocol,
            network_id,
            story_id,
            actionable_virtual_zones_names,
            story_group_name,
            timestamp,
            last_updated,
            type_number,
            type_name)
end

.namesObject

A mapping from model property names to API property names.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/ctd_documentation/models/alert.rb', line 145

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['resource_id'] = 'resource_id'
  @_hash['id'] = 'id'
  @_hash['site_id'] = 'site_id'
  @_hash['is_qualified'] = 'is_qualified'
  @_hash['actionable_diffs'] = 'actionable_diffs'
  @_hash['actionable_suspicious_files'] = 'actionable_suspicious_files'
  @_hash['actionable_information'] = 'actionable_information'
  @_hash['actionable_policies'] = 'actionable_policies'
  @_hash['actionable_assets'] = 'actionable_assets'
  @_hash['actionable_caps'] = 'actionable_caps'
  @_hash['significant_indicators'] = 'significant_indicators'
  @_hash['alert_indicators'] = 'alert_indicators'
  @_hash['threat_type'] = 'threat_type'
  @_hash['category_number'] = 'category_number'
  @_hash['category_name'] = 'category_name'
  @_hash['description'] = 'description'
  @_hash['network'] = 'network'
  @_hash['score'] = 'score'
  @_hash['severity_number'] = 'severity_number'
  @_hash['severity_name'] = 'severity_name'
  @_hash['resolution_number'] = 'resolution_number'
  @_hash['resolution_name'] = 'resolution_name'
  @_hash['resolved'] = 'resolved'
  @_hash['relevant'] = 'relevant'
  @_hash['protocol'] = 'protocol'
  @_hash['network_id'] = 'network_id'
  @_hash['story_id'] = 'story_id'
  @_hash['actionable_virtual_zones_names'] =
    'actionable_virtual_zones_names'
  @_hash['story_group_name'] = 'story_group_name'
  @_hash['timestamp'] = 'timestamp'
  @_hash['last_updated'] = 'last_updated'
  @_hash['type_number'] = 'type_number'
  @_hash['type_name'] = 'type_name'
  @_hash
end

.nullablesObject

An array for nullable fields



224
225
226
# File 'lib/ctd_documentation/models/alert.rb', line 224

def self.nullables
  []
end

.optionalsObject

An array for optional fields



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/ctd_documentation/models/alert.rb', line 185

def self.optionals
  %w[
    resource_id
    id
    site_id
    is_qualified
    actionable_diffs
    actionable_suspicious_files
    actionable_information
    actionable_policies
    actionable_assets
    actionable_caps
    significant_indicators
    alert_indicators
    threat_type
    category_number
    category_name
    description
    network
    score
    severity_number
    severity_name
    resolution_number
    resolution_name
    resolved
    relevant
    protocol
    network_id
    story_id
    actionable_virtual_zones_names
    story_group_name
    timestamp
    last_updated
    type_number
    type_name
  ]
end