Class: OCI::CloudGuard::Models::ResourceProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/cloud_guard/models/resource_profile.rb

Overview

Resource profile details.

Constant Summary collapse

RISK_LEVEL_ENUM =
[
  RISK_LEVEL_CRITICAL = 'CRITICAL'.freeze,
  RISK_LEVEL_HIGH = 'HIGH'.freeze,
  RISK_LEVEL_MEDIUM = 'MEDIUM'.freeze,
  RISK_LEVEL_LOW = 'LOW'.freeze,
  RISK_LEVEL_MINOR = 'MINOR'.freeze,
  RISK_LEVEL_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ResourceProfile

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 155

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.sightings_count = attributes[:'sightingsCount'] if attributes[:'sightingsCount']

  raise 'You cannot provide both :sightingsCount and :sightings_count' if attributes.key?(:'sightingsCount') && attributes.key?(:'sightings_count')

  self.sightings_count = attributes[:'sightings_count'] if attributes[:'sightings_count']

  self.id = attributes[:'id'] if attributes[:'id']

  self.resource_id = attributes[:'resourceId'] if attributes[:'resourceId']

  raise 'You cannot provide both :resourceId and :resource_id' if attributes.key?(:'resourceId') && attributes.key?(:'resource_id')

  self.resource_id = attributes[:'resource_id'] if attributes[:'resource_id']

  self.display_name = attributes[:'displayName'] if attributes[:'displayName']

  raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')

  self.display_name = attributes[:'display_name'] if attributes[:'display_name']

  self.type = attributes[:'type'] if attributes[:'type']

  self.problem_ids = attributes[:'problemIds'] if attributes[:'problemIds']

  raise 'You cannot provide both :problemIds and :problem_ids' if attributes.key?(:'problemIds') && attributes.key?(:'problem_ids')

  self.problem_ids = attributes[:'problem_ids'] if attributes[:'problem_ids']

  self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']

  raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')

  self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']

  self.target_id = attributes[:'targetId'] if attributes[:'targetId']

  raise 'You cannot provide both :targetId and :target_id' if attributes.key?(:'targetId') && attributes.key?(:'target_id')

  self.target_id = attributes[:'target_id'] if attributes[:'target_id']

  self.risk_score = attributes[:'riskScore'] if attributes[:'riskScore']

  raise 'You cannot provide both :riskScore and :risk_score' if attributes.key?(:'riskScore') && attributes.key?(:'risk_score')

  self.risk_score = attributes[:'risk_score'] if attributes[:'risk_score']

  self.risk_level = attributes[:'riskLevel'] if attributes[:'riskLevel']

  raise 'You cannot provide both :riskLevel and :risk_level' if attributes.key?(:'riskLevel') && attributes.key?(:'risk_level')

  self.risk_level = attributes[:'risk_level'] if attributes[:'risk_level']

  self.peak_risk_score = attributes[:'peakRiskScore'] if attributes[:'peakRiskScore']

  raise 'You cannot provide both :peakRiskScore and :peak_risk_score' if attributes.key?(:'peakRiskScore') && attributes.key?(:'peak_risk_score')

  self.peak_risk_score = attributes[:'peak_risk_score'] if attributes[:'peak_risk_score']

  self.time_peak_score = attributes[:'timePeakScore'] if attributes[:'timePeakScore']

  raise 'You cannot provide both :timePeakScore and :time_peak_score' if attributes.key?(:'timePeakScore') && attributes.key?(:'time_peak_score')

  self.time_peak_score = attributes[:'time_peak_score'] if attributes[:'time_peak_score']

  self.time_first_detected = attributes[:'timeFirstDetected'] if attributes[:'timeFirstDetected']

  raise 'You cannot provide both :timeFirstDetected and :time_first_detected' if attributes.key?(:'timeFirstDetected') && attributes.key?(:'time_first_detected')

  self.time_first_detected = attributes[:'time_first_detected'] if attributes[:'time_first_detected']

  self.time_last_detected = attributes[:'timeLastDetected'] if attributes[:'timeLastDetected']

  raise 'You cannot provide both :timeLastDetected and :time_last_detected' if attributes.key?(:'timeLastDetected') && attributes.key?(:'time_last_detected')

  self.time_last_detected = attributes[:'time_last_detected'] if attributes[:'time_last_detected']

  self.tactics = attributes[:'tactics'] if attributes[:'tactics']

  self.locks = attributes[:'locks'] if attributes[:'locks']
end

Instance Attribute Details

#compartment_idString

[Required] Compartment OCID for the resource profile

Returns:

  • (String)


47
48
49
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 47

def compartment_id
  @compartment_id
end

#display_nameString

[Required] Display name for the resource profile

Returns:

  • (String)


35
36
37
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 35

def display_name
  @display_name
end

#idString

[Required] Unique identifier for the resource profile

Returns:

  • (String)


27
28
29
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 27

def id
  @id
end

#locksArray<OCI::CloudGuard::Models::ResourceLock>

Locks associated with this resource.



83
84
85
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 83

def locks
  @locks
end

#peak_risk_scoreFloat

Peak risk score for the resource profile

Returns:

  • (Float)


63
64
65
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 63

def peak_risk_score
  @peak_risk_score
end

#problem_idsArray<String>

List of problems IDs associated with the resource profile

Returns:

  • (Array<String>)


43
44
45
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 43

def problem_ids
  @problem_ids
end

#resource_idString

[Required] Unique identifier for the resource associated with the resource profile

Returns:

  • (String)


31
32
33
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 31

def resource_id
  @resource_id
end

#risk_levelString

Risk level associated with resource profile

Returns:

  • (String)


59
60
61
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 59

def risk_level
  @risk_level
end

#risk_scoreFloat

[Required] Risk score for the resource profile

Returns:

  • (Float)


55
56
57
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 55

def risk_score
  @risk_score
end

#sightings_countInteger

Number of sightings associated with the resource profile

Returns:

  • (Integer)


23
24
25
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 23

def sightings_count
  @sightings_count
end

#tacticsArray<OCI::CloudGuard::Models::TacticSummary>

[Required] List of tactic summaries associated with the resource profile



79
80
81
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 79

def tactics
  @tactics
end

#target_idString

Unique target ID for the resource profile

Returns:

  • (String)


51
52
53
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 51

def target_id
  @target_id
end

#time_first_detectedDateTime

[Required] The date and time the resource profile was first detected. Format defined by RFC3339.

Returns:

  • (DateTime)


71
72
73
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 71

def time_first_detected
  @time_first_detected
end

#time_last_detectedDateTime

[Required] The date and time the resource profile was last detected. Format defined by RFC3339.

Returns:

  • (DateTime)


75
76
77
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 75

def time_last_detected
  @time_last_detected
end

#time_peak_scoreDateTime

The date and time for the peak risk score. Format defined by RFC3339.

Returns:

  • (DateTime)


67
68
69
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 67

def time_peak_score
  @time_peak_score
end

#typeString

[Required] Resource type for the resource profile

Returns:

  • (String)


39
40
41
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 39

def type
  @type
end

Class Method Details

.attribute_mapObject

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



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 86

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'sightings_count': :'sightingsCount',
    'id': :'id',
    'resource_id': :'resourceId',
    'display_name': :'displayName',
    'type': :'type',
    'problem_ids': :'problemIds',
    'compartment_id': :'compartmentId',
    'target_id': :'targetId',
    'risk_score': :'riskScore',
    'risk_level': :'riskLevel',
    'peak_risk_score': :'peakRiskScore',
    'time_peak_score': :'timePeakScore',
    'time_first_detected': :'timeFirstDetected',
    'time_last_detected': :'timeLastDetected',
    'tactics': :'tactics',
    'locks': :'locks'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 110

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'sightings_count': :'Integer',
    'id': :'String',
    'resource_id': :'String',
    'display_name': :'String',
    'type': :'String',
    'problem_ids': :'Array<String>',
    'compartment_id': :'String',
    'target_id': :'String',
    'risk_score': :'Float',
    'risk_level': :'String',
    'peak_risk_score': :'Float',
    'time_peak_score': :'DateTime',
    'time_first_detected': :'DateTime',
    'time_last_detected': :'DateTime',
    'tactics': :'Array<OCI::CloudGuard::Models::TacticSummary>',
    'locks': :'Array<OCI::CloudGuard::Models::ResourceLock>'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 262

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    sightings_count == other.sightings_count &&
    id == other.id &&
    resource_id == other.resource_id &&
    display_name == other.display_name &&
    type == other.type &&
    problem_ids == other.problem_ids &&
    compartment_id == other.compartment_id &&
    target_id == other.target_id &&
    risk_score == other.risk_score &&
    risk_level == other.risk_level &&
    peak_risk_score == other.peak_risk_score &&
    time_peak_score == other.time_peak_score &&
    time_first_detected == other.time_first_detected &&
    time_last_detected == other.time_last_detected &&
    tactics == other.tactics &&
    locks == other.locks
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



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 307

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


287
288
289
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 287

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



296
297
298
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 296

def hash
  [sightings_count, id, resource_id, display_name, type, problem_ids, compartment_id, target_id, risk_score, risk_level, peak_risk_score, time_peak_score, time_first_detected, time_last_detected, tactics, locks].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



340
341
342
343
344
345
346
347
348
349
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 340

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



334
335
336
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 334

def to_s
  to_hash.to_s
end