Class: MistApi::UpgradeSiteDevicesCounts

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

Overview

UpgradeSiteDevicesCounts 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, failed = SKIP, reboot_in_progress = SKIP, rebooted = SKIP, scheduled = SKIP, skipped = SKIP, total = SKIP, upgraded = SKIP) ⇒ UpgradeSiteDevicesCounts

Returns a new instance of UpgradeSiteDevicesCounts.



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/mist_api/models/upgrade_site_devices_counts.rb', line 84

def initialize(download_requested = SKIP, downloaded = 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
  @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_requestedInteger

Count of devices which cloud has requested to download firmware

Returns:

  • (Integer)


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

def download_requested
  @download_requested
end

#downloadedInteger

Count of ap’s which have the firmware downloaded

Returns:

  • (Integer)


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

def downloaded
  @downloaded
end

#failedInteger

Count of devices which have failed to upgrade

Returns:

  • (Integer)


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

def failed
  @failed
end

#reboot_in_progressInteger

Count of devices which are rebooting

Returns:

  • (Integer)


26
27
28
# File 'lib/mist_api/models/upgrade_site_devices_counts.rb', line 26

def reboot_in_progress
  @reboot_in_progress
end

#rebootedInteger

Count of devices which have rebooted successfully

Returns:

  • (Integer)


30
31
32
# File 'lib/mist_api/models/upgrade_site_devices_counts.rb', line 30

def rebooted
  @rebooted
end

#scheduledInteger

Count of devices which cloud has scheduled an upgrade for

Returns:

  • (Integer)


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

def scheduled
  @scheduled
end

#skippedInteger

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

Returns:

  • (Integer)


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

def skipped
  @skipped
end

#totalInteger

Count of devices part of this upgrade

Returns:

  • (Integer)


43
44
45
# File 'lib/mist_api/models/upgrade_site_devices_counts.rb', line 43

def total
  @total
end

#upgradedInteger

Count of devices which have upgraded successfully

Returns:

  • (Integer)


47
48
49
# File 'lib/mist_api/models/upgrade_site_devices_counts.rb', line 47

def upgraded
  @upgraded
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/mist_api/models/upgrade_site_devices_counts.rb', line 99

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
  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.
  UpgradeSiteDevicesCounts.new(download_requested,
                               downloaded,
                               failed,
                               reboot_in_progress,
                               rebooted,
                               scheduled,
                               skipped,
                               total,
                               upgraded)
end

.namesObject

A mapping from model property names to API property names.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/mist_api/models/upgrade_site_devices_counts.rb', line 50

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['download_requested'] = 'download_requested'
  @_hash['downloaded'] = 'downloaded'
  @_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



80
81
82
# File 'lib/mist_api/models/upgrade_site_devices_counts.rb', line 80

def self.nullables
  []
end

.optionalsObject

An array for optional fields



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/mist_api/models/upgrade_site_devices_counts.rb', line 65

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



136
137
138
139
140
141
142
143
# File 'lib/mist_api/models/upgrade_site_devices_counts.rb', line 136

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} download_requested: #{@download_requested.inspect}, downloaded:"\
  " #{@downloaded.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.



128
129
130
131
132
133
# File 'lib/mist_api/models/upgrade_site_devices_counts.rb', line 128

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