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):

  • :sightings_count (Integer)

    The value to assign to the #sightings_count property

  • :id (String)

    The value to assign to the #id property

  • :resource_id (String)

    The value to assign to the #resource_id property

  • :display_name (String)

    The value to assign to the #display_name property

  • :type (String)

    The value to assign to the #type property

  • :problem_ids (Array<String>)

    The value to assign to the #problem_ids property

  • :compartment_id (String)

    The value to assign to the #compartment_id property

  • :target_id (String)

    The value to assign to the #target_id property

  • :risk_score (Float)

    The value to assign to the #risk_score property

  • :risk_level (String)

    The value to assign to the #risk_level property

  • :peak_risk_score (Float)

    The value to assign to the #peak_risk_score property

  • :time_peak_score (DateTime)

    The value to assign to the #time_peak_score property

  • :time_first_detected (DateTime)

    The value to assign to the #time_first_detected property

  • :time_last_detected (DateTime)

    The value to assign to the #time_last_detected property

  • :tactics (Array<OCI::CloudGuard::Models::TacticSummary>)

    The value to assign to the #tactics property



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

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']
end

Instance Attribute Details

#compartment_idString

[Required] Compartment Id for 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] Resource name for 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 resource profile

Returns:

  • (String)


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

def id
  @id
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 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 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 this 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 summary 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

Target Id for 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 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 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.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 82

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'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 105

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>'
    # 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



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 253

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
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



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 297

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


277
278
279
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 277

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



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

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].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



330
331
332
333
334
335
336
337
338
339
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 330

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



324
325
326
# File 'lib/oci/cloud_guard/models/resource_profile.rb', line 324

def to_s
  to_hash.to_s
end