Class: Falcon::ApimodelsRule

Inherits:
Object
  • Object
show all
Defined in:
lib/crimson-falcon/models/apimodels_rule.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ApimodelsRule

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
301
302
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
454
455
456
457
458
459
460
461
462
463
464
465
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 251

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Falcon::ApimodelsRule` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Falcon::ApimodelsRule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'alert_info')
    self.alert_info = attributes[:'alert_info']
  end

  if attributes.key?(:'attack_types')
    if (value = attributes[:'attack_types']).is_a?(Array)
      self.attack_types = value
    end
  end

  if attributes.key?(:'auto_remediable')
    self.auto_remediable = attributes[:'auto_remediable']
  end

  if attributes.key?(:'category')
    self.category = attributes[:'category']
  end

  if attributes.key?(:'cid')
    self.cid = attributes[:'cid']
  end

  if attributes.key?(:'cloneable')
    self.cloneable = attributes[:'cloneable']
  end

  if attributes.key?(:'controls')
    if (value = attributes[:'controls']).is_a?(Array)
      self.controls = value
    end
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end

  if attributes.key?(:'created_by')
    self.created_by = attributes[:'created_by']
  end

  if attributes.key?(:'custom_configuration')
    self.custom_configuration = attributes[:'custom_configuration']
  end

  if attributes.key?(:'deleted_at')
    self.deleted_at = attributes[:'deleted_at']
  end

  if attributes.key?(:'deleted_by')
    self.deleted_by = attributes[:'deleted_by']
  end

  if attributes.key?(:'deprecated')
    self.deprecated = attributes[:'deprecated']
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'domain')
    self.domain = attributes[:'domain']
  end

  if attributes.key?(:'logic')
    self.logic = attributes[:'logic']
  end

  if attributes.key?(:'logic_format')
    self.logic_format = attributes[:'logic_format']
  end

  if attributes.key?(:'mitre_tactics_id')
    self.mitre_tactics_id = attributes[:'mitre_tactics_id']
  end

  if attributes.key?(:'mitre_tactics_name')
    self.mitre_tactics_name = attributes[:'mitre_tactics_name']
  end

  if attributes.key?(:'mitre_tactics_url')
    self.mitre_tactics_url = attributes[:'mitre_tactics_url']
  end

  if attributes.key?(:'mitre_techniques_id')
    self.mitre_techniques_id = attributes[:'mitre_techniques_id']
  end

  if attributes.key?(:'mitre_techniques_name')
    self.mitre_techniques_name = attributes[:'mitre_techniques_name']
  end

  if attributes.key?(:'mitre_techniques_url')
    self.mitre_techniques_url = attributes[:'mitre_techniques_url']
  end

  if attributes.key?(:'mutable')
    self.mutable = attributes[:'mutable']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'origin')
    self.origin = attributes[:'origin']
  end

  if attributes.key?(:'overrides')
    if (value = attributes[:'overrides']).is_a?(Array)
      self.overrides = value
    end
  end

  if attributes.key?(:'parent_rule__pk')
    self.parent_rule__pk = attributes[:'parent_rule__pk']
  end

  if attributes.key?(:'parent_rule_short_code')
    self.parent_rule_short_code = attributes[:'parent_rule_short_code']
  end

  if attributes.key?(:'parent_rule_short_uuid')
    self.parent_rule_short_uuid = attributes[:'parent_rule_short_uuid']
  end

  if attributes.key?(:'platform')
    self.platform = attributes[:'platform']
  end

  if attributes.key?(:'provider')
    self.provider = attributes[:'provider']
  end

  if attributes.key?(:'remediation')
    self.remediation = attributes[:'remediation']
  end

  if attributes.key?(:'remediation_url')
    self.remediation_url = attributes[:'remediation_url']
  end

  if attributes.key?(:'resource_metadata')
    self. = attributes[:'resource_metadata']
  end

  if attributes.key?(:'resource_types')
    if (value = attributes[:'resource_types']).is_a?(Array)
      self.resource_types = value
    end
  end

  if attributes.key?(:'revision')
    self.revision = attributes[:'revision']
  end

  if attributes.key?(:'rule_logic_list')
    if (value = attributes[:'rule_logic_list']).is_a?(Array)
      self.rule_logic_list = value
    end
  end

  if attributes.key?(:'scope_asset_filter')
    self.scope_asset_filter = attributes[:'scope_asset_filter']
  end

  if attributes.key?(:'scope_type')
    self.scope_type = attributes[:'scope_type']
  end

  if attributes.key?(:'severity')
    self.severity = attributes[:'severity']
  end

  if attributes.key?(:'short_code')
    self.short_code = attributes[:'short_code']
  end

  if attributes.key?(:'subdomain')
    self.subdomain = attributes[:'subdomain']
  end

  if attributes.key?(:'update_reason')
    self.update_reason = attributes[:'update_reason']
  end

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  end

  if attributes.key?(:'updated_by')
    self.updated_by = attributes[:'updated_by']
  end

  if attributes.key?(:'uuid')
    self.uuid = attributes[:'uuid']
  end

  if attributes.key?(:'visible')
    self.visible = attributes[:'visible']
  end
end

Instance Attribute Details

#alert_infoObject

Returns the value of attribute alert_info.



34
35
36
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 34

def alert_info
  @alert_info
end

#attack_typesObject

Returns the value of attribute attack_types.



36
37
38
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 36

def attack_types
  @attack_types
end

#auto_remediableObject

Returns the value of attribute auto_remediable.



38
39
40
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 38

def auto_remediable
  @auto_remediable
end

#categoryObject

Returns the value of attribute category.



40
41
42
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 40

def category
  @category
end

#cidObject

Returns the value of attribute cid.



42
43
44
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 42

def cid
  @cid
end

#cloneableObject

Returns the value of attribute cloneable.



44
45
46
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 44

def cloneable
  @cloneable
end

#controlsObject

Returns the value of attribute controls.



46
47
48
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 46

def controls
  @controls
end

#created_atObject

Returns the value of attribute created_at.



48
49
50
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 48

def created_at
  @created_at
end

#created_byObject

Returns the value of attribute created_by.



50
51
52
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 50

def created_by
  @created_by
end

#custom_configurationObject

Returns the value of attribute custom_configuration.



52
53
54
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 52

def custom_configuration
  @custom_configuration
end

#deleted_atObject

Returns the value of attribute deleted_at.



54
55
56
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 54

def deleted_at
  @deleted_at
end

#deleted_byObject

Returns the value of attribute deleted_by.



56
57
58
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 56

def deleted_by
  @deleted_by
end

#deprecatedObject

Returns the value of attribute deprecated.



58
59
60
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 58

def deprecated
  @deprecated
end

#descriptionObject

Returns the value of attribute description.



60
61
62
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 60

def description
  @description
end

#domainObject

Returns the value of attribute domain.



62
63
64
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 62

def domain
  @domain
end

#logicObject

Returns the value of attribute logic.



64
65
66
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 64

def logic
  @logic
end

#logic_formatObject

Returns the value of attribute logic_format.



66
67
68
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 66

def logic_format
  @logic_format
end

#mitre_tactics_idObject

Returns the value of attribute mitre_tactics_id.



68
69
70
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 68

def mitre_tactics_id
  @mitre_tactics_id
end

#mitre_tactics_nameObject

Returns the value of attribute mitre_tactics_name.



70
71
72
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 70

def mitre_tactics_name
  @mitre_tactics_name
end

#mitre_tactics_urlObject

Returns the value of attribute mitre_tactics_url.



72
73
74
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 72

def mitre_tactics_url
  @mitre_tactics_url
end

#mitre_techniques_idObject

Returns the value of attribute mitre_techniques_id.



74
75
76
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 74

def mitre_techniques_id
  @mitre_techniques_id
end

#mitre_techniques_nameObject

Returns the value of attribute mitre_techniques_name.



76
77
78
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 76

def mitre_techniques_name
  @mitre_techniques_name
end

#mitre_techniques_urlObject

Returns the value of attribute mitre_techniques_url.



78
79
80
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 78

def mitre_techniques_url
  @mitre_techniques_url
end

#mutableObject

Returns the value of attribute mutable.



80
81
82
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 80

def mutable
  @mutable
end

#nameObject

Returns the value of attribute name.



82
83
84
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 82

def name
  @name
end

#originObject

Returns the value of attribute origin.



84
85
86
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 84

def origin
  @origin
end

#overridesObject

Returns the value of attribute overrides.



86
87
88
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 86

def overrides
  @overrides
end

#parent_rule__pkObject

Returns the value of attribute parent_rule__pk.



88
89
90
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 88

def parent_rule__pk
  @parent_rule__pk
end

#parent_rule_short_codeObject

Returns the value of attribute parent_rule_short_code.



90
91
92
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 90

def parent_rule_short_code
  @parent_rule_short_code
end

#parent_rule_short_uuidObject

Returns the value of attribute parent_rule_short_uuid.



92
93
94
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 92

def parent_rule_short_uuid
  @parent_rule_short_uuid
end

#platformObject

Returns the value of attribute platform.



94
95
96
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 94

def platform
  @platform
end

#providerObject

Returns the value of attribute provider.



96
97
98
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 96

def provider
  @provider
end

#remediationObject

Returns the value of attribute remediation.



98
99
100
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 98

def remediation
  @remediation
end

#remediation_urlObject

Returns the value of attribute remediation_url.



100
101
102
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 100

def remediation_url
  @remediation_url
end

#resource_metadataObject

Returns the value of attribute resource_metadata.



102
103
104
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 102

def 
  @resource_metadata
end

#resource_typesObject

Returns the value of attribute resource_types.



104
105
106
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 104

def resource_types
  @resource_types
end

#revisionObject

Returns the value of attribute revision.



106
107
108
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 106

def revision
  @revision
end

#rule_logic_listObject

Returns the value of attribute rule_logic_list.



108
109
110
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 108

def rule_logic_list
  @rule_logic_list
end

#scope_asset_filterObject

Returns the value of attribute scope_asset_filter.



110
111
112
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 110

def scope_asset_filter
  @scope_asset_filter
end

#scope_typeObject

Returns the value of attribute scope_type.



112
113
114
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 112

def scope_type
  @scope_type
end

#severityObject

Returns the value of attribute severity.



114
115
116
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 114

def severity
  @severity
end

#short_codeObject

Returns the value of attribute short_code.



116
117
118
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 116

def short_code
  @short_code
end

#subdomainObject

Returns the value of attribute subdomain.



118
119
120
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 118

def subdomain
  @subdomain
end

#update_reasonObject

Returns the value of attribute update_reason.



120
121
122
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 120

def update_reason
  @update_reason
end

#updated_atObject

Returns the value of attribute updated_at.



122
123
124
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 122

def updated_at
  @updated_at
end

#updated_byObject

Returns the value of attribute updated_by.



124
125
126
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 124

def updated_by
  @updated_by
end

#uuidObject

Returns the value of attribute uuid.



126
127
128
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 126

def uuid
  @uuid
end

#visibleObject

Returns the value of attribute visible.



128
129
130
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 128

def visible
  @visible
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



185
186
187
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 185

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
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/crimson-falcon/models/apimodels_rule.rb', line 131

def self.attribute_map
  {
    :'alert_info' => :'alert_info',
    :'attack_types' => :'attack_types',
    :'auto_remediable' => :'auto_remediable',
    :'category' => :'category',
    :'cid' => :'cid',
    :'cloneable' => :'cloneable',
    :'controls' => :'controls',
    :'created_at' => :'created_at',
    :'created_by' => :'created_by',
    :'custom_configuration' => :'custom_configuration',
    :'deleted_at' => :'deleted_at',
    :'deleted_by' => :'deleted_by',
    :'deprecated' => :'deprecated',
    :'description' => :'description',
    :'domain' => :'domain',
    :'logic' => :'logic',
    :'logic_format' => :'logic_format',
    :'mitre_tactics_id' => :'mitre_tactics_id',
    :'mitre_tactics_name' => :'mitre_tactics_name',
    :'mitre_tactics_url' => :'mitre_tactics_url',
    :'mitre_techniques_id' => :'mitre_techniques_id',
    :'mitre_techniques_name' => :'mitre_techniques_name',
    :'mitre_techniques_url' => :'mitre_techniques_url',
    :'mutable' => :'mutable',
    :'name' => :'name',
    :'origin' => :'origin',
    :'overrides' => :'overrides',
    :'parent_rule__pk' => :'parent_rule__pk',
    :'parent_rule_short_code' => :'parent_rule_short_code',
    :'parent_rule_short_uuid' => :'parent_rule_short_uuid',
    :'platform' => :'platform',
    :'provider' => :'provider',
    :'remediation' => :'remediation',
    :'remediation_url' => :'remediation_url',
    :'resource_metadata' => :'resource_metadata',
    :'resource_types' => :'resource_types',
    :'revision' => :'revision',
    :'rule_logic_list' => :'rule_logic_list',
    :'scope_asset_filter' => :'scope_asset_filter',
    :'scope_type' => :'scope_type',
    :'severity' => :'severity',
    :'short_code' => :'short_code',
    :'subdomain' => :'subdomain',
    :'update_reason' => :'update_reason',
    :'updated_at' => :'updated_at',
    :'updated_by' => :'updated_by',
    :'uuid' => :'uuid',
    :'visible' => :'visible'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



685
686
687
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 685

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



244
245
246
247
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 244

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 190

def self.openapi_types
  {
    :'alert_info' => :'String',
    :'attack_types' => :'Array<String>',
    :'auto_remediable' => :'Boolean',
    :'category' => :'String',
    :'cid' => :'String',
    :'cloneable' => :'Boolean',
    :'controls' => :'Array<ApimodelsControl>',
    :'created_at' => :'Time',
    :'created_by' => :'String',
    :'custom_configuration' => :'Object',
    :'deleted_at' => :'Time',
    :'deleted_by' => :'String',
    :'deprecated' => :'Boolean',
    :'description' => :'String',
    :'domain' => :'String',
    :'logic' => :'String',
    :'logic_format' => :'String',
    :'mitre_tactics_id' => :'String',
    :'mitre_tactics_name' => :'String',
    :'mitre_tactics_url' => :'String',
    :'mitre_techniques_id' => :'String',
    :'mitre_techniques_name' => :'String',
    :'mitre_techniques_url' => :'String',
    :'mutable' => :'String',
    :'name' => :'String',
    :'origin' => :'String',
    :'overrides' => :'Array<ApimodelsRuleOverride>',
    :'parent_rule__pk' => :'Integer',
    :'parent_rule_short_code' => :'Integer',
    :'parent_rule_short_uuid' => :'String',
    :'platform' => :'String',
    :'provider' => :'String',
    :'remediation' => :'String',
    :'remediation_url' => :'String',
    :'resource_metadata' => :'String',
    :'resource_types' => :'Array<ApimodelsResourceType>',
    :'revision' => :'Integer',
    :'rule_logic_list' => :'Array<ApimodelsRuleLogic>',
    :'scope_asset_filter' => :'ApimodelsAssetFilter',
    :'scope_type' => :'String',
    :'severity' => :'Integer',
    :'short_code' => :'Integer',
    :'subdomain' => :'String',
    :'update_reason' => :'String',
    :'updated_at' => :'Time',
    :'updated_by' => :'String',
    :'uuid' => :'String',
    :'visible' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 617

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      alert_info == o.alert_info &&
      attack_types == o.attack_types &&
      auto_remediable == o.auto_remediable &&
      category == o.category &&
      cid == o.cid &&
      cloneable == o.cloneable &&
      controls == o.controls &&
      created_at == o.created_at &&
      created_by == o.created_by &&
      custom_configuration == o.custom_configuration &&
      deleted_at == o.deleted_at &&
      deleted_by == o.deleted_by &&
      deprecated == o.deprecated &&
      description == o.description &&
      domain == o.domain &&
      logic == o.logic &&
      logic_format == o.logic_format &&
      mitre_tactics_id == o.mitre_tactics_id &&
      mitre_tactics_name == o.mitre_tactics_name &&
      mitre_tactics_url == o.mitre_tactics_url &&
      mitre_techniques_id == o.mitre_techniques_id &&
      mitre_techniques_name == o.mitre_techniques_name &&
      mitre_techniques_url == o.mitre_techniques_url &&
      mutable == o.mutable &&
      name == o.name &&
      origin == o.origin &&
      overrides == o.overrides &&
      parent_rule__pk == o.parent_rule__pk &&
      parent_rule_short_code == o.parent_rule_short_code &&
      parent_rule_short_uuid == o.parent_rule_short_uuid &&
      platform == o.platform &&
      provider == o.provider &&
      remediation == o.remediation &&
      remediation_url == o.remediation_url &&
       == o. &&
      resource_types == o.resource_types &&
      revision == o.revision &&
      rule_logic_list == o.rule_logic_list &&
      scope_asset_filter == o.scope_asset_filter &&
      scope_type == o.scope_type &&
      severity == o.severity &&
      short_code == o.short_code &&
      subdomain == o.subdomain &&
      update_reason == o.update_reason &&
      updated_at == o.updated_at &&
      updated_by == o.updated_by &&
      uuid == o.uuid &&
      visible == o.visible
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 716

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Falcon.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



787
788
789
790
791
792
793
794
795
796
797
798
799
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 787

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 692

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


672
673
674
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 672

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



678
679
680
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 678

def hash
  [alert_info, attack_types, auto_remediable, category, cid, cloneable, controls, created_at, created_by, custom_configuration, deleted_at, deleted_by, deprecated, description, domain, logic, logic_format, mitre_tactics_id, mitre_tactics_name, mitre_tactics_url, mitre_techniques_id, mitre_techniques_name, mitre_techniques_url, mutable, name, origin, overrides, parent_rule__pk, parent_rule_short_code, parent_rule_short_uuid, platform, provider, remediation, remediation_url, , resource_types, revision, rule_logic_list, scope_asset_filter, scope_type, severity, short_code, subdomain, update_reason, updated_at, updated_by, uuid, visible].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 469

def list_invalid_properties
  invalid_properties = Array.new
  if @alert_info.nil?
    invalid_properties.push('invalid value for "alert_info", alert_info cannot be nil.')
  end

  if @auto_remediable.nil?
    invalid_properties.push('invalid value for "auto_remediable", auto_remediable cannot be nil.')
  end

  if @cid.nil?
    invalid_properties.push('invalid value for "cid", cid cannot be nil.')
  end

  if @cloneable.nil?
    invalid_properties.push('invalid value for "cloneable", cloneable cannot be nil.')
  end

  if @controls.nil?
    invalid_properties.push('invalid value for "controls", controls cannot be nil.')
  end

  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  if @created_by.nil?
    invalid_properties.push('invalid value for "created_by", created_by cannot be nil.')
  end

  if @description.nil?
    invalid_properties.push('invalid value for "description", description cannot be nil.')
  end

  if @domain.nil?
    invalid_properties.push('invalid value for "domain", domain cannot be nil.')
  end

  if @mitre_tactics_id.nil?
    invalid_properties.push('invalid value for "mitre_tactics_id", mitre_tactics_id cannot be nil.')
  end

  if @mitre_tactics_name.nil?
    invalid_properties.push('invalid value for "mitre_tactics_name", mitre_tactics_name cannot be nil.')
  end

  if @mitre_tactics_url.nil?
    invalid_properties.push('invalid value for "mitre_tactics_url", mitre_tactics_url cannot be nil.')
  end

  if @mitre_techniques_id.nil?
    invalid_properties.push('invalid value for "mitre_techniques_id", mitre_techniques_id cannot be nil.')
  end

  if @mitre_techniques_name.nil?
    invalid_properties.push('invalid value for "mitre_techniques_name", mitre_techniques_name cannot be nil.')
  end

  if @mitre_techniques_url.nil?
    invalid_properties.push('invalid value for "mitre_techniques_url", mitre_techniques_url cannot be nil.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @origin.nil?
    invalid_properties.push('invalid value for "origin", origin cannot be nil.')
  end

  if @overrides.nil?
    invalid_properties.push('invalid value for "overrides", overrides cannot be nil.')
  end

  if @provider.nil?
    invalid_properties.push('invalid value for "provider", provider cannot be nil.')
  end

  if @remediation.nil?
    invalid_properties.push('invalid value for "remediation", remediation cannot be nil.')
  end

  if @resource_types.nil?
    invalid_properties.push('invalid value for "resource_types", resource_types cannot be nil.')
  end

  if @rule_logic_list.nil?
    invalid_properties.push('invalid value for "rule_logic_list", rule_logic_list cannot be nil.')
  end

  if @scope_type.nil?
    invalid_properties.push('invalid value for "scope_type", scope_type cannot be nil.')
  end

  if @severity.nil?
    invalid_properties.push('invalid value for "severity", severity cannot be nil.')
  end

  if @short_code.nil?
    invalid_properties.push('invalid value for "short_code", short_code cannot be nil.')
  end

  if @subdomain.nil?
    invalid_properties.push('invalid value for "subdomain", subdomain cannot be nil.')
  end

  if @uuid.nil?
    invalid_properties.push('invalid value for "uuid", uuid cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



763
764
765
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 763

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



769
770
771
772
773
774
775
776
777
778
779
780
781
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 769

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



757
758
759
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 757

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/crimson-falcon/models/apimodels_rule.rb', line 584

def valid?
  return false if @alert_info.nil?
  return false if @auto_remediable.nil?
  return false if @cid.nil?
  return false if @cloneable.nil?
  return false if @controls.nil?
  return false if @created_at.nil?
  return false if @created_by.nil?
  return false if @description.nil?
  return false if @domain.nil?
  return false if @mitre_tactics_id.nil?
  return false if @mitre_tactics_name.nil?
  return false if @mitre_tactics_url.nil?
  return false if @mitre_techniques_id.nil?
  return false if @mitre_techniques_name.nil?
  return false if @mitre_techniques_url.nil?
  return false if @name.nil?
  return false if @origin.nil?
  return false if @overrides.nil?
  return false if @provider.nil?
  return false if @remediation.nil?
  return false if @resource_types.nil?
  return false if @rule_logic_list.nil?
  return false if @scope_type.nil?
  return false if @severity.nil?
  return false if @short_code.nil?
  return false if @subdomain.nil?
  return false if @uuid.nil?
  true
end