Class: OCI::VulnerabilityScanning::Models::VulnerabilitySummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/vulnerability_scanning/models/vulnerability_summary.rb

Overview

Summary of a scan vulnerability

Constant Summary collapse

SEVERITY_ENUM =
[
  SEVERITY_NONE = 'NONE'.freeze,
  SEVERITY_LOW = 'LOW'.freeze,
  SEVERITY_MEDIUM = 'MEDIUM'.freeze,
  SEVERITY_HIGH = 'HIGH'.freeze,
  SEVERITY_CRITICAL = 'CRITICAL'.freeze,
  SEVERITY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
STATE_ENUM =
[
  STATE_OPEN = 'OPEN'.freeze,
  STATE_FIXED = 'FIXED'.freeze,
  STATE_NOT_APPLICABLE = 'NOT_APPLICABLE'.freeze,
  STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
VULNERABILITY_TYPE_ENUM =
[
  VULNERABILITY_TYPE_CVE = 'CVE'.freeze,
  VULNERABILITY_TYPE_PROBLEM = 'PROBLEM'.freeze,
  VULNERABILITY_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
  LIFECYCLE_STATE_UPDATING = 'UPDATING'.freeze,
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
  LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
  LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
  LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ VulnerabilitySummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 150

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.id = attributes[:'id'] if attributes[:'id']

  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.vulnerability_reference = attributes[:'vulnerabilityReference'] if attributes[:'vulnerabilityReference']

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

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

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

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

  self.cve_description = attributes[:'cveDescription'] if attributes[:'cveDescription']

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

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

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

  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.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.impacted_resources_count = attributes[:'impactedResourcesCount'] if attributes[:'impactedResourcesCount']

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

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

  self.vulnerability_type = attributes[:'vulnerabilityType'] if attributes[:'vulnerabilityType']

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

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

  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']

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

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

Instance Attribute Details

#compartment_idString

[Required] Compartment ID of the vulnerability. Vulnerabilities with identical CVEs can exist in different compartments.

Returns:

  • (String)


50
51
52
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 50

def compartment_id
  @compartment_id
end

#cve_descriptionString

The description of CVE vulnerability

Returns:

  • (String)


66
67
68
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 66

def cve_description
  @cve_description
end

#idString

[Required] ID of the vulnerability

Returns:

  • (String)


46
47
48
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 46

def id
  @id
end

#impacted_resources_countOCI::VulnerabilityScanning::Models::ImpactedResourcesCount

This attribute is required.



82
83
84
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 82

def impacted_resources_count
  @impacted_resources_count
end

#lifecycle_stateString

The current state of the resource.

Returns:

  • (String)


90
91
92
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 90

def lifecycle_state
  @lifecycle_state
end

#nameString

[Required] Vulnerability name

Returns:

  • (String)


70
71
72
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 70

def name
  @name
end

#severityString

[Required] Severity of the vulnerability

Returns:

  • (String)


58
59
60
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 58

def severity
  @severity
end

#stateString

State of the vulnerability

Returns:

  • (String)


62
63
64
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 62

def state
  @state
end

#time_first_detectedDateTime

[Required] Date of scan result that first reported the vulnerability

Returns:

  • (DateTime)


78
79
80
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 78

def time_first_detected
  @time_first_detected
end

#time_last_detectedDateTime

[Required] Date of scan result that most recently reported the vulnerability

Returns:

  • (DateTime)


74
75
76
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 74

def time_last_detected
  @time_last_detected
end

#vulnerability_referenceString

Reference to the vulnerability type's unique identifier. For CVE, this is the MITRE CVE ID

Returns:

  • (String)


54
55
56
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 54

def vulnerability_reference
  @vulnerability_reference
end

#vulnerability_typeString

[Required] Specifies the type of Vulnerability

Returns:

  • (String)


86
87
88
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 86

def vulnerability_type
  @vulnerability_type
end

Class Method Details

.attribute_mapObject

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



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 93

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'compartment_id': :'compartmentId',
    'vulnerability_reference': :'vulnerabilityReference',
    'severity': :'severity',
    'state': :'state',
    'cve_description': :'cveDescription',
    'name': :'name',
    'time_last_detected': :'timeLastDetected',
    'time_first_detected': :'timeFirstDetected',
    'impacted_resources_count': :'impactedResourcesCount',
    'vulnerability_type': :'vulnerabilityType',
    'lifecycle_state': :'lifecycleState'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 113

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'compartment_id': :'String',
    'vulnerability_reference': :'String',
    'severity': :'String',
    'state': :'String',
    'cve_description': :'String',
    'name': :'String',
    'time_last_detected': :'DateTime',
    'time_first_detected': :'DateTime',
    'impacted_resources_count': :'OCI::VulnerabilityScanning::Models::ImpactedResourcesCount',
    'vulnerability_type': :'String',
    'lifecycle_state': :'String'
    # 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



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 272

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

  self.class == other.class &&
    id == other.id &&
    compartment_id == other.compartment_id &&
    vulnerability_reference == other.vulnerability_reference &&
    severity == other.severity &&
    state == other.state &&
    cve_description == other.cve_description &&
    name == other.name &&
    time_last_detected == other.time_last_detected &&
    time_first_detected == other.time_first_detected &&
    impacted_resources_count == other.impacted_resources_count &&
    vulnerability_type == other.vulnerability_type &&
    lifecycle_state == other.lifecycle_state
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



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 313

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


293
294
295
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 293

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



302
303
304
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 302

def hash
  [id, compartment_id, vulnerability_reference, severity, state, cve_description, name, time_last_detected, time_first_detected, impacted_resources_count, vulnerability_type, lifecycle_state].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



346
347
348
349
350
351
352
353
354
355
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 346

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



340
341
342
# File 'lib/oci/vulnerability_scanning/models/vulnerability_summary.rb', line 340

def to_s
  to_hash.to_s
end