Class: Falcon::ResourcesComplianceControl

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ResourcesComplianceControl

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
183
184
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
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
# File 'lib/crimson-falcon/models/resources_compliance_control.rb', line 143

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



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

def 
  @account_id
end

#account_nameObject

Returns the value of attribute account_name.



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

def 
  @account_name
end

#assessment_idObject

Returns the value of attribute assessment_id.



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

def assessment_id
  @assessment_id
end

#cloud_groupsObject

Returns the value of attribute cloud_groups.



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

def cloud_groups
  @cloud_groups
end

#cloud_groups_v2Object

Returns the value of attribute cloud_groups_v2.



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

def cloud_groups_v2
  @cloud_groups_v2
end

#cloud_labelsObject

Returns the value of attribute cloud_labels.



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

def cloud_labels
  @cloud_labels
end

#cloud_providerObject

Returns the value of attribute cloud_provider.



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

def cloud_provider
  @cloud_provider
end

#controlObject

Returns the value of attribute control.



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

def control
  @control
end

#gcrnObject

Returns the value of attribute gcrn.



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

def gcrn
  @gcrn
end

#groupsObject

Returns the value of attribute groups.



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

def groups
  @groups
end

#last_evaluatedObject

Returns the value of attribute last_evaluated.



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

def last_evaluated
  @last_evaluated
end

#regionObject

Returns the value of attribute region.



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

def region
  @region
end

#resource_countsObject

Returns the value of attribute resource_counts.



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

def resource_counts
  @resource_counts
end

#resource_providerObject

Returns the value of attribute resource_provider.



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

def resource_provider
  @resource_provider
end

#resource_typeObject

Returns the value of attribute resource_type.



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

def resource_type
  @resource_type
end

#resource_type_nameObject

Returns the value of attribute resource_type_name.



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

def resource_type_name
  @resource_type_name
end

#rulesObject

Returns the value of attribute rules.



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

def rules
  @rules
end

#serviceObject

Returns the value of attribute service.



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

def service
  @service
end

#service_categoryObject

Returns the value of attribute service_category.



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

def service_category
  @service_category
end

#severitiesObject

Returns the value of attribute severities.



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

def severities
  @severities
end

#tagsObject

Returns the value of attribute tags.



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

def tags
  @tags
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/crimson-falcon/models/resources_compliance_control.rb', line 77

def self.attribute_map
  {
    :'account_id' => :'account_id',
    :'account_name' => :'account_name',
    :'assessment_id' => :'assessment_id',
    :'cloud_groups' => :'cloud_groups',
    :'cloud_groups_v2' => :'cloud_groups_v2',
    :'cloud_labels' => :'cloud_labels',
    :'cloud_provider' => :'cloud_provider',
    :'control' => :'control',
    :'gcrn' => :'gcrn',
    :'groups' => :'groups',
    :'last_evaluated' => :'last_evaluated',
    :'region' => :'region',
    :'resource_counts' => :'resource_counts',
    :'resource_provider' => :'resource_provider',
    :'resource_type' => :'resource_type',
    :'resource_type_name' => :'resource_type_name',
    :'rules' => :'rules',
    :'service' => :'service',
    :'service_category' => :'service_category',
    :'severities' => :'severities',
    :'tags' => :'tags'
  }
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



386
387
388
# File 'lib/crimson-falcon/models/resources_compliance_control.rb', line 386

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

.openapi_nullableObject

List of attributes with nullable: true



136
137
138
139
# File 'lib/crimson-falcon/models/resources_compliance_control.rb', line 136

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

.openapi_typesObject

Attribute type mapping.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/crimson-falcon/models/resources_compliance_control.rb', line 109

def self.openapi_types
  {
    :'account_id' => :'String',
    :'account_name' => :'String',
    :'assessment_id' => :'String',
    :'cloud_groups' => :'Array<DomainCloudScope>',
    :'cloud_groups_v2' => :'Array<DomainCloudGroup>',
    :'cloud_labels' => :'Array<ClassificationLabel>',
    :'cloud_provider' => :'String',
    :'control' => :'ResourcesControlInfo',
    :'gcrn' => :'String',
    :'groups' => :'Array<String>',
    :'last_evaluated' => :'Time',
    :'region' => :'String',
    :'resource_counts' => :'ResourceCounts',
    :'resource_provider' => :'String',
    :'resource_type' => :'String',
    :'resource_type_name' => :'String',
    :'rules' => :'Array<ResourcesRule>',
    :'service' => :'String',
    :'service_category' => :'String',
    :'severities' => :'Array<String>',
    :'tags' => :'Hash<String, String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
       == o. &&
      assessment_id == o.assessment_id &&
      cloud_groups == o.cloud_groups &&
      cloud_groups_v2 == o.cloud_groups_v2 &&
      cloud_labels == o.cloud_labels &&
      cloud_provider == o.cloud_provider &&
      control == o.control &&
      gcrn == o.gcrn &&
      groups == o.groups &&
      last_evaluated == o.last_evaluated &&
      region == o.region &&
      resource_counts == o.resource_counts &&
      resource_provider == o.resource_provider &&
      resource_type == o.resource_type &&
      resource_type_name == o.resource_type_name &&
      rules == o.rules &&
      service == o.service &&
      service_category == o.service_category &&
      severities == o.severities &&
      tags == o.tags
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



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

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



488
489
490
491
492
493
494
495
496
497
498
499
500
# File 'lib/crimson-falcon/models/resources_compliance_control.rb', line 488

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



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/crimson-falcon/models/resources_compliance_control.rb', line 393

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


373
374
375
# File 'lib/crimson-falcon/models/resources_compliance_control.rb', line 373

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



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

def hash
  [, , assessment_id, cloud_groups, cloud_groups_v2, cloud_labels, cloud_provider, control, gcrn, groups, last_evaluated, region, resource_counts, resource_provider, resource_type, resource_type_name, rules, service, service_category, severities, tags].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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

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



470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/crimson-falcon/models/resources_compliance_control.rb', line 470

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



458
459
460
# File 'lib/crimson-falcon/models/resources_compliance_control.rb', line 458

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



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/crimson-falcon/models/resources_compliance_control.rb', line 324

def valid?
  return false if @account_id.nil?
  return false if @account_name.nil?
  return false if @assessment_id.nil?
  return false if @cloud_provider.nil?
  return false if @control.nil?
  return false if @last_evaluated.nil?
  return false if @region.nil?
  return false if @resource_counts.nil?
  return false if @resource_provider.nil?
  return false if @resource_type.nil?
  return false if @resource_type_name.nil?
  return false if @rules.nil?
  return false if @service.nil?
  return false if @service_category.nil?
  return false if @severities.nil?
  true
end