Class: MistApi::RemoteSyslog

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

Overview

RemoteSyslog 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(archive = SKIP, cacerts = SKIP, console = SKIP, enabled = false, files = SKIP, network = SKIP, send_to_all_servers = false, servers = SKIP, time_format = SKIP, users = SKIP) ⇒ RemoteSyslog

Returns a new instance of RemoteSyslog.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/mist_api/models/remote_syslog.rb', line 92

def initialize(archive = SKIP, cacerts = SKIP, console = SKIP,
               enabled = false, files = SKIP, network = SKIP,
               send_to_all_servers = false, servers = SKIP,
               time_format = SKIP, users = SKIP)
  @archive = archive unless archive == SKIP
  @cacerts = cacerts unless cacerts == SKIP
  @console = console unless console == SKIP
  @enabled = enabled unless enabled == SKIP
  @files = files unless files == SKIP
  @network = network unless network == SKIP
  @send_to_all_servers = send_to_all_servers unless send_to_all_servers == SKIP
  @servers = servers unless servers == SKIP
  @time_format = time_format unless time_format == SKIP
  @users = users unless users == SKIP
end

Instance Attribute Details

#archiveRemoteSyslogArchive

TODO: Write general description for this method

Returns:



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

def archive
  @archive
end

#cacertsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def cacerts
  @cacerts
end

#consoleRemoteSyslogConsole

TODO: Write general description for this method

Returns:



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

def console
  @console
end

#enabledTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#filesArray[RemoteSyslogFileConfig]

TODO: Write general description for this method

Returns:



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

def files
  @files
end

#networkString

If source_address is configured, will use the vlan firstly otherwise use source_ip

Returns:

  • (String)


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

def network
  @network
end

#send_to_all_serversTrueClass | FalseClass

If source_address is configured, will use the vlan firstly otherwise use source_ip

Returns:

  • (TrueClass | FalseClass)


40
41
42
# File 'lib/mist_api/models/remote_syslog.rb', line 40

def send_to_all_servers
  @send_to_all_servers
end

#serversArray[RemoteSyslogServer]

If source_address is configured, will use the vlan firstly otherwise use source_ip

Returns:



45
46
47
# File 'lib/mist_api/models/remote_syslog.rb', line 45

def servers
  @servers
end

#time_formatRemoteSyslogTimeFormatEnum

enum: ‘millisecond`, `year`, `year millisecond`



49
50
51
# File 'lib/mist_api/models/remote_syslog.rb', line 49

def time_format
  @time_format
end

#usersArray[RemoteSyslogUser]

enum: ‘millisecond`, `year`, `year millisecond`

Returns:



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

def users
  @users
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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
# File 'lib/mist_api/models/remote_syslog.rb', line 109

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  archive = RemoteSyslogArchive.from_hash(hash['archive']) if hash['archive']
  cacerts = hash.key?('cacerts') ? hash['cacerts'] : SKIP
  console = RemoteSyslogConsole.from_hash(hash['console']) if hash['console']
  enabled = hash['enabled'] ||= false
  # Parameter is an array, so we need to iterate through it
  files = nil
  unless hash['files'].nil?
    files = []
    hash['files'].each do |structure|
      files << (RemoteSyslogFileConfig.from_hash(structure) if structure)
    end
  end

  files = SKIP unless hash.key?('files')
  network = hash.key?('network') ? hash['network'] : SKIP
  send_to_all_servers = hash['send_to_all_servers'] ||= false
  # Parameter is an array, so we need to iterate through it
  servers = nil
  unless hash['servers'].nil?
    servers = []
    hash['servers'].each do |structure|
      servers << (RemoteSyslogServer.from_hash(structure) if structure)
    end
  end

  servers = SKIP unless hash.key?('servers')
  time_format = hash.key?('time_format') ? hash['time_format'] : 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 << (RemoteSyslogUser.from_hash(structure) if structure)
    end
  end

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

  # Create object from extracted values.
  RemoteSyslog.new(archive,
                   cacerts,
                   console,
                   enabled,
                   files,
                   network,
                   send_to_all_servers,
                   servers,
                   time_format,
                   users)
end

.namesObject

A mapping from model property names to API property names.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/mist_api/models/remote_syslog.rb', line 56

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['archive'] = 'archive'
  @_hash['cacerts'] = 'cacerts'
  @_hash['console'] = 'console'
  @_hash['enabled'] = 'enabled'
  @_hash['files'] = 'files'
  @_hash['network'] = 'network'
  @_hash['send_to_all_servers'] = 'send_to_all_servers'
  @_hash['servers'] = 'servers'
  @_hash['time_format'] = 'time_format'
  @_hash['users'] = 'users'
  @_hash
end

.nullablesObject

An array for nullable fields



88
89
90
# File 'lib/mist_api/models/remote_syslog.rb', line 88

def self.nullables
  []
end

.optionalsObject

An array for optional fields



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/mist_api/models/remote_syslog.rb', line 72

def self.optionals
  %w[
    archive
    cacerts
    console
    enabled
    files
    network
    send_to_all_servers
    servers
    time_format
    users
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



174
175
176
177
178
179
180
# File 'lib/mist_api/models/remote_syslog.rb', line 174

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} archive: #{@archive.inspect}, cacerts: #{@cacerts.inspect}, console:"\
  " #{@console.inspect}, enabled: #{@enabled.inspect}, files: #{@files.inspect}, network:"\
  " #{@network.inspect}, send_to_all_servers: #{@send_to_all_servers.inspect}, servers:"\
  " #{@servers.inspect}, time_format: #{@time_format.inspect}, users: #{@users.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



165
166
167
168
169
170
171
# File 'lib/mist_api/models/remote_syslog.rb', line 165

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} archive: #{@archive}, cacerts: #{@cacerts}, console: #{@console}, enabled:"\
  " #{@enabled}, files: #{@files}, network: #{@network}, send_to_all_servers:"\
  " #{@send_to_all_servers}, servers: #{@servers}, time_format: #{@time_format}, users:"\
  " #{@users}>"
end