Class: OCI::Core::Models::UpdateDrgRouteRuleDetails

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

Overview

Details used to update a route rule in the DRG route table.

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 = {}) ⇒ UpdateDrgRouteRuleDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :id (String)

    The value to assign to the #id property

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



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 77

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

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

Instance Attribute Details

#destinationString

The range of IP addresses used for matching when routing traffic.

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

Returns:

  • (String)


28
29
30
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 28

def destination
  @destination
end

#destination_typeString

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)


35
36
37
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 35

def destination_type
  @destination_type
end

#idString

[Required] The Oracle-assigned ID of each DRG route rule to update.

Returns:

  • (String)


19
20
21
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 19

def id
  @id
end

#next_hop_drg_attachment_idString

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

Returns:

  • (String)


41
42
43
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 41

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.



44
45
46
47
48
49
50
51
52
53
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 44

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

.swagger_typesObject

Attribute type mapping.



56
57
58
59
60
61
62
63
64
65
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 56

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'destination': :'String',
    'destination_type': :'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



115
116
117
118
119
120
121
122
123
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 115

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

  self.class == other.class &&
    id == other.id &&
    destination == other.destination &&
    destination_type == other.destination_type &&
    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



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 148

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


128
129
130
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 128

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



137
138
139
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 137

def hash
  [id, destination, destination_type, 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



181
182
183
184
185
186
187
188
189
190
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 181

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



175
176
177
# File 'lib/oci/core/models/update_drg_route_rule_details.rb', line 175

def to_s
  to_hash.to_s
end