Class: MistApi::SwitchAutoUpgrade

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

Overview

SwitchAutoUpgrade 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(custom_versions = SKIP, enabled = SKIP, snapshot = false) ⇒ SwitchAutoUpgrade

Returns a new instance of SwitchAutoUpgrade.



48
49
50
51
52
# File 'lib/mist_api/models/switch_auto_upgrade.rb', line 48

def initialize(custom_versions = SKIP, enabled = SKIP, snapshot = false)
  @custom_versions = custom_versions unless custom_versions == SKIP
  @enabled = enabled unless enabled == SKIP
  @snapshot = snapshot unless snapshot == SKIP
end

Instance Attribute Details

#custom_versionsHash[String, String]

Custom version to be used. The Property Key is the switch hardware and the property value is the firmware version

Returns:

  • (Hash[String, String])


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

def custom_versions
  @custom_versions
end

#enabledTrueClass | FalseClass

Enable auto upgrade for the switch

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#snapshotTrueClass | FalseClass

Enable snapshot during the upgrade process

Returns:

  • (TrueClass | FalseClass)


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

def snapshot
  @snapshot
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

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

  # Create object from extracted values.
  SwitchAutoUpgrade.new(custom_versions,
                        enabled,
                        snapshot)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/mist_api/models/switch_auto_upgrade.rb', line 26

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
38
39
40
41
# File 'lib/mist_api/models/switch_auto_upgrade.rb', line 35

def self.optionals
  %w[
    custom_versions
    enabled
    snapshot
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



78
79
80
81
82
# File 'lib/mist_api/models/switch_auto_upgrade.rb', line 78

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

#to_sObject

Provides a human-readable string representation of the object.



71
72
73
74
75
# File 'lib/mist_api/models/switch_auto_upgrade.rb', line 71

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