class OCI::DatabaseMigration::Models::MigrationJobProgressSummary

Summary of the progress of a Migration Job.

Constants

CURRENT_PHASE_ENUM
CURRENT_STATUS_ENUM

Attributes

current_phase[R]

[Required] Current phase of the job.

@return [String]

current_status[R]

[Required] Current status of the job.

@return [String]

job_progress[RW]

[Required] Job progress percentage (0 - 100)

@return [Integer]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/oci/database_migration/models/migration_job_progress_summary.rb, line 56
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'current_phase': :'currentPhase',
    'current_status': :'currentStatus',
    'job_progress': :'jobProgress'
    # 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] :current_phase The value to assign to the {#current_phase} property @option attributes [String] :current_status The value to assign to the {#current_status} property @option attributes [Integer] :job_progress The value to assign to the {#job_progress} property

# File lib/oci/database_migration/models/migration_job_progress_summary.rb, line 86
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.current_phase = attributes[:'currentPhase'] if attributes[:'currentPhase']

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

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

  self.current_status = attributes[:'currentStatus'] if attributes[:'currentStatus']

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

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

  self.job_progress = attributes[:'jobProgress'] if attributes[:'jobProgress']

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

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

Attribute type mapping.

# File lib/oci/database_migration/models/migration_job_progress_summary.rb, line 67
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'current_phase': :'String',
    'current_status': :'String',
    'job_progress': :'Integer'
    # 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/database_migration/models/migration_job_progress_summary.rb, line 144
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    current_phase == other.current_phase &&
    current_status == other.current_status &&
    job_progress == other.job_progress
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/database_migration/models/migration_job_progress_summary.rb, line 176
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
current_phase=(current_phase) click to toggle source

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

# File lib/oci/database_migration/models/migration_job_progress_summary.rb, line 115
def current_phase=(current_phase)
  # rubocop:disable Style/ConditionalAssignment
  if current_phase && !CURRENT_PHASE_ENUM.include?(current_phase)
    OCI.logger.debug("Unknown value for 'current_phase' [" + current_phase + "]. Mapping to 'CURRENT_PHASE_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @current_phase = CURRENT_PHASE_UNKNOWN_ENUM_VALUE
  else
    @current_phase = current_phase
  end
  # rubocop:enable Style/ConditionalAssignment
end
current_status=(current_status) click to toggle source

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

# File lib/oci/database_migration/models/migration_job_progress_summary.rb, line 128
def current_status=(current_status)
  # rubocop:disable Style/ConditionalAssignment
  if current_status && !CURRENT_STATUS_ENUM.include?(current_status)
    OCI.logger.debug("Unknown value for 'current_status' [" + current_status + "]. Mapping to 'CURRENT_STATUS_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @current_status = CURRENT_STATUS_UNKNOWN_ENUM_VALUE
  else
    @current_status = current_status
  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/database_migration/models/migration_job_progress_summary.rb, line 156
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/database_migration/models/migration_job_progress_summary.rb, line 165
def hash
  [current_phase, current_status, job_progress].hash
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/database_migration/models/migration_job_progress_summary.rb, line 209
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/database_migration/models/migration_job_progress_summary.rb, line 203
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/database_migration/models/migration_job_progress_summary.rb, line 226
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