Class: MistApi::StatsWanTunnel

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

Overview

StatsWanTunnel 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(peer_ip = nil, auth_algo = SKIP, encrypt_algo = SKIP, ike_version = SKIP, ip = SKIP, last_event = SKIP, mac = SKIP, node = SKIP, org_id = SKIP, peer_host = SKIP, priority = SKIP, protocol = SKIP, rx_bytes = SKIP, rx_pkts = SKIP, site_id = SKIP, tunnel_name = SKIP, tx_bytes = SKIP, tx_pkts = SKIP, up = SKIP, uptime = SKIP, wan_name = SKIP, additional_properties = nil) ⇒ StatsWanTunnel

Returns a new instance of StatsWanTunnel.



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/mist_api/models/stats_wan_tunnel.rb', line 159

def initialize(peer_ip = nil, auth_algo = SKIP, encrypt_algo = SKIP,
               ike_version = SKIP, ip = SKIP, last_event = SKIP, mac = SKIP,
               node = SKIP, org_id = SKIP, peer_host = SKIP,
               priority = SKIP, protocol = SKIP, rx_bytes = SKIP,
               rx_pkts = SKIP, site_id = SKIP, tunnel_name = SKIP,
               tx_bytes = SKIP, tx_pkts = SKIP, up = SKIP, uptime = SKIP,
               wan_name = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @auth_algo = auth_algo unless auth_algo == SKIP
  @encrypt_algo = encrypt_algo unless encrypt_algo == SKIP
  @ike_version = ike_version unless ike_version == SKIP
  @ip = ip unless ip == SKIP
  @last_event = last_event unless last_event == SKIP
  @mac = mac unless mac == SKIP
  @node = node unless node == SKIP
  @org_id = org_id unless org_id == SKIP
  @peer_host = peer_host unless peer_host == SKIP
  @peer_ip = peer_ip
  @priority = priority unless priority == SKIP
  @protocol = protocol unless protocol == SKIP
  @rx_bytes = rx_bytes unless rx_bytes == SKIP
  @rx_pkts = rx_pkts unless rx_pkts == SKIP
  @site_id = site_id unless site_id == SKIP
  @tunnel_name = tunnel_name unless tunnel_name == SKIP
  @tx_bytes = tx_bytes unless tx_bytes == SKIP
  @tx_pkts = tx_pkts unless tx_pkts == SKIP
  @up = up unless up == SKIP
  @uptime = uptime unless uptime == SKIP
  @wan_name = wan_name unless wan_name == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#auth_algoString

Authentication algorithm

Returns:

  • (String)


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

def auth_algo
  @auth_algo
end

#encrypt_algoString

Encryption algorithm

Returns:

  • (String)


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

def encrypt_algo
  @encrypt_algo
end

#ike_versionString

IKE version

Returns:

  • (String)


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

def ike_version
  @ike_version
end

#ipString

IP Address

Returns:

  • (String)


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

def ip
  @ip
end

#last_eventString

Reason of why the tunnel is down

Returns:

  • (String)


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

def last_event
  @last_event
end

#macString

Router mac address

Returns:

  • (String)


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

def mac
  @mac
end

#nodeString

Node0/node1

Returns:

  • (String)


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

def node
  @node
end

#org_idUUID | String

Node0/node1

Returns:

  • (UUID | String)


42
43
44
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 42

def org_id
  @org_id
end

#peer_hostString

Peer host

Returns:

  • (String)


46
47
48
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 46

def peer_host
  @peer_host
end

#peer_ipString

Peer ip address

Returns:

  • (String)


50
51
52
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 50

def peer_ip
  @peer_ip
end

#priorityTunnelPriorityEnum

enum: ‘primary`, `secondary`

Returns:



54
55
56
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 54

def priority
  @priority
end

#protocolWanTunnelProtocolEnum

enum: ‘gre`, `ipsec`



58
59
60
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 58

def protocol
  @protocol
end

#rx_bytesInteger

Amount of traffic received since connection

Returns:

  • (Integer)


62
63
64
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 62

def rx_bytes
  @rx_bytes
end

#rx_pktsInteger

Amount of packets received since connection

Returns:

  • (Integer)


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

def rx_pkts
  @rx_pkts
end

#site_idUUID | String

Amount of packets received since connection

Returns:

  • (UUID | String)


70
71
72
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 70

def site_id
  @site_id
end

#tunnel_nameString

Mist Tunnel Name

Returns:

  • (String)


74
75
76
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 74

def tunnel_name
  @tunnel_name
end

#tx_bytesInteger

Amount of traffic sent since connection

Returns:

  • (Integer)


78
79
80
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 78

def tx_bytes
  @tx_bytes
end

#tx_pktsInteger

Amount of packets sent since connection

Returns:

  • (Integer)


82
83
84
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 82

def tx_pkts
  @tx_pkts
end

#upTrueClass | FalseClass

Amount of packets sent since connection

Returns:

  • (TrueClass | FalseClass)


86
87
88
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 86

def up
  @up
end

#uptimeInteger

Duration from first (or last) SA was established

Returns:

  • (Integer)


90
91
92
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 90

def uptime
  @uptime
end

#wan_nameString

WAN interface name

Returns:

  • (String)


94
95
96
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 94

def wan_name
  @wan_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 194

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  peer_ip = hash.key?('peer_ip') ? hash['peer_ip'] : nil
  auth_algo = hash.key?('auth_algo') ? hash['auth_algo'] : SKIP
  encrypt_algo = hash.key?('encrypt_algo') ? hash['encrypt_algo'] : SKIP
  ike_version = hash.key?('ike_version') ? hash['ike_version'] : SKIP
  ip = hash.key?('ip') ? hash['ip'] : SKIP
  last_event = hash.key?('last_event') ? hash['last_event'] : SKIP
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  node = hash.key?('node') ? hash['node'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  peer_host = hash.key?('peer_host') ? hash['peer_host'] : SKIP
  priority = hash.key?('priority') ? hash['priority'] : SKIP
  protocol = hash.key?('protocol') ? hash['protocol'] : SKIP
  rx_bytes = hash.key?('rx_bytes') ? hash['rx_bytes'] : SKIP
  rx_pkts = hash.key?('rx_pkts') ? hash['rx_pkts'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  tunnel_name = hash.key?('tunnel_name') ? hash['tunnel_name'] : SKIP
  tx_bytes = hash.key?('tx_bytes') ? hash['tx_bytes'] : SKIP
  tx_pkts = hash.key?('tx_pkts') ? hash['tx_pkts'] : SKIP
  up = hash.key?('up') ? hash['up'] : SKIP
  uptime = hash.key?('uptime') ? hash['uptime'] : SKIP
  wan_name = hash.key?('wan_name') ? hash['wan_name'] : 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.
  StatsWanTunnel.new(peer_ip,
                     auth_algo,
                     encrypt_algo,
                     ike_version,
                     ip,
                     last_event,
                     mac,
                     node,
                     org_id,
                     peer_host,
                     priority,
                     protocol,
                     rx_bytes,
                     rx_pkts,
                     site_id,
                     tunnel_name,
                     tx_bytes,
                     tx_pkts,
                     up,
                     uptime,
                     wan_name,
                     additional_properties)
end

.namesObject

A mapping from model property names to API property names.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 97

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['auth_algo'] = 'auth_algo'
  @_hash['encrypt_algo'] = 'encrypt_algo'
  @_hash['ike_version'] = 'ike_version'
  @_hash['ip'] = 'ip'
  @_hash['last_event'] = 'last_event'
  @_hash['mac'] = 'mac'
  @_hash['node'] = 'node'
  @_hash['org_id'] = 'org_id'
  @_hash['peer_host'] = 'peer_host'
  @_hash['peer_ip'] = 'peer_ip'
  @_hash['priority'] = 'priority'
  @_hash['protocol'] = 'protocol'
  @_hash['rx_bytes'] = 'rx_bytes'
  @_hash['rx_pkts'] = 'rx_pkts'
  @_hash['site_id'] = 'site_id'
  @_hash['tunnel_name'] = 'tunnel_name'
  @_hash['tx_bytes'] = 'tx_bytes'
  @_hash['tx_pkts'] = 'tx_pkts'
  @_hash['up'] = 'up'
  @_hash['uptime'] = 'uptime'
  @_hash['wan_name'] = 'wan_name'
  @_hash
end

.nullablesObject

An array for nullable fields



150
151
152
153
154
155
156
157
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 150

def self.nullables
  %w[
    rx_bytes
    rx_pkts
    tx_bytes
    tx_pkts
  ]
end

.optionalsObject

An array for optional fields



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 124

def self.optionals
  %w[
    auth_algo
    encrypt_algo
    ike_version
    ip
    last_event
    mac
    node
    org_id
    peer_host
    priority
    protocol
    rx_bytes
    rx_pkts
    site_id
    tunnel_name
    tx_bytes
    tx_pkts
    up
    uptime
    wan_name
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (StatsWanTunnel | Hash)

    value against the validation is performed.



254
255
256
257
258
259
260
261
262
263
264
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 254

def self.validate(value)
  if value.instance_of? self
    return APIHelper.valid_type?(value.peer_ip,
                                 ->(val) { val.instance_of? String })
  end

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['peer_ip'],
                        ->(val) { val.instance_of? String })
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 279

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} auth_algo: #{@auth_algo.inspect}, encrypt_algo: #{@encrypt_algo.inspect},"\
  " ike_version: #{@ike_version.inspect}, ip: #{@ip.inspect}, last_event:"\
  " #{@last_event.inspect}, mac: #{@mac.inspect}, node: #{@node.inspect}, org_id:"\
  " #{@org_id.inspect}, peer_host: #{@peer_host.inspect}, peer_ip: #{@peer_ip.inspect},"\
  " priority: #{@priority.inspect}, protocol: #{@protocol.inspect}, rx_bytes:"\
  " #{@rx_bytes.inspect}, rx_pkts: #{@rx_pkts.inspect}, site_id: #{@site_id.inspect},"\
  " tunnel_name: #{@tunnel_name.inspect}, tx_bytes: #{@tx_bytes.inspect}, tx_pkts:"\
  " #{@tx_pkts.inspect}, up: #{@up.inspect}, uptime: #{@uptime.inspect}, wan_name:"\
  " #{@wan_name.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



267
268
269
270
271
272
273
274
275
276
# File 'lib/mist_api/models/stats_wan_tunnel.rb', line 267

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} auth_algo: #{@auth_algo}, encrypt_algo: #{@encrypt_algo}, ike_version:"\
  " #{@ike_version}, ip: #{@ip}, last_event: #{@last_event}, mac: #{@mac}, node: #{@node},"\
  " org_id: #{@org_id}, peer_host: #{@peer_host}, peer_ip: #{@peer_ip}, priority:"\
  " #{@priority}, protocol: #{@protocol}, rx_bytes: #{@rx_bytes}, rx_pkts: #{@rx_pkts},"\
  " site_id: #{@site_id}, tunnel_name: #{@tunnel_name}, tx_bytes: #{@tx_bytes}, tx_pkts:"\
  " #{@tx_pkts}, up: #{@up}, uptime: #{@uptime}, wan_name: #{@wan_name},"\
  " additional_properties: #{@additional_properties}>"
end