class OCI::Core::Models::InstanceConfigurationCreateVnicDetails

Contains the properties of the VNIC for an instance configuration. See {CreateVnicDetails} and [Instance Configurations](docs.cloud.oracle.com/iaas/Content/Compute/Concepts/instancemanagement.htm#config) for more information.

Attributes

assign_private_dns_record[RW]

Whether the VNIC should be assigned a private DNS record. See the `assignPrivateDnsRecord` attribute of {CreateVnicDetails} for more information.

@return [BOOLEAN]

assign_public_ip[RW]

Whether the VNIC should be assigned a public IP address. See the `assignPublicIp` attribute of {CreateVnicDetails} for more information.

@return [BOOLEAN]

defined_tags[RW]

Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).

Example: `{"Operations": {"CostCenter": "42"}}`

@return [Hash<String, Hash<String, Object>>]

display_name[RW]

A user-friendly name for the VNIC. Does not have to be unique. Avoid entering confidential information.

@return [String]

freeform_tags[RW]

Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).

Example: `{"Department": "Finance"}`

@return [Hash<String, String>]

hostname_label[RW]

The hostname for the VNIC's primary private IP. See the `hostnameLabel` attribute of {CreateVnicDetails} for more information.

@return [String]

nsg_ids[RW]

A list of the OCIDs of the network security groups (NSGs) to add the VNIC to. For more information about NSGs, see {NetworkSecurityGroup}.

@return [Array<String>]

private_ip[RW]

A private IP address of your choice to assign to the VNIC. See the `privateIp` attribute of {CreateVnicDetails} for more information.

@return [String]

skip_source_dest_check[RW]

Whether the source/destination check is disabled on the VNIC. See the `skipSourceDestCheck` attribute of {CreateVnicDetails} for more information.

@return [BOOLEAN]

subnet_id[RW]

The OCID of the subnet to create the VNIC in. See the `subnetId` attribute of {CreateVnicDetails} for more information.

@return [String]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/oci/core/models/instance_configuration_create_vnic_details.rb, line 78
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'assign_public_ip': :'assignPublicIp',
    'assign_private_dns_record': :'assignPrivateDnsRecord',
    'defined_tags': :'definedTags',
    'display_name': :'displayName',
    'freeform_tags': :'freeformTags',
    'hostname_label': :'hostnameLabel',
    'nsg_ids': :'nsgIds',
    'private_ip': :'privateIp',
    'skip_source_dest_check': :'skipSourceDestCheck',
    'subnet_id': :'subnetId'
    # 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 [BOOLEAN] :assign_public_ip The value to assign to the {#assign_public_ip} property @option attributes [BOOLEAN] :assign_private_dns_record The value to assign to the {#assign_private_dns_record} property @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property @option attributes [String] :display_name The value to assign to the {#display_name} property @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property @option attributes [String] :hostname_label The value to assign to the {#hostname_label} property @option attributes [Array<String>] :nsg_ids The value to assign to the {#nsg_ids} property @option attributes [String] :private_ip The value to assign to the {#private_ip} property @option attributes [BOOLEAN] :skip_source_dest_check The value to assign to the {#skip_source_dest_check} property @option attributes [String] :subnet_id The value to assign to the {#subnet_id} property

# File lib/oci/core/models/instance_configuration_create_vnic_details.rb, line 129
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.assign_public_ip = attributes[:'assignPublicIp'] unless attributes[:'assignPublicIp'].nil?

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

  self.assign_public_ip = attributes[:'assign_public_ip'] unless attributes[:'assign_public_ip'].nil?

  self.assign_private_dns_record = attributes[:'assignPrivateDnsRecord'] unless attributes[:'assignPrivateDnsRecord'].nil?

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

  self.assign_private_dns_record = attributes[:'assign_private_dns_record'] unless attributes[:'assign_private_dns_record'].nil?

  self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']

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

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

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

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

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

  self.hostname_label = attributes[:'hostnameLabel'] if attributes[:'hostnameLabel']

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

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

  self.nsg_ids = attributes[:'nsgIds'] if attributes[:'nsgIds']

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

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

  self.private_ip = attributes[:'privateIp'] if attributes[:'privateIp']

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

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

  self.skip_source_dest_check = attributes[:'skipSourceDestCheck'] unless attributes[:'skipSourceDestCheck'].nil?

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

  self.skip_source_dest_check = attributes[:'skip_source_dest_check'] unless attributes[:'skip_source_dest_check'].nil?

  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']
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/oci/core/models/instance_configuration_create_vnic_details.rb, line 96
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'assign_public_ip': :'BOOLEAN',
    'assign_private_dns_record': :'BOOLEAN',
    'defined_tags': :'Hash<String, Hash<String, Object>>',
    'display_name': :'String',
    'freeform_tags': :'Hash<String, String>',
    'hostname_label': :'String',
    'nsg_ids': :'Array<String>',
    'private_ip': :'String',
    'skip_source_dest_check': :'BOOLEAN',
    'subnet_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/core/models/instance_configuration_create_vnic_details.rb, line 203
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    assign_public_ip == other.assign_public_ip &&
    assign_private_dns_record == other.assign_private_dns_record &&
    defined_tags == other.defined_tags &&
    display_name == other.display_name &&
    freeform_tags == other.freeform_tags &&
    hostname_label == other.hostname_label &&
    nsg_ids == other.nsg_ids &&
    private_ip == other.private_ip &&
    skip_source_dest_check == other.skip_source_dest_check &&
    subnet_id == other.subnet_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/core/models/instance_configuration_create_vnic_details.rb, line 242
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/core/models/instance_configuration_create_vnic_details.rb, line 222
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/core/models/instance_configuration_create_vnic_details.rb, line 231
def hash
  [assign_public_ip, assign_private_dns_record, defined_tags, display_name, freeform_tags, hostname_label, nsg_ids, private_ip, skip_source_dest_check, subnet_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/core/models/instance_configuration_create_vnic_details.rb, line 275
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/core/models/instance_configuration_create_vnic_details.rb, line 269
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/core/models/instance_configuration_create_vnic_details.rb, line 292
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