Class: MistApi::SiteSettingAutoUpgradeEsl

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

Overview

auto upgrade AP ESL. When both firmware and ESL auto-upgrade are enabled, ESL upgrade will be done only after firmware upgrade

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(allow_downgrade = false, custom_versions = SKIP, day_of_week = SKIP, enabled = false, time_of_day = SKIP, version = SKIP) ⇒ SiteSettingAutoUpgradeEsl

Returns a new instance of SiteSettingAutoUpgradeEsl.



70
71
72
73
74
75
76
77
78
79
# File 'lib/mist_api/models/site_setting_auto_upgrade_esl.rb', line 70

def initialize(allow_downgrade = false, custom_versions = SKIP,
               day_of_week = SKIP, enabled = false, time_of_day = SKIP,
               version = SKIP)
  @allow_downgrade = allow_downgrade unless allow_downgrade == SKIP
  @custom_versions = custom_versions unless custom_versions == SKIP
  @day_of_week = day_of_week unless day_of_week == SKIP
  @enabled = enabled unless enabled == SKIP
  @time_of_day = time_of_day unless time_of_day == SKIP
  @version = version unless version == SKIP
end

Instance Attribute Details

#allow_downgradeTrueClass | FalseClass

If true, it will allow downgrade to a lower version

Returns:

  • (TrueClass | FalseClass)


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

def allow_downgrade
  @allow_downgrade
end

#custom_versionsHash[String, String]

Custom versions for different models. Property key is the model name (e.g. “AP41”)

Returns:

  • (Hash[String, String])


20
21
22
# File 'lib/mist_api/models/site_setting_auto_upgrade_esl.rb', line 20

def custom_versions
  @custom_versions
end

#day_of_weekDayOfWeekEnum

enum: ‘any`, `fri`, `mon`, `sat`, `sun`, `thu`, `tue`, `wed`

Returns:



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

def day_of_week
  @day_of_week
end

#enabledTrueClass | FalseClass

Whether auto upgrade should happen (Note that Mist may auto-upgrade if the version is not supported)

Returns:

  • (TrueClass | FalseClass)


29
30
31
# File 'lib/mist_api/models/site_setting_auto_upgrade_esl.rb', line 29

def enabled
  @enabled
end

#time_of_dayString

‘any` / HH:MM (24-hour format), upgrade will happen within up to 1-hour from this time

Returns:

  • (String)


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

def time_of_day
  @time_of_day
end

#versionString

‘any` / HH:MM (24-hour format), upgrade will happen within up to 1-hour from this time

Returns:

  • (String)


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

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/mist_api/models/site_setting_auto_upgrade_esl.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  allow_downgrade = hash['allow_downgrade'] ||= false
  custom_versions =
    hash.key?('custom_versions') ? hash['custom_versions'] : SKIP
  day_of_week = hash.key?('day_of_week') ? hash['day_of_week'] : SKIP
  enabled = hash['enabled'] ||= false
  time_of_day = hash.key?('time_of_day') ? hash['time_of_day'] : SKIP
  version = hash.key?('version') ? hash['version'] : SKIP

  # Create object from extracted values.
  SiteSettingAutoUpgradeEsl.new(allow_downgrade,
                                custom_versions,
                                day_of_week,
                                enabled,
                                time_of_day,
                                version)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['allow_downgrade'] = 'allow_downgrade'
  @_hash['custom_versions'] = 'custom_versions'
  @_hash['day_of_week'] = 'day_of_week'
  @_hash['enabled'] = 'enabled'
  @_hash['time_of_day'] = 'time_of_day'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/mist_api/models/site_setting_auto_upgrade_esl.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    allow_downgrade
    custom_versions
    day_of_week
    enabled
    time_of_day
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



112
113
114
115
116
117
# File 'lib/mist_api/models/site_setting_auto_upgrade_esl.rb', line 112

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} allow_downgrade: #{@allow_downgrade.inspect}, custom_versions:"\
  " #{@custom_versions.inspect}, day_of_week: #{@day_of_week.inspect}, enabled:"\
  " #{@enabled.inspect}, time_of_day: #{@time_of_day.inspect}, version: #{@version.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



104
105
106
107
108
109
# File 'lib/mist_api/models/site_setting_auto_upgrade_esl.rb', line 104

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} allow_downgrade: #{@allow_downgrade}, custom_versions: #{@custom_versions},"\
  " day_of_week: #{@day_of_week}, enabled: #{@enabled}, time_of_day: #{@time_of_day}, version:"\
  " #{@version}>"
end