if $splunk_xml_library == :rexml
class REXML::Text # :nodoc: def text value end end
end
Provides a class representing the collection of users and roles in Splunk. This should look identical to Collection to the end user of the SDK.
Users and roles are both case insensitive to the entity name, and neither returns the newly created entity.
Provide a class representing a collection of input kinds.
Provides a class representing the collection of jobs in Splunk.
Provides a collection representing system-wide messages on Splunk.
Provides a subclass of Entity to represent stanzas in configuration files.
This module provides the Service class, which encapsulates the interaction with Splunk.
Create a logged in reference to a Splunk instance.
connect takes a hash of values as its sole argument. The keys it understands are:
`:username` - log in to Splunk as this user (no default)
`:password` - password to use when logging in (no default)
`:host` - Splunk host (e.g. "10.1.2.3") (defaults to 'localhost')
`:port` - the Splunk management port (defaults to '8089')
`:protocol` - either 'https' or 'http' (defaults to 'https')
`:namespace` - application namespace option. 'username:appname'
(defaults to nil)
`:token` - a preauthenticated Splunk token (default to nil)
Returns: a logged in Service object.
Example:
require 'splunk-sdk-ruby' service = Splunk::connect(:username => "admin", :password => "changeme")
# File lib/splunk-sdk-ruby/service.rb, line 81 def self.connect(args) Service.new(args).login() end
Convert a hash of +eai:acl+ fields from Splunk's REST API into a namespace.
eai_acl should be a hash containing at least the key +"sharing"+, and, depending on the value associated with +"sharing"+, possibly keys +"app"+ and +"owner"+.
Returns: a Namespace.
# File lib/splunk-sdk-ruby/namespace.rb, line 80 def self.eai_acl_to_namespace(eai_acl) namespace(:sharing => eai_acl["sharing"], :app => eai_acl["app"], :owner => eai_acl["owner"]) end
Create a Namespace.
namespace takes a hash of arguments, recognizing the keys :sharing, :owner, and :app. Among them, :sharing is required, and depending on its value, the others may be required or not.
:sharing determines what kind of namespace is produced. It can have the values +"default"+, +"global"+, +"system"+, +"user"+, or +"app"+.
If :sharing is +"default"+, +"global"+, or +"system"+, the other two arguments are ignored. If :sharing is +"app"+, only :app is used, specifying the application of the namespace. If :sharing is +"user"+, then both the :app and :owner arguments are used.
If :sharing is +"app"+ but :app is +""+, it returns an AppReferenceNamespace.
Returns: a Namespace.
# File lib/splunk-sdk-ruby/namespace.rb, line 107 def self.namespace(args) sharing = args.fetch(:sharing, "default") owner = args.fetch(:owner, nil) app = args.fetch(:app, nil) if sharing == "system" return SystemNamespace.instance elsif sharing == "global" return GlobalNamespace.instance elsif sharing == "user" if owner.nil? or owner == "" raise ArgumentError.new("Must provide an owner for user namespaces.") elsif app.nil? or app == "" raise ArgumentError.new("Must provide an app for user namespaces.") else return UserNamespace.new(owner, app) end elsif sharing == "app" if app.nil? raise ArgumentError.new("Must specify an application for application sharing") elsif args[:app] == "" return AppReferenceNamespace.instance else return AppNamespace.new(args[:app]) end elsif sharing == "default" return DefaultNamespace.instance else raise ArgumentError.new("Unknown sharing value: #{sharing}") end end
Generated with the Darkfish Rdoc Generator 2.