Class: MistApi::StatsMxtunnel

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

Overview

MxTunnels statistics

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(remote_ip = nil, ap = SKIP, for_site = SKIP, fwupdate = SKIP, last_seen = SKIP, mtu = SKIP, mxcluster_id = SKIP, mxedge_id = SKIP, mxtunnel_id = SKIP, org_id = SKIP, peer_mxedge_id = SKIP, remote_port = SKIP, rx_control_pkts = SKIP, sessions = SKIP, site_id = SKIP, state = SKIP, tx_control_pkts = SKIP, uptime = SKIP, additional_properties = nil) ⇒ StatsMxtunnel

Returns a new instance of StatsMxtunnel.



141
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
# File 'lib/mist_api/models/stats_mxtunnel.rb', line 141

def initialize(remote_ip = nil, ap = SKIP, for_site = SKIP, fwupdate = SKIP,
               last_seen = SKIP, mtu = SKIP, mxcluster_id = SKIP,
               mxedge_id = SKIP, mxtunnel_id = SKIP, org_id = SKIP,
               peer_mxedge_id = SKIP, remote_port = SKIP,
               rx_control_pkts = SKIP, sessions = SKIP, site_id = SKIP,
               state = SKIP, tx_control_pkts = SKIP, uptime = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @ap = ap unless ap == SKIP
  @for_site = for_site unless for_site == SKIP
  @fwupdate = fwupdate unless fwupdate == SKIP
  @last_seen = last_seen unless last_seen == SKIP
  @mtu = mtu unless mtu == SKIP
  @mxcluster_id = mxcluster_id unless mxcluster_id == SKIP
  @mxedge_id = mxedge_id unless mxedge_id == SKIP
  @mxtunnel_id = mxtunnel_id unless mxtunnel_id == SKIP
  @org_id = org_id unless org_id == SKIP
  @peer_mxedge_id = peer_mxedge_id unless peer_mxedge_id == SKIP
  @remote_ip = remote_ip
  @remote_port = remote_port unless remote_port == SKIP
  @rx_control_pkts = rx_control_pkts unless rx_control_pkts == SKIP
  @sessions = sessions unless sessions == SKIP
  @site_id = site_id unless site_id == SKIP
  @state = state unless state == SKIP
  @tx_control_pkts = tx_control_pkts unless tx_control_pkts == SKIP
  @uptime = uptime unless uptime == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#apString

TODO: Write general description for this method

Returns:

  • (String)


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

def ap
  @ap
end

#for_siteTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def for_site
  @for_site
end

#fwupdateFwupdateStat

TODO: Write general description for this method

Returns:



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

def fwupdate
  @fwupdate
end

#last_seenFloat

Last seen timestamp

Returns:

  • (Float)


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

def last_seen
  @last_seen
end

#mtuInteger

Last seen timestamp

Returns:

  • (Integer)


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

def mtu
  @mtu
end

#mxcluster_idUUID | String

Last seen timestamp

Returns:

  • (UUID | String)


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

def mxcluster_id
  @mxcluster_id
end

#mxedge_idUUID | String

Last seen timestamp

Returns:

  • (UUID | String)


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

def mxedge_id
  @mxedge_id
end

#mxtunnel_idUUID | String

Last seen timestamp

Returns:

  • (UUID | String)


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

def mxtunnel_id
  @mxtunnel_id
end

#org_idUUID | String

Last seen timestamp

Returns:

  • (UUID | String)


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

def org_id
  @org_id
end

#peer_mxedge_idUUID | String

MxEdge ID of the peer(mist edge to mist edge tunnel)

Returns:

  • (UUID | String)


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

def peer_mxedge_id
  @peer_mxedge_id
end

#remote_ipString

MxEdge ID of the peer(mist edge to mist edge tunnel)

Returns:

  • (String)


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

def remote_ip
  @remote_ip
end

#remote_portInteger

MxEdge ID of the peer(mist edge to mist edge tunnel)

Returns:

  • (Integer)


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

def remote_port
  @remote_port
end

#rx_control_pktsInteger

MxEdge ID of the peer(mist edge to mist edge tunnel)

Returns:

  • (Integer)


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

def rx_control_pkts
  @rx_control_pkts
end

#sessionsArray[StatsMxtunnelSession]

List of sessions

Returns:



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

def sessions
  @sessions
end

#site_idUUID | String

List of sessions

Returns:

  • (UUID | String)


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

def site_id
  @site_id
end

#stateStatsMxtunnelStateEnum

enum: ‘established`, `established_with_sessions`, `idle`, `wait-ctrl-conn`, `wait-ctrl-reply`



75
76
77
# File 'lib/mist_api/models/stats_mxtunnel.rb', line 75

def state
  @state
end

#tx_control_pktsInteger

enum: ‘established`, `established_with_sessions`, `idle`, `wait-ctrl-conn`, `wait-ctrl-reply`

Returns:

  • (Integer)


80
81
82
# File 'lib/mist_api/models/stats_mxtunnel.rb', line 80

def tx_control_pkts
  @tx_control_pkts
end

#uptimeInteger

enum: ‘established`, `established_with_sessions`, `idle`, `wait-ctrl-conn`, `wait-ctrl-reply`

Returns:

  • (Integer)


85
86
87
# File 'lib/mist_api/models/stats_mxtunnel.rb', line 85

def uptime
  @uptime
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
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
# File 'lib/mist_api/models/stats_mxtunnel.rb', line 173

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  remote_ip = hash.key?('remote_ip') ? hash['remote_ip'] : nil
  ap = hash.key?('ap') ? hash['ap'] : SKIP
  for_site = hash.key?('for_site') ? hash['for_site'] : SKIP
  fwupdate = FwupdateStat.from_hash(hash['fwupdate']) if hash['fwupdate']
  last_seen = hash.key?('last_seen') ? hash['last_seen'] : SKIP
  mtu = hash.key?('mtu') ? hash['mtu'] : SKIP
  mxcluster_id = hash.key?('mxcluster_id') ? hash['mxcluster_id'] : SKIP
  mxedge_id = hash.key?('mxedge_id') ? hash['mxedge_id'] : SKIP
  mxtunnel_id = hash.key?('mxtunnel_id') ? hash['mxtunnel_id'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  peer_mxedge_id =
    hash.key?('peer_mxedge_id') ? hash['peer_mxedge_id'] : SKIP
  remote_port = hash.key?('remote_port') ? hash['remote_port'] : SKIP
  rx_control_pkts =
    hash.key?('rx_control_pkts') ? hash['rx_control_pkts'] : SKIP
  # Parameter is an array, so we need to iterate through it
  sessions = nil
  unless hash['sessions'].nil?
    sessions = []
    hash['sessions'].each do |structure|
      sessions << (StatsMxtunnelSession.from_hash(structure) if structure)
    end
  end

  sessions = SKIP unless hash.key?('sessions')
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  state = hash.key?('state') ? hash['state'] : SKIP
  tx_control_pkts =
    hash.key?('tx_control_pkts') ? hash['tx_control_pkts'] : SKIP
  uptime = hash.key?('uptime') ? hash['uptime'] : 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.
  StatsMxtunnel.new(remote_ip,
                    ap,
                    for_site,
                    fwupdate,
                    last_seen,
                    mtu,
                    mxcluster_id,
                    mxedge_id,
                    mxtunnel_id,
                    org_id,
                    peer_mxedge_id,
                    remote_port,
                    rx_control_pkts,
                    sessions,
                    site_id,
                    state,
                    tx_control_pkts,
                    uptime,
                    additional_properties)
end

.namesObject

A mapping from model property names to API property names.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/mist_api/models/stats_mxtunnel.rb', line 88

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ap'] = 'ap'
  @_hash['for_site'] = 'for_site'
  @_hash['fwupdate'] = 'fwupdate'
  @_hash['last_seen'] = 'last_seen'
  @_hash['mtu'] = 'mtu'
  @_hash['mxcluster_id'] = 'mxcluster_id'
  @_hash['mxedge_id'] = 'mxedge_id'
  @_hash['mxtunnel_id'] = 'mxtunnel_id'
  @_hash['org_id'] = 'org_id'
  @_hash['peer_mxedge_id'] = 'peer_mxedge_id'
  @_hash['remote_ip'] = 'remote_ip'
  @_hash['remote_port'] = 'remote_port'
  @_hash['rx_control_pkts'] = 'rx_control_pkts'
  @_hash['sessions'] = 'sessions'
  @_hash['site_id'] = 'site_id'
  @_hash['state'] = 'state'
  @_hash['tx_control_pkts'] = 'tx_control_pkts'
  @_hash['uptime'] = 'uptime'
  @_hash
end

.nullablesObject

An array for nullable fields



135
136
137
138
139
# File 'lib/mist_api/models/stats_mxtunnel.rb', line 135

def self.nullables
  %w[
    last_seen
  ]
end

.optionalsObject

An array for optional fields



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/mist_api/models/stats_mxtunnel.rb', line 112

def self.optionals
  %w[
    ap
    for_site
    fwupdate
    last_seen
    mtu
    mxcluster_id
    mxedge_id
    mxtunnel_id
    org_id
    peer_mxedge_id
    remote_port
    rx_control_pkts
    sessions
    site_id
    state
    tx_control_pkts
    uptime
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (StatsMxtunnel | Hash)

    value against the validation is performed.



239
240
241
242
243
244
245
246
247
248
249
# File 'lib/mist_api/models/stats_mxtunnel.rb', line 239

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

  return false unless value.instance_of? Hash

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/mist_api/models/stats_mxtunnel.rb', line 264

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ap: #{@ap.inspect}, for_site: #{@for_site.inspect}, fwupdate:"\
  " #{@fwupdate.inspect}, last_seen: #{@last_seen.inspect}, mtu: #{@mtu.inspect},"\
  " mxcluster_id: #{@mxcluster_id.inspect}, mxedge_id: #{@mxedge_id.inspect}, mxtunnel_id:"\
  " #{@mxtunnel_id.inspect}, org_id: #{@org_id.inspect}, peer_mxedge_id:"\
  " #{@peer_mxedge_id.inspect}, remote_ip: #{@remote_ip.inspect}, remote_port:"\
  " #{@remote_port.inspect}, rx_control_pkts: #{@rx_control_pkts.inspect}, sessions:"\
  " #{@sessions.inspect}, site_id: #{@site_id.inspect}, state: #{@state.inspect},"\
  " tx_control_pkts: #{@tx_control_pkts.inspect}, uptime: #{@uptime.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



252
253
254
255
256
257
258
259
260
261
# File 'lib/mist_api/models/stats_mxtunnel.rb', line 252

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ap: #{@ap}, for_site: #{@for_site}, fwupdate: #{@fwupdate}, last_seen:"\
  " #{@last_seen}, mtu: #{@mtu}, mxcluster_id: #{@mxcluster_id}, mxedge_id: #{@mxedge_id},"\
  " mxtunnel_id: #{@mxtunnel_id}, org_id: #{@org_id}, peer_mxedge_id: #{@peer_mxedge_id},"\
  " remote_ip: #{@remote_ip}, remote_port: #{@remote_port}, rx_control_pkts:"\
  " #{@rx_control_pkts}, sessions: #{@sessions}, site_id: #{@site_id}, state: #{@state},"\
  " tx_control_pkts: #{@tx_control_pkts}, uptime: #{@uptime}, additional_properties:"\
  " #{@additional_properties}>"
end