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



142
143
144
145
146
147
148
149
150
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
# File 'lib/oci/core/models/drg_route_rule.rb', line 142

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

Instance Attribute Details

#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)


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

def destination
  @destination
end

#destination_typeString

[Required] The type of destination for the rule. the type is required if direction = EGRESS.

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)


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

def destination_type
  @destination_type
end

#idString

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

Returns:

  • (String)


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

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)


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

def is_blackhole
  @is_blackhole
end

#is_conflictBOOLEAN

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

Returns:

  • (BOOLEAN)


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

def is_conflict
  @is_conflict
end

#next_hop_drg_attachment_idString

[Required] The [OCID](docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) 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)


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

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)


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

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)


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

def route_type
  @route_type
end

Class Method Details

.attribute_mapObject

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



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/oci/core/models/drg_route_rule.rb', line 97

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'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/oci/core/models/drg_route_rule.rb', line 113

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'
    # 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



239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/oci/core/models/drg_route_rule.rb', line 239

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
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



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/oci/core/models/drg_route_rule.rb', line 276

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


256
257
258
# File 'lib/oci/core/models/drg_route_rule.rb', line 256

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



265
266
267
# File 'lib/oci/core/models/drg_route_rule.rb', line 265

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

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



309
310
311
312
313
314
315
316
317
318
# File 'lib/oci/core/models/drg_route_rule.rb', line 309

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



303
304
305
# File 'lib/oci/core/models/drg_route_rule.rb', line 303

def to_s
  to_hash.to_s
end