class OCI::Oda::Models::WorkRequestSummary

A description of the work request's status.

Constants

REQUEST_ACTION_ENUM
STATUS_ENUM

Attributes

compartment_id[RW]

[Required] The identifier of the compartment that contains the work request. @return [String]

id[RW]

[Required] The identifier of the work request. @return [String]

oda_instance_id[RW]

[Required] The identifier of the Digital Assistant instance to which this work request pertains. @return [String]

request_action[R]

[Required] The type of the operation that's associated with the work request. @return [String]

resources[RW]

[Required] The resources that this work request affects. @return [Array<OCI::Oda::Models::WorkRequestResource>]

status[R]

[Required] The status of current work request. @return [String]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/oci/oda/models/work_request_summary.rb, line 62
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'compartment_id': :'compartmentId',
    'oda_instance_id': :'odaInstanceId',
    'request_action': :'requestAction',
    'status': :'status',
    'resources': :'resources'
    # 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] :oda_instance_id The value to assign to the {#oda_instance_id} property @option attributes [String] :request_action The value to assign to the {#request_action} property @option attributes [String] :status The value to assign to the {#status} property @option attributes [Array<OCI::Oda::Models::WorkRequestResource>] :resources The value to assign to the {#resources} property

# File lib/oci/oda/models/work_request_summary.rb, line 101
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.oda_instance_id = attributes[:'odaInstanceId'] if attributes[:'odaInstanceId']

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

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

  self.request_action = attributes[:'requestAction'] if attributes[:'requestAction']

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

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

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

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

Attribute type mapping.

# File lib/oci/oda/models/work_request_summary.rb, line 76
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'compartment_id': :'String',
    'oda_instance_id': :'String',
    'request_action': :'String',
    'status': :'String',
    'resources': :'Array<OCI::Oda::Models::WorkRequestResource>'
    # 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/oda/models/work_request_summary.rb, line 165
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    id == other.id &&
    compartment_id == other.compartment_id &&
    oda_instance_id == other.oda_instance_id &&
    request_action == other.request_action &&
    status == other.status &&
    resources == other.resources
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/oda/models/work_request_summary.rb, line 200
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/oda/models/work_request_summary.rb, line 180
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/oda/models/work_request_summary.rb, line 189
def hash
  [id, compartment_id, oda_instance_id, request_action, status, resources].hash
end
request_action=(request_action) click to toggle source

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

# File lib/oci/oda/models/work_request_summary.rb, line 136
def request_action=(request_action)
  # rubocop:disable Style/ConditionalAssignment
  if request_action && !REQUEST_ACTION_ENUM.include?(request_action)
    OCI.logger.debug("Unknown value for 'request_action' [" + request_action + "]. Mapping to 'REQUEST_ACTION_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @request_action = REQUEST_ACTION_UNKNOWN_ENUM_VALUE
  else
    @request_action = request_action
  end
  # rubocop:enable Style/ConditionalAssignment
end
status=(status) click to toggle source

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

# File lib/oci/oda/models/work_request_summary.rb, line 149
def status=(status)
  # rubocop:disable Style/ConditionalAssignment
  if status && !STATUS_ENUM.include?(status)
    OCI.logger.debug("Unknown value for 'status' [" + status + "]. Mapping to 'STATUS_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @status = STATUS_UNKNOWN_ENUM_VALUE
  else
    @status = status
  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/oda/models/work_request_summary.rb, line 233
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/oda/models/work_request_summary.rb, line 227
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/oda/models/work_request_summary.rb, line 250
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