Class: MistApi::AutoPlacement

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

Overview

AutoPlacement 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(dryrun = false, force_collection = false, macs = SKIP, override = false, additional_properties = nil) ⇒ AutoPlacement

Returns a new instance of AutoPlacement.



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

def initialize(dryrun = false, force_collection = false, macs = SKIP,
               override = false, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @dryrun = dryrun unless dryrun == SKIP
  @force_collection = force_collection unless force_collection == SKIP
  @macs = macs unless macs == SKIP
  @override = override unless override == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#dryrunTrueClass | FalseClass

Set to ‘true` to perform an invalid AP check and provide an estimated run time without enqueuing the run into the auto placement service.

Returns:

  • (TrueClass | FalseClass)


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

def dryrun
  @dryrun
end

#force_collectionTrueClass | FalseClass

  • If ‘force_collection`==`false`: the API attempts to start localization

with existing data.

  • If ‘force_collection`==`true`: maintenance the API attempts to start

orchestration.

Returns:

  • (TrueClass | FalseClass)


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

def force_collection
  @force_collection
end

#macsArray[String]

List of device macs

Returns:

  • (Array[String])


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

def macs
  @macs
end

#overrideTrueClass | FalseClass

Set to ‘true` to run auto placement even if there are invalid APs in the selected APs.

Returns:

  • (TrueClass | FalseClass)


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

def override
  @override
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  dryrun = hash['dryrun'] ||= false
  force_collection = hash['force_collection'] ||= false
  macs = hash.key?('macs') ? hash['macs'] : SKIP
  override = hash['override'] ||= false

  # 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.
  AutoPlacement.new(dryrun,
                    force_collection,
                    macs,
                    override,
                    additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['dryrun'] = 'dryrun'
  @_hash['force_collection'] = 'force_collection'
  @_hash['macs'] = 'macs'
  @_hash['override'] = 'override'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    dryrun
    force_collection
    macs
    override
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



103
104
105
106
107
108
# File 'lib/mist_api/models/auto_placement.rb', line 103

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

#to_sObject

Provides a human-readable string representation of the object.



96
97
98
99
100
# File 'lib/mist_api/models/auto_placement.rb', line 96

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