class OCI::CloudGuard::Models::ProblemSummary

Summary of the Problem.

Constants

DETECTOR_ID_ENUM
LIFECYCLE_DETAIL_ENUM
LIFECYCLE_STATE_ENUM
RISK_LEVEL_ENUM

Attributes

compartment_id[RW]

[Required] Compartment Identifier where the resource is created @return [String]

detector_id[R]

Id of detector associated with the Problem. @return [String]

detector_rule_id[RW]

Identifier of the rule @return [String]

id[RW]

[Required] Unique identifier that is immutable on creation @return [String]

labels[RW]

user defined labels on the problem @return [Array<String>]

lifecycle_detail[R]

The lifecycleDetail will give more detail on the substate of the lifecycleState. @return [String]

lifecycle_state[R]

The current state of the Problem. @return [String]

region[RW]

DEPRECATED @return [String]

regions[RW]

Regions where the problem is found @return [Array<String>]

resource_id[RW]

Identifier of the Resource @return [String]

resource_name[RW]

DisplayName of the Resource @return [String]

resource_type[RW]

Type of the Resource @return [String]

risk_level[R]

The Risk Level @return [String]

target_id[RW]

targetId associated with the problem. @return [String]

time_first_detected[RW]

The date and time the problem was first detected. Format defined by RFC3339. @return [DateTime]

time_last_detected[RW]

The date and time the problem was last detected. Format defined by RFC3339. @return [DateTime]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/oci/cloud_guard/models/problem_summary.rb, line 104
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'compartment_id': :'compartmentId',
    'detector_rule_id': :'detectorRuleId',
    'risk_level': :'riskLevel',
    'resource_id': :'resourceId',
    'resource_name': :'resourceName',
    'resource_type': :'resourceType',
    'labels': :'labels',
    'time_first_detected': :'timeFirstDetected',
    'time_last_detected': :'timeLastDetected',
    'lifecycle_state': :'lifecycleState',
    'lifecycle_detail': :'lifecycleDetail',
    'detector_id': :'detectorId',
    'region': :'region',
    'regions': :'regions',
    'target_id': :'targetId'
    # rubocop:enable Style/SymbolLiteral
  }
end
new(attributes = {}) click to toggle source

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] :detector_rule_id The value to assign to the {#detector_rule_id} property @option attributes [String] :risk_level The value to assign to the {#risk_level} property @option attributes [String] :resource_id The value to assign to the {#resource_id} property @option attributes [String] :resource_name The value to assign to the {#resource_name} property @option attributes [String] :resource_type The value to assign to the {#resource_type} property @option attributes [Array<String>] :labels The value to assign to the {#labels} property @option attributes [DateTime] :time_first_detected The value to assign to the {#time_first_detected} property @option attributes [DateTime] :time_last_detected The value to assign to the {#time_last_detected} property @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property @option attributes [String] :lifecycle_detail The value to assign to the {#lifecycle_detail} property @option attributes [String] :detector_id The value to assign to the {#detector_id} property @option attributes [String] :region The value to assign to the {#region} property @option attributes [Array<String>] :regions The value to assign to the {#regions} property @option attributes [String] :target_id The value to assign to the {#target_id} property

# File lib/oci/cloud_guard/models/problem_summary.rb, line 173
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.detector_rule_id = attributes[:'detectorRuleId'] if attributes[:'detectorRuleId']

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

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

  self.risk_level = attributes[:'riskLevel'] if attributes[:'riskLevel']

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

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

  self.resource_id = attributes[:'resourceId'] if attributes[:'resourceId']

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

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

  self.resource_name = attributes[:'resourceName'] if attributes[:'resourceName']

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

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

  self.resource_type = attributes[:'resourceType'] if attributes[:'resourceType']

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

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

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

  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.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.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']

  self.lifecycle_detail = attributes[:'lifecycleDetail'] if attributes[:'lifecycleDetail']

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

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

  self.detector_id = attributes[:'detectorId'] if attributes[:'detectorId']

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

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

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

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

  self.target_id = attributes[:'targetId'] if attributes[:'targetId']

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

  self.target_id = attributes[:'target_id'] if attributes[:'target_id']
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/oci/cloud_guard/models/problem_summary.rb, line 128
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'compartment_id': :'String',
    'detector_rule_id': :'String',
    'risk_level': :'String',
    'resource_id': :'String',
    'resource_name': :'String',
    'resource_type': :'String',
    'labels': :'Array<String>',
    'time_first_detected': :'DateTime',
    'time_last_detected': :'DateTime',
    'lifecycle_state': :'String',
    'lifecycle_detail': :'String',
    'detector_id': :'String',
    'region': :'String',
    'regions': :'Array<String>',
    'target_id': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Public Instance Methods

==(other) click to toggle source

Checks equality by comparing each attribute. @param [Object] other the other object to be compared

# File lib/oci/cloud_guard/models/problem_summary.rb, line 319
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    id == other.id &&
    compartment_id == other.compartment_id &&
    detector_rule_id == other.detector_rule_id &&
    risk_level == other.risk_level &&
    resource_id == other.resource_id &&
    resource_name == other.resource_name &&
    resource_type == other.resource_type &&
    labels == other.labels &&
    time_first_detected == other.time_first_detected &&
    time_last_detected == other.time_last_detected &&
    lifecycle_state == other.lifecycle_state &&
    lifecycle_detail == other.lifecycle_detail &&
    detector_id == other.detector_id &&
    region == other.region &&
    regions == other.regions &&
    target_id == other.target_id
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/oci/cloud_guard/models/problem_summary.rb, line 364
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
detector_id=(detector_id) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] detector_id Object to be assigned

# File lib/oci/cloud_guard/models/problem_summary.rb, line 303
def detector_id=(detector_id)
  # rubocop:disable Style/ConditionalAssignment
  if detector_id && !DETECTOR_ID_ENUM.include?(detector_id)
    OCI.logger.debug("Unknown value for 'detector_id' [" + detector_id + "]. Mapping to 'DETECTOR_ID_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @detector_id = DETECTOR_ID_UNKNOWN_ENUM_VALUE
  else
    @detector_id = detector_id
  end
  # rubocop:enable Style/ConditionalAssignment
end
eql?(other) click to toggle source

@see the `==` method @param [Object] other the other object to be compared

# File lib/oci/cloud_guard/models/problem_summary.rb, line 344
def eql?(other)
  self == other
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/oci/cloud_guard/models/problem_summary.rb, line 353
def hash
  [id, compartment_id, detector_rule_id, risk_level, resource_id, resource_name, resource_type, labels, time_first_detected, time_last_detected, lifecycle_state, lifecycle_detail, detector_id, region, regions, target_id].hash
end
lifecycle_detail=(lifecycle_detail) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] lifecycle_detail Object to be assigned

# File lib/oci/cloud_guard/models/problem_summary.rb, line 290
def lifecycle_detail=(lifecycle_detail)
  # rubocop:disable Style/ConditionalAssignment
  if lifecycle_detail && !LIFECYCLE_DETAIL_ENUM.include?(lifecycle_detail)
    OCI.logger.debug("Unknown value for 'lifecycle_detail' [" + lifecycle_detail + "]. Mapping to 'LIFECYCLE_DETAIL_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @lifecycle_detail = LIFECYCLE_DETAIL_UNKNOWN_ENUM_VALUE
  else
    @lifecycle_detail = lifecycle_detail
  end
  # rubocop:enable Style/ConditionalAssignment
end
lifecycle_state=(lifecycle_state) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] lifecycle_state Object to be assigned

# File lib/oci/cloud_guard/models/problem_summary.rb, line 277
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
risk_level=(risk_level) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] risk_level Object to be assigned

# File lib/oci/cloud_guard/models/problem_summary.rb, line 264
def risk_level=(risk_level)
  # rubocop:disable Style/ConditionalAssignment
  if risk_level && !RISK_LEVEL_ENUM.include?(risk_level)
    OCI.logger.debug("Unknown value for 'risk_level' [" + risk_level + "]. Mapping to 'RISK_LEVEL_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @risk_level = RISK_LEVEL_UNKNOWN_ENUM_VALUE
  else
    @risk_level = risk_level
  end
  # rubocop:enable Style/ConditionalAssignment
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/oci/cloud_guard/models/problem_summary.rb, line 397
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_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/oci/cloud_guard/models/problem_summary.rb, line 391
def to_s
  to_hash.to_s
end

Private Instance Methods

_to_hash(value) click to toggle source

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/cloud_guard/models/problem_summary.rb, line 414
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