Class: MistApi::InventoryUpdate

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

Overview

InventoryUpdate 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(op = nil, disable_auto_config = false, macs = SKIP, managed = false, mist_configured = SKIP, no_reassign = false, serials = SKIP, site_id = SKIP, additional_properties = nil) ⇒ InventoryUpdate

Returns a new instance of InventoryUpdate.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/mist_api/models/inventory_update.rb', line 94

def initialize(op = nil, disable_auto_config = false, macs = SKIP,
               managed = false, mist_configured = SKIP, no_reassign = false,
               serials = SKIP, site_id = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @disable_auto_config = disable_auto_config unless disable_auto_config == SKIP
  @macs = macs unless macs == SKIP
  @managed = managed unless managed == SKIP
  @mist_configured = mist_configured unless mist_configured == SKIP
  @no_reassign = no_reassign unless no_reassign == SKIP
  @op = op
  @serials = serials unless serials == SKIP
  @site_id = site_id unless site_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#disable_auto_configTrueClass | FalseClass

If ‘op`==`assign`, this disables the default behavior of a cloud-ready switch/gateway being managed/configured by Mist. Setting this to `true` means you want to disable the default behavior and do not want the device to be Mist-managed.

Returns:

  • (TrueClass | FalseClass)


17
18
19
# File 'lib/mist_api/models/inventory_update.rb', line 17

def disable_auto_config
  @disable_auto_config
end

#macsArray[String]

If ‘op`==`assign`, `op`==`unassign`, `op`==`upgrade_to_mist`or `op`==`downgrade_to_jsi` , list of MAC, e.g. [“5c5b350e0001”]

Returns:

  • (Array[String])


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

def macs
  @macs
end

#managedTrueClass | FalseClass

If ‘op`==`assign`. An adopted switch/gateway will not be managed/configured by Mist by default. Setting this parameter to `true` enables the adopted switch/gateway to be managed/configured by Mist.

Returns:

  • (TrueClass | FalseClass)


28
29
30
# File 'lib/mist_api/models/inventory_update.rb', line 28

def managed
  @managed
end

#mist_configuredTrueClass | FalseClass

whether the device can be configured by Mist or not. This deprecates ‘managed` (for adopted device) and `disable_auto_config` for claimed device)

Returns:

  • (TrueClass | FalseClass)


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

def mist_configured
  @mist_configured
end

#no_reassignTrueClass | FalseClass

If ‘op`==`assign`, if true, treat site assignment against an already assigned AP as error

Returns:

  • (TrueClass | FalseClass)


39
40
41
# File 'lib/mist_api/models/inventory_update.rb', line 39

def no_reassign
  @no_reassign
end

#opInventoryUpdateOperationEnum

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



52
53
54
# File 'lib/mist_api/models/inventory_update.rb', line 52

def op
  @op
end

#serialsArray[String]

If ‘op`==`delete`, list of serial numbers, e.g. [“FXLH2015150025”]

Returns:

  • (Array[String])


56
57
58
# File 'lib/mist_api/models/inventory_update.rb', line 56

def serials
  @serials
end

#site_idUUID | String

If ‘op`==`assign`, target site id

Returns:

  • (UUID | String)


60
61
62
# File 'lib/mist_api/models/inventory_update.rb', line 60

def site_id
  @site_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/mist_api/models/inventory_update.rb', line 112

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  op = hash.key?('op') ? hash['op'] : nil
  disable_auto_config = hash['disable_auto_config'] ||= false
  macs = hash.key?('macs') ? hash['macs'] : SKIP
  managed = hash['managed'] ||= false
  mist_configured =
    hash.key?('mist_configured') ? hash['mist_configured'] : SKIP
  no_reassign = hash['no_reassign'] ||= false
  serials = hash.key?('serials') ? hash['serials'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP

  # 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.
  InventoryUpdate.new(op,
                      disable_auto_config,
                      macs,
                      managed,
                      mist_configured,
                      no_reassign,
                      serials,
                      site_id,
                      additional_properties)
end

.namesObject

A mapping from model property names to API property names.



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/mist_api/models/inventory_update.rb', line 63

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['disable_auto_config'] = 'disable_auto_config'
  @_hash['macs'] = 'macs'
  @_hash['managed'] = 'managed'
  @_hash['mist_configured'] = 'mist_configured'
  @_hash['no_reassign'] = 'no_reassign'
  @_hash['op'] = 'op'
  @_hash['serials'] = 'serials'
  @_hash['site_id'] = 'site_id'
  @_hash
end

.nullablesObject

An array for nullable fields



90
91
92
# File 'lib/mist_api/models/inventory_update.rb', line 90

def self.nullables
  []
end

.optionalsObject

An array for optional fields



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/mist_api/models/inventory_update.rb', line 77

def self.optionals
  %w[
    disable_auto_config
    macs
    managed
    mist_configured
    no_reassign
    serials
    site_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



155
156
157
158
159
160
161
162
# File 'lib/mist_api/models/inventory_update.rb', line 155

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} disable_auto_config: #{@disable_auto_config.inspect}, macs:"\
  " #{@macs.inspect}, managed: #{@managed.inspect}, mist_configured:"\
  " #{@mist_configured.inspect}, no_reassign: #{@no_reassign.inspect}, op: #{@op.inspect},"\
  " serials: #{@serials.inspect}, site_id: #{@site_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



146
147
148
149
150
151
152
# File 'lib/mist_api/models/inventory_update.rb', line 146

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} disable_auto_config: #{@disable_auto_config}, macs: #{@macs}, managed:"\
  " #{@managed}, mist_configured: #{@mist_configured}, no_reassign: #{@no_reassign}, op:"\
  " #{@op}, serials: #{@serials}, site_id: #{@site_id}, additional_properties:"\
  " #{@additional_properties}>"
end