Class: MistApi::SsrUpgrade

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

Overview

SsrUpgrade 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(version = 'stable', channel = SsrUpgradeChannelEnum::STABLE, reboot_at = SKIP, start_time = SKIP, additional_properties = nil) ⇒ SsrUpgrade

Returns a new instance of SsrUpgrade.



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/mist_api/models/ssr_upgrade.rb', line 54

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

  @channel = channel unless channel == SKIP
  @reboot_at = reboot_at unless reboot_at == SKIP
  @start_time = start_time unless start_time == SKIP
  @version = version
  @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.rb', line 14

def channel
  @channel
end

#reboot_atInteger

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

Returns:

  • (Integer)


19
20
21
# File 'lib/mist_api/models/ssr_upgrade.rb', line 19

def reboot_at
  @reboot_at
end

#start_timeInteger

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

Returns:

  • (Integer)


24
25
26
# File 'lib/mist_api/models/ssr_upgrade.rb', line 24

def start_time
  @start_time
end

#versionString

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

Returns:

  • (String)


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

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/mist_api/models/ssr_upgrade.rb', line 68

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  version = hash['version'] ||= 'stable'
  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

  # 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.
  SsrUpgrade.new(version,
                 channel,
                 reboot_at,
                 start_time,
                 additional_properties)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
38
# File 'lib/mist_api/models/ssr_upgrade.rb', line 31

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

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/mist_api/models/ssr_upgrade.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
44
45
46
47
# File 'lib/mist_api/models/ssr_upgrade.rb', line 41

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



100
101
102
103
104
105
# File 'lib/mist_api/models/ssr_upgrade.rb', line 100

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

#to_sObject

Provides a human-readable string representation of the object.



93
94
95
96
97
# File 'lib/mist_api/models/ssr_upgrade.rb', line 93

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