Class: MistApi::TuntermMonitoringItem

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

Overview

TuntermMonitoringItem 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 = SKIP, port = SKIP, protocol = SKIP, src_vlan_id = SKIP, timeout = 300) ⇒ TuntermMonitoringItem

Returns a new instance of TuntermMonitoringItem.



61
62
63
64
65
66
67
68
# File 'lib/mist_api/models/tunterm_monitoring_item.rb', line 61

def initialize(host = SKIP, port = SKIP, protocol = SKIP,
               src_vlan_id = SKIP, timeout = 300)
  @host = host unless host == SKIP
  @port = port unless port == SKIP
  @protocol = protocol unless protocol == SKIP
  @src_vlan_id = src_vlan_id unless src_vlan_id == SKIP
  @timeout = timeout unless timeout == SKIP
end

Instance Attribute Details

#hostString

Can be ip, ipv6, hostname

Returns:

  • (String)


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

def host
  @host
end

#portInteger

When ‘protocol`==`tcp`

Returns:

  • (Integer)


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

def port
  @port
end

#protocolTuntermMonitoringProtocolEnum

enum: ‘arp`, `ping`, `tcp`



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

def protocol
  @protocol
end

#src_vlan_idInteger

Optional source for the monitoring check, vlan_id configured in tunterm_other_ip_configs

Returns:

  • (Integer)


27
28
29
# File 'lib/mist_api/models/tunterm_monitoring_item.rb', line 27

def src_vlan_id
  @src_vlan_id
end

#timeoutInteger

Optional source for the monitoring check, vlan_id configured in tunterm_other_ip_configs

Returns:

  • (Integer)


32
33
34
# File 'lib/mist_api/models/tunterm_monitoring_item.rb', line 32

def timeout
  @timeout
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  host = hash.key?('host') ? hash['host'] : SKIP
  port = hash.key?('port') ? hash['port'] : SKIP
  protocol = hash.key?('protocol') ? hash['protocol'] : SKIP
  src_vlan_id = hash.key?('src_vlan_id') ? hash['src_vlan_id'] : SKIP
  timeout = hash['timeout'] ||= 300

  # Create object from extracted values.
  TuntermMonitoringItem.new(host,
                            port,
                            protocol,
                            src_vlan_id,
                            timeout)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/mist_api/models/tunterm_monitoring_item.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['host'] = 'host'
  @_hash['port'] = 'port'
  @_hash['protocol'] = 'protocol'
  @_hash['src_vlan_id'] = 'src_vlan_id'
  @_hash['timeout'] = 'timeout'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
# File 'lib/mist_api/models/tunterm_monitoring_item.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
53
54
# File 'lib/mist_api/models/tunterm_monitoring_item.rb', line 46

def self.optionals
  %w[
    host
    port
    protocol
    src_vlan_id
    timeout
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



97
98
99
100
101
# File 'lib/mist_api/models/tunterm_monitoring_item.rb', line 97

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} host: #{@host.inspect}, port: #{@port.inspect}, protocol:"\
  " #{@protocol.inspect}, src_vlan_id: #{@src_vlan_id.inspect}, timeout: #{@timeout.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



90
91
92
93
94
# File 'lib/mist_api/models/tunterm_monitoring_item.rb', line 90

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} host: #{@host}, port: #{@port}, protocol: #{@protocol}, src_vlan_id:"\
  " #{@src_vlan_id}, timeout: #{@timeout}>"
end