Class: Falcon::ItautomationTaskExecution

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ItautomationTaskExecution

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
222
223
224
225
226
227
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
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 186

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Falcon::ItautomationTaskExecution` 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::ItautomationTaskExecution`. 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?(:'composite_query')
    self.composite_query = attributes[:'composite_query']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#composite_queryObject

Returns the value of attribute composite_query.



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

def composite_query
  @composite_query
end

#discover_new_hostsObject

Whether to discover new hosts for the scheduled task. Example: true



37
38
39
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 37

def discover_new_hosts
  @discover_new_hosts
end

#discover_offline_hostsObject

Whether to discover offline hosts for the scheduled task. Example: true



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

def discover_offline_hosts
  @discover_offline_hosts
end

#distributeObject

Whether to distribute the scheduled task. Example: true



43
44
45
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 43

def distribute
  @distribute
end

#execution_argsObject

Key-value pairs of argument values to pass when executing the task. Example: ‘abc123’, ‘region’: ‘us-east-1’



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

def execution_args
  @execution_args
end

#expiration_intervalObject

Duration for which the task stays active. Once expired, new and offline hosts won’t be targeted. Example: 1m



49
50
51
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 49

def expiration_interval
  @expiration_interval
end

#guardrailsObject

Returns the value of attribute guardrails.



51
52
53
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 51

def guardrails
  @guardrails
end

#idObject

Unique identifier for the task execution. Example: f64b95555ef54ea682619ce880d267cc



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

def id
  @id
end

#os_queryObject

OSQuery to execute. Example: select * from users



57
58
59
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 57

def os_query
  @os_query
end

#platformsObject

List of supported platforms. Example: [‘Windows’, ‘Linux’, ‘Mac’]



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

def platforms
  @platforms
end

#queriesObject

Returns the value of attribute queries.



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

def queries
  @queries
end

#remediationsObject

Returns the value of attribute remediations.



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

def remediations
  @remediations
end

#run_byObject

Username/api client name of who initiated the execution. Example: john.smith@crowdstrike.com



67
68
69
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 67

def run_by
  @run_by
end

#run_typeObject

Type of execution. Example: OnDemand



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

def run_type
  @run_type
end

#status_by_stageObject

Returns the value of attribute status_by_stage.



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

def status_by_stage
  @status_by_stage
end

#targetObject

Target filter in FQL format. Example: platform_name: ‘Windows’



75
76
77
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 75

def target
  @target
end

#task_idObject

ID of the task execution. Example: b533b64eed8a49a8aad84a0b82983939



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

def task_id
  @task_id
end

#task_nameObject

Name of the task execution. Example: OSQuery Check



81
82
83
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 81

def task_name
  @task_name
end

#task_parametersObject

Parameters for the task



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

def task_parameters
  @task_parameters
end

#task_typeObject

Type of task execution.



87
88
89
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 87

def task_type
  @task_type
end

#trigger_conditionObject

Conditions that trigger remediation scripts



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

def trigger_condition
  @trigger_condition
end

#verification_conditionObject

Conditions that verify action tasks



93
94
95
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 93

def verification_condition
  @verification_condition
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



146
147
148
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 146

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 118

def self.attribute_map
  {
    :'composite_query' => :'composite_query',
    :'discover_new_hosts' => :'discover_new_hosts',
    :'discover_offline_hosts' => :'discover_offline_hosts',
    :'distribute' => :'distribute',
    :'execution_args' => :'execution_args',
    :'expiration_interval' => :'expiration_interval',
    :'guardrails' => :'guardrails',
    :'id' => :'id',
    :'os_query' => :'os_query',
    :'platforms' => :'platforms',
    :'queries' => :'queries',
    :'remediations' => :'remediations',
    :'run_by' => :'run_by',
    :'run_type' => :'run_type',
    :'status_by_stage' => :'status_by_stage',
    :'target' => :'target',
    :'task_id' => :'task_id',
    :'task_name' => :'task_name',
    :'task_parameters' => :'task_parameters',
    :'task_type' => :'task_type',
    :'trigger_condition' => :'trigger_condition',
    :'verification_condition' => :'verification_condition'
  }
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



392
393
394
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 392

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

.openapi_nullableObject

List of attributes with nullable: true



179
180
181
182
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 179

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

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 151

def self.openapi_types
  {
    :'composite_query' => :'ItautomationCompositeQuery',
    :'discover_new_hosts' => :'Boolean',
    :'discover_offline_hosts' => :'Boolean',
    :'distribute' => :'Boolean',
    :'execution_args' => :'Hash<String, String>',
    :'expiration_interval' => :'String',
    :'guardrails' => :'FalconforitapiGuardrails',
    :'id' => :'String',
    :'os_query' => :'String',
    :'platforms' => :'Array<String>',
    :'queries' => :'ItautomationScripts',
    :'remediations' => :'ItautomationScripts',
    :'run_by' => :'String',
    :'run_type' => :'String',
    :'status_by_stage' => :'ItautomationTaskStageExecutionStatus',
    :'target' => :'String',
    :'task_id' => :'String',
    :'task_name' => :'String',
    :'task_parameters' => :'Array<ItautomationTaskParameter>',
    :'task_type' => :'String',
    :'trigger_condition' => :'Array<FalconforitapiConditionGroup>',
    :'verification_condition' => :'Array<FalconforitapiConditionGroup>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 350

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      composite_query == o.composite_query &&
      discover_new_hosts == o.discover_new_hosts &&
      discover_offline_hosts == o.discover_offline_hosts &&
      distribute == o.distribute &&
      execution_args == o.execution_args &&
      expiration_interval == o.expiration_interval &&
      guardrails == o.guardrails &&
      id == o.id &&
      os_query == o.os_query &&
      platforms == o.platforms &&
      queries == o.queries &&
      remediations == o.remediations &&
      run_by == o.run_by &&
      run_type == o.run_type &&
      status_by_stage == o.status_by_stage &&
      target == o.target &&
      task_id == o.task_id &&
      task_name == o.task_name &&
      task_parameters == o.task_parameters &&
      task_type == o.task_type &&
      trigger_condition == o.trigger_condition &&
      verification_condition == o.verification_condition
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



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
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 423

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



494
495
496
497
498
499
500
501
502
503
504
505
506
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 494

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



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 399

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


379
380
381
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 379

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



385
386
387
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 385

def hash
  [composite_query, discover_new_hosts, discover_offline_hosts, distribute, execution_args, expiration_interval, guardrails, id, os_query, platforms, queries, remediations, run_by, run_type, status_by_stage, target, task_id, task_name, task_parameters, task_type, trigger_condition, verification_condition].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 300

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

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

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

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

  if @task_type.nil?
    invalid_properties.push('invalid value for "task_type", task_type 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



470
471
472
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 470

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



476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 476

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



464
465
466
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 464

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



327
328
329
330
331
332
333
334
335
336
# File 'lib/crimson-falcon/models/itautomation_task_execution.rb', line 327

def valid?
  return false if @id.nil?
  return false if @run_by.nil?
  return false if @run_type.nil?
  return false if @target.nil?
  return false if @task_type.nil?
  task_type_validator = EnumAttributeValidator.new('String', ["query", "remediation"])
  return false unless task_type_validator.valid?(@task_type)
  true
end