Class: MistApi::UtilsPing

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/utils_ping.rb

Overview

UtilsPing Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(host = nil, count = 10, egress_interface = SKIP, node = SKIP, size = 56, use_ipv6 = false, vrf = SKIP, additional_properties = nil) ⇒ UtilsPing

Returns a new instance of UtilsPing.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/mist_api/models/utils_ping.rb', line 70

def initialize(host = nil, count = 10, egress_interface = SKIP, node = SKIP,
               size = 56, use_ipv6 = false, vrf = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @count = count unless count == SKIP
  @egress_interface = egress_interface unless egress_interface == SKIP
  @host = host
  @node = node unless node == SKIP
  @size = size unless size == SKIP
  @use_ipv6 = use_ipv6 unless use_ipv6 == SKIP
  @vrf = vrf unless vrf == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/mist_api/models/utils_ping.rb', line 14

def count
  @count
end

#egress_interfaceString

Interface through which packet needs to egress

Returns:

  • (String)


18
19
20
# File 'lib/mist_api/models/utils_ping.rb', line 18

def egress_interface
  @egress_interface
end

#hostString

can be ip, ipv6, hostname

Returns:

  • (String)


22
23
24
# File 'lib/mist_api/models/utils_ping.rb', line 22

def host
  @host
end

#nodeHaClusterNodeEnum

only for HA. enum: ‘node0`, `node1`

Returns:



26
27
28
# File 'lib/mist_api/models/utils_ping.rb', line 26

def node
  @node
end

#sizeInteger

only for HA. enum: ‘node0`, `node1`

Returns:

  • (Integer)


30
31
32
# File 'lib/mist_api/models/utils_ping.rb', line 30

def size
  @size
end

#use_ipv6TrueClass | FalseClass

applicable when host is hostname

Returns:

  • (TrueClass | FalseClass)


34
35
36
# File 'lib/mist_api/models/utils_ping.rb', line 34

def use_ipv6
  @use_ipv6
end

#vrfString

VRF/Routing instance through which the packet needs to be sent

Returns:

  • (String)


38
39
40
# File 'lib/mist_api/models/utils_ping.rb', line 38

def vrf
  @vrf
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/mist_api/models/utils_ping.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  host = hash.key?('host') ? hash['host'] : nil
  count = hash['count'] ||= 10
  egress_interface =
    hash.key?('egress_interface') ? hash['egress_interface'] : SKIP
  node = hash.key?('node') ? hash['node'] : SKIP
  size = hash['size'] ||= 56
  use_ipv6 = hash['use_ipv6'] ||= false
  vrf = hash.key?('vrf') ? hash['vrf'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  UtilsPing.new(host,
                count,
                egress_interface,
                node,
                size,
                use_ipv6,
                vrf,
                additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/mist_api/models/utils_ping.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['count'] = 'count'
  @_hash['egress_interface'] = 'egress_interface'
  @_hash['host'] = 'host'
  @_hash['node'] = 'node'
  @_hash['size'] = 'size'
  @_hash['use_ipv6'] = 'use_ipv6'
  @_hash['vrf'] = 'vrf'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/mist_api/models/utils_ping.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
# File 'lib/mist_api/models/utils_ping.rb', line 54

def self.optionals
  %w[
    count
    egress_interface
    node
    size
    use_ipv6
    vrf
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



127
128
129
130
131
132
133
# File 'lib/mist_api/models/utils_ping.rb', line 127

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} count: #{@count.inspect}, egress_interface: #{@egress_interface.inspect},"\
  " host: #{@host.inspect}, node: #{@node.inspect}, size: #{@size.inspect}, use_ipv6:"\
  " #{@use_ipv6.inspect}, vrf: #{@vrf.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



119
120
121
122
123
124
# File 'lib/mist_api/models/utils_ping.rb', line 119

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} count: #{@count}, egress_interface: #{@egress_interface}, host: #{@host},"\
  " node: #{@node}, size: #{@size}, use_ipv6: #{@use_ipv6}, vrf: #{@vrf},"\
  " additional_properties: #{@additional_properties}>"
end