Class: MistApi::UtilsReleaseDhcpLeases

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

Overview

Note: * valid combinations for Junos: * ‘port_id` * `macs` + `network` * valid combinations for SSR: * `port_id` * `macs` + `network` * `port_id` + `network` * `network` * if network or port_id is specified and macs is empty, it means all clients under network or port_id

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(port_id = nil, macs = SKIP, network = SKIP, node = SKIP, additional_properties = nil) ⇒ UtilsReleaseDhcpLeases

Returns a new instance of UtilsReleaseDhcpLeases.



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/mist_api/models/utils_release_dhcp_leases.rb', line 56

def initialize(port_id = nil, macs = SKIP, network = SKIP, node = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @macs = macs unless macs == SKIP
  @network = network unless network == SKIP
  @node = node unless node == SKIP
  @port_id = port_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#macsArray[String]

A list of client macs to be released

Returns:

  • (Array[String])


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

def macs
  @macs
end

#networkString

The network for the leases IPs to be released

Returns:

  • (String)


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

def network
  @network
end

#nodeHaClusterNodeEnum

only for HA. enum: ‘node0`, `node1`

Returns:



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

def node
  @node
end

#port_idString

The network interface on which to release the current DHCP release

Returns:

  • (String)


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

def port_id
  @port_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  port_id = hash.key?('port_id') ? hash['port_id'] : nil
  macs = hash.key?('macs') ? hash['macs'] : SKIP
  network = hash.key?('network') ? hash['network'] : SKIP
  node = hash.key?('node') ? hash['node'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  UtilsReleaseDhcpLeases.new(port_id,
                             macs,
                             network,
                             node,
                             additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['macs'] = 'macs'
  @_hash['network'] = 'network'
  @_hash['node'] = 'node'
  @_hash['port_id'] = 'port_id'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
# File 'lib/mist_api/models/utils_release_dhcp_leases.rb', line 52

def self.nullables
  []
end

.optionalsObject

An array for optional fields



43
44
45
46
47
48
49
# File 'lib/mist_api/models/utils_release_dhcp_leases.rb', line 43

def self.optionals
  %w[
    macs
    network
    node
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



101
102
103
104
105
106
# File 'lib/mist_api/models/utils_release_dhcp_leases.rb', line 101

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} macs: #{@macs.inspect}, network: #{@network.inspect}, node:"\
  " #{@node.inspect}, port_id: #{@port_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



94
95
96
97
98
# File 'lib/mist_api/models/utils_release_dhcp_leases.rb', line 94

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} macs: #{@macs}, network: #{@network}, node: #{@node}, port_id: #{@port_id},"\
  " additional_properties: #{@additional_properties}>"
end