class OCI::Bds::Models::Node

Details about a node.

Constants

LIFECYCLE_STATE_ENUM
NODE_TYPE_ENUM

Attributes

attached_block_volumes[RW]

The list of block volumes attached to a given node. @return [Array<OCI::Bds::Models::VolumeAttachmentDetail>]

availability_domain[RW]

[Required] The name of the availability domain in which the node is running. @return [String]

display_name[RW]

[Required] The name of the node. @return [String]

fault_domain[RW]

[Required] The name of the fault domain in which the node is running. @return [String]

hostname[RW]

The fully-qualified hostname (FQDN) of the node. @return [String]

image_id[RW]

The OCID of the image from which the node was created. @return [String]

instance_id[RW]

[Required] The OCID of the underlying Oracle Cloud Infrastructure Compute instance. @return [String]

ip_address[RW]

[Required] IP address of the node. @return [String]

lifecycle_state[R]

[Required] The state of the node. @return [String]

node_type[R]

[Required] Cluster node type. @return [String]

shape[RW]

[Required] Shape of the node. @return [String]

ssh_fingerprint[RW]

[Required] The fingerprint of the SSH key used for node access. @return [String]

subnet_id[RW]

[Required] The OCID of the subnet in which the node is to be created. @return [String]

time_created[RW]

[Required] The time the node was created, shown as an RFC 3339 formatted datetime string. @return [DateTime]

time_updated[RW]

The time the cluster was updated, shown as an RFC 3339 formatted datetime string. @return [DateTime]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/oci/bds/models/node.rb, line 93
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'instance_id': :'instanceId',
    'display_name': :'displayName',
    'lifecycle_state': :'lifecycleState',
    'node_type': :'nodeType',
    'shape': :'shape',
    'attached_block_volumes': :'attachedBlockVolumes',
    'subnet_id': :'subnetId',
    'ip_address': :'ipAddress',
    'hostname': :'hostname',
    'image_id': :'imageId',
    'ssh_fingerprint': :'sshFingerprint',
    'availability_domain': :'availabilityDomain',
    'fault_domain': :'faultDomain',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated'
    # 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] :instance_id The value to assign to the {#instance_id} property @option attributes [String] :display_name The value to assign to the {#display_name} property @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property @option attributes [String] :node_type The value to assign to the {#node_type} property @option attributes [String] :shape The value to assign to the {#shape} property @option attributes [Array<OCI::Bds::Models::VolumeAttachmentDetail>] :attached_block_volumes The value to assign to the {#attached_block_volumes} property @option attributes [String] :subnet_id The value to assign to the {#subnet_id} property @option attributes [String] :ip_address The value to assign to the {#ip_address} property @option attributes [String] :hostname The value to assign to the {#hostname} property @option attributes [String] :image_id The value to assign to the {#image_id} property @option attributes [String] :ssh_fingerprint The value to assign to the {#ssh_fingerprint} property @option attributes [String] :availability_domain The value to assign to the {#availability_domain} property @option attributes [String] :fault_domain The value to assign to the {#fault_domain} property @option attributes [DateTime] :time_created The value to assign to the {#time_created} property @option attributes [DateTime] :time_updated The value to assign to the {#time_updated} property

# File lib/oci/bds/models/node.rb, line 159
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.instance_id = attributes[:'instanceId'] if attributes[:'instanceId']

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

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

  self.display_name = attributes[:'displayName'] if attributes[:'displayName']

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

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

  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']

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

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

  self.node_type = attributes[:'nodeType'] if attributes[:'nodeType']

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

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

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

  self.attached_block_volumes = attributes[:'attachedBlockVolumes'] if attributes[:'attachedBlockVolumes']

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

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

  self.subnet_id = attributes[:'subnetId'] if attributes[:'subnetId']

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

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

  self.ip_address = attributes[:'ipAddress'] if attributes[:'ipAddress']

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

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

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

  self.image_id = attributes[:'imageId'] if attributes[:'imageId']

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

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

  self.ssh_fingerprint = attributes[:'sshFingerprint'] if attributes[:'sshFingerprint']

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

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

  self.availability_domain = attributes[:'availabilityDomain'] if attributes[:'availabilityDomain']

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

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

  self.fault_domain = attributes[:'faultDomain'] if attributes[:'faultDomain']

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

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

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

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

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

Attribute type mapping.

# File lib/oci/bds/models/node.rb, line 116
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'instance_id': :'String',
    'display_name': :'String',
    'lifecycle_state': :'String',
    'node_type': :'String',
    'shape': :'String',
    'attached_block_volumes': :'Array<OCI::Bds::Models::VolumeAttachmentDetail>',
    'subnet_id': :'String',
    'ip_address': :'String',
    'hostname': :'String',
    'image_id': :'String',
    'ssh_fingerprint': :'String',
    'availability_domain': :'String',
    'fault_domain': :'String',
    'time_created': :'DateTime',
    'time_updated': :'DateTime'
    # 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/bds/models/node.rb, line 281
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    instance_id == other.instance_id &&
    display_name == other.display_name &&
    lifecycle_state == other.lifecycle_state &&
    node_type == other.node_type &&
    shape == other.shape &&
    attached_block_volumes == other.attached_block_volumes &&
    subnet_id == other.subnet_id &&
    ip_address == other.ip_address &&
    hostname == other.hostname &&
    image_id == other.image_id &&
    ssh_fingerprint == other.ssh_fingerprint &&
    availability_domain == other.availability_domain &&
    fault_domain == other.fault_domain &&
    time_created == other.time_created &&
    time_updated == other.time_updated
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/bds/models/node.rb, line 325
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/bds/models/node.rb, line 305
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/bds/models/node.rb, line 314
def hash
  [instance_id, display_name, lifecycle_state, node_type, shape, attached_block_volumes, subnet_id, ip_address, hostname, image_id, ssh_fingerprint, availability_domain, fault_domain, time_created, time_updated].hash
end
lifecycle_state=(lifecycle_state) click to toggle source

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

# File lib/oci/bds/models/node.rb, line 252
def lifecycle_state=(lifecycle_state)
  # rubocop:disable Style/ConditionalAssignment
  if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
    OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
  else
    @lifecycle_state = lifecycle_state
  end
  # rubocop:enable Style/ConditionalAssignment
end
node_type=(node_type) click to toggle source

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

# File lib/oci/bds/models/node.rb, line 265
def node_type=(node_type)
  # rubocop:disable Style/ConditionalAssignment
  if node_type && !NODE_TYPE_ENUM.include?(node_type)
    OCI.logger.debug("Unknown value for 'node_type' [" + node_type + "]. Mapping to 'NODE_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @node_type = NODE_TYPE_UNKNOWN_ENUM_VALUE
  else
    @node_type = node_type
  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/bds/models/node.rb, line 358
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/bds/models/node.rb, line 352
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/bds/models/node.rb, line 375
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