Class: OCI::Adm::Models::VulnerabilityDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/adm/models/vulnerability_details.rb

Overview

A vulnerability details contains details for a vulnerability as reported by the source.

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ VulnerabilityDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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
# File 'lib/oci/adm/models/vulnerability_details.rb', line 128

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

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

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

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

  self.is_direct_vulnerability = attributes[:'isDirectVulnerability'] unless attributes[:'isDirectVulnerability'].nil?

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

  self.is_direct_vulnerability = attributes[:'is_direct_vulnerability'] unless attributes[:'is_direct_vulnerability'].nil?

  self.related_vulnerabilities = attributes[:'relatedVulnerabilities'] if attributes[:'relatedVulnerabilities']

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

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

  self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']

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

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

  self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated']

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

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

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

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

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

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

  self.vulnerability_summary = attributes[:'vulnerabilitySummary'] if attributes[:'vulnerabilitySummary']

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

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

  self.vulnerability_description = attributes[:'vulnerabilityDescription'] if attributes[:'vulnerabilityDescription']

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

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

Instance Attribute Details

#is_direct_vulnerabilityBOOLEAN

Indicates if the vulnerability is immediately affecting any artifact in an audit.

Returns:

  • (BOOLEAN)


32
33
34
# File 'lib/oci/adm/models/vulnerability_details.rb', line 32

def is_direct_vulnerability
  @is_direct_vulnerability
end

#metricsArray<OCI::Adm::Models::VulnerabilityMetric>

List of reported metrics by the source.



52
53
54
# File 'lib/oci/adm/models/vulnerability_details.rb', line 52

def metrics
  @metrics
end

#referencesArray<String>

References of the vulnerability at source.

Returns:

  • (Array<String>)


60
61
62
# File 'lib/oci/adm/models/vulnerability_details.rb', line 60

def references
  @references
end

List of related vulnerabilities, as reported by the source, along with aliases, where aliases are the same vulnerability reported by different sources.



36
37
38
# File 'lib/oci/adm/models/vulnerability_details.rb', line 36

def related_vulnerabilities
  @related_vulnerabilities
end

#severityString

ADM qualitative severity score. Can be either NONE, LOW, MEDIUM, HIGH or CRITICAL.

Returns:

  • (String)


48
49
50
# File 'lib/oci/adm/models/vulnerability_details.rb', line 48

def severity
  @severity
end

#sourceString

[Required] Source that published the vulnerability.

Returns:

  • (String)


28
29
30
# File 'lib/oci/adm/models/vulnerability_details.rb', line 28

def source
  @source
end

#statusString

The status of the vulnerability, may be one of Analyzed, Rejected, Modified, Awaiting Analysis, Undergoing Analysis, Published, Withdrawn, Received as reported by the source.

Returns:

  • (String)


56
57
58
# File 'lib/oci/adm/models/vulnerability_details.rb', line 56

def status
  @status
end

#time_createdDateTime

Date when the vulnerability was published, at the source.

Returns:

  • (DateTime)


40
41
42
# File 'lib/oci/adm/models/vulnerability_details.rb', line 40

def time_created
  @time_created
end

#time_updatedDateTime

Date when the vulnerability was last modified, at the source.

Returns:

  • (DateTime)


44
45
46
# File 'lib/oci/adm/models/vulnerability_details.rb', line 44

def time_updated
  @time_updated
end

#vulnerability_descriptionString

Detailed description of the vulnerability.

Returns:

  • (String)


68
69
70
# File 'lib/oci/adm/models/vulnerability_details.rb', line 68

def vulnerability_description
  @vulnerability_description
end

#vulnerability_idString

[Required] Vulnerability identifier from source, e.g., CVE-1999-0067, GHSA-9vjp-v76f-g363.

Returns:

  • (String)


24
25
26
# File 'lib/oci/adm/models/vulnerability_details.rb', line 24

def vulnerability_id
  @vulnerability_id
end

#vulnerability_summaryString

Summary of the vulnerability.

Returns:

  • (String)


64
65
66
# File 'lib/oci/adm/models/vulnerability_details.rb', line 64

def vulnerability_summary
  @vulnerability_summary
end

Class Method Details

.attribute_mapObject

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



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/oci/adm/models/vulnerability_details.rb', line 71

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'vulnerability_id': :'vulnerabilityId',
    'source': :'source',
    'is_direct_vulnerability': :'isDirectVulnerability',
    'related_vulnerabilities': :'relatedVulnerabilities',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated',
    'severity': :'severity',
    'metrics': :'metrics',
    'status': :'status',
    'references': :'references',
    'vulnerability_summary': :'vulnerabilitySummary',
    'vulnerability_description': :'vulnerabilityDescription'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/oci/adm/models/vulnerability_details.rb', line 91

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'vulnerability_id': :'String',
    'source': :'String',
    'is_direct_vulnerability': :'BOOLEAN',
    'related_vulnerabilities': :'Array<OCI::Adm::Models::RelatedVulnerabilityReference>',
    'time_created': :'DateTime',
    'time_updated': :'DateTime',
    'severity': :'String',
    'metrics': :'Array<OCI::Adm::Models::VulnerabilityMetric>',
    'status': :'String',
    'references': :'Array<String>',
    'vulnerability_summary': :'String',
    'vulnerability_description': :'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



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/oci/adm/models/vulnerability_details.rb', line 207

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

  self.class == other.class &&
    vulnerability_id == other.vulnerability_id &&
    source == other.source &&
    is_direct_vulnerability == other.is_direct_vulnerability &&
    related_vulnerabilities == other.related_vulnerabilities &&
    time_created == other.time_created &&
    time_updated == other.time_updated &&
    severity == other.severity &&
    metrics == other.metrics &&
    status == other.status &&
    references == other.references &&
    vulnerability_summary == other.vulnerability_summary &&
    vulnerability_description == other.vulnerability_description
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



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/oci/adm/models/vulnerability_details.rb', line 248

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


228
229
230
# File 'lib/oci/adm/models/vulnerability_details.rb', line 228

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



237
238
239
# File 'lib/oci/adm/models/vulnerability_details.rb', line 237

def hash
  [vulnerability_id, source, is_direct_vulnerability, related_vulnerabilities, time_created, time_updated, severity, metrics, status, references, vulnerability_summary, vulnerability_description].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



281
282
283
284
285
286
287
288
289
290
# File 'lib/oci/adm/models/vulnerability_details.rb', line 281

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



275
276
277
# File 'lib/oci/adm/models/vulnerability_details.rb', line 275

def to_s
  to_hash.to_s
end