Class: MistApi::DhcpSnooping

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

Overview

DhcpSnooping 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(all_networks = SKIP, enable_arp_spoof_check = SKIP, enable_ip_source_guard = SKIP, enabled = SKIP, networks = SKIP) ⇒ DhcpSnooping

Returns a new instance of DhcpSnooping.



59
60
61
62
63
64
65
66
67
# File 'lib/mist_api/models/dhcp_snooping.rb', line 59

def initialize(all_networks = SKIP, enable_arp_spoof_check = SKIP,
               enable_ip_source_guard = SKIP, enabled = SKIP,
               networks = SKIP)
  @all_networks = all_networks unless all_networks == SKIP
  @enable_arp_spoof_check = enable_arp_spoof_check unless enable_arp_spoof_check == SKIP
  @enable_ip_source_guard = enable_ip_source_guard unless enable_ip_source_guard == SKIP
  @enabled = enabled unless enabled == SKIP
  @networks = networks unless networks == SKIP
end

Instance Attribute Details

#all_networksTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def all_networks
  @all_networks
end

#enable_arp_spoof_checkTrueClass | FalseClass

Enable for dynamic ARP inspection check

Returns:

  • (TrueClass | FalseClass)


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

def enable_arp_spoof_check
  @enable_arp_spoof_check
end

#enable_ip_source_guardTrueClass | FalseClass

Enable for check for forging source IP address

Returns:

  • (TrueClass | FalseClass)


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

def enable_ip_source_guard
  @enable_ip_source_guard
end

#enabledTrueClass | FalseClass

Enable for check for forging source IP address

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#networksArray[String]

If ‘all_networks`==`false`, list of network with DHCP snooping enabled

Returns:

  • (Array[String])


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

def networks
  @networks
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  all_networks = hash.key?('all_networks') ? hash['all_networks'] : SKIP
  enable_arp_spoof_check =
    hash.key?('enable_arp_spoof_check') ? hash['enable_arp_spoof_check'] : SKIP
  enable_ip_source_guard =
    hash.key?('enable_ip_source_guard') ? hash['enable_ip_source_guard'] : SKIP
  enabled = hash.key?('enabled') ? hash['enabled'] : SKIP
  networks = hash.key?('networks') ? hash['networks'] : SKIP

  # Create object from extracted values.
  DhcpSnooping.new(all_networks,
                   enable_arp_spoof_check,
                   enable_ip_source_guard,
                   enabled,
                   networks)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/mist_api/models/dhcp_snooping.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['all_networks'] = 'all_networks'
  @_hash['enable_arp_spoof_check'] = 'enable_arp_spoof_check'
  @_hash['enable_ip_source_guard'] = 'enable_ip_source_guard'
  @_hash['enabled'] = 'enabled'
  @_hash['networks'] = 'networks'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/mist_api/models/dhcp_snooping.rb', line 44

def self.optionals
  %w[
    all_networks
    enable_arp_spoof_check
    enable_ip_source_guard
    enabled
    networks
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



99
100
101
102
103
104
105
# File 'lib/mist_api/models/dhcp_snooping.rb', line 99

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} all_networks: #{@all_networks.inspect}, enable_arp_spoof_check:"\
  " #{@enable_arp_spoof_check.inspect}, enable_ip_source_guard:"\
  " #{@enable_ip_source_guard.inspect}, enabled: #{@enabled.inspect}, networks:"\
  " #{@networks.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



91
92
93
94
95
96
# File 'lib/mist_api/models/dhcp_snooping.rb', line 91

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} all_networks: #{@all_networks}, enable_arp_spoof_check:"\
  " #{@enable_arp_spoof_check}, enable_ip_source_guard: #{@enable_ip_source_guard}, enabled:"\
  " #{@enabled}, networks: #{@networks}>"
end