Class: MistApi::DeviceUpgrade
- Defined in:
- lib/mist_api/models/device_upgrade.rb
Overview
DeviceUpgrade Model.
Instance Attribute Summary collapse
-
#reboot ⇒ TrueClass | FalseClass
For Switches and Gateways only (APs are automatically rebooted).
-
#reboot_at ⇒ Integer
For Switches and Gateways only and if ‘reboot`==`true`.
-
#snapshot ⇒ TrueClass | FalseClass
For Junos devices only.
-
#start_time ⇒ Integer
Firmware download start time in epoch.
-
#version ⇒ String
Specific version / ‘stable`, default is to use the latest.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(version = 'stable', reboot = false, reboot_at = SKIP, snapshot = false, start_time = SKIP, additional_properties = nil) ⇒ DeviceUpgrade
constructor
A new instance of DeviceUpgrade.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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', reboot = false, reboot_at = SKIP, snapshot = false, start_time = SKIP, additional_properties = nil) ⇒ DeviceUpgrade
Returns a new instance of DeviceUpgrade.
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/mist_api/models/device_upgrade.rb', line 60 def initialize(version = 'stable', reboot = false, reboot_at = SKIP, snapshot = false, start_time = SKIP, additional_properties = nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @reboot = reboot unless reboot == SKIP @reboot_at = reboot_at unless reboot_at == SKIP @snapshot = snapshot unless snapshot == SKIP @start_time = start_time unless start_time == SKIP @version = version @additional_properties = additional_properties end |
Instance Attribute Details
#reboot ⇒ TrueClass | FalseClass
For Switches and Gateways only (APs are automatically rebooted). Reboot device immediately after upgrade is completed
15 16 17 |
# File 'lib/mist_api/models/device_upgrade.rb', line 15 def reboot @reboot end |
#reboot_at ⇒ Integer
For Switches and Gateways only and if ‘reboot`==`true`. Reboot start time in epoch seconds, default is `start_time`
20 21 22 |
# File 'lib/mist_api/models/device_upgrade.rb', line 20 def reboot_at @reboot_at end |
#snapshot ⇒ TrueClass | FalseClass
For Junos devices only. Perform recovery snapshot after device is rebooted
24 25 26 |
# File 'lib/mist_api/models/device_upgrade.rb', line 24 def snapshot @snapshot end |
#start_time ⇒ Integer
Firmware download start time in epoch
28 29 30 |
# File 'lib/mist_api/models/device_upgrade.rb', line 28 def start_time @start_time end |
#version ⇒ String
Specific version / ‘stable`, default is to use the latest
32 33 34 |
# File 'lib/mist_api/models/device_upgrade.rb', line 32 def version @version end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/mist_api/models/device_upgrade.rb', line 75 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. version = hash['version'] ||= 'stable' reboot = hash['reboot'] ||= false reboot_at = hash.key?('reboot_at') ? hash['reboot_at'] : SKIP snapshot = hash['snapshot'] ||= false 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. DeviceUpgrade.new(version, reboot, reboot_at, snapshot, start_time, additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 43 |
# File 'lib/mist_api/models/device_upgrade.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['reboot'] = 'reboot' @_hash['reboot_at'] = 'reboot_at' @_hash['snapshot'] = 'snapshot' @_hash['start_time'] = 'start_time' @_hash['version'] = 'version' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/mist_api/models/device_upgrade.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 51 52 53 |
# File 'lib/mist_api/models/device_upgrade.rb', line 46 def self.optionals %w[ reboot reboot_at snapshot start_time ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
110 111 112 113 114 115 |
# File 'lib/mist_api/models/device_upgrade.rb', line 110 def inspect class_name = self.class.name.split('::').last "<#{class_name} reboot: #{@reboot.inspect}, reboot_at: #{@reboot_at.inspect}, snapshot:"\ " #{@snapshot.inspect}, start_time: #{@start_time.inspect}, version: #{@version.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
102 103 104 105 106 107 |
# File 'lib/mist_api/models/device_upgrade.rb', line 102 def to_s class_name = self.class.name.split('::').last "<#{class_name} reboot: #{@reboot}, reboot_at: #{@reboot_at}, snapshot: #{@snapshot},"\ " start_time: #{@start_time}, version: #{@version}, additional_properties:"\ " #{@additional_properties}>" end |