class OCI::Core::Models::IPSecConnectionTunnel

Information about a single tunnel in an IPSec connection. This object does not include the tunnel's shared secret (pre-shared key). That is in the {IPSecConnectionTunnelSharedSecret} object.

Constants

IKE_VERSION_ENUM
LIFECYCLE_STATE_ENUM
ROUTING_ENUM
STATUS_ENUM

Attributes

bgp_session_info[RW]

@return [OCI::Core::Models::BgpSessionInfo]

compartment_id[RW]

[Required] The [OCID](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the tunnel.

@return [String]

cpe_ip[RW]

The IP address of the CPE's VPN headend.

Example: `203.0.113.22`

@return [String]

display_name[RW]

A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

@return [String]

encryption_domain_config[RW]

@return [OCI::Core::Models::EncryptionDomainConfig]

id[RW]

[Required] The [OCID](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the tunnel. @return [String]

ike_version[R]

Internet Key Exchange protocol version.

@return [String]

lifecycle_state[R]

[Required] The tunnel's lifecycle state. @return [String]

routing[R]

The type of routing used for this tunnel (either BGP dynamic routing or static routing).

@return [String]

status[R]

The status of the tunnel based on IPSec protocol characteristics. @return [String]

time_created[RW]

The date and time the IPSec connection tunnel was created, in the format defined by [RFC3339](tools.ietf.org/html/rfc3339).

Example: `2016-08-25T21:10:29.600Z`

@return [DateTime]

time_status_updated[RW]

When the status of the tunnel last changed, in the format defined by [RFC3339](tools.ietf.org/html/rfc3339).

Example: `2016-08-25T21:10:29.600Z`

@return [DateTime]

vpn_ip[RW]

The IP address of Oracle's VPN headend.

Example: `203.0.113.21`

@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/ip_sec_connection_tunnel.rb, line 111
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'compartment_id': :'compartmentId',
    'id': :'id',
    'vpn_ip': :'vpnIp',
    'cpe_ip': :'cpeIp',
    'status': :'status',
    'ike_version': :'ikeVersion',
    'lifecycle_state': :'lifecycleState',
    'display_name': :'displayName',
    'bgp_session_info': :'bgpSessionInfo',
    'encryption_domain_config': :'encryptionDomainConfig',
    'routing': :'routing',
    'time_created': :'timeCreated',
    'time_status_updated': :'timeStatusUpdated'
    # 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] :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] :vpn_ip The value to assign to the {#vpn_ip} property @option attributes [String] :cpe_ip The value to assign to the {#cpe_ip} property @option attributes [String] :status The value to assign to the {#status} property @option attributes [String] :ike_version The value to assign to the {#ike_version} property @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property @option attributes [String] :display_name The value to assign to the {#display_name} property @option attributes [OCI::Core::Models::BgpSessionInfo] :bgp_session_info The value to assign to the {#bgp_session_info} property @option attributes [OCI::Core::Models::EncryptionDomainConfig] :encryption_domain_config The value to assign to the {#encryption_domain_config} property @option attributes [String] :routing The value to assign to the {#routing} property @option attributes [DateTime] :time_created The value to assign to the {#time_created} property @option attributes [DateTime] :time_status_updated The value to assign to the {#time_status_updated} property

# File lib/oci/core/models/ip_sec_connection_tunnel.rb, line 171
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.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.vpn_ip = attributes[:'vpnIp'] if attributes[:'vpnIp']

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

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

  self.cpe_ip = attributes[:'cpeIp'] if attributes[:'cpeIp']

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

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

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

  self.ike_version = attributes[:'ikeVersion'] if attributes[:'ikeVersion']

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

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

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

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

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

  self.encryption_domain_config = attributes[:'encryptionDomainConfig'] if attributes[:'encryptionDomainConfig']

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

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

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

  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_status_updated = attributes[:'timeStatusUpdated'] if attributes[:'timeStatusUpdated']

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

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

Attribute type mapping.

# File lib/oci/core/models/ip_sec_connection_tunnel.rb, line 132
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'compartment_id': :'String',
    'id': :'String',
    'vpn_ip': :'String',
    'cpe_ip': :'String',
    'status': :'String',
    'ike_version': :'String',
    'lifecycle_state': :'String',
    'display_name': :'String',
    'bgp_session_info': :'OCI::Core::Models::BgpSessionInfo',
    'encryption_domain_config': :'OCI::Core::Models::EncryptionDomainConfig',
    'routing': :'String',
    'time_created': :'DateTime',
    'time_status_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/core/models/ip_sec_connection_tunnel.rb, line 303
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    compartment_id == other.compartment_id &&
    id == other.id &&
    vpn_ip == other.vpn_ip &&
    cpe_ip == other.cpe_ip &&
    status == other.status &&
    ike_version == other.ike_version &&
    lifecycle_state == other.lifecycle_state &&
    display_name == other.display_name &&
    bgp_session_info == other.bgp_session_info &&
    encryption_domain_config == other.encryption_domain_config &&
    routing == other.routing &&
    time_created == other.time_created &&
    time_status_updated == other.time_status_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/core/models/ip_sec_connection_tunnel.rb, line 345
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/ip_sec_connection_tunnel.rb, line 325
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/ip_sec_connection_tunnel.rb, line 334
def hash
  [compartment_id, id, vpn_ip, cpe_ip, status, ike_version, lifecycle_state, display_name, bgp_session_info, encryption_domain_config, routing, time_created, time_status_updated].hash
end
ike_version=(ike_version) click to toggle source

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

# File lib/oci/core/models/ip_sec_connection_tunnel.rb, line 261
def ike_version=(ike_version)
  # rubocop:disable Style/ConditionalAssignment
  if ike_version && !IKE_VERSION_ENUM.include?(ike_version)
    OCI.logger.debug("Unknown value for 'ike_version' [" + ike_version + "]. Mapping to 'IKE_VERSION_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @ike_version = IKE_VERSION_UNKNOWN_ENUM_VALUE
  else
    @ike_version = ike_version
  end
  # rubocop:enable Style/ConditionalAssignment
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/core/models/ip_sec_connection_tunnel.rb, line 274
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
routing=(routing) click to toggle source

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

# File lib/oci/core/models/ip_sec_connection_tunnel.rb, line 287
def routing=(routing)
  # rubocop:disable Style/ConditionalAssignment
  if routing && !ROUTING_ENUM.include?(routing)
    OCI.logger.debug("Unknown value for 'routing' [" + routing + "]. Mapping to 'ROUTING_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @routing = ROUTING_UNKNOWN_ENUM_VALUE
  else
    @routing = routing
  end
  # rubocop:enable Style/ConditionalAssignment
end
status=(status) click to toggle source

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

# File lib/oci/core/models/ip_sec_connection_tunnel.rb, line 248
def status=(status)
  # rubocop:disable Style/ConditionalAssignment
  if status && !STATUS_ENUM.include?(status)
    OCI.logger.debug("Unknown value for 'status' [" + status + "]. Mapping to 'STATUS_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @status = STATUS_UNKNOWN_ENUM_VALUE
  else
    @status = status
  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/core/models/ip_sec_connection_tunnel.rb, line 378
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/ip_sec_connection_tunnel.rb, line 372
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/ip_sec_connection_tunnel.rb, line 395
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