Class: MistApi::ExtraRoute
- Defined in:
- lib/mist_api/models/extra_route.rb
Overview
ExtraRoute Model.
Instance Attribute Summary collapse
-
#discard ⇒ TrueClass | FalseClass
This takes precedence.
-
#metric ⇒ Integer
This takes precedence.
-
#next_qualified ⇒ Hash[String, ExtraRouteNextQualifiedProperties]
This takes precedence.
-
#no_resolve ⇒ TrueClass | FalseClass
This takes precedence.
-
#preference ⇒ Integer
This takes precedence.
-
#via ⇒ Object
Next-hop IP Address.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(discard = false, metric = SKIP, next_qualified = SKIP, no_resolve = false, preference = SKIP, via = SKIP) ⇒ ExtraRoute
constructor
A new instance of ExtraRoute.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(discard = false, metric = SKIP, next_qualified = SKIP, no_resolve = false, preference = SKIP, via = SKIP) ⇒ ExtraRoute
Returns a new instance of ExtraRoute.
70 71 72 73 74 75 76 77 78 |
# File 'lib/mist_api/models/extra_route.rb', line 70 def initialize(discard = false, metric = SKIP, next_qualified = SKIP, no_resolve = false, preference = SKIP, via = SKIP) @discard = discard unless discard == SKIP @metric = metric unless metric == SKIP @next_qualified = next_qualified unless next_qualified == SKIP @no_resolve = no_resolve unless no_resolve == SKIP @preference = preference unless preference == SKIP @via = via unless via == SKIP end |
Instance Attribute Details
#discard ⇒ TrueClass | FalseClass
This takes precedence
14 15 16 |
# File 'lib/mist_api/models/extra_route.rb', line 14 def discard @discard end |
#metric ⇒ Integer
This takes precedence
18 19 20 |
# File 'lib/mist_api/models/extra_route.rb', line 18 def metric @metric end |
#next_qualified ⇒ Hash[String, ExtraRouteNextQualifiedProperties]
This takes precedence
22 23 24 |
# File 'lib/mist_api/models/extra_route.rb', line 22 def next_qualified @next_qualified end |
#no_resolve ⇒ TrueClass | FalseClass
This takes precedence
26 27 28 |
# File 'lib/mist_api/models/extra_route.rb', line 26 def no_resolve @no_resolve end |
#preference ⇒ Integer
This takes precedence
30 31 32 |
# File 'lib/mist_api/models/extra_route.rb', line 30 def preference @preference end |
#via ⇒ Object
Next-hop IP Address. Can be a single IP address or an array of IP addresses for ECMP (Equal-Cost Multi-Path) load balancing across multiple next-hops.
36 37 38 |
# File 'lib/mist_api/models/extra_route.rb', line 36 def via @via end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/mist_api/models/extra_route.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. discard = hash['discard'] ||= false metric = hash.key?('metric') ? hash['metric'] : SKIP next_qualified = ExtraRouteNextQualifiedProperties.from_hash(hash['next_qualified']) if hash['next_qualified'] next_qualified = SKIP unless hash.key?('next_qualified') no_resolve = hash['no_resolve'] ||= false preference = hash.key?('preference') ? hash['preference'] : SKIP via = hash.key?('via') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:NextHopVia), hash['via'] ) : SKIP # Create object from extracted values. ExtraRoute.new(discard, metric, next_qualified, no_resolve, preference, via) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/mist_api/models/extra_route.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['discard'] = 'discard' @_hash['metric'] = 'metric' @_hash['next_qualified'] = 'next_qualified' @_hash['no_resolve'] = 'no_resolve' @_hash['preference'] = 'preference' @_hash['via'] = 'via' @_hash end |
.nullables ⇒ Object
An array for nullable fields
63 64 65 66 67 68 |
# File 'lib/mist_api/models/extra_route.rb', line 63 def self.nullables %w[ metric preference ] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/mist_api/models/extra_route.rb', line 51 def self.optionals %w[ discard metric next_qualified no_resolve preference via ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
108 109 110 111 112 113 114 |
# File 'lib/mist_api/models/extra_route.rb', line 108 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
124 125 126 127 128 129 |
# File 'lib/mist_api/models/extra_route.rb', line 124 def inspect class_name = self.class.name.split('::').last "<#{class_name} discard: #{@discard.inspect}, metric: #{@metric.inspect}, next_qualified:"\ " #{@next_qualified.inspect}, no_resolve: #{@no_resolve.inspect}, preference:"\ " #{@preference.inspect}, via: #{@via.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
117 118 119 120 121 |
# File 'lib/mist_api/models/extra_route.rb', line 117 def to_s class_name = self.class.name.split('::').last "<#{class_name} discard: #{@discard}, metric: #{@metric}, next_qualified:"\ " #{@next_qualified}, no_resolve: #{@no_resolve}, preference: #{@preference}, via: #{@via}>" end |