Class: OCI::Core::Models::DrgRouteRule

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

Overview

A DRG route rule is a mapping between a destination IP address range and a DRG attachment. The map is used to route matching packets. Traffic will be routed across the attachments using Equal-cost multi-path routing (ECMP) if there are multiple rules with identical destinations and none of the rules conflict.

Constant Summary collapse

DESTINATION_TYPE_ENUM =
[
  DESTINATION_TYPE_CIDR_BLOCK = 'CIDR_BLOCK'.freeze,
  DESTINATION_TYPE_SERVICE_CIDR_BLOCK = 'SERVICE_CIDR_BLOCK'.freeze,
  DESTINATION_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
ROUTE_TYPE_ENUM =
[
  ROUTE_TYPE_STATIC = 'STATIC'.freeze,
  ROUTE_TYPE_DYNAMIC = 'DYNAMIC'.freeze,
  ROUTE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
ROUTE_PROVENANCE_ENUM =
[
  ROUTE_PROVENANCE_STATIC = 'STATIC'.freeze,
  ROUTE_PROVENANCE_VCN = 'VCN'.freeze,
  ROUTE_PROVENANCE_VIRTUAL_CIRCUIT = 'VIRTUAL_CIRCUIT'.freeze,
  ROUTE_PROVENANCE_IPSEC_TUNNEL = 'IPSEC_TUNNEL'.freeze,
  ROUTE_PROVENANCE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DrgRouteRule

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :destination (String)

    The value to assign to the #destination property

  • :destination_type (String)

    The value to assign to the #destination_type property

  • :next_hop_drg_attachment_id (String)

    The value to assign to the #next_hop_drg_attachment_id property

  • :route_type (String)

    The value to assign to the #route_type property

  • :is_conflict (BOOLEAN)

    The value to assign to the #is_conflict property

  • :is_blackhole (BOOLEAN)

    The value to assign to the #is_blackhole property

  • :id (String)

    The value to assign to the #id property

  • :route_provenance (String)

    The value to assign to the #route_provenance property

  • :attributes (Object)

    The value to assign to the #attributes property



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/oci/core/models/drg_route_rule.rb', line 151

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

  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.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']

  self.route_type = attributes[:'routeType'] if attributes[:'routeType']

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

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

  self.is_conflict = attributes[:'isConflict'] unless attributes[:'isConflict'].nil?
  self.is_conflict = false if is_conflict.nil? && !attributes.key?(:'isConflict') # rubocop:disable Style/StringLiterals

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

  self.is_conflict = attributes[:'is_conflict'] unless attributes[:'is_conflict'].nil?
  self.is_conflict = false if is_conflict.nil? && !attributes.key?(:'isConflict') && !attributes.key?(:'is_conflict') # rubocop:disable Style/StringLiterals

  self.is_blackhole = attributes[:'isBlackhole'] unless attributes[:'isBlackhole'].nil?
  self.is_blackhole = false if is_blackhole.nil? && !attributes.key?(:'isBlackhole') # rubocop:disable Style/StringLiterals

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

  self.is_blackhole = attributes[:'is_blackhole'] unless attributes[:'is_blackhole'].nil?
  self.is_blackhole = false if is_blackhole.nil? && !attributes.key?(:'isBlackhole') && !attributes.key?(:'is_blackhole') # rubocop:disable Style/StringLiterals

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

  self.route_provenance = attributes[:'routeProvenance'] if attributes[:'routeProvenance']

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

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

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

Instance Attribute Details

#attributesObject

Additional properties for the route, computed by the service.

Returns:

  • (Object)


100
101
102
# File 'lib/oci/core/models/drg_route_rule.rb', line 100

def attributes
  @attributes
end

#destinationString

[Required] Represents the range of IP addresses to match against when routing traffic.

Potential values: * An IP address range (IPv4 or IPv6) in CIDR notation. For example: 192.168.1.0/24 or 2001:0db8:0123:45::/56. * When you're setting up a security rule for traffic destined for a particular Service through a service gateway, this is the cidrBlock value associated with that Service. For example: oci-phx-objectstorage.

Returns:

  • (String)


44
45
46
# File 'lib/oci/core/models/drg_route_rule.rb', line 44

def destination
  @destination
end

#destination_typeString

[Required] The type of destination for the rule.

Allowed values:

  • CIDR_BLOCK: If the rule's destination is an IP address range in CIDR notation.

  • SERVICE_CIDR_BLOCK: If the rule's destination is the cidrBlock value for a Service (the rule is for traffic destined for a particular Service through a service gateway).

Returns:

  • (String)


56
57
58
# File 'lib/oci/core/models/drg_route_rule.rb', line 56

def destination_type
  @destination_type
end

#idString

[Required] The Oracle-assigned ID of the DRG route rule.

Returns:

  • (String)


85
86
87
# File 'lib/oci/core/models/drg_route_rule.rb', line 85

def id
  @id
end

#is_blackholeBOOLEAN

Indicates that if the next hop attachment does not exist, so traffic for this route is discarded without notification.

Returns:

  • (BOOLEAN)


80
81
82
# File 'lib/oci/core/models/drg_route_rule.rb', line 80

def is_blackhole
  @is_blackhole
end

#is_conflictBOOLEAN

Indicates that the route was not imported due to a conflict between route rules.

Returns:

  • (BOOLEAN)


75
76
77
# File 'lib/oci/core/models/drg_route_rule.rb', line 75

def is_conflict
  @is_conflict
end

#next_hop_drg_attachment_idString

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

A value of BLACKHOLE means traffic for this route is discarded without notification.

Returns:

  • (String)


64
65
66
# File 'lib/oci/core/models/drg_route_rule.rb', line 64

def next_hop_drg_attachment_id
  @next_hop_drg_attachment_id
end

#route_provenanceString

[Required] The earliest origin of a route. If a route is advertised to a DRG through an IPsec tunnel attachment, and is propagated to peered DRGs via RPC attachments, the route's provenance in the peered DRGs remains IPSEC_TUNNEL, because that is the earliest origin.

No routes with a provenance IPSEC_TUNNEL or VIRTUAL_CIRCUIT will be exported to IPsec tunnel or virtual circuit attachments, regardless of the attachment's export distribution.

Returns:

  • (String)


95
96
97
# File 'lib/oci/core/models/drg_route_rule.rb', line 95

def route_provenance
  @route_provenance
end

#route_typeString

You can specify static routes for the DRG route table using the API. The DRG learns dynamic routes from the DRG attachments using various routing protocols.

Returns:

  • (String)


70
71
72
# File 'lib/oci/core/models/drg_route_rule.rb', line 70

def route_type
  @route_type
end

Class Method Details

.attribute_mapObject

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



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/oci/core/models/drg_route_rule.rb', line 103

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'destination': :'destination',
    'destination_type': :'destinationType',
    'next_hop_drg_attachment_id': :'nextHopDrgAttachmentId',
    'route_type': :'routeType',
    'is_conflict': :'isConflict',
    'is_blackhole': :'isBlackhole',
    'id': :'id',
    'route_provenance': :'routeProvenance',
    'attributes': :'attributes'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/oci/core/models/drg_route_rule.rb', line 120

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'destination': :'String',
    'destination_type': :'String',
    'next_hop_drg_attachment_id': :'String',
    'route_type': :'String',
    'is_conflict': :'BOOLEAN',
    'is_blackhole': :'BOOLEAN',
    'id': :'String',
    'route_provenance': :'String',
    'attributes': :'Object'
    # 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



250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/oci/core/models/drg_route_rule.rb', line 250

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

  self.class == other.class &&
    destination == other.destination &&
    destination_type == other.destination_type &&
    next_hop_drg_attachment_id == other.next_hop_drg_attachment_id &&
    route_type == other.route_type &&
    is_conflict == other.is_conflict &&
    is_blackhole == other.is_blackhole &&
    id == other.id &&
    route_provenance == other.route_provenance &&
    attributes == other.attributes
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



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/oci/core/models/drg_route_rule.rb', line 288

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


268
269
270
# File 'lib/oci/core/models/drg_route_rule.rb', line 268

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



277
278
279
# File 'lib/oci/core/models/drg_route_rule.rb', line 277

def hash
  [destination, destination_type, next_hop_drg_attachment_id, route_type, is_conflict, is_blackhole, id, route_provenance, attributes].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



321
322
323
324
325
326
327
328
329
330
# File 'lib/oci/core/models/drg_route_rule.rb', line 321

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



315
316
317
# File 'lib/oci/core/models/drg_route_rule.rb', line 315

def to_s
  to_hash.to_s
end