class OCI::Rover::Models::RoverWorkload

Information about a RoverWorkload.

Attributes

compartment_id[RW]

[Required] The OCID of the compartment containing the workload. @return [String]

id[RW]

[Required] The Unique Oracle ID (OCID) that is immutable on creation. @return [String]

name[RW]

Name of the Rover Workload @return [String]

object_count[RW]

Number of objects in a workload. @return [String]

prefix[RW]

Prefix to filter objects in case it is a bucket. @return [String]

range_end[RW]

End of the range in a bucket. @return [String]

range_start[RW]

Start of the range in a bucket. @return [String]

size[RW]

Size of the workload. @return [String]

work_request_id[RW]

The compute work request id to track progress of custom image exports. @return [String]

workload_type[RW]

[Required] The type of workload @return [String]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/oci/rover/models/rover_workload.rb, line 51
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'compartment_id': :'compartmentId',
    'id': :'id',
    'size': :'size',
    'object_count': :'objectCount',
    'prefix': :'prefix',
    'range_start': :'rangeStart',
    'range_end': :'rangeEnd',
    'workload_type': :'workloadType',
    'work_request_id': :'workRequestId'
    # 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] :name The value to assign to the {#name} property @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property @option attributes [String] :id The value to assign to the {#id} property @option attributes [String] :size The value to assign to the {#size} property @option attributes [String] :object_count The value to assign to the {#object_count} property @option attributes [String] :prefix The value to assign to the {#prefix} property @option attributes [String] :range_start The value to assign to the {#range_start} property @option attributes [String] :range_end The value to assign to the {#range_end} property @option attributes [String] :workload_type The value to assign to the {#workload_type} property @option attributes [String] :work_request_id The value to assign to the {#work_request_id} property

# File lib/oci/rover/models/rover_workload.rb, line 102
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.name = attributes[:'name'] if attributes[:'name']

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

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

  self.object_count = attributes[:'objectCount'] if attributes[:'objectCount']

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

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

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

  self.range_start = attributes[:'rangeStart'] if attributes[:'rangeStart']

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

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

  self.range_end = attributes[:'rangeEnd'] if attributes[:'rangeEnd']

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

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

  self.workload_type = attributes[:'workloadType'] if attributes[:'workloadType']

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

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

  self.work_request_id = attributes[:'workRequestId'] if attributes[:'workRequestId']

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

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

Attribute type mapping.

# File lib/oci/rover/models/rover_workload.rb, line 69
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'compartment_id': :'String',
    'id': :'String',
    'size': :'String',
    'object_count': :'String',
    'prefix': :'String',
    'range_start': :'String',
    'range_end': :'String',
    'workload_type': :'String',
    'work_request_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/rover/models/rover_workload.rb, line 160
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    name == other.name &&
    compartment_id == other.compartment_id &&
    id == other.id &&
    size == other.size &&
    object_count == other.object_count &&
    prefix == other.prefix &&
    range_start == other.range_start &&
    range_end == other.range_end &&
    workload_type == other.workload_type &&
    work_request_id == other.work_request_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/rover/models/rover_workload.rb, line 199
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/rover/models/rover_workload.rb, line 179
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/rover/models/rover_workload.rb, line 188
def hash
  [name, compartment_id, id, size, object_count, prefix, range_start, range_end, workload_type, work_request_id].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/rover/models/rover_workload.rb, line 232
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/rover/models/rover_workload.rb, line 226
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/rover/models/rover_workload.rb, line 249
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