Class: MistApi::SsrUpgradeMulti

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

Overview

SsrUpgradeMulti 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(device_ids = nil, channel = SsrUpgradeChannelEnum::STABLE, reboot_at = SKIP, start_time = SKIP, strategy = SsrUpgradeStrategyEnum::BIG_BANG, version = SKIP, additional_properties = nil) ⇒ SsrUpgradeMulti

Returns a new instance of SsrUpgradeMulti.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/mist_api/models/ssr_upgrade_multi.rb', line 68

def initialize(device_ids = nil, channel = SsrUpgradeChannelEnum::STABLE,
               reboot_at = SKIP, start_time = SKIP,
               strategy = SsrUpgradeStrategyEnum::BIG_BANG, version = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @channel = channel unless channel == SKIP
  @device_ids = device_ids
  @reboot_at = reboot_at unless reboot_at == SKIP
  @start_time = start_time unless start_time == SKIP
  @strategy = strategy unless strategy == SKIP
  @version = version unless version == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#channelSsrUpgradeChannelEnum

upgrade channel to follow. enum: ‘alpha`, `beta`, `stable`



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

def channel
  @channel
end

#device_idsArray[UUID | String]

List of 128T device IDs to upgrade

Returns:

  • (Array[UUID | String])


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

def device_ids
  @device_ids
end

#reboot_atInteger

Reboot start time in epoch seconds, default is start_time, -1 disables reboot

Returns:

  • (Integer)


23
24
25
# File 'lib/mist_api/models/ssr_upgrade_multi.rb', line 23

def reboot_at
  @reboot_at
end

#start_timeInteger

128T firmware download start time in epoch seconds, default is now, -1 disables download

Returns:

  • (Integer)


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

def start_time
  @start_time
end

#strategySsrUpgradeStrategyEnum

enum:

* `big_bang`: upgrade all at once
* `serial`: one at a time


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

def strategy
  @strategy
end

#versionString

128T firmware version to upgrade (e.g. 5.3.0-93)

Returns:

  • (String)


38
39
40
# File 'lib/mist_api/models/ssr_upgrade_multi.rb', line 38

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/mist_api/models/ssr_upgrade_multi.rb', line 85

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_ids = hash.key?('device_ids') ? hash['device_ids'] : nil
  channel = hash['channel'] ||= SsrUpgradeChannelEnum::STABLE
  reboot_at = hash.key?('reboot_at') ? hash['reboot_at'] : SKIP
  start_time = hash.key?('start_time') ? hash['start_time'] : SKIP
  strategy = hash['strategy'] ||= SsrUpgradeStrategyEnum::BIG_BANG
  version = hash.key?('version') ? hash['version'] : 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.
  SsrUpgradeMulti.new(device_ids,
                      channel,
                      reboot_at,
                      start_time,
                      strategy,
                      version,
                      additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
# File 'lib/mist_api/models/ssr_upgrade_multi.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['channel'] = 'channel'
  @_hash['device_ids'] = 'device_ids'
  @_hash['reboot_at'] = 'reboot_at'
  @_hash['start_time'] = 'start_time'
  @_hash['strategy'] = 'strategy'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/mist_api/models/ssr_upgrade_multi.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
56
57
58
59
60
61
# File 'lib/mist_api/models/ssr_upgrade_multi.rb', line 53

def self.optionals
  %w[
    channel
    reboot_at
    start_time
    strategy
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
128
# File 'lib/mist_api/models/ssr_upgrade_multi.rb', line 122

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} channel: #{@channel.inspect}, device_ids: #{@device_ids.inspect},"\
  " reboot_at: #{@reboot_at.inspect}, start_time: #{@start_time.inspect}, strategy:"\
  " #{@strategy.inspect}, version: #{@version.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



114
115
116
117
118
119
# File 'lib/mist_api/models/ssr_upgrade_multi.rb', line 114

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} channel: #{@channel}, device_ids: #{@device_ids}, reboot_at: #{@reboot_at},"\
  " start_time: #{@start_time}, strategy: #{@strategy}, version: #{@version},"\
  " additional_properties: #{@additional_properties}>"
end