Class: MistApi::UpgradeDeviceStrategyEnum

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

Overview

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

Constant Summary collapse

UPGRADE_DEVICE_STRATEGY_ENUM =
[
  # TODO: Write general description for BIG_BANG
  BIG_BANG = 'big_bang'.freeze,

  # TODO: Write general description for CANARY
  CANARY = 'canary'.freeze,

  # TODO: Write general description for RRM
  RRM = 'rrm'.freeze,

  # TODO: Write general description for SERIAL
  SERIAL = 'serial'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = BIG_BANG) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/mist_api/models/upgrade_device_strategy_enum.rb', line 30

def self.from_value(value, default_value = BIG_BANG)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'big_bang' then BIG_BANG
  when 'canary' then CANARY
  when 'rrm' then RRM
  when 'serial' then SERIAL
  else
    default_value
  end
end

.validate(value) ⇒ Object



24
25
26
27
28
# File 'lib/mist_api/models/upgrade_device_strategy_enum.rb', line 24

def self.validate(value)
  return false if value.nil?

  UPGRADE_DEVICE_STRATEGY_ENUM.include?(value)
end