Class: OCI::Adm::Models::VulnerableArtifactVersionRange

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

Overview

Vulnerable artifact version range.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ VulnerableArtifactVersionRange

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 61

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

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

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

  self.version_end_including = attributes[:'versionEndIncluding'] if attributes[:'versionEndIncluding']

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

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

  self.version_start_including = attributes[:'versionStartIncluding'] if attributes[:'versionStartIncluding']

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

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

  self.version_start_excluding = attributes[:'versionStartExcluding'] if attributes[:'versionStartExcluding']

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

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

Instance Attribute Details

#version_end_excludingString

The version immediately after the last affected version. Versions up to, but not including this version, are vulnerable.

Returns:

  • (String)


13
14
15
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 13

def version_end_excluding
  @version_end_excluding
end

#version_end_includingString

Marks the latest version that is affected by the vulnerability. This version and all preceding versions, going back to versionStartExcluding or versionStartIncluding, are considered vulnerable.

Returns:

  • (String)


17
18
19
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 17

def version_end_including
  @version_end_including
end

#version_start_excludingString

The version immediately before the start of affected versions. The specified version is not affected, but versions immediately after are, up to versionStartIncluding or beyond, if not otherwise defined.

Returns:

  • (String)


25
26
27
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 25

def version_start_excluding
  @version_start_excluding
end

#version_start_includingString

The first version affected by the vulnerability. This version and those following it are considered vulnerable until versionEndExcluding or versionEndIncluding is reached.

Returns:

  • (String)


21
22
23
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 21

def version_start_including
  @version_start_including
end

Class Method Details

.attribute_mapObject

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



28
29
30
31
32
33
34
35
36
37
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 28

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'version_end_excluding': :'versionEndExcluding',
    'version_end_including': :'versionEndIncluding',
    'version_start_including': :'versionStartIncluding',
    'version_start_excluding': :'versionStartExcluding'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



40
41
42
43
44
45
46
47
48
49
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 40

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'version_end_excluding': :'String',
    'version_end_including': :'String',
    'version_start_including': :'String',
    'version_start_excluding': :'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



99
100
101
102
103
104
105
106
107
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 99

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

  self.class == other.class &&
    version_end_excluding == other.version_end_excluding &&
    version_end_including == other.version_end_including &&
    version_start_including == other.version_start_including &&
    version_start_excluding == other.version_start_excluding
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



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 132

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


112
113
114
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 112

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



121
122
123
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 121

def hash
  [version_end_excluding, version_end_including, version_start_including, version_start_excluding].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



165
166
167
168
169
170
171
172
173
174
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 165

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



159
160
161
# File 'lib/oci/adm/models/vulnerable_artifact_version_range.rb', line 159

def to_s
  to_hash.to_s
end