Class: MistApi::ResponseUpgradeOrgDevices

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

Overview

ResponseUpgradeOrgDevices 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(enable_p2p = SKIP, force = SKIP, id = SKIP, strategy = UpgradeDeviceStrategyEnum::BIG_BANG, target_version = SKIP, upgrades = SKIP) ⇒ ResponseUpgradeOrgDevices

Returns a new instance of ResponseUpgradeOrgDevices.



66
67
68
69
70
71
72
73
74
75
# File 'lib/mist_api/models/response_upgrade_org_devices.rb', line 66

def initialize(enable_p2p = SKIP, force = SKIP, id = SKIP,
               strategy = UpgradeDeviceStrategyEnum::BIG_BANG,
               target_version = SKIP, upgrades = SKIP)
  @enable_p2p = enable_p2p unless enable_p2p == SKIP
  @force = force unless force == SKIP
  @id = id unless id == SKIP
  @strategy = strategy unless strategy == SKIP
  @target_version = target_version unless target_version == SKIP
  @upgrades = upgrades unless upgrades == SKIP
end

Instance Attribute Details

#enable_p2pTrueClass | FalseClass

Whether to allow local AP-to-AP FW upgrade

Returns:

  • (TrueClass | FalseClass)


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

def enable_p2p
  @enable_p2p
end

#forceTrueClass | FalseClass

Whether to force upgrade when requested version is same as running version

Returns:

  • (TrueClass | FalseClass)


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

def force
  @force
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def id
  @id
end

#strategyUpgradeDeviceStrategyEnum

enum: ‘big_bang` (upgrade all at once), `canary`, `rrm` (APs only), `serial` (one at a time)



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

def strategy
  @strategy
end

#target_versionString

Version to upgrade to

Returns:

  • (String)


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

def target_version
  @target_version
end

#upgradesArray[UpgradeOrgDevicesUpgrade]

Version to upgrade to

Returns:



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

def upgrades
  @upgrades
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/mist_api/models/response_upgrade_org_devices.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  enable_p2p = hash.key?('enable_p2p') ? hash['enable_p2p'] : SKIP
  force = hash.key?('force') ? hash['force'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  strategy = hash['strategy'] ||= UpgradeDeviceStrategyEnum::BIG_BANG
  target_version =
    hash.key?('target_version') ? hash['target_version'] : SKIP
  # Parameter is an array, so we need to iterate through it
  upgrades = nil
  unless hash['upgrades'].nil?
    upgrades = []
    hash['upgrades'].each do |structure|
      upgrades << (UpgradeOrgDevicesUpgrade.from_hash(structure) if structure)
    end
  end

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

  # Create object from extracted values.
  ResponseUpgradeOrgDevices.new(enable_p2p,
                                force,
                                id,
                                strategy,
                                target_version,
                                upgrades)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/mist_api/models/response_upgrade_org_devices.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['enable_p2p'] = 'enable_p2p'
  @_hash['force'] = 'force'
  @_hash['id'] = 'id'
  @_hash['strategy'] = 'strategy'
  @_hash['target_version'] = 'target_version'
  @_hash['upgrades'] = 'upgrades'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
58
59
# File 'lib/mist_api/models/response_upgrade_org_devices.rb', line 50

def self.optionals
  %w[
    enable_p2p
    force
    id
    strategy
    target_version
    upgrades
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



116
117
118
119
120
121
# File 'lib/mist_api/models/response_upgrade_org_devices.rb', line 116

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} enable_p2p: #{@enable_p2p.inspect}, force: #{@force.inspect}, id:"\
  " #{@id.inspect}, strategy: #{@strategy.inspect}, target_version:"\
  " #{@target_version.inspect}, upgrades: #{@upgrades.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



109
110
111
112
113
# File 'lib/mist_api/models/response_upgrade_org_devices.rb', line 109

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} enable_p2p: #{@enable_p2p}, force: #{@force}, id: #{@id}, strategy:"\
  " #{@strategy}, target_version: #{@target_version}, upgrades: #{@upgrades}>"
end