Class: MistApi::RemoteSyslogServer

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

Overview

RemoteSyslogServer 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(contents = SKIP, explicit_priority = SKIP, facility = RemoteSyslogFacilityEnum::ANY, host = SKIP, match = SKIP, port = SKIP, protocol = RemoteSyslogServerProtocolEnum::UDP, routing_instance = SKIP, server_name = SKIP, severity = RemoteSyslogSeverityEnum::ANY, source_address = SKIP, structured_data = SKIP, tag = SKIP) ⇒ RemoteSyslogServer

Returns a new instance of RemoteSyslogServer.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/mist_api/models/remote_syslog_server.rb', line 117

def initialize(contents = SKIP, explicit_priority = SKIP,
               facility = RemoteSyslogFacilityEnum::ANY, host = SKIP,
               match = SKIP, port = SKIP,
               protocol = RemoteSyslogServerProtocolEnum::UDP,
               routing_instance = SKIP, server_name = SKIP,
               severity = RemoteSyslogSeverityEnum::ANY,
               source_address = SKIP, structured_data = SKIP, tag = SKIP)
  @contents = contents unless contents == SKIP
  @explicit_priority = explicit_priority unless explicit_priority == SKIP
  @facility = facility unless facility == SKIP
  @host = host unless host == SKIP
  @match = match unless match == SKIP
  @port = port unless port == SKIP
  @protocol = protocol unless protocol == SKIP
  @routing_instance = routing_instance unless routing_instance == SKIP
  @server_name = server_name unless server_name == SKIP
  @severity = severity unless severity == SKIP
  @source_address = source_address unless source_address == SKIP
  @structured_data = structured_data unless structured_data == SKIP
  @tag = tag unless tag == SKIP
end

Instance Attribute Details

#contentsArray[RemoteSyslogContent]

TODO: Write general description for this method

Returns:



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

def contents
  @contents
end

#explicit_priorityTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def explicit_priority
  @explicit_priority
end

#facilityRemoteSyslogFacilityEnum

enum: ‘any`, `authorization`, `change-log`, `config`, `conflict-log`, `daemon`, `dfc`, `external`, `firewall`, `ftp`, `interactive-commands`, `kernel`, `ntp`, `pfe`, `security`, `user`



24
25
26
# File 'lib/mist_api/models/remote_syslog_server.rb', line 24

def facility
  @facility
end

#hostString

enum: ‘any`, `authorization`, `change-log`, `config`, `conflict-log`, `daemon`, `dfc`, `external`, `firewall`, `ftp`, `interactive-commands`, `kernel`, `ntp`, `pfe`, `security`, `user`

Returns:

  • (String)


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

def host
  @host
end

#matchString

enum: ‘any`, `authorization`, `change-log`, `config`, `conflict-log`, `daemon`, `dfc`, `external`, `firewall`, `ftp`, `interactive-commands`, `kernel`, `ntp`, `pfe`, `security`, `user`

Returns:

  • (String)


36
37
38
# File 'lib/mist_api/models/remote_syslog_server.rb', line 36

def match
  @match
end

#portObject

Syslog Service Port, value from 1 to 65535

Returns:

  • (Object)


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

def port
  @port
end

#protocolRemoteSyslogServerProtocolEnum

enum: ‘tcp`, `udp`



44
45
46
# File 'lib/mist_api/models/remote_syslog_server.rb', line 44

def protocol
  @protocol
end

#routing_instanceString

enum: ‘tcp`, `udp`

Returns:

  • (String)


48
49
50
# File 'lib/mist_api/models/remote_syslog_server.rb', line 48

def routing_instance
  @routing_instance
end

#server_nameString

Name of the server

Returns:

  • (String)


52
53
54
# File 'lib/mist_api/models/remote_syslog_server.rb', line 52

def server_name
  @server_name
end

#severityRemoteSyslogSeverityEnum

enum: ‘alert`, `any`, `critical`, `emergency`, `error`, `info`, `notice`, `warning`



57
58
59
# File 'lib/mist_api/models/remote_syslog_server.rb', line 57

def severity
  @severity
end

#source_addressString

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

Returns:

  • (String)


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

def source_address
  @source_address
end

#structured_dataTrueClass | FalseClass

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

Returns:

  • (TrueClass | FalseClass)


67
68
69
# File 'lib/mist_api/models/remote_syslog_server.rb', line 67

def structured_data
  @structured_data
end

#tagString

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

Returns:

  • (String)


72
73
74
# File 'lib/mist_api/models/remote_syslog_server.rb', line 72

def tag
  @tag
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/mist_api/models/remote_syslog_server.rb', line 140

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

  contents = SKIP unless hash.key?('contents')
  explicit_priority =
    hash.key?('explicit_priority') ? hash['explicit_priority'] : SKIP
  facility = hash['facility'] ||= RemoteSyslogFacilityEnum::ANY
  host = hash.key?('host') ? hash['host'] : SKIP
  match = hash.key?('match') ? hash['match'] : SKIP
  port = hash.key?('port') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:RemoteSyslogServerPort), hash['port']
  ) : SKIP
  protocol = hash['protocol'] ||= RemoteSyslogServerProtocolEnum::UDP
  routing_instance =
    hash.key?('routing_instance') ? hash['routing_instance'] : SKIP
  server_name = hash.key?('server_name') ? hash['server_name'] : SKIP
  severity = hash['severity'] ||= RemoteSyslogSeverityEnum::ANY
  source_address =
    hash.key?('source_address') ? hash['source_address'] : SKIP
  structured_data =
    hash.key?('structured_data') ? hash['structured_data'] : SKIP
  tag = hash.key?('tag') ? hash['tag'] : SKIP

  # Create object from extracted values.
  RemoteSyslogServer.new(contents,
                         explicit_priority,
                         facility,
                         host,
                         match,
                         port,
                         protocol,
                         routing_instance,
                         server_name,
                         severity,
                         source_address,
                         structured_data,
                         tag)
end

.namesObject

A mapping from model property names to API property names.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/mist_api/models/remote_syslog_server.rb', line 75

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['contents'] = 'contents'
  @_hash['explicit_priority'] = 'explicit_priority'
  @_hash['facility'] = 'facility'
  @_hash['host'] = 'host'
  @_hash['match'] = 'match'
  @_hash['port'] = 'port'
  @_hash['protocol'] = 'protocol'
  @_hash['routing_instance'] = 'routing_instance'
  @_hash['server_name'] = 'server_name'
  @_hash['severity'] = 'severity'
  @_hash['source_address'] = 'source_address'
  @_hash['structured_data'] = 'structured_data'
  @_hash['tag'] = 'tag'
  @_hash
end

.nullablesObject

An array for nullable fields



113
114
115
# File 'lib/mist_api/models/remote_syslog_server.rb', line 113

def self.nullables
  []
end

.optionalsObject

An array for optional fields



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/mist_api/models/remote_syslog_server.rb', line 94

def self.optionals
  %w[
    contents
    explicit_priority
    facility
    host
    match
    port
    protocol
    routing_instance
    server_name
    severity
    source_address
    structured_data
    tag
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



191
192
193
194
195
196
197
# File 'lib/mist_api/models/remote_syslog_server.rb', line 191

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.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} contents: #{@contents.inspect}, explicit_priority:"\
  " #{@explicit_priority.inspect}, facility: #{@facility.inspect}, host: #{@host.inspect},"\
  " match: #{@match.inspect}, port: #{@port.inspect}, protocol: #{@protocol.inspect},"\
  " routing_instance: #{@routing_instance.inspect}, server_name: #{@server_name.inspect},"\
  " severity: #{@severity.inspect}, source_address: #{@source_address.inspect},"\
  " structured_data: #{@structured_data.inspect}, tag: #{@tag.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} contents: #{@contents}, explicit_priority: #{@explicit_priority}, facility:"\
  " #{@facility}, host: #{@host}, match: #{@match}, port: #{@port}, protocol: #{@protocol},"\
  " routing_instance: #{@routing_instance}, server_name: #{@server_name}, severity:"\
  " #{@severity}, source_address: #{@source_address}, structured_data: #{@structured_data},"\
  " tag: #{@tag}>"
end