Class: MistApi::Tacacs

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

Overview

Tacacs 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(acct_servers = SKIP, default_role = TacacsDefaultRoleEnum::NONE, enabled = SKIP, network = SKIP, tacplus_servers = SKIP) ⇒ Tacacs

Returns a new instance of Tacacs.



59
60
61
62
63
64
65
66
67
# File 'lib/mist_api/models/tacacs.rb', line 59

def initialize(acct_servers = SKIP,
               default_role = TacacsDefaultRoleEnum::NONE, enabled = SKIP,
               network = SKIP, tacplus_servers = SKIP)
  @acct_servers = acct_servers unless acct_servers == SKIP
  @default_role = default_role unless default_role == SKIP
  @enabled = enabled unless enabled == SKIP
  @network = network unless network == SKIP
  @tacplus_servers = tacplus_servers unless tacplus_servers == SKIP
end

Instance Attribute Details

#acct_serversArray[TacacsAcctServer]

TODO: Write general description for this method

Returns:



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

def acct_servers
  @acct_servers
end

#default_roleTacacsDefaultRoleEnum

enum: ‘admin`, `helpdesk`, `none`, `read`



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

def default_role
  @default_role
end

#enabledTrueClass | FalseClass

enum: ‘admin`, `helpdesk`, `none`, `read`

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#networkString

Which network the TACACS server resides

Returns:

  • (String)


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

def network
  @network
end

#tacplus_serversArray[TacacsAuthServer]

Which network the TACACS server resides

Returns:



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

def tacplus_servers
  @tacplus_servers
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/mist_api/models/tacacs.rb', line 70

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
  acct_servers = nil
  unless hash['acct_servers'].nil?
    acct_servers = []
    hash['acct_servers'].each do |structure|
      acct_servers << (TacacsAcctServer.from_hash(structure) if structure)
    end
  end

  acct_servers = SKIP unless hash.key?('acct_servers')
  default_role = hash['default_role'] ||= TacacsDefaultRoleEnum::NONE
  enabled = hash.key?('enabled') ? hash['enabled'] : SKIP
  network = hash.key?('network') ? hash['network'] : SKIP
  # Parameter is an array, so we need to iterate through it
  tacplus_servers = nil
  unless hash['tacplus_servers'].nil?
    tacplus_servers = []
    hash['tacplus_servers'].each do |structure|
      tacplus_servers << (TacacsAuthServer.from_hash(structure) if structure)
    end
  end

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

  # Create object from extracted values.
  Tacacs.new(acct_servers,
             default_role,
             enabled,
             network,
             tacplus_servers)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['acct_servers'] = 'acct_servers'
  @_hash['default_role'] = 'default_role'
  @_hash['enabled'] = 'enabled'
  @_hash['network'] = 'network'
  @_hash['tacplus_servers'] = 'tacplus_servers'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/mist_api/models/tacacs.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    acct_servers
    default_role
    enabled
    network
    tacplus_servers
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (Tacacs | Hash)

    value against the validation is performed.



108
109
110
111
112
113
114
# File 'lib/mist_api/models/tacacs.rb', line 108

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} acct_servers: #{@acct_servers.inspect}, default_role:"\
  " #{@default_role.inspect}, enabled: #{@enabled.inspect}, network: #{@network.inspect},"\
  " tacplus_servers: #{@tacplus_servers.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



117
118
119
120
121
# File 'lib/mist_api/models/tacacs.rb', line 117

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} acct_servers: #{@acct_servers}, default_role: #{@default_role}, enabled:"\
  " #{@enabled}, network: #{@network}, tacplus_servers: #{@tacplus_servers}>"
end