Class: MistApi::UpgradeDevicesTargets

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

Overview

UpgradeDevicesTargets 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(download_requested = SKIP, downloaded = SKIP, downloading = SKIP, failed = SKIP, reboot_in_progress = SKIP, rebooted = SKIP, scheduled = SKIP, skipped = SKIP, total = SKIP, upgraded = SKIP) ⇒ UpgradeDevicesTargets

Returns a new instance of UpgradeDevicesTargets.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 91

def initialize(download_requested = SKIP, downloaded = SKIP,
               downloading = SKIP, failed = SKIP, reboot_in_progress = SKIP,
               rebooted = SKIP, scheduled = SKIP, skipped = SKIP,
               total = SKIP, upgraded = SKIP)
  @download_requested = download_requested unless download_requested == SKIP
  @downloaded = downloaded unless downloaded == SKIP
  @downloading = downloading unless downloading == SKIP
  @failed = failed unless failed == SKIP
  @reboot_in_progress = reboot_in_progress unless reboot_in_progress == SKIP
  @rebooted = rebooted unless rebooted == SKIP
  @scheduled = scheduled unless scheduled == SKIP
  @skipped = skipped unless skipped == SKIP
  @total = total unless total == SKIP
  @upgraded = upgraded unless upgraded == SKIP
end

Instance Attribute Details

#download_requestedArray[String]

List of devices MAC Addresses which cloud has requested to download firmware

Returns:

  • (Array[String])


15
16
17
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 15

def download_requested
  @download_requested
end

#downloadedArray[String]

List of devices MAC Addresses which have the firmware downloaded

Returns:

  • (Array[String])


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

def downloaded
  @downloaded
end

#downloadingArray[String]

List of devices MAC Addresses which are currently downloading the firmware

Returns:

  • (Array[String])


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

def downloading
  @downloading
end

#failedArray[String]

List of devices MAC Addresses which have failed to upgrade

Returns:

  • (Array[String])


27
28
29
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 27

def failed
  @failed
end

#reboot_in_progressArray[String]

List of devices MAC Addresses which are rebooting

Returns:

  • (Array[String])


31
32
33
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 31

def reboot_in_progress
  @reboot_in_progress
end

#rebootedArray[String]

List of devices MAC Addresses which have rebooted successfully

Returns:

  • (Array[String])


35
36
37
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 35

def rebooted
  @rebooted
end

#scheduledArray[String]

List of devices MAC Addresses which cloud has scheduled an upgrade for

Returns:

  • (Array[String])


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

def scheduled
  @scheduled
end

#skippedArray[String]

List of devices MAC Addresses which skipped upgrade since requested version was same as running version. Use force to always upgrade

Returns:

  • (Array[String])


44
45
46
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 44

def skipped
  @skipped
end

#totalInteger

Count of devices part of this upgrade

Returns:

  • (Integer)


48
49
50
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 48

def total
  @total
end

#upgradedArray[String]

Count of devices which have upgraded successfully

Returns:

  • (Array[String])


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

def upgraded
  @upgraded
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



108
109
110
111
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
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 108

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  download_requested =
    hash.key?('download_requested') ? hash['download_requested'] : SKIP
  downloaded = hash.key?('downloaded') ? hash['downloaded'] : SKIP
  downloading = hash.key?('downloading') ? hash['downloading'] : SKIP
  failed = hash.key?('failed') ? hash['failed'] : SKIP
  reboot_in_progress =
    hash.key?('reboot_in_progress') ? hash['reboot_in_progress'] : SKIP
  rebooted = hash.key?('rebooted') ? hash['rebooted'] : SKIP
  scheduled = hash.key?('scheduled') ? hash['scheduled'] : SKIP
  skipped = hash.key?('skipped') ? hash['skipped'] : SKIP
  total = hash.key?('total') ? hash['total'] : SKIP
  upgraded = hash.key?('upgraded') ? hash['upgraded'] : SKIP

  # Create object from extracted values.
  UpgradeDevicesTargets.new(download_requested,
                            downloaded,
                            downloading,
                            failed,
                            reboot_in_progress,
                            rebooted,
                            scheduled,
                            skipped,
                            total,
                            upgraded)
end

.namesObject

A mapping from model property names to API property names.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 55

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['download_requested'] = 'download_requested'
  @_hash['downloaded'] = 'downloaded'
  @_hash['downloading'] = 'downloading'
  @_hash['failed'] = 'failed'
  @_hash['reboot_in_progress'] = 'reboot_in_progress'
  @_hash['rebooted'] = 'rebooted'
  @_hash['scheduled'] = 'scheduled'
  @_hash['skipped'] = 'skipped'
  @_hash['total'] = 'total'
  @_hash['upgraded'] = 'upgraded'
  @_hash
end

.nullablesObject

An array for nullable fields



87
88
89
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 87

def self.nullables
  []
end

.optionalsObject

An array for optional fields



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 71

def self.optionals
  %w[
    download_requested
    downloaded
    downloading
    failed
    reboot_in_progress
    rebooted
    scheduled
    skipped
    total
    upgraded
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



148
149
150
151
152
153
154
155
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 148

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} download_requested: #{@download_requested.inspect}, downloaded:"\
  " #{@downloaded.inspect}, downloading: #{@downloading.inspect}, failed: #{@failed.inspect},"\
  " reboot_in_progress: #{@reboot_in_progress.inspect}, rebooted: #{@rebooted.inspect},"\
  " scheduled: #{@scheduled.inspect}, skipped: #{@skipped.inspect}, total: #{@total.inspect},"\
  " upgraded: #{@upgraded.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



139
140
141
142
143
144
145
# File 'lib/mist_api/models/upgrade_devices_targets.rb', line 139

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} download_requested: #{@download_requested}, downloaded: #{@downloaded},"\
  " downloading: #{@downloading}, failed: #{@failed}, reboot_in_progress:"\
  " #{@reboot_in_progress}, rebooted: #{@rebooted}, scheduled: #{@scheduled}, skipped:"\
  " #{@skipped}, total: #{@total}, upgraded: #{@upgraded}>"
end