Class: OCI::VulnerabilityScanning::Models::Package

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

Overview

Details of the vulnerable package found

Constant Summary collapse

TYPE_ENUM =
[
  TYPE_JAVA = 'JAVA'.freeze,
  TYPE_APK = 'APK'.freeze,
  TYPE_RPM = 'RPM'.freeze,
  TYPE_DEB = 'DEB'.freeze,
  TYPE_GO = 'GO'.freeze,
  TYPE_NPM = 'NPM'.freeze,
  TYPE_PYTHON = 'PYTHON'.freeze,
  TYPE_RUST = 'RUST'.freeze,
  TYPE_PHP_COMPOSER = 'PHP_COMPOSER'.freeze,
  TYPE_GEM = 'GEM'.freeze,
  TYPE_MSRC_KB = 'MSRC_KB'.freeze,
  TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Package

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :name (String)

    The value to assign to the #name property

  • :version (String)

    The value to assign to the #version property

  • :cve_fix_version (String)

    The value to assign to the #cve_fix_version property

  • :type (String)

    The value to assign to the #type property

  • :locations (Array<String>)

    The value to assign to the #locations property



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

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

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

  self.cve_fix_version = attributes[:'cveFixVersion'] if attributes[:'cveFixVersion']

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

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

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

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

Instance Attribute Details

#cve_fix_versionString

Package version in which the CVE was fixed

Returns:

  • (String)


37
38
39
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 37

def cve_fix_version
  @cve_fix_version
end

#locationsArray<String>

Disk locations where package was found

Returns:

  • (Array<String>)


45
46
47
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 45

def locations
  @locations
end

#nameString

[Required] Name of the package

Returns:

  • (String)


29
30
31
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 29

def name
  @name
end

#typeString

[Required] Package type

Returns:

  • (String)


41
42
43
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 41

def type
  @type
end

#versionString

[Required] Package version

Returns:

  • (String)


33
34
35
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 33

def version
  @version
end

Class Method Details

.attribute_mapObject

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



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 48

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'version': :'version',
    'cve_fix_version': :'cveFixVersion',
    'type': :'type',
    'locations': :'locations'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 61

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'version': :'String',
    'cve_fix_version': :'String',
    'type': :'String',
    'locations': :'Array<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



125
126
127
128
129
130
131
132
133
134
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 125

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

  self.class == other.class &&
    name == other.name &&
    version == other.version &&
    cve_fix_version == other.cve_fix_version &&
    type == other.type &&
    locations == other.locations
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



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 159

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


139
140
141
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 139

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



148
149
150
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 148

def hash
  [name, version, cve_fix_version, type, locations].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



192
193
194
195
196
197
198
199
200
201
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 192

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



186
187
188
# File 'lib/oci/vulnerability_scanning/models/package.rb', line 186

def to_s
  to_hash.to_s
end