Class: MistApi::SwitchAutoUpgrade
- Defined in:
- lib/mist_api/models/switch_auto_upgrade.rb
Overview
SwitchAutoUpgrade Model.
Instance Attribute Summary collapse
-
#custom_versions ⇒ Hash[String, String]
Custom version to be used.
-
#enabled ⇒ TrueClass | FalseClass
Enable auto upgrade for the switch.
-
#snapshot ⇒ TrueClass | FalseClass
Enable snapshot during the upgrade process.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(custom_versions = SKIP, enabled = SKIP, snapshot = false) ⇒ SwitchAutoUpgrade
constructor
A new instance of SwitchAutoUpgrade.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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_versions ⇒ Hash[String, String]
Custom version to be used. The Property Key is the switch hardware and the property value is the firmware version
15 16 17 |
# File 'lib/mist_api/models/switch_auto_upgrade.rb', line 15 def custom_versions @custom_versions end |
#enabled ⇒ TrueClass | FalseClass
Enable auto upgrade for the switch
19 20 21 |
# File 'lib/mist_api/models/switch_auto_upgrade.rb', line 19 def enabled @enabled end |
#snapshot ⇒ TrueClass | FalseClass
Enable snapshot during the upgrade process
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
44 45 46 |
# File 'lib/mist_api/models/switch_auto_upgrade.rb', line 44 def self.nullables [] end |
.optionals ⇒ Object
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
#inspect ⇒ Object
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_s ⇒ Object
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 |