class OCI::VulnerabilityScanning::Models::HostVulnerabilitySummary
Summary of a host scan vulnerability
Constants
- LIFECYCLE_STATE_ENUM
- SEVERITY_ENUM
- STATE_ENUM
- VULNERABILITY_TYPE_ENUM
Attributes
[Required] Compartment ID of the vulnerability. Vulnerabilities with identical CVEs can exist in different compartments. @return [String]
Reference to MITRE CVE ID @return [String]
[Required] Number of scanned hosts in this compartment whose scan results currently report this vulnerability @return [Integer]
[Required] ID of the vulnerability @return [String]
The current state of the resource. @return [String]
[Required] Vulnerability name @return [String]
[Required] Severity of the vulnerability @return [String]
State of the vulnerability @return [String]
[Required] Date of scan result that first reported the vulnerability @return [DateTime]
[Required] Date of scan result that most recently reported the vulnerability @return [DateTime]
[Required] Specifies the type of Vulnerability @return [String]
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 88 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'id': :'id', 'compartment_id': :'compartmentId', 'cve_reference': :'cveReference', 'severity': :'severity', 'state': :'state', 'name': :'name', 'time_last_detected': :'timeLastDetected', 'time_first_detected': :'timeFirstDetected', 'host_count': :'hostCount', 'vulnerability_type': :'vulnerabilityType', 'lifecycle_state': :'lifecycleState' # rubocop:enable Style/SymbolLiteral } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash @option attributes [String] :id The value to assign to the {#id} property @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property @option attributes [String] :cve_reference The value to assign to the {#cve_reference} property @option attributes [String] :severity The value to assign to the {#severity} property @option attributes [String] :state The value to assign to the {#state} property @option attributes [String] :name The value to assign to the {#name} property @option attributes [DateTime] :time_last_detected The value to assign to the {#time_last_detected} property @option attributes [DateTime] :time_first_detected The value to assign to the {#time_first_detected} property @option attributes [Integer] :host_count The value to assign to the {#host_count} property @option attributes [String] :vulnerability_type The value to assign to the {#vulnerability_type} property @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 142 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.cve_reference = attributes[:'cveReference'] if attributes[:'cveReference'] raise 'You cannot provide both :cveReference and :cve_reference' if attributes.key?(:'cveReference') && attributes.key?(:'cve_reference') self.cve_reference = attributes[:'cve_reference'] if attributes[:'cve_reference'] self.severity = attributes[:'severity'] if attributes[:'severity'] self.state = attributes[:'state'] if attributes[:'state'] 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.host_count = attributes[:'hostCount'] if attributes[:'hostCount'] raise 'You cannot provide both :hostCount and :host_count' if attributes.key?(:'hostCount') && attributes.key?(:'host_count') self.host_count = attributes[:'host_count'] if attributes[:'host_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
Attribute type mapping.
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 107 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'id': :'String', 'compartment_id': :'String', 'cve_reference': :'String', 'severity': :'String', 'state': :'String', 'name': :'String', 'time_last_detected': :'DateTime', 'time_first_detected': :'DateTime', 'host_count': :'Integer', 'vulnerability_type': :'String', 'lifecycle_state': :'String' # rubocop:enable Style/SymbolLiteral } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] other the other object to be compared
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 258 def ==(other) return true if equal?(other) self.class == other.class && id == other.id && compartment_id == other.compartment_id && cve_reference == other.cve_reference && severity == other.severity && state == other.state && name == other.name && time_last_detected == other.time_last_detected && time_first_detected == other.time_first_detected && host_count == other.host_count && vulnerability_type == other.vulnerability_type && lifecycle_state == other.lifecycle_state end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 298 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
@see the `==` method @param [Object] other the other object to be compared
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 278 def eql?(other) self == other end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 287 def hash [id, compartment_id, cve_reference, severity, state, name, time_last_detected, time_first_detected, host_count, vulnerability_type, lifecycle_state].hash end
Custom attribute writer method checking allowed values (enum). @param [Object] lifecycle_state
Object
to be assigned
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 242 def lifecycle_state=(lifecycle_state) # rubocop:disable Style/ConditionalAssignment if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state) OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE else @lifecycle_state = lifecycle_state end # rubocop:enable Style/ConditionalAssignment end
Custom attribute writer method checking allowed values (enum). @param [Object] severity Object
to be assigned
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 203 def severity=(severity) # rubocop:disable Style/ConditionalAssignment if severity && !SEVERITY_ENUM.include?(severity) OCI.logger.debug("Unknown value for 'severity' [" + severity + "]. Mapping to 'SEVERITY_UNKNOWN_ENUM_VALUE'") if OCI.logger @severity = SEVERITY_UNKNOWN_ENUM_VALUE else @severity = severity end # rubocop:enable Style/ConditionalAssignment end
Custom attribute writer method checking allowed values (enum). @param [Object] state Object
to be assigned
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 216 def state=(state) # rubocop:disable Style/ConditionalAssignment if state && !STATE_ENUM.include?(state) OCI.logger.debug("Unknown value for 'state' [" + state + "]. Mapping to 'STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger @state = STATE_UNKNOWN_ENUM_VALUE else @state = state end # rubocop:enable Style/ConditionalAssignment end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 331 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
Returns the string representation of the object @return [String] String presentation of the object
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 325 def to_s to_hash.to_s end
Custom attribute writer method checking allowed values (enum). @param [Object] vulnerability_type
Object
to be assigned
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 229 def vulnerability_type=(vulnerability_type) # rubocop:disable Style/ConditionalAssignment if vulnerability_type && !VULNERABILITY_TYPE_ENUM.include?(vulnerability_type) OCI.logger.debug("Unknown value for 'vulnerability_type' [" + vulnerability_type + "]. Mapping to 'VULNERABILITY_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger @vulnerability_type = VULNERABILITY_TYPE_UNKNOWN_ENUM_VALUE else @vulnerability_type = vulnerability_type end # rubocop:enable Style/ConditionalAssignment end
Private Instance Methods
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/oci/vulnerability_scanning/models/host_vulnerability_summary.rb, line 348 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end