Class: MistApi::InventoryUpdateOperationEnum

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

Overview

enum: * ‘upgrade_to_mist`: Upgrade to mist-managed * `downgrade_to_jsi`: Downgrade to basic monitoring. When downgrading a VC member to jsi, we will move the cloud connection of the VC to jsi-terminator and keep all VC device/inventories intact for pain-free upgrading back to mist. * `assign`: Assign inventory to a site * `unassign`: Unassign inventory from a site * `delete`: Delete multiple inventory from org. If the device is already assigned to a site, it will be unassigned

Constant Summary collapse

INVENTORY_UPDATE_OPERATION_ENUM =
[
  # TODO: Write general description for ASSIGN
  ASSIGN = 'assign'.freeze,

  # TODO: Write general description for DELETE
  DELETE = 'delete'.freeze,

  # TODO: Write general description for DOWNGRADE_TO_JSI
  DOWNGRADE_TO_JSI = 'downgrade_to_jsi'.freeze,

  # TODO: Write general description for UNASSIGN
  UNASSIGN = 'unassign'.freeze,

  # TODO: Write general description for UPGRADE_TO_MIST
  UPGRADE_TO_MIST = 'upgrade_to_mist'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ASSIGN) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/mist_api/models/inventory_update_operation_enum.rb', line 38

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

  str = value.to_s.strip

  case str.downcase
  when 'assign' then ASSIGN
  when 'delete' then DELETE
  when 'downgrade_to_jsi' then DOWNGRADE_TO_JSI
  when 'unassign' then UNASSIGN
  when 'upgrade_to_mist' then UPGRADE_TO_MIST
  else
    default_value
  end
end

.validate(value) ⇒ Object



32
33
34
35
36
# File 'lib/mist_api/models/inventory_update_operation_enum.rb', line 32

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

  INVENTORY_UPDATE_OPERATION_ENUM.include?(value)
end