Class: MistApi::SettingSsrAutoUpgrade

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

Overview

auto_upgrade device first time it is onboarded

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(channel = SsrUpgradeChannelEnum::STABLE, custom_versions = SKIP, enabled = false, version = SKIP) ⇒ SettingSsrAutoUpgrade

Returns a new instance of SettingSsrAutoUpgrade.



54
55
56
57
58
59
60
# File 'lib/mist_api/models/setting_ssr_auto_upgrade.rb', line 54

def initialize(channel = SsrUpgradeChannelEnum::STABLE,
               custom_versions = SKIP, enabled = false, version = SKIP)
  @channel = channel unless channel == SKIP
  @custom_versions = custom_versions unless custom_versions == SKIP
  @enabled = enabled unless enabled == SKIP
  @version = version unless version == SKIP
end

Instance Attribute Details

#channelSsrUpgradeChannelEnum

upgrade channel to follow. enum: ‘alpha`, `beta`, `stable`



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

def channel
  @channel
end

#custom_versionsHash[String, String]

Property key is the SSR model (e.g. “SSR130”).

Returns:

  • (Hash[String, String])


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

def custom_versions
  @custom_versions
end

#enabledTrueClass | FalseClass

Property key is the SSR model (e.g. “SSR130”).

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#versionString

Firmware version to deploy (e.g. 6.3.0-107.r1). Optional, used when custom_versions not specified

Returns:

  • (String)


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

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  channel = hash['channel'] ||= SsrUpgradeChannelEnum::STABLE
  custom_versions =
    hash.key?('custom_versions') ? hash['custom_versions'] : SKIP
  enabled = hash['enabled'] ||= false
  version = hash.key?('version') ? hash['version'] : SKIP

  # Create object from extracted values.
  SettingSsrAutoUpgrade.new(channel,
                            custom_versions,
                            enabled,
                            version)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    channel
    custom_versions
    enabled
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



88
89
90
91
92
# File 'lib/mist_api/models/setting_ssr_auto_upgrade.rb', line 88

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

#to_sObject

Provides a human-readable string representation of the object.



81
82
83
84
85
# File 'lib/mist_api/models/setting_ssr_auto_upgrade.rb', line 81

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