Class: MistApi::RemoteSyslogContent

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

Overview

RemoteSyslogContent 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(facility = RemoteSyslogFacilityEnum::ANY, severity = RemoteSyslogSeverityEnum::ANY) ⇒ RemoteSyslogContent

Returns a new instance of RemoteSyslogContent.



44
45
46
47
48
# File 'lib/mist_api/models/remote_syslog_content.rb', line 44

def initialize(facility = RemoteSyslogFacilityEnum::ANY,
               severity = RemoteSyslogSeverityEnum::ANY)
  @facility = facility unless facility == SKIP
  @severity = severity unless severity == SKIP
end

Instance Attribute Details

#facilityRemoteSyslogFacilityEnum

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



16
17
18
# File 'lib/mist_api/models/remote_syslog_content.rb', line 16

def facility
  @facility
end

#severityRemoteSyslogSeverityEnum

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



21
22
23
# File 'lib/mist_api/models/remote_syslog_content.rb', line 21

def severity
  @severity
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/mist_api/models/remote_syslog_content.rb', line 51

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  facility = hash['facility'] ||= RemoteSyslogFacilityEnum::ANY
  severity = hash['severity'] ||= RemoteSyslogSeverityEnum::ANY

  # Create object from extracted values.
  RemoteSyslogContent.new(facility,
                          severity)
end

.namesObject

A mapping from model property names to API property names.



24
25
26
27
28
29
# File 'lib/mist_api/models/remote_syslog_content.rb', line 24

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['facility'] = 'facility'
  @_hash['severity'] = 'severity'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



32
33
34
35
36
37
# File 'lib/mist_api/models/remote_syslog_content.rb', line 32

def self.optionals
  %w[
    facility
    severity
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



65
66
67
68
69
70
71
# File 'lib/mist_api/models/remote_syslog_content.rb', line 65

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.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} facility: #{@facility.inspect}, severity: #{@severity.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



74
75
76
77
# File 'lib/mist_api/models/remote_syslog_content.rb', line 74

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} facility: #{@facility}, severity: #{@severity}>"
end