Class: MistApi::SnmpConfig

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

Overview

SnmpConfig 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(client_list = SKIP, contact = SKIP, description = SKIP, enabled = true, engine_id = SKIP, engine_id_type = SnmpConfigEngineIdTypeEnum::LOCAL, location = SKIP, name = SKIP, network = 'default', trap_groups = SKIP, v2c_config = SKIP, v3_config = SKIP, views = SKIP) ⇒ SnmpConfig

Returns a new instance of SnmpConfig.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/mist_api/models/snmp_config.rb', line 107

def initialize(client_list = SKIP, contact = SKIP, description = SKIP,
               enabled = true, engine_id = SKIP,
               engine_id_type = SnmpConfigEngineIdTypeEnum::LOCAL,
               location = SKIP, name = SKIP, network = 'default',
               trap_groups = SKIP, v2c_config = SKIP, v3_config = SKIP,
               views = SKIP)
  @client_list = client_list unless client_list == SKIP
  @contact = contact unless contact == SKIP
  @description = description unless description == SKIP
  @enabled = enabled unless enabled == SKIP
  @engine_id = engine_id unless engine_id == SKIP
  @engine_id_type = engine_id_type unless engine_id_type == SKIP
  @location = location unless location == SKIP
  @name = name unless name == SKIP
  @network = network unless network == SKIP
  @trap_groups = trap_groups unless trap_groups == SKIP
  @v2c_config = v2c_config unless v2c_config == SKIP
  @v3_config = v3_config unless v3_config == SKIP
  @views = views unless views == SKIP
end

Instance Attribute Details

#client_listArray[SnmpConfigClientList]

TODO: Write general description for this method

Returns:



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

def client_list
  @client_list
end

#contactString

TODO: Write general description for this method

Returns:

  • (String)


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

def contact
  @contact
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


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

def description
  @description
end

#enabledTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#engine_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def engine_id
  @engine_id
end

#engine_id_typeSnmpConfigEngineIdTypeEnum

enum: ‘local`, `use_mac_address`



34
35
36
# File 'lib/mist_api/models/snmp_config.rb', line 34

def engine_id_type
  @engine_id_type
end

#locationString

enum: ‘local`, `use_mac_address`

Returns:

  • (String)


38
39
40
# File 'lib/mist_api/models/snmp_config.rb', line 38

def location
  @location
end

#nameString

enum: ‘local`, `use_mac_address`

Returns:

  • (String)


42
43
44
# File 'lib/mist_api/models/snmp_config.rb', line 42

def name
  @name
end

#networkString

enum: ‘local`, `use_mac_address`

Returns:

  • (String)


46
47
48
# File 'lib/mist_api/models/snmp_config.rb', line 46

def network
  @network
end

#trap_groupsArray[SnmpConfigTrapGroup]

enum: ‘local`, `use_mac_address`

Returns:



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

def trap_groups
  @trap_groups
end

#v2c_configArray[SnmpConfigV2cConfig]

enum: ‘local`, `use_mac_address`

Returns:



54
55
56
# File 'lib/mist_api/models/snmp_config.rb', line 54

def v2c_config
  @v2c_config
end

#v3_configSnmpv3Config

enum: ‘local`, `use_mac_address`

Returns:



58
59
60
# File 'lib/mist_api/models/snmp_config.rb', line 58

def v3_config
  @v3_config
end

#viewsArray[SnmpConfigView]

enum: ‘local`, `use_mac_address`

Returns:



62
63
64
# File 'lib/mist_api/models/snmp_config.rb', line 62

def views
  @views
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/mist_api/models/snmp_config.rb', line 129

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  client_list = nil
  unless hash['client_list'].nil?
    client_list = []
    hash['client_list'].each do |structure|
      client_list << (SnmpConfigClientList.from_hash(structure) if structure)
    end
  end

  client_list = SKIP unless hash.key?('client_list')
  contact = hash.key?('contact') ? hash['contact'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  enabled = hash['enabled'] ||= true
  engine_id = hash.key?('engine_id') ? hash['engine_id'] : SKIP
  engine_id_type =
    hash['engine_id_type'] ||= SnmpConfigEngineIdTypeEnum::LOCAL
  location = hash.key?('location') ? hash['location'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  network = hash['network'] ||= 'default'
  # Parameter is an array, so we need to iterate through it
  trap_groups = nil
  unless hash['trap_groups'].nil?
    trap_groups = []
    hash['trap_groups'].each do |structure|
      trap_groups << (SnmpConfigTrapGroup.from_hash(structure) if structure)
    end
  end

  trap_groups = SKIP unless hash.key?('trap_groups')
  # Parameter is an array, so we need to iterate through it
  v2c_config = nil
  unless hash['v2c_config'].nil?
    v2c_config = []
    hash['v2c_config'].each do |structure|
      v2c_config << (SnmpConfigV2cConfig.from_hash(structure) if structure)
    end
  end

  v2c_config = SKIP unless hash.key?('v2c_config')
  v3_config = Snmpv3Config.from_hash(hash['v3_config']) if hash['v3_config']
  # Parameter is an array, so we need to iterate through it
  views = nil
  unless hash['views'].nil?
    views = []
    hash['views'].each do |structure|
      views << (SnmpConfigView.from_hash(structure) if structure)
    end
  end

  views = SKIP unless hash.key?('views')

  # Create object from extracted values.
  SnmpConfig.new(client_list,
                 contact,
                 description,
                 enabled,
                 engine_id,
                 engine_id_type,
                 location,
                 name,
                 network,
                 trap_groups,
                 v2c_config,
                 v3_config,
                 views)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_list'] = 'client_list'
  @_hash['contact'] = 'contact'
  @_hash['description'] = 'description'
  @_hash['enabled'] = 'enabled'
  @_hash['engine_id'] = 'engine_id'
  @_hash['engine_id_type'] = 'engine_id_type'
  @_hash['location'] = 'location'
  @_hash['name'] = 'name'
  @_hash['network'] = 'network'
  @_hash['trap_groups'] = 'trap_groups'
  @_hash['v2c_config'] = 'v2c_config'
  @_hash['v3_config'] = 'v3_config'
  @_hash['views'] = 'views'
  @_hash
end

.nullablesObject

An array for nullable fields



103
104
105
# File 'lib/mist_api/models/snmp_config.rb', line 103

def self.nullables
  []
end

.optionalsObject

An array for optional fields



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/mist_api/models/snmp_config.rb', line 84

def self.optionals
  %w[
    client_list
    contact
    description
    enabled
    engine_id
    engine_id_type
    location
    name
    network
    trap_groups
    v2c_config
    v3_config
    views
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



211
212
213
214
215
216
217
218
219
# File 'lib/mist_api/models/snmp_config.rb', line 211

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} client_list: #{@client_list.inspect}, contact: #{@contact.inspect},"\
  " description: #{@description.inspect}, enabled: #{@enabled.inspect}, engine_id:"\
  " #{@engine_id.inspect}, engine_id_type: #{@engine_id_type.inspect}, location:"\
  " #{@location.inspect}, name: #{@name.inspect}, network: #{@network.inspect}, trap_groups:"\
  " #{@trap_groups.inspect}, v2c_config: #{@v2c_config.inspect}, v3_config:"\
  " #{@v3_config.inspect}, views: #{@views.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



201
202
203
204
205
206
207
208
# File 'lib/mist_api/models/snmp_config.rb', line 201

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} client_list: #{@client_list}, contact: #{@contact}, description:"\
  " #{@description}, enabled: #{@enabled}, engine_id: #{@engine_id}, engine_id_type:"\
  " #{@engine_id_type}, location: #{@location}, name: #{@name}, network: #{@network},"\
  " trap_groups: #{@trap_groups}, v2c_config: #{@v2c_config}, v3_config: #{@v3_config}, views:"\
  " #{@views}>"
end