Class: MistApi::SnmpUsm

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

Overview

SnmpUsm 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(engine_type = SKIP, remote_engine_id = SKIP, users = SKIP) ⇒ SnmpUsm

Returns a new instance of SnmpUsm.



47
48
49
50
51
# File 'lib/mist_api/models/snmp_usm.rb', line 47

def initialize(engine_type = SKIP, remote_engine_id = SKIP, users = SKIP)
  @engine_type = engine_type unless engine_type == SKIP
  @remote_engine_id = remote_engine_id unless remote_engine_id == SKIP
  @users = users unless users == SKIP
end

Instance Attribute Details

#engine_typeSnmpUsmEngineTypeEnum

enum: ‘local_engine`, `remote_engine`



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

def engine_type
  @engine_type
end

#remote_engine_idString

Required only if ‘engine_type`==`remote_engine`

Returns:

  • (String)


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

def remote_engine_id
  @remote_engine_id
end

#usersArray[SnmpUsmUser]

Required only if ‘engine_type`==`remote_engine`

Returns:



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

def users
  @users
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/mist_api/models/snmp_usm.rb', line 54

def self.from_hash(hash)
  return nil unless hash

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

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

  # Create object from extracted values.
  SnmpUsm.new(engine_type,
              remote_engine_id,
              users)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['engine_type'] = 'engine_type'
  @_hash['remote_engine_id'] = 'remote_engine_id'
  @_hash['users'] = 'users'
  @_hash
end

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/mist_api/models/snmp_usm.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    engine_type
    remote_engine_id
    users
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



86
87
88
89
90
# File 'lib/mist_api/models/snmp_usm.rb', line 86

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

#to_sObject

Provides a human-readable string representation of the object.



79
80
81
82
83
# File 'lib/mist_api/models/snmp_usm.rb', line 79

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