class OCI::CloudGuard::Models::DetectorRuleSummary

Summary of the Detector Rules.

Constants

DETECTOR_ENUM
LIFECYCLE_STATE_ENUM
MANAGED_LIST_TYPES_ENUM

Attributes

candidate_responder_rules[RW]

List of CandidateResponderRule related to this rule @return [Array<OCI::CloudGuard::Models::CandidateResponderRule>]

description[RW]

Description for detector rule @return [String]

detector[R]

[Required] possible type of detectors @return [String]

detector_details[RW]

@return [OCI::CloudGuard::Models::DetectorDetails]

display_name[RW]

DetectorTemplate Identifier, can be renamed @return [String]

id[RW]

[Required] The unique identifier of the detector rule @return [String]

lifecycle_details[RW]

A message describing the current state in more detail. For example, can be used to provide actionable information for a resource in Failed state. @return [String]

lifecycle_state[R]

The current state of the detector rule @return [String]

managed_list_types[R]

List of cloudguard managed list types related to this rule @return [Array<String>]

recommendation[RW]

Recommendation for detector rule @return [String]

resource_type[RW]

resource type of the configuration to which the rule is applied @return [String]

service_type[RW]

service type of the configuration to which the rule is applied @return [String]

time_created[RW]

The date and time the detector rule was created. Format defined by RFC3339. @return [DateTime]

time_updated[RW]

The date and time the detector rule was updated. 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/detector_rule_summary.rb, line 100
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'display_name': :'displayName',
    'description': :'description',
    'recommendation': :'recommendation',
    'detector': :'detector',
    'service_type': :'serviceType',
    'resource_type': :'resourceType',
    'managed_list_types': :'managedListTypes',
    'candidate_responder_rules': :'candidateResponderRules',
    'detector_details': :'detectorDetails',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated',
    'lifecycle_state': :'lifecycleState',
    'lifecycle_details': :'lifecycleDetails'
    # 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] :display_name The value to assign to the {#display_name} property @option attributes [String] :description The value to assign to the {#description} property @option attributes [String] :recommendation The value to assign to the {#recommendation} property @option attributes [String] :detector The value to assign to the {#detector} property @option attributes [String] :service_type The value to assign to the {#service_type} property @option attributes [String] :resource_type The value to assign to the {#resource_type} property @option attributes [Array<String>] :managed_list_types The value to assign to the {#managed_list_types} property @option attributes [Array<OCI::CloudGuard::Models::CandidateResponderRule>] :candidate_responder_rules The value to assign to the {#candidate_responder_rules} property @option attributes [OCI::CloudGuard::Models::DetectorDetails] :detector_details The value to assign to the {#detector_details} property @option attributes [DateTime] :time_created The value to assign to the {#time_created} property @option attributes [DateTime] :time_updated The value to assign to the {#time_updated} property @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property @option attributes [String] :lifecycle_details The value to assign to the {#lifecycle_details} property

# File lib/oci/cloud_guard/models/detector_rule_summary.rb, line 163
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.display_name = attributes[:'displayName'] if attributes[:'displayName']

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

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

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

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

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

  self.service_type = attributes[:'serviceType'] if attributes[:'serviceType']

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

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

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

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

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

  self.candidate_responder_rules = attributes[:'candidateResponderRules'] if attributes[:'candidateResponderRules']

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

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

  self.detector_details = attributes[:'detectorDetails'] if attributes[:'detectorDetails']

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

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

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

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

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

Attribute type mapping.

# File lib/oci/cloud_guard/models/detector_rule_summary.rb, line 122
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'display_name': :'String',
    'description': :'String',
    'recommendation': :'String',
    'detector': :'String',
    'service_type': :'String',
    'resource_type': :'String',
    'managed_list_types': :'Array<String>',
    'candidate_responder_rules': :'Array<OCI::CloudGuard::Models::CandidateResponderRule>',
    'detector_details': :'OCI::CloudGuard::Models::DetectorDetails',
    'time_created': :'DateTime',
    'time_updated': :'DateTime',
    'lifecycle_state': :'String',
    'lifecycle_details': :'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/detector_rule_summary.rb, line 291
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    id == other.id &&
    display_name == other.display_name &&
    description == other.description &&
    recommendation == other.recommendation &&
    detector == other.detector &&
    service_type == other.service_type &&
    resource_type == other.resource_type &&
    managed_list_types == other.managed_list_types &&
    candidate_responder_rules == other.candidate_responder_rules &&
    detector_details == other.detector_details &&
    time_created == other.time_created &&
    time_updated == other.time_updated &&
    lifecycle_state == other.lifecycle_state &&
    lifecycle_details == other.lifecycle_details
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/detector_rule_summary.rb, line 334
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=(detector) click to toggle source

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

# File lib/oci/cloud_guard/models/detector_rule_summary.rb, line 242
def detector=(detector)
  # rubocop:disable Style/ConditionalAssignment
  if detector && !DETECTOR_ENUM.include?(detector)
    OCI.logger.debug("Unknown value for 'detector' [" + detector + "]. Mapping to 'DETECTOR_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @detector = DETECTOR_UNKNOWN_ENUM_VALUE
  else
    @detector = detector
  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/detector_rule_summary.rb, line 314
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/detector_rule_summary.rb, line 323
def hash
  [id, display_name, description, recommendation, detector, service_type, resource_type, managed_list_types, candidate_responder_rules, detector_details, time_created, time_updated, lifecycle_state, lifecycle_details].hash
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/detector_rule_summary.rb, line 275
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
managed_list_types=(managed_list_types) click to toggle source

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

# File lib/oci/cloud_guard/models/detector_rule_summary.rb, line 255
def managed_list_types=(managed_list_types)
  # rubocop:disable Style/ConditionalAssignment
  if managed_list_types.nil?
    @managed_list_types = nil
  else
    @managed_list_types =
      managed_list_types.collect do |item|
        if MANAGED_LIST_TYPES_ENUM.include?(item)
          item
        else
          OCI.logger.debug("Unknown value for 'managed_list_types' [#{item}]. Mapping to 'MANAGED_LIST_TYPES_UNKNOWN_ENUM_VALUE'") if OCI.logger
          MANAGED_LIST_TYPES_UNKNOWN_ENUM_VALUE
        end
      end
  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/detector_rule_summary.rb, line 367
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/detector_rule_summary.rb, line 361
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/detector_rule_summary.rb, line 384
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