class OCI::CloudGuard::Models::ProblemHistorySummary

Problem History Definition.

Constants

ACTOR_TYPE_ENUM
EVENT_STATUS_ENUM
LIFECYCLE_DETAIL_ENUM

Attributes

actor_name[RW]

[Required] Resource Name who performed activity @return [String]

actor_type[R]

[Required] Actor type who performed the operation @return [String]

comment[RW]

User Defined Comments @return [String]

delta[RW]

[Required] Impacted Resource Names in a comma-separated string. @return [String]

event_status[R]

Event status @return [String]

explanation[RW]

[Required] Activity explanation details @return [String]

id[RW]

[Required] Unique identifier for the history record @return [String]

lifecycle_detail[R]

[Required] Problem Lifecycle Detail Status @return [String]

problem_id[RW]

[Required] problemId for which history is associated to. @return [String]

time_created[RW]

[Required] Type of the Entity @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_history_summary.rb, line 76
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'problem_id': :'problemId',
    'actor_type': :'actorType',
    'actor_name': :'actorName',
    'explanation': :'explanation',
    'lifecycle_detail': :'lifecycleDetail',
    'event_status': :'eventStatus',
    'time_created': :'timeCreated',
    'delta': :'delta',
    'comment': :'comment'
    # 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] :problem_id The value to assign to the {#problem_id} property @option attributes [String] :actor_type The value to assign to the {#actor_type} property @option attributes [String] :actor_name The value to assign to the {#actor_name} property @option attributes [String] :explanation The value to assign to the {#explanation} property @option attributes [String] :lifecycle_detail The value to assign to the {#lifecycle_detail} property @option attributes [String] :event_status The value to assign to the {#event_status} property @option attributes [DateTime] :time_created The value to assign to the {#time_created} property @option attributes [String] :delta The value to assign to the {#delta} property @option attributes [String] :comment The value to assign to the {#comment} property

# File lib/oci/cloud_guard/models/problem_history_summary.rb, line 127
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.problem_id = attributes[:'problemId'] if attributes[:'problemId']

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

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

  self.actor_type = attributes[:'actorType'] if attributes[:'actorType']

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

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

  self.actor_name = attributes[:'actorName'] if attributes[:'actorName']

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

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

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

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

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

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

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

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

Attribute type mapping.

# File lib/oci/cloud_guard/models/problem_history_summary.rb, line 94
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'problem_id': :'String',
    'actor_type': :'String',
    'actor_name': :'String',
    'explanation': :'String',
    'lifecycle_detail': :'String',
    'event_status': :'String',
    'time_created': :'DateTime',
    'delta': :'String',
    'comment': :'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_history_summary.rb, line 224
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    id == other.id &&
    problem_id == other.problem_id &&
    actor_type == other.actor_type &&
    actor_name == other.actor_name &&
    explanation == other.explanation &&
    lifecycle_detail == other.lifecycle_detail &&
    event_status == other.event_status &&
    time_created == other.time_created &&
    delta == other.delta &&
    comment == other.comment
end
actor_type=(actor_type) click to toggle source

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

# File lib/oci/cloud_guard/models/problem_history_summary.rb, line 182
def actor_type=(actor_type)
  # rubocop:disable Style/ConditionalAssignment
  if actor_type && !ACTOR_TYPE_ENUM.include?(actor_type)
    OCI.logger.debug("Unknown value for 'actor_type' [" + actor_type + "]. Mapping to 'ACTOR_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @actor_type = ACTOR_TYPE_UNKNOWN_ENUM_VALUE
  else
    @actor_type = actor_type
  end
  # rubocop:enable Style/ConditionalAssignment
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_history_summary.rb, line 263
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) click to toggle source

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

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

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

# File lib/oci/cloud_guard/models/problem_history_summary.rb, line 208
def event_status=(event_status)
  # rubocop:disable Style/ConditionalAssignment
  if event_status && !EVENT_STATUS_ENUM.include?(event_status)
    OCI.logger.debug("Unknown value for 'event_status' [" + event_status + "]. Mapping to 'EVENT_STATUS_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @event_status = EVENT_STATUS_UNKNOWN_ENUM_VALUE
  else
    @event_status = event_status
  end
  # rubocop:enable Style/ConditionalAssignment
end
hash() click to toggle source

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

# File lib/oci/cloud_guard/models/problem_history_summary.rb, line 252
def hash
  [id, problem_id, actor_type, actor_name, explanation, lifecycle_detail, event_status, time_created, delta, comment].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_history_summary.rb, line 195
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
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_history_summary.rb, line 296
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_history_summary.rb, line 290
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_history_summary.rb, line 313
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