Class: Cisco::SyslogSettings

Inherits:
NodeUtil show all
Defined in:
lib/cisco_node_utils/syslog_settings.rb

Overview

SyslogSettings - node utility class for Syslog Settings configuration management

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NodeUtil

client, #client, config_get, #config_get, #config_get_default, config_get_default, config_set, #config_set, #get, #ios_xr?, #nexus?, #node, node, platform, #platform, supports?, #supports?

Constructor Details

#initialize(name) ⇒ SyslogSettings

Returns a new instance of SyslogSettings.



27
28
29
30
31
32
33
# File 'lib/cisco_node_utils/syslog_settings.rb', line 27

def initialize(name)
  fail TypeError unless name.is_a?(String)
  fail ArgumentError,
       "This provider only accepts an id of 'default'" \
       unless name.eql?('default')
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



25
26
27
# File 'lib/cisco_node_utils/syslog_settings.rb', line 25

def name
  @name
end

Class Method Details

.syslogsettingsObject



35
36
37
38
39
# File 'lib/cisco_node_utils/syslog_settings.rb', line 35

def self.syslogsettings
  hash = {}
  hash['default'] = SyslogSettings.new('default')
  hash
end

Instance Method Details

#==(other) ⇒ Object



41
42
43
# File 'lib/cisco_node_utils/syslog_settings.rb', line 41

def ==(other)
  name == other.name
end

#timestampObject



45
46
47
# File 'lib/cisco_node_utils/syslog_settings.rb', line 45

def timestamp
  config_get('syslog_settings', 'timestamp')
end

#timestamp=(val) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cisco_node_utils/syslog_settings.rb', line 49

def timestamp=(val)
  fail TypeError unless val.is_a?(String)
  fail TypeError \
    unless %w(seconds milliseconds).include?(val)

  # There is no unset version as timestamp has a default value
  config_set('syslog_settings',
             'timestamp',
             state: '',
             units: val)
end