Class: MistApi::ApIpConfig

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

Overview

IP AP settings

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(dns = SKIP, dns_suffix = SKIP, gateway = SKIP, gateway6 = SKIP, ip = SKIP, ip6 = SKIP, mtu = SKIP, netmask = SKIP, netmask6 = SKIP, type = IpTypeEnum::DHCP, type6 = IpType6Enum::DISABLED, vlan_id = 1) ⇒ ApIpConfig

Returns a new instance of ApIpConfig.



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

def initialize(dns = SKIP, dns_suffix = SKIP, gateway = SKIP,
               gateway6 = SKIP, ip = SKIP, ip6 = SKIP, mtu = SKIP,
               netmask = SKIP, netmask6 = SKIP, type = IpTypeEnum::DHCP,
               type6 = IpType6Enum::DISABLED, vlan_id = 1)
  @dns = dns unless dns == SKIP
  @dns_suffix = dns_suffix unless dns_suffix == SKIP
  @gateway = gateway unless gateway == SKIP
  @gateway6 = gateway6 unless gateway6 == SKIP
  @ip = ip unless ip == SKIP
  @ip6 = ip6 unless ip6 == SKIP
  @mtu = mtu unless mtu == SKIP
  @netmask = netmask unless netmask == SKIP
  @netmask6 = netmask6 unless netmask6 == SKIP
  @type = type unless type == SKIP
  @type6 = type6 unless type6 == SKIP
  @vlan_id = vlan_id unless vlan_id == SKIP
end

Instance Attribute Details

#dnsArray[String]

If ‘type`==`static`

Returns:

  • (Array[String])


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

def dns
  @dns
end

#dns_suffixArray[String]

Required if ‘type`==`static`

Returns:

  • (Array[String])


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

def dns_suffix
  @dns_suffix
end

#gatewayString

Required if ‘type`==`static`

Returns:

  • (String)


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

def gateway
  @gateway
end

#gateway6String

Required if ‘type`==`static`

Returns:

  • (String)


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

def gateway6
  @gateway6
end

#ipString

Required if ‘type`==`static`

Returns:

  • (String)


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

def ip
  @ip
end

#ip6String

Required if ‘type`==`static`

Returns:

  • (String)


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

def ip6
  @ip6
end

#mtuInteger

Required if ‘type`==`static`

Returns:

  • (Integer)


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

def mtu
  @mtu
end

#netmaskString

Required if ‘type`==`static`

Returns:

  • (String)


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

def netmask
  @netmask
end

#netmask6String

Required if ‘type`==`static`

Returns:

  • (String)


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

def netmask6
  @netmask6
end

#typeIpTypeEnum

enum: ‘dhcp`, `static`

Returns:



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

def type
  @type
end

#type6IpType6Enum

enum: ‘autoconf`, `dhcp`, `disabled`, `static`

Returns:



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

def type6
  @type6
end

#vlan_idInteger

Management VLAN id, default is 1 (untagged)

Returns:

  • (Integer)


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

def vlan_id
  @vlan_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



120
121
122
123
124
125
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
# File 'lib/mist_api/models/ap_ip_config.rb', line 120

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  dns = hash.key?('dns') ? hash['dns'] : SKIP
  dns_suffix = hash.key?('dns_suffix') ? hash['dns_suffix'] : SKIP
  gateway = hash.key?('gateway') ? hash['gateway'] : SKIP
  gateway6 = hash.key?('gateway6') ? hash['gateway6'] : SKIP
  ip = hash.key?('ip') ? hash['ip'] : SKIP
  ip6 = hash.key?('ip6') ? hash['ip6'] : SKIP
  mtu = hash.key?('mtu') ? hash['mtu'] : SKIP
  netmask = hash.key?('netmask') ? hash['netmask'] : SKIP
  netmask6 = hash.key?('netmask6') ? hash['netmask6'] : SKIP
  type = hash['type'] ||= IpTypeEnum::DHCP
  type6 = hash['type6'] ||= IpType6Enum::DISABLED
  vlan_id = hash['vlan_id'] ||= 1

  # Create object from extracted values.
  ApIpConfig.new(dns,
                 dns_suffix,
                 gateway,
                 gateway6,
                 ip,
                 ip6,
                 mtu,
                 netmask,
                 netmask6,
                 type,
                 type6,
                 vlan_id)
end

.namesObject

A mapping from model property names to API property names.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/mist_api/models/ap_ip_config.rb', line 61

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['dns'] = 'dns'
  @_hash['dns_suffix'] = 'dns_suffix'
  @_hash['gateway'] = 'gateway'
  @_hash['gateway6'] = 'gateway6'
  @_hash['ip'] = 'ip'
  @_hash['ip6'] = 'ip6'
  @_hash['mtu'] = 'mtu'
  @_hash['netmask'] = 'netmask'
  @_hash['netmask6'] = 'netmask6'
  @_hash['type'] = 'type'
  @_hash['type6'] = 'type6'
  @_hash['vlan_id'] = 'vlan_id'
  @_hash
end

.nullablesObject

An array for nullable fields



97
98
99
# File 'lib/mist_api/models/ap_ip_config.rb', line 97

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    dns
    dns_suffix
    gateway
    gateway6
    ip
    ip6
    mtu
    netmask
    netmask6
    type
    type6
    vlan_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



161
162
163
164
165
166
167
168
# File 'lib/mist_api/models/ap_ip_config.rb', line 161

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} dns: #{@dns.inspect}, dns_suffix: #{@dns_suffix.inspect}, gateway:"\
  " #{@gateway.inspect}, gateway6: #{@gateway6.inspect}, ip: #{@ip.inspect}, ip6:"\
  " #{@ip6.inspect}, mtu: #{@mtu.inspect}, netmask: #{@netmask.inspect}, netmask6:"\
  " #{@netmask6.inspect}, type: #{@type.inspect}, type6: #{@type6.inspect}, vlan_id:"\
  " #{@vlan_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



153
154
155
156
157
158
# File 'lib/mist_api/models/ap_ip_config.rb', line 153

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} dns: #{@dns}, dns_suffix: #{@dns_suffix}, gateway: #{@gateway}, gateway6:"\
  " #{@gateway6}, ip: #{@ip}, ip6: #{@ip6}, mtu: #{@mtu}, netmask: #{@netmask}, netmask6:"\
  " #{@netmask6}, type: #{@type}, type6: #{@type6}, vlan_id: #{@vlan_id}>"
end