class OCI::Blockchain::Models::ScaleBlockchainPlatformDetails

Scale operation details for a blockchain platform. The scale operation payload has multiple options

The scale operation payload must have at least one of the above options.

Attributes

add_osns[RW]

new OSNs to add @return [Array<OCI::Blockchain::Models::CreateOsnDetails>]

add_peers[RW]

new Peers to add @return [Array<OCI::Blockchain::Models::CreatePeerDetails>]

add_replicas[RW]

@return [OCI::Blockchain::Models::ReplicaDetails]

add_storage[RW]

@return [OCI::Blockchain::Models::ScaleStorageDetails]

modify_peers[RW]

modify ocpu allocation to existing Peers @return [Array<OCI::Blockchain::Models::ModifyPeerDetails>]

remove_osns[RW]

OSN id list to remove @return [Array<String>]

remove_peers[RW]

Peer id list to remove @return [Array<String>]

remove_replicas[RW]

@return [OCI::Blockchain::Models::ReplicaDetails]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/oci/blockchain/models/scale_blockchain_platform_details.rb, line 50
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'add_osns': :'addOsns',
    'add_replicas': :'addReplicas',
    'add_peers': :'addPeers',
    'add_storage': :'addStorage',
    'modify_peers': :'modifyPeers',
    'remove_replicas': :'removeReplicas',
    'remove_osns': :'removeOsns',
    'remove_peers': :'removePeers'
    # 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 [Array<OCI::Blockchain::Models::CreateOsnDetails>] :add_osns The value to assign to the {#add_osns} property @option attributes [OCI::Blockchain::Models::ReplicaDetails] :add_replicas The value to assign to the {#add_replicas} property @option attributes [Array<OCI::Blockchain::Models::CreatePeerDetails>] :add_peers The value to assign to the {#add_peers} property @option attributes [OCI::Blockchain::Models::ScaleStorageDetails] :add_storage The value to assign to the {#add_storage} property @option attributes [Array<OCI::Blockchain::Models::ModifyPeerDetails>] :modify_peers The value to assign to the {#modify_peers} property @option attributes [OCI::Blockchain::Models::ReplicaDetails] :remove_replicas The value to assign to the {#remove_replicas} property @option attributes [Array<String>] :remove_osns The value to assign to the {#remove_osns} property @option attributes [Array<String>] :remove_peers The value to assign to the {#remove_peers} property

# File lib/oci/blockchain/models/scale_blockchain_platform_details.rb, line 95
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.add_osns = attributes[:'addOsns'] if attributes[:'addOsns']

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

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

  self.add_replicas = attributes[:'addReplicas'] if attributes[:'addReplicas']

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

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

  self.add_peers = attributes[:'addPeers'] if attributes[:'addPeers']

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

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

  self.add_storage = attributes[:'addStorage'] if attributes[:'addStorage']

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

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

  self.modify_peers = attributes[:'modifyPeers'] if attributes[:'modifyPeers']

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

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

  self.remove_replicas = attributes[:'removeReplicas'] if attributes[:'removeReplicas']

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

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

  self.remove_osns = attributes[:'removeOsns'] if attributes[:'removeOsns']

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

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

  self.remove_peers = attributes[:'removePeers'] if attributes[:'removePeers']

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

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

Attribute type mapping.

# File lib/oci/blockchain/models/scale_blockchain_platform_details.rb, line 66
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'add_osns': :'Array<OCI::Blockchain::Models::CreateOsnDetails>',
    'add_replicas': :'OCI::Blockchain::Models::ReplicaDetails',
    'add_peers': :'Array<OCI::Blockchain::Models::CreatePeerDetails>',
    'add_storage': :'OCI::Blockchain::Models::ScaleStorageDetails',
    'modify_peers': :'Array<OCI::Blockchain::Models::ModifyPeerDetails>',
    'remove_replicas': :'OCI::Blockchain::Models::ReplicaDetails',
    'remove_osns': :'Array<String>',
    'remove_peers': :'Array<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/blockchain/models/scale_blockchain_platform_details.rb, line 157
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    add_osns == other.add_osns &&
    add_replicas == other.add_replicas &&
    add_peers == other.add_peers &&
    add_storage == other.add_storage &&
    modify_peers == other.modify_peers &&
    remove_replicas == other.remove_replicas &&
    remove_osns == other.remove_osns &&
    remove_peers == other.remove_peers
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/blockchain/models/scale_blockchain_platform_details.rb, line 194
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/blockchain/models/scale_blockchain_platform_details.rb, line 174
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/blockchain/models/scale_blockchain_platform_details.rb, line 183
def hash
  [add_osns, add_replicas, add_peers, add_storage, modify_peers, remove_replicas, remove_osns, remove_peers].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/blockchain/models/scale_blockchain_platform_details.rb, line 227
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/blockchain/models/scale_blockchain_platform_details.rb, line 221
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/blockchain/models/scale_blockchain_platform_details.rb, line 244
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