Class: MistApi::UpgradeOrgDevicesVersion

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

Overview

UpgradeOrgDevicesVersion 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(firmware_type = SKIP, force = false, model_version = SKIP, version = SKIP) ⇒ UpgradeOrgDevicesVersion

Returns a new instance of UpgradeOrgDevicesVersion.



57
58
59
60
61
62
63
# File 'lib/mist_api/models/upgrade_org_devices_version.rb', line 57

def initialize(firmware_type = SKIP, force = false, model_version = SKIP,
               version = SKIP)
  @firmware_type = firmware_type unless firmware_type == SKIP
  @force = force unless force == SKIP
  @model_version = model_version unless model_version == SKIP
  @version = version unless version == SKIP
end

Instance Attribute Details

#firmware_typeUpgradeOrgDevicesVersionFirmwareTypeEnum

enum: ‘ap`, `junos`



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

def firmware_type
  @firmware_type
end

#forceTrueClass | FalseClass

If ‘firmware_type`==`ap`, set to `true` if upgrade is needed when target version <= running version

Returns:

  • (TrueClass | FalseClass)


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

def force
  @force
end

#model_versionHash[String, String]

If ‘firmware_type`==`junos`, used to select different versions for different models (Overrides `version` for the specified models). Property key is the hadware model (e.g. `EX4400-24MP`), Property value is the firmware version (e.g. `23.4R1.9`)

Returns:

  • (Hash[String, String])


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

def model_version
  @model_version
end

#versionString

version of the firmware to deploy

Returns:

  • (String)


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

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/mist_api/models/upgrade_org_devices_version.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  firmware_type = hash.key?('firmware_type') ? hash['firmware_type'] : SKIP
  force = hash['force'] ||= false
  model_version = hash.key?('model_version') ? hash['model_version'] : SKIP
  version = hash.key?('version') ? hash['version'] : SKIP

  # Create object from extracted values.
  UpgradeOrgDevicesVersion.new(firmware_type,
                               force,
                               model_version,
                               version)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
# File 'lib/mist_api/models/upgrade_org_devices_version.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['firmware_type'] = 'firmware_type'
  @_hash['force'] = 'force'
  @_hash['model_version'] = 'model_version'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



53
54
55
# File 'lib/mist_api/models/upgrade_org_devices_version.rb', line 53

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    firmware_type
    force
    model_version
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



90
91
92
93
94
# File 'lib/mist_api/models/upgrade_org_devices_version.rb', line 90

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

#to_sObject

Provides a human-readable string representation of the object.



83
84
85
86
87
# File 'lib/mist_api/models/upgrade_org_devices_version.rb', line 83

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