Class: MistApi::HaClusterConfig

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

Overview

HaClusterConfig 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(disable_auto_config = SKIP, managed = SKIP, mist_configured = SKIP, nodes = SKIP, site_id = SKIP, additional_properties = nil) ⇒ HaClusterConfig

Returns a new instance of HaClusterConfig.



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

def initialize(disable_auto_config = SKIP, managed = SKIP,
               mist_configured = SKIP, nodes = SKIP, site_id = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @disable_auto_config = disable_auto_config unless disable_auto_config == SKIP
  @managed = managed unless managed == SKIP
  @mist_configured = mist_configured unless mist_configured == SKIP
  @nodes = nodes unless nodes == SKIP
  @site_id = site_id unless site_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#disable_auto_configTrueClass | FalseClass

This disables the default behavior of a cloud-ready switch/gateway being managed/configured by Mist. Setting this to ‘true` means you want to disable the default behavior and do not want the device to be Mist-managed.

Returns:

  • (TrueClass | FalseClass)


17
18
19
# File 'lib/mist_api/models/ha_cluster_config.rb', line 17

def disable_auto_config
  @disable_auto_config
end

#managedTrueClass | FalseClass

An adopted switch/gateway will not be managed/configured by Mist by default. Setting this parameter to ‘true` enables the adopted switch/gateway to be managed/configured by Mist.

Returns:

  • (TrueClass | FalseClass)


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

def managed
  @managed
end

#mist_configuredTrueClass | FalseClass

whether the device can be configured by Mist or not. This deprecates ‘managed` (for adopted device) and `disable_auto_config` for claimed device)

Returns:

  • (TrueClass | FalseClass)


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

def mist_configured
  @mist_configured
end

#nodesArray[HaClusterConfigNode]

whether the device can be configured by Mist or not. This deprecates ‘managed` (for adopted device) and `disable_auto_config` for claimed device)

Returns:



35
36
37
# File 'lib/mist_api/models/ha_cluster_config.rb', line 35

def nodes
  @nodes
end

#site_idUUID | String

whether the device can be configured by Mist or not. This deprecates ‘managed` (for adopted device) and `disable_auto_config` for claimed device)

Returns:

  • (UUID | String)


41
42
43
# File 'lib/mist_api/models/ha_cluster_config.rb', line 41

def site_id
  @site_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/mist_api/models/ha_cluster_config.rb', line 85

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  disable_auto_config =
    hash.key?('disable_auto_config') ? hash['disable_auto_config'] : SKIP
  managed = hash.key?('managed') ? hash['managed'] : SKIP
  mist_configured =
    hash.key?('mist_configured') ? hash['mist_configured'] : SKIP
  # Parameter is an array, so we need to iterate through it
  nodes = nil
  unless hash['nodes'].nil?
    nodes = []
    hash['nodes'].each do |structure|
      nodes << (HaClusterConfigNode.from_hash(structure) if structure)
    end
  end

  nodes = SKIP unless hash.key?('nodes')
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  HaClusterConfig.new(disable_auto_config,
                      managed,
                      mist_configured,
                      nodes,
                      site_id,
                      additional_properties)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
# File 'lib/mist_api/models/ha_cluster_config.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['disable_auto_config'] = 'disable_auto_config'
  @_hash['managed'] = 'managed'
  @_hash['mist_configured'] = 'mist_configured'
  @_hash['nodes'] = 'nodes'
  @_hash['site_id'] = 'site_id'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    disable_auto_config
    managed
    mist_configured
    nodes
    site_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



131
132
133
134
135
136
137
# File 'lib/mist_api/models/ha_cluster_config.rb', line 131

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} disable_auto_config: #{@disable_auto_config.inspect}, managed:"\
  " #{@managed.inspect}, mist_configured: #{@mist_configured.inspect}, nodes:"\
  " #{@nodes.inspect}, site_id: #{@site_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



123
124
125
126
127
128
# File 'lib/mist_api/models/ha_cluster_config.rb', line 123

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} disable_auto_config: #{@disable_auto_config}, managed: #{@managed},"\
  " mist_configured: #{@mist_configured}, nodes: #{@nodes}, site_id: #{@site_id},"\
  " additional_properties: #{@additional_properties}>"
end