Class: MistApi::SynthetictestDevice

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

Overview

SynthetictestDevice 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(type = nil, host = SKIP, hostname = SKIP, ip = SKIP, password = SKIP, ping_count = 10, ping_details = false, ping_size = 56, port_id = SKIP, protocol = SynthetictestDeviceProtocolEnum::ENUM_PINGTRACEROUTE, tenant = SKIP, timeout = 60, traceroute_udp_port = 33434, url = SKIP, username = SKIP, vlan_id = SKIP, additional_properties = nil) ⇒ SynthetictestDevice

Returns a new instance of SynthetictestDevice.



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/mist_api/models/synthetictest_device.rb', line 126

def initialize(
  type = nil, host = SKIP, hostname = SKIP, ip = SKIP, password = SKIP,
  ping_count = 10, ping_details = false, ping_size = 56, port_id = SKIP,
  protocol = SynthetictestDeviceProtocolEnum::ENUM_PINGTRACEROUTE,
  tenant = SKIP, timeout = 60, traceroute_udp_port = 33434, url = SKIP,
  username = SKIP, vlan_id = SKIP, additional_properties = nil
)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @host = host unless host == SKIP
  @hostname = hostname unless hostname == SKIP
  @ip = ip unless ip == SKIP
  @password = password unless password == SKIP
  @ping_count = ping_count unless ping_count == SKIP
  @ping_details = ping_details unless ping_details == SKIP
  @ping_size = ping_size unless ping_size == SKIP
  @port_id = port_id unless port_id == SKIP
  @protocol = protocol unless protocol == SKIP
  @tenant = tenant unless tenant == SKIP
  @timeout = timeout unless timeout == SKIP
  @traceroute_udp_port = traceroute_udp_port unless traceroute_udp_port == SKIP
  @type = type
  @url = url unless url == SKIP
  @username = username unless username == SKIP
  @vlan_id = vlan_id unless vlan_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#hostString

If ‘type`==`lan_connectivity`

Returns:

  • (String)


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

def host
  @host
end

#hostnameString

If ‘type`==`dns`

Returns:

  • (String)


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

def hostname
  @hostname
end

#ipString

If ‘type`==`arp`

Returns:

  • (String)


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

def ip
  @ip
end

#passwordString

If ‘type`==`radius`

Returns:

  • (String)


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

def password
  @password
end

#ping_countInteger

If ‘type`==`lan_connectivity`

Returns:

  • (Integer)


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

def ping_count
  @ping_count
end

#ping_detailsTrueClass | FalseClass

If ‘type`==`lan_connectivity`

Returns:

  • (TrueClass | FalseClass)


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

def ping_details
  @ping_details
end

#ping_sizeInteger

If ‘type`==`lan_connectivity`

Returns:

  • (Integer)


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

def ping_size
  @ping_size
end

#port_idString

If ‘type`==`speedtest`, required for ssr

Returns:

  • (String)


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

def port_id
  @port_id
end

#protocolSynthetictestDeviceProtocolEnum

if ‘type`==`lan_connectivity`. enum: `ping`, `traceroute`, `ping+traceroute`



47
48
49
# File 'lib/mist_api/models/synthetictest_device.rb', line 47

def protocol
  @protocol
end

#tenantString

If ‘type`==`curl` or `type`==`lan_connectivity`

Returns:

  • (String)


51
52
53
# File 'lib/mist_api/models/synthetictest_device.rb', line 51

def tenant
  @tenant
end

#timeoutInteger

If ‘type`==`curl`

Returns:

  • (Integer)


55
56
57
# File 'lib/mist_api/models/synthetictest_device.rb', line 55

def timeout
  @timeout
end

#traceroute_udp_portInteger

SRX only, traceroute udp port

Returns:

  • (Integer)


59
60
61
# File 'lib/mist_api/models/synthetictest_device.rb', line 59

def traceroute_udp_port
  @traceroute_udp_port
end

#typeSynthetictestTypeEnum

enum: ‘arp`, `curl`, `dhcp`, `dhcp6`, `dns`, `lan_connectivity`, `radius`, `speedtest`



64
65
66
# File 'lib/mist_api/models/synthetictest_device.rb', line 64

def type
  @type
end

#urlString

If ‘type`==`curl`

Returns:

  • (String)


68
69
70
# File 'lib/mist_api/models/synthetictest_device.rb', line 68

def url
  @url
end

#usernameString

If ‘type`==`radius`

Returns:

  • (String)


72
73
74
# File 'lib/mist_api/models/synthetictest_device.rb', line 72

def username
  @username
end

#vlan_idObject

Required for AP

Returns:

  • (Object)


76
77
78
# File 'lib/mist_api/models/synthetictest_device.rb', line 76

def vlan_id
  @vlan_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



156
157
158
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/mist_api/models/synthetictest_device.rb', line 156

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : nil
  host = hash.key?('host') ? hash['host'] : SKIP
  hostname = hash.key?('hostname') ? hash['hostname'] : SKIP
  ip = hash.key?('ip') ? hash['ip'] : SKIP
  password = hash.key?('password') ? hash['password'] : SKIP
  ping_count = hash['ping_count'] ||= 10
  ping_details = hash['ping_details'] ||= false
  ping_size = hash['ping_size'] ||= 56
  port_id = hash.key?('port_id') ? hash['port_id'] : SKIP
  protocol =
    hash['protocol'] ||= SynthetictestDeviceProtocolEnum::ENUM_PINGTRACEROUTE
  tenant = hash.key?('tenant') ? hash['tenant'] : SKIP
  timeout = hash['timeout'] ||= 60
  traceroute_udp_port = hash['traceroute_udp_port'] ||= 33434
  url = hash.key?('url') ? hash['url'] : SKIP
  username = hash.key?('username') ? hash['username'] : SKIP
  vlan_id = hash.key?('vlan_id') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:SynthetictestDeviceVlanId), hash['vlan_id']
  ) : 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.
  SynthetictestDevice.new(type,
                          host,
                          hostname,
                          ip,
                          password,
                          ping_count,
                          ping_details,
                          ping_size,
                          port_id,
                          protocol,
                          tenant,
                          timeout,
                          traceroute_udp_port,
                          url,
                          username,
                          vlan_id,
                          additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['host'] = 'host'
  @_hash['hostname'] = 'hostname'
  @_hash['ip'] = 'ip'
  @_hash['password'] = 'password'
  @_hash['ping_count'] = 'ping_count'
  @_hash['ping_details'] = 'ping_details'
  @_hash['ping_size'] = 'ping_size'
  @_hash['port_id'] = 'port_id'
  @_hash['protocol'] = 'protocol'
  @_hash['tenant'] = 'tenant'
  @_hash['timeout'] = 'timeout'
  @_hash['traceroute_udp_port'] = 'traceroute_udp_port'
  @_hash['type'] = 'type'
  @_hash['url'] = 'url'
  @_hash['username'] = 'username'
  @_hash['vlan_id'] = 'vlan_id'
  @_hash
end

.nullablesObject

An array for nullable fields



122
123
124
# File 'lib/mist_api/models/synthetictest_device.rb', line 122

def self.nullables
  []
end

.optionalsObject

An array for optional fields



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/mist_api/models/synthetictest_device.rb', line 101

def self.optionals
  %w[
    host
    hostname
    ip
    password
    ping_count
    ping_details
    ping_size
    port_id
    protocol
    tenant
    timeout
    traceroute_udp_port
    url
    username
    vlan_id
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



209
210
211
212
213
214
215
216
217
218
219
# File 'lib/mist_api/models/synthetictest_device.rb', line 209

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

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['type'],
                        ->(val) { SynthetictestTypeEnum.validate(val) })
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



232
233
234
235
236
237
238
239
240
241
# File 'lib/mist_api/models/synthetictest_device.rb', line 232

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} host: #{@host.inspect}, hostname: #{@hostname.inspect}, ip: #{@ip.inspect},"\
  " password: #{@password.inspect}, ping_count: #{@ping_count.inspect}, ping_details:"\
  " #{@ping_details.inspect}, ping_size: #{@ping_size.inspect}, port_id: #{@port_id.inspect},"\
  " protocol: #{@protocol.inspect}, tenant: #{@tenant.inspect}, timeout: #{@timeout.inspect},"\
  " traceroute_udp_port: #{@traceroute_udp_port.inspect}, type: #{@type.inspect}, url:"\
  " #{@url.inspect}, username: #{@username.inspect}, vlan_id: #{@vlan_id.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



222
223
224
225
226
227
228
229
# File 'lib/mist_api/models/synthetictest_device.rb', line 222

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} host: #{@host}, hostname: #{@hostname}, ip: #{@ip}, password: #{@password},"\
  " ping_count: #{@ping_count}, ping_details: #{@ping_details}, ping_size: #{@ping_size},"\
  " port_id: #{@port_id}, protocol: #{@protocol}, tenant: #{@tenant}, timeout: #{@timeout},"\
  " traceroute_udp_port: #{@traceroute_udp_port}, type: #{@type}, url: #{@url}, username:"\
  " #{@username}, vlan_id: #{@vlan_id}, additional_properties: #{@additional_properties}>"
end