Class: MistApi::DhcpdConfigProperty

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

Overview

DhcpdConfigProperty 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(dns_servers = SKIP, dns_suffix = SKIP, fixed_bindings = SKIP, gateway = SKIP, ip6_end = SKIP, ip6_start = SKIP, ip_end = SKIP, ip_start = SKIP, lease_time = 86400, options = SKIP, server_id_override = false, servers = SKIP, serversv6 = SKIP, type = DhcpdConfigTypeEnum::LOCAL, type6 = DhcpdConfigTypeEnum::NONE, vendor_encapsulated = SKIP) ⇒ DhcpdConfigProperty

Returns a new instance of DhcpdConfigProperty.



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 137

def initialize(dns_servers = SKIP, dns_suffix = SKIP, fixed_bindings = SKIP,
               gateway = SKIP, ip6_end = SKIP, ip6_start = SKIP,
               ip_end = SKIP, ip_start = SKIP, lease_time = 86400,
               options = SKIP, server_id_override = false, servers = SKIP,
               serversv6 = SKIP, type = DhcpdConfigTypeEnum::LOCAL,
               type6 = DhcpdConfigTypeEnum::NONE,
               vendor_encapsulated = SKIP)
  @dns_servers = dns_servers unless dns_servers == SKIP
  @dns_suffix = dns_suffix unless dns_suffix == SKIP
  @fixed_bindings = fixed_bindings unless fixed_bindings == SKIP
  @gateway = gateway unless gateway == SKIP
  @ip6_end = ip6_end unless ip6_end == SKIP
  @ip6_start = ip6_start unless ip6_start == SKIP
  @ip_end = ip_end unless ip_end == SKIP
  @ip_start = ip_start unless ip_start == SKIP
  @lease_time = lease_time unless lease_time == SKIP
  @options = options unless options == SKIP
  @server_id_override = server_id_override unless server_id_override == SKIP
  @servers = servers unless servers == SKIP
  @serversv6 = serversv6 unless serversv6 == SKIP
  @type = type unless type == SKIP
  @type6 = type6 unless type6 == SKIP
  @vendor_encapsulated = vendor_encapsulated unless vendor_encapsulated == SKIP
end

Instance Attribute Details

#dns_serversArray[String]

If ‘type`==`local` or `type6`==`local` - optional, if not defined, system one will be used

Returns:

  • (Array[String])


15
16
17
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 15

def dns_servers
  @dns_servers
end

#dns_suffixArray[String]

If ‘type`==`local` or `type6`==`local` - optional, if not defined, system one will be used

Returns:

  • (Array[String])


20
21
22
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 20

def dns_suffix
  @dns_suffix
end

#fixed_bindingsHash[String, DhcpdConfigFixedBinding]

If ‘type`==`local` or `type6`==`local`. Property key is the MAC Address. Format is `[0-9a-f]12` (e.g. “5684dae9ac8b”)

Returns:



25
26
27
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 25

def fixed_bindings
  @fixed_bindings
end

#gatewayString

If ‘type`==`local` - optional, `ip` will be used if not provided

Returns:

  • (String)


29
30
31
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 29

def gateway
  @gateway
end

#ip6_endString

If ‘type6`==`local`

Returns:

  • (String)


33
34
35
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 33

def ip6_end
  @ip6_end
end

#ip6_startString

If ‘type6`==`local`

Returns:

  • (String)


37
38
39
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 37

def ip6_start
  @ip6_start
end

#ip_endString

If ‘type`==`local`

Returns:

  • (String)


41
42
43
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 41

def ip_end
  @ip_end
end

#ip_startString

If ‘type`==`local`

Returns:

  • (String)


45
46
47
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 45

def ip_start
  @ip_start
end

#lease_timeInteger

In seconds, lease time has to be between 3600 [1hr] - 604800 [1 week], default is 86400 [1 day]

Returns:

  • (Integer)


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

def lease_time
  @lease_time
end

#optionsHash[String, DhcpdConfigOption]

If ‘type`==`local` or `type6`==`local`. Property key is the DHCP option number

Returns:



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

def options
  @options
end

#server_id_overrideTrueClass | FalseClass

‘server_id_override`==`true` means the device, when acts as DHCP relay and forwards DHCP responses from DHCP server to clients, should overwrite the Sever Identifier option (i.e. DHCP option 54) in DHCP responses with its own IP address.

Returns:

  • (TrueClass | FalseClass)


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

def server_id_override
  @server_id_override
end

#serversArray[String]

If ‘type`==`relay`

Returns:

  • (Array[String])


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

def servers
  @servers
end

#serversv6Array[String]

If ‘type6`==`relay`

Returns:

  • (Array[String])


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

def serversv6
  @serversv6
end

#typeDhcpdConfigTypeEnum

enum: ‘local` (DHCP Server), `none`, `relay` (DHCP Relay)

Returns:



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

def type
  @type
end

#type6DhcpdConfigTypeEnum

enum: ‘local` (DHCP Server), `none`, `relay` (DHCP Relay)

Returns:



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

def type6
  @type6
end

#vendor_encapsulatedHash[String, DhcpdConfigVendorOption]

If ‘type`==`local` or `type6`==`local`. Property key is <enterprise number>:<sub option code>, with

* enterprise number: 1-65535

(www.iana.org/assignments/enterprise-numbers/enterprise-numbers)

* sub option code: 1-255, sub-option code

Returns:



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

def vendor_encapsulated
  @vendor_encapsulated
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
206
207
208
209
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 163

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  dns_servers = hash.key?('dns_servers') ? hash['dns_servers'] : SKIP
  dns_suffix = hash.key?('dns_suffix') ? hash['dns_suffix'] : SKIP
  fixed_bindings = DhcpdConfigFixedBinding.from_hash(hash['fixed_bindings']) if
    hash['fixed_bindings']

  fixed_bindings = SKIP unless hash.key?('fixed_bindings')
  gateway = hash.key?('gateway') ? hash['gateway'] : SKIP
  ip6_end = hash.key?('ip6_end') ? hash['ip6_end'] : SKIP
  ip6_start = hash.key?('ip6_start') ? hash['ip6_start'] : SKIP
  ip_end = hash.key?('ip_end') ? hash['ip_end'] : SKIP
  ip_start = hash.key?('ip_start') ? hash['ip_start'] : SKIP
  lease_time = hash['lease_time'] ||= 86400
  options = DhcpdConfigOption.from_hash(hash['options']) if hash['options']

  options = SKIP unless hash.key?('options')
  server_id_override = hash['server_id_override'] ||= false
  servers = hash.key?('servers') ? hash['servers'] : SKIP
  serversv6 = hash.key?('serversv6') ? hash['serversv6'] : SKIP
  type = hash['type'] ||= DhcpdConfigTypeEnum::LOCAL
  type6 = hash['type6'] ||= DhcpdConfigTypeEnum::NONE
  vendor_encapsulated = DhcpdConfigVendorOption.from_hash(hash['vendor_encapsulated']) if
    hash['vendor_encapsulated']

  vendor_encapsulated = SKIP unless hash.key?('vendor_encapsulated')

  # Create object from extracted values.
  DhcpdConfigProperty.new(dns_servers,
                          dns_suffix,
                          fixed_bindings,
                          gateway,
                          ip6_end,
                          ip6_start,
                          ip_end,
                          ip_start,
                          lease_time,
                          options,
                          server_id_override,
                          servers,
                          serversv6,
                          type,
                          type6,
                          vendor_encapsulated)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['dns_servers'] = 'dns_servers'
  @_hash['dns_suffix'] = 'dns_suffix'
  @_hash['fixed_bindings'] = 'fixed_bindings'
  @_hash['gateway'] = 'gateway'
  @_hash['ip6_end'] = 'ip6_end'
  @_hash['ip6_start'] = 'ip6_start'
  @_hash['ip_end'] = 'ip_end'
  @_hash['ip_start'] = 'ip_start'
  @_hash['lease_time'] = 'lease_time'
  @_hash['options'] = 'options'
  @_hash['server_id_override'] = 'server_id_override'
  @_hash['servers'] = 'servers'
  @_hash['serversv6'] = 'serversv6'
  @_hash['type'] = 'type'
  @_hash['type6'] = 'type6'
  @_hash['vendor_encapsulated'] = 'vendor_encapsulated'
  @_hash
end

.nullablesObject

An array for nullable fields



133
134
135
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 133

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    dns_servers
    dns_suffix
    fixed_bindings
    gateway
    ip6_end
    ip6_start
    ip_end
    ip_start
    lease_time
    options
    server_id_override
    servers
    serversv6
    type
    type6
    vendor_encapsulated
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



223
224
225
226
227
228
229
230
231
232
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 223

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} dns_servers: #{@dns_servers.inspect}, dns_suffix: #{@dns_suffix.inspect},"\
  " fixed_bindings: #{@fixed_bindings.inspect}, gateway: #{@gateway.inspect}, ip6_end:"\
  " #{@ip6_end.inspect}, ip6_start: #{@ip6_start.inspect}, ip_end: #{@ip_end.inspect},"\
  " ip_start: #{@ip_start.inspect}, lease_time: #{@lease_time.inspect}, options:"\
  " #{@options.inspect}, server_id_override: #{@server_id_override.inspect}, servers:"\
  " #{@servers.inspect}, serversv6: #{@serversv6.inspect}, type: #{@type.inspect}, type6:"\
  " #{@type6.inspect}, vendor_encapsulated: #{@vendor_encapsulated.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



212
213
214
215
216
217
218
219
220
# File 'lib/mist_api/models/dhcpd_config_property.rb', line 212

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} dns_servers: #{@dns_servers}, dns_suffix: #{@dns_suffix}, fixed_bindings:"\
  " #{@fixed_bindings}, gateway: #{@gateway}, ip6_end: #{@ip6_end}, ip6_start: #{@ip6_start},"\
  " ip_end: #{@ip_end}, ip_start: #{@ip_start}, lease_time: #{@lease_time}, options:"\
  " #{@options}, server_id_override: #{@server_id_override}, servers: #{@servers}, serversv6:"\
  " #{@serversv6}, type: #{@type}, type6: #{@type6}, vendor_encapsulated:"\
  " #{@vendor_encapsulated}>"
end