Class: MistApi::ResponseSiteDeviceUpgradesItem

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

Overview

ResponseSiteDeviceUpgradesItem 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(id = nil, counts = SKIP, current_phase = SKIP, enable_p2p = SKIP, force = SKIP, max_failure_percentage = SKIP, max_failures = SKIP, reboot_at = SKIP, start_time = SKIP, status = SKIP, strategy = UpgradeDeviceStrategyEnum::BIG_BANG, target_version = SKIP, upgrade_plan = SKIP) ⇒ ResponseSiteDeviceUpgradesItem

Returns a new instance of ResponseSiteDeviceUpgradesItem.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 111

def initialize(id = nil, counts = SKIP, current_phase = SKIP,
               enable_p2p = SKIP, force = SKIP,
               max_failure_percentage = SKIP, max_failures = SKIP,
               reboot_at = SKIP, start_time = SKIP, status = SKIP,
               strategy = UpgradeDeviceStrategyEnum::BIG_BANG,
               target_version = SKIP, upgrade_plan = SKIP)
  @counts = counts unless counts == SKIP
  @current_phase = current_phase unless current_phase == SKIP
  @enable_p2p = enable_p2p unless enable_p2p == SKIP
  @force = force unless force == SKIP
  @id = id
  @max_failure_percentage = max_failure_percentage unless max_failure_percentage == SKIP
  @max_failures = max_failures unless max_failures == SKIP
  @reboot_at = reboot_at unless reboot_at == SKIP
  @start_time = start_time unless start_time == SKIP
  @status = status unless status == SKIP
  @strategy = strategy unless strategy == SKIP
  @target_version = target_version unless target_version == SKIP
  @upgrade_plan = upgrade_plan unless upgrade_plan == SKIP
end

Instance Attribute Details

#countsUpgradeSiteDevicesCounts

TODO: Write general description for this method



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

def counts
  @counts
end

#current_phaseInteger

Current canary or rrm phase in progress

Returns:

  • (Integer)


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

def current_phase
  @current_phase
end

#enable_p2pTrueClass | FalseClass

Whether to allow local AP-to-AP FW upgrade

Returns:

  • (TrueClass | FalseClass)


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

def enable_p2p
  @enable_p2p
end

#forceTrueClass | FalseClass

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

Returns:

  • (TrueClass | FalseClass)


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

def force
  @force
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def id
  @id
end

#max_failure_percentageInteger

Percentage of failures allowed

Returns:

  • (Integer)


34
35
36
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 34

def max_failure_percentage
  @max_failure_percentage
end

#max_failuresArray[Integer]

If ‘strategy`==`canary`. Number of failures allowed within each phase. Only applicable for `canary`. Array length should be same as `canary_phases`. Will be used if provided, else `max_failure_percentage` will be used

Returns:

  • (Array[Integer])


41
42
43
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 41

def max_failures
  @max_failures
end

#reboot_atInteger

reboot start time in epoch

Returns:

  • (Integer)


45
46
47
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 45

def reboot_at
  @reboot_at
end

#start_timeInteger

Firmware download start time in epoch

Returns:

  • (Integer)


49
50
51
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 49

def start_time
  @start_time
end

#statusUpgradeDeviceStatusEnum

status upgrade is in. enum: ‘cancelled`, `completed`, `created`, `downloaded`, `downloading`, `failed`, `upgrading`, `queued`



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

def status
  @status
end

#strategyUpgradeDeviceStrategyEnum

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



59
60
61
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 59

def strategy
  @strategy
end

#target_versionString

Version to upgrade to

Returns:

  • (String)


63
64
65
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 63

def target_version
  @target_version
end

#upgrade_planObject

a dictionary of rrm phase number to devices part of that phase

Returns:

  • (Object)


67
68
69
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 67

def upgrade_plan
  @upgrade_plan
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 133

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  counts = UpgradeSiteDevicesCounts.from_hash(hash['counts']) if hash['counts']
  current_phase = hash.key?('current_phase') ? hash['current_phase'] : SKIP
  enable_p2p = hash.key?('enable_p2p') ? hash['enable_p2p'] : SKIP
  force = hash.key?('force') ? hash['force'] : SKIP
  max_failure_percentage =
    hash.key?('max_failure_percentage') ? hash['max_failure_percentage'] : SKIP
  max_failures = hash.key?('max_failures') ? hash['max_failures'] : SKIP
  reboot_at = hash.key?('reboot_at') ? hash['reboot_at'] : SKIP
  start_time = hash.key?('start_time') ? hash['start_time'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  strategy = hash['strategy'] ||= UpgradeDeviceStrategyEnum::BIG_BANG
  target_version =
    hash.key?('target_version') ? hash['target_version'] : SKIP
  upgrade_plan = hash.key?('upgrade_plan') ? hash['upgrade_plan'] : SKIP

  # Create object from extracted values.
  ResponseSiteDeviceUpgradesItem.new(id,
                                     counts,
                                     current_phase,
                                     enable_p2p,
                                     force,
                                     max_failure_percentage,
                                     max_failures,
                                     reboot_at,
                                     start_time,
                                     status,
                                     strategy,
                                     target_version,
                                     upgrade_plan)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['counts'] = 'counts'
  @_hash['current_phase'] = 'current_phase'
  @_hash['enable_p2p'] = 'enable_p2p'
  @_hash['force'] = 'force'
  @_hash['id'] = 'id'
  @_hash['max_failure_percentage'] = 'max_failure_percentage'
  @_hash['max_failures'] = 'max_failures'
  @_hash['reboot_at'] = 'reboot_at'
  @_hash['start_time'] = 'start_time'
  @_hash['status'] = 'status'
  @_hash['strategy'] = 'strategy'
  @_hash['target_version'] = 'target_version'
  @_hash['upgrade_plan'] = 'upgrade_plan'
  @_hash
end

.nullablesObject

An array for nullable fields



107
108
109
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 107

def self.nullables
  []
end

.optionalsObject

An array for optional fields



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 89

def self.optionals
  %w[
    counts
    current_phase
    enable_p2p
    force
    max_failure_percentage
    max_failures
    reboot_at
    start_time
    status
    strategy
    target_version
    upgrade_plan
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



180
181
182
183
184
185
186
187
188
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 180

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} counts: #{@counts.inspect}, current_phase: #{@current_phase.inspect},"\
  " enable_p2p: #{@enable_p2p.inspect}, force: #{@force.inspect}, id: #{@id.inspect},"\
  " max_failure_percentage: #{@max_failure_percentage.inspect}, max_failures:"\
  " #{@max_failures.inspect}, reboot_at: #{@reboot_at.inspect}, start_time:"\
  " #{@start_time.inspect}, status: #{@status.inspect}, strategy: #{@strategy.inspect},"\
  " target_version: #{@target_version.inspect}, upgrade_plan: #{@upgrade_plan.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



170
171
172
173
174
175
176
177
# File 'lib/mist_api/models/response_site_device_upgrades_item.rb', line 170

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} counts: #{@counts}, current_phase: #{@current_phase}, enable_p2p:"\
  " #{@enable_p2p}, force: #{@force}, id: #{@id}, max_failure_percentage:"\
  " #{@max_failure_percentage}, max_failures: #{@max_failures}, reboot_at: #{@reboot_at},"\
  " start_time: #{@start_time}, status: #{@status}, strategy: #{@strategy}, target_version:"\
  " #{@target_version}, upgrade_plan: #{@upgrade_plan}>"
end