Class: OCI::Core::Models::AddDrgRouteRuleDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/core/models/add_drg_route_rule_details.rb

Overview

Details needed when adding a DRG route rule.

Constant Summary collapse

DESTINATION_TYPE_ENUM =
[
  DESTINATION_TYPE_CIDR_BLOCK = 'CIDR_BLOCK'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AddDrgRouteRuleDetails

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/oci/core/models/add_drg_route_rule_details.rb', line 70

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

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

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

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

  self.next_hop_drg_attachment_id = attributes[:'nextHopDrgAttachmentId'] if attributes[:'nextHopDrgAttachmentId']

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

  self.next_hop_drg_attachment_id = attributes[:'next_hop_drg_attachment_id'] if attributes[:'next_hop_drg_attachment_id']
end

Instance Attribute Details

#destinationString

[Required] This is the range of IP addresses used for matching when routing traffic. Only CIDR_BLOCK values are allowed.

Potential values: * IP address range in CIDR notation. This can be an IPv4 CIDR block or IPv6 prefix. For example: 192.168.1.0/24 or 2001:0db8:0123:45::/56.

Returns:

  • (String)


31
32
33
# File 'lib/oci/core/models/add_drg_route_rule_details.rb', line 31

def destination
  @destination
end

#destination_typeString

[Required] Type of destination for the rule. Allowed values: * CIDR_BLOCK: If the rule's destination is an IP address range in CIDR notation.

Returns:

  • (String)


21
22
23
# File 'lib/oci/core/models/add_drg_route_rule_details.rb', line 21

def destination_type
  @destination_type
end

#next_hop_drg_attachment_idString

[Required] The OCID of the next hop DRG attachment. The next hop DRG attachment is responsible for reaching the network destination.

Returns:

  • (String)


37
38
39
# File 'lib/oci/core/models/add_drg_route_rule_details.rb', line 37

def next_hop_drg_attachment_id
  @next_hop_drg_attachment_id
end

Class Method Details

.attribute_mapObject

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



40
41
42
43
44
45
46
47
48
# File 'lib/oci/core/models/add_drg_route_rule_details.rb', line 40

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'destination_type': :'destinationType',
    'destination': :'destination',
    'next_hop_drg_attachment_id': :'nextHopDrgAttachmentId'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



51
52
53
54
55
56
57
58
59
# File 'lib/oci/core/models/add_drg_route_rule_details.rb', line 51

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'destination_type': :'String',
    'destination': :'String',
    'next_hop_drg_attachment_id': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



106
107
108
109
110
111
112
113
# File 'lib/oci/core/models/add_drg_route_rule_details.rb', line 106

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    destination_type == other.destination_type &&
    destination == other.destination &&
    next_hop_drg_attachment_id == other.next_hop_drg_attachment_id
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/oci/core/models/add_drg_route_rule_details.rb', line 138

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) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


118
119
120
# File 'lib/oci/core/models/add_drg_route_rule_details.rb', line 118

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



127
128
129
# File 'lib/oci/core/models/add_drg_route_rule_details.rb', line 127

def hash
  [destination_type, destination, next_hop_drg_attachment_id].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



171
172
173
174
175
176
177
178
179
180
# File 'lib/oci/core/models/add_drg_route_rule_details.rb', line 171

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



165
166
167
# File 'lib/oci/core/models/add_drg_route_rule_details.rb', line 165

def to_s
  to_hash.to_s
end