Class: MistApi::SwitchPortConfigOverwrite

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

Overview

Switch port config

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(description = SKIP, disabled = false, duplex = SwitchPortUsageDuplexOverwriteEnum::AUTO, mac_limit = SKIP, poe_disabled = false, poe_keep_state_when_reboot = false, port_network = SKIP, speed = SwitchPortUsageSpeedOverwriteEnum::AUTO) ⇒ SwitchPortConfigOverwrite

Returns a new instance of SwitchPortConfigOverwrite.



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

def initialize(description = SKIP, disabled = false,
               duplex = SwitchPortUsageDuplexOverwriteEnum::AUTO,
               mac_limit = SKIP, poe_disabled = false,
               poe_keep_state_when_reboot = false, port_network = SKIP,
               speed = SwitchPortUsageSpeedOverwriteEnum::AUTO)
  @description = description unless description == SKIP
  @disabled = disabled unless disabled == SKIP
  @duplex = duplex unless duplex == SKIP
  @mac_limit = mac_limit unless mac_limit == SKIP
  @poe_disabled = poe_disabled unless poe_disabled == SKIP
  unless poe_keep_state_when_reboot == SKIP
    @poe_keep_state_when_reboot =
      poe_keep_state_when_reboot
  end
  @port_network = port_network unless port_network == SKIP
  @speed = speed unless speed == SKIP
end

Instance Attribute Details

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


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

def description
  @description
end

#disabledTrueClass | FalseClass

Whether the port is disabled

Returns:

  • (TrueClass | FalseClass)


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

def disabled
  @disabled
end

#duplexSwitchPortUsageDuplexOverwriteEnum

Link connection mode. enum: ‘auto`, `full`, `half`



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

def duplex
  @duplex
end

#mac_limitObject

Max number of mac addresses, default is 0 for unlimited, otherwise range is 1 to 16383 (upper bound constrained by platform)

Returns:

  • (Object)


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

def mac_limit
  @mac_limit
end

#poe_disabledTrueClass | FalseClass

Whether PoE capabilities are disabled for a port

Returns:

  • (TrueClass | FalseClass)


31
32
33
# File 'lib/mist_api/models/switch_port_config_overwrite.rb', line 31

def poe_disabled
  @poe_disabled
end

#poe_keep_state_when_rebootTrueClass | FalseClass

Whether Perpetual PoE is enabled; keeps PoE state across reboots

Returns:

  • (TrueClass | FalseClass)


35
36
37
# File 'lib/mist_api/models/switch_port_config_overwrite.rb', line 35

def poe_keep_state_when_reboot
  @poe_keep_state_when_reboot
end

#port_networkString

Native network/vlan for untagged traffic

Returns:

  • (String)


39
40
41
# File 'lib/mist_api/models/switch_port_config_overwrite.rb', line 39

def port_network
  @port_network
end

#speedSwitchPortUsageSpeedOverwriteEnum

Port Speed, default is auto to automatically negotiate speed enum: ‘100m`, `10m`, `1g`, `2.5g`, `5g`, `10g`, `25g`, `40g`, `100g`,`auto`



44
45
46
# File 'lib/mist_api/models/switch_port_config_overwrite.rb', line 44

def speed
  @speed
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/mist_api/models/switch_port_config_overwrite.rb', line 98

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  description = hash.key?('description') ? hash['description'] : SKIP
  disabled = hash['disabled'] ||= false
  duplex = hash['duplex'] ||= SwitchPortUsageDuplexOverwriteEnum::AUTO
  mac_limit = hash.key?('mac_limit') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:SwitchPortUsageMacLimitOverwrite), hash['mac_limit']
  ) : SKIP
  poe_disabled = hash['poe_disabled'] ||= false
  poe_keep_state_when_reboot = hash['poe_keep_state_when_reboot'] ||= false
  port_network = hash.key?('port_network') ? hash['port_network'] : SKIP
  speed = hash['speed'] ||= SwitchPortUsageSpeedOverwriteEnum::AUTO

  # Create object from extracted values.
  SwitchPortConfigOverwrite.new(description,
                                disabled,
                                duplex,
                                mac_limit,
                                poe_disabled,
                                poe_keep_state_when_reboot,
                                port_network,
                                speed)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/mist_api/models/switch_port_config_overwrite.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['description'] = 'description'
  @_hash['disabled'] = 'disabled'
  @_hash['duplex'] = 'duplex'
  @_hash['mac_limit'] = 'mac_limit'
  @_hash['poe_disabled'] = 'poe_disabled'
  @_hash['poe_keep_state_when_reboot'] = 'poe_keep_state_when_reboot'
  @_hash['port_network'] = 'port_network'
  @_hash['speed'] = 'speed'
  @_hash
end

.nullablesObject

An array for nullable fields



75
76
77
# File 'lib/mist_api/models/switch_port_config_overwrite.rb', line 75

def self.nullables
  []
end

.optionalsObject

An array for optional fields



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/mist_api/models/switch_port_config_overwrite.rb', line 61

def self.optionals
  %w[
    description
    disabled
    duplex
    mac_limit
    poe_disabled
    poe_keep_state_when_reboot
    port_network
    speed
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



126
127
128
129
130
131
132
# File 'lib/mist_api/models/switch_port_config_overwrite.rb', line 126

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



143
144
145
146
147
148
149
150
# File 'lib/mist_api/models/switch_port_config_overwrite.rb', line 143

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} description: #{@description.inspect}, disabled: #{@disabled.inspect},"\
  " duplex: #{@duplex.inspect}, mac_limit: #{@mac_limit.inspect}, poe_disabled:"\
  " #{@poe_disabled.inspect}, poe_keep_state_when_reboot:"\
  " #{@poe_keep_state_when_reboot.inspect}, port_network: #{@port_network.inspect}, speed:"\
  " #{@speed.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



135
136
137
138
139
140
# File 'lib/mist_api/models/switch_port_config_overwrite.rb', line 135

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} description: #{@description}, disabled: #{@disabled}, duplex: #{@duplex},"\
  " mac_limit: #{@mac_limit}, poe_disabled: #{@poe_disabled}, poe_keep_state_when_reboot:"\
  " #{@poe_keep_state_when_reboot}, port_network: #{@port_network}, speed: #{@speed}>"
end