com.splunk
Class Service

java.lang.Object
  extended by com.splunk.HttpService
      extended by com.splunk.Service

public class Service
extends HttpService

The Service class represents a Splunk service instance at a given address (host:port), accessed using the http or https protocol scheme.

A Service instance also captures an optional namespace context consisting of an optional owner name (or "-" wildcard) and optional app name (or "-" wildcard).

To access Service members, the Service instance must be authenticated by presenting credentials using the login method, or by constructing the Service instance using the connect method, which both creates and authenticates the instance.


Field Summary
static java.lang.String DEFAULT_HOST
          The default host name, which is used when a host name is not provided.
static int DEFAULT_PORT
          The default port number, which is used when a port number is not provided.
static java.lang.String DEFAULT_SCHEME
          The default scheme, which is used when a scheme is not provided.
 java.lang.String version
          The version of this Splunk instance, once logged in.
 
Constructor Summary
Service(java.util.Map<java.lang.String,java.lang.Object> args)
          Creates a new Service instance using a map of arguments.
Service(ServiceArgs args)
          Creates a new Service instance using a collection of arguments.
Service(java.lang.String host)
          Creates a new Service instance using a host.
Service(java.lang.String host, int port)
          Creates a new Service instance using a host and port.
Service(java.lang.String host, int port, java.lang.String scheme)
          Creates a new Service instance using a host, port, and scheme for accessing the service (http or https).
Service(java.lang.String host, int port, java.lang.String scheme, java.net.URLStreamHandler httpsHandler)
          Constructs a new Service instance using the given host, port, and scheme, and instructing it to use the specified HTTPS handler.
 
Method Summary
static Service connect(java.util.Map<java.lang.String,java.lang.Object> args)
          Establishes a connection to a Splunk service using a map of arguments.
 java.io.InputStream export(java.lang.String search)
          Runs an export search (using the search/jobs/export endpoint), and streams results back in an input stream.
 java.io.InputStream export(java.lang.String search, JobExportArgs args)
          Runs an export search with arguments (using the search/jobs/export endpoint), and streams results back in an input stream.
 java.io.InputStream export(java.lang.String search, java.util.Map args)
          Runs an export search with arguments (using the search/jobs/export endpoint), and streams results back in an input stream.
 java.lang.String fullpath(java.lang.String path, Args namespace)
          Ensures that a given path is fully qualified, prepending a path prefix if necessary.
 java.lang.String getApp()
          Returns the app context for this Service instance.
 EntityCollection<Application> getApplications()
          Returns the collection of applications.
 java.lang.String[] getCapabilities()
          Returns an array of system capabilities.
 ConfCollection getConfs()
          Returns the collection of configurations.
 ConfCollection getConfs(Args args)
          Returns the collection of configurations.
 DeploymentClient getDeploymentClient()
          Returns the configuration and status of a deployment client.
 EntityCollection<DeploymentServerClass> getDeploymentServerClasses()
          Returns a collection of class configurations for a deployment server.
 EntityCollection<DeploymentServerClass> getDeploymentServerClasses(Args args)
          Returns a collection of class configurations for a deployment server.
 EntityCollection<DeploymentServer> getDeploymentServers()
          Returns the configuration of all deployment servers.
 EntityCollection<DeploymentServer> getDeploymentServers(Args args)
          Returns the collection of deployment servers.
 EntityCollection<DeploymentTenant> getDeploymentTenants()
          Returns a collection of multi-tenant configurations.
 EntityCollection<DeploymentTenant> getDeploymentTenants(Args args)
          Returns a collection of multi-tenant configurations.
 DistributedConfiguration getDistributedConfiguration()
          Returns information about distributed search options.
 EntityCollection<DistributedPeer> getDistributedPeers()
          Returns a collection of distributed search peers.
 EntityCollection<DistributedPeer> getDistributedPeers(Args args)
          Returns a collection of distributed search peers.
 EventTypeCollection getEventTypes()
          Returns a collection of saved event types.
 EventTypeCollection getEventTypes(Args args)
          Returns a collection of saved event types.
 FiredAlertGroupCollection getFiredAlertGroups()
          Returns a collection of alerts that have been fired by the service.
 FiredAlertGroupCollection getFiredAlertsGroups(Args args)
          Returns a collection of alerts that have been fired by the service.
 IndexCollection getIndexes()
          Returns a collection of Splunk indexes.
 IndexCollection getIndexes(Args args)
          Returns a collection of Splunk indexes.
 IndexCollection getIndexes(IndexCollectionArgs args)
          Returns a collection of Splunk indexes.
 ServiceInfo getInfo()
          Returns information about the Splunk service.
 InputCollection getInputs()
          Returns a collection of configured inputs.
 InputCollection getInputs(Args args)
          Returns a collection of configured inputs.
 JobCollection getJobs()
          Returns a collection of current search jobs.
 JobCollection getJobs(Args args)
          Returns a collection of current search jobs.
 JobCollection getJobs(CollectionArgs args)
          Returns a collection of current search jobs.
 EntityCollection<LicenseGroup> getLicenseGroups()
          Returns a collection of license group configurations.
 EntityCollection<LicenseGroup> getLicenseGroups(Args args)
          Returns a collection of license group configurations.
 EntityCollection<LicenseMessage> getLicenseMessages()
          Returns a collection of messages from the licenser.
 EntityCollection<LicenseMessage> getLicenseMessages(Args args)
          Returns a collection of messages from the licenser.
 LicensePoolCollection getLicensePools()
          Returns a collection of licenser pool configurations.
 LicensePoolCollection getLicensePools(Args args)
          Returns a collection of licenser pool configurations.
 EntityCollection<License> getLicenses()
          Returns a collection of licenses for this service.
 EntityCollection<License> getLicenses(Args args)
          Returns a collection of licenses for this service.
 EntityCollection<LicenseSlave> getLicenseSlaves()
          Returns a collection of slaves reporting to this license master.
 EntityCollection<LicenseSlave> getLicenseSlaves(Args args)
          Returns a collection of slaves reporting to this license master.
 EntityCollection<LicenseStack> getLicenseStacks()
          Returns a collection of license stack configurations.
 EntityCollection<LicenseStack> getLicenseStacks(Args args)
          Returns a collection of license stack configurations.
 EntityCollection<Logger> getLoggers()
          Returns a collection of service logging categories and their status.
 EntityCollection<Logger> getLoggers(Args args)
          Returns a collection of service logging categories and their status.
 MessageCollection getMessages()
          Returns a collection of system messages.
 MessageCollection getMessages(Args args)
          Returns a collection of system messages.
 ResourceCollection<ModularInputKind> getModularInputKinds()
          Returns a collection of modular inputs.
 ResourceCollection<ModularInputKind> getModularInputKinds(Args args)
          Returns a collection of modular inputs.
 OutputDefault getOutputDefault()
          Returns global TCP output properties.
 EntityCollection<OutputGroup> getOutputGroups()
          Returns a collection of output group configurations.
 EntityCollection<OutputGroup> getOutputGroups(Args args)
          Returns a collection of output group configurations.
 EntityCollection<OutputServer> getOutputServers()
          Returns a collection of data-forwarding configurations.
 EntityCollection<OutputServer> getOutputServers(Args args)
          Returns a collection of data-forwarding configurations.
 EntityCollection<OutputSyslog> getOutputSyslogs()
          Returns a collection of configurations for forwarding data in standard syslog format.
 EntityCollection<OutputSyslog> getOutputSyslogs(Args args)
          Returns a collection of configurations for forwarding data in standard syslog format.
 java.lang.String getOwner()
          Returns the current owner context for this Service instance.
 java.lang.String getPassword()
          Returns the current password that was used to authenticate the session.
 PasswordCollection getPasswords()
          Returns a collection of passwords.
 PasswordCollection getPasswords(Args args)
          Returns a collection of passwords.
 Receiver getReceiver()
          Returns the receiver object for the Splunk service.
 EntityCollection<Role> getRoles()
          Returns a collection of Splunk user roles.
 EntityCollection<Role> getRoles(Args args)
          Returns a collection of Splunk user roles.
 SavedSearchCollection getSavedSearches()
          Returns a collection of saved searches.
 SavedSearchCollection getSavedSearches(Args args)
          Returns a collection of saved searches.
 SavedSearchCollection getSavedSearches(SavedSearchCollectionArgs args)
          Returns a collection of saved searches.
 Settings getSettings()
          Returns service configuration information for an instance of Splunk.
 java.lang.String getToken()
          Returns the current session token.
 EntityCollection<Upload> getUploads()
          Returns a collection of in-progress oneshot uploads.
 EntityCollection<Upload> getUploads(Args namespace)
          Returns a collection of in-progress oneshot uploads.
 java.lang.String getUsername()
          Returns the Splunk account username that was used to authenticate the current session.
 UserCollection getUsers()
          Returns a collection of Splunk users.
 UserCollection getUsers(Args args)
          Returns a collection of Splunk users.
 Service login()
          Authenticates the Service instance with the username and password that were specified when the instance was created.
 Service login(java.lang.String username, java.lang.String password)
          Authenticates the Service instance with a specified username and password.
 Service logout()
          Forgets the current session token.
 java.io.InputStream oneshotSearch(java.lang.String query)
          Creates a oneshot synchronous search.
 java.io.InputStream oneshotSearch(java.lang.String query, Args args)
          Creates a oneshot synchronous search using search arguments.
 java.io.InputStream oneshotSearch(java.lang.String query, java.util.Map args)
          Creates a oneshot synchronous search using search arguments.
 java.net.Socket open(int port)
          Opens a raw socket to this service.
 ResponseMessage parse(java.lang.String query)
          Parses a search query and returns a semantic map for the search in JSON format.
 ResponseMessage parse(java.lang.String query, java.util.Map args)
          Parses a search query with additional arguments and returns a semantic map for the search in JSON format.
 ResponseMessage restart()
          Restarts the service.
 Job search(java.lang.String query)
          Creates an asynchronous search using the given query.
 Job search(java.lang.String query, java.util.Map<java.lang.String,java.lang.Object> args)
          Creates an asynchronous search job using the given query and search arguments.
 ResponseMessage send(java.lang.String path, RequestMessage request)
          Issues an HTTP request against the service using a request path and message.
 void setToken(java.lang.String value)
          Provides a session token for use by this Service instance.
 int versionCompare(java.lang.String otherVersion)
          Returns a value indicating how the version of this Splunk instance compares to a given version: -1 if this version < the given version 0 if this version = the given version 1 if this version > the given version
 
Methods inherited from class com.splunk.HttpService
delete, delete, get, get, getHost, getPort, getPrefix, getScheme, getUrl, post, post
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public java.lang.String version
The version of this Splunk instance, once logged in.


DEFAULT_HOST

public static java.lang.String DEFAULT_HOST
The default host name, which is used when a host name is not provided.


DEFAULT_PORT

public static int DEFAULT_PORT
The default port number, which is used when a port number is not provided.


DEFAULT_SCHEME

public static java.lang.String DEFAULT_SCHEME
The default scheme, which is used when a scheme is not provided.

Constructor Detail

Service

public Service(java.lang.String host)
Creates a new Service instance using a host.

Parameters:
host - The host name.

Service

public Service(java.lang.String host,
               int port)
Creates a new Service instance using a host and port.

Parameters:
host - The host name.
port - The port number.

Service

public Service(java.lang.String host,
               int port,
               java.lang.String scheme)
Creates a new Service instance using a host, port, and scheme for accessing the service (http or https).

Parameters:
host - The host name.
port - The port number.
scheme - The scheme (http or https).

Service

public Service(java.lang.String host,
               int port,
               java.lang.String scheme,
               java.net.URLStreamHandler httpsHandler)
Constructs a new Service instance using the given host, port, and scheme, and instructing it to use the specified HTTPS handler.

Parameters:
host - The host name of the service.
port - The port number of the service.
scheme - Scheme for accessing the service (http or https).

Service

public Service(ServiceArgs args)
Creates a new Service instance using a collection of arguments.

Parameters:
args - The ServiceArgs to initialize the service.

Service

public Service(java.util.Map<java.lang.String,java.lang.Object> args)
Creates a new Service instance using a map of arguments.

Parameters:
args - A Map of arguments to initialize the service.
Method Detail

connect

public static Service connect(java.util.Map<java.lang.String,java.lang.Object> args)
Establishes a connection to a Splunk service using a map of arguments. This member creates a new Service instance and authenticates the session using credentials passed in from the args map.

Parameters:
args - The args map.
Returns:
A new Service instance.

export

public java.io.InputStream export(java.lang.String search)
Runs an export search (using the search/jobs/export endpoint), and streams results back in an input stream.

Parameters:
search - The search query to run.
Returns:
The InputStream object that contains the search results.

export

public java.io.InputStream export(java.lang.String search,
                                  java.util.Map args)
Runs an export search with arguments (using the search/jobs/export endpoint), and streams results back in an input stream.

Parameters:
search - The search query to run.
args - Additional search arguments. For a list of possible parameters, see Saved search parameters on dev.splunk.com.
Returns:
The InputStream object that contains the search results.

export

public java.io.InputStream export(java.lang.String search,
                                  JobExportArgs args)
Runs an export search with arguments (using the search/jobs/export endpoint), and streams results back in an input stream.

Parameters:
search - The search query to run.
args - Additional search arguments (see JobExportArgs).
Returns:
The InputStream object that contains the search results.

fullpath

public java.lang.String fullpath(java.lang.String path,
                                 Args namespace)
Ensures that a given path is fully qualified, prepending a path prefix if necessary. The path prefix is constructed using the current owner and app context when available.

Parameters:
path - The path to verify.
namespace - The namespace dictionary (app, owner, sharing).
Returns:
A fully-qualified resource path.

getApp

public java.lang.String getApp()
Returns the app context for this Service instance. A null value indicates no app context, and a value of "-" indicates an app wildcard.

Returns:
The app context.

getApplications

public EntityCollection<Application> getApplications()
Returns the collection of applications.

Returns:
The application collection.

getConfs

public ConfCollection getConfs()
Returns the collection of configurations.

Returns:
The configurations collection.

getConfs

public ConfCollection getConfs(Args args)
Returns the collection of configurations.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
The configurations collection.

getCapabilities

public java.lang.String[] getCapabilities()
Returns an array of system capabilities.

Returns:
An array of capabilities.

getDeploymentClient

public DeploymentClient getDeploymentClient()
Returns the configuration and status of a deployment client.

Returns:
The configuration and status.

getDeploymentServers

public EntityCollection<DeploymentServer> getDeploymentServers()
Returns the configuration of all deployment servers.

Returns:
The configuration of deployment servers.

getDeploymentServers

public EntityCollection<DeploymentServer> getDeploymentServers(Args args)
Returns the collection of deployment servers.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
The configuration of deployment servers.

getDeploymentServerClasses

public EntityCollection<DeploymentServerClass> getDeploymentServerClasses()
Returns a collection of class configurations for a deployment server.

Returns:
A collection of class configurations.

getDeploymentServerClasses

public EntityCollection<DeploymentServerClass> getDeploymentServerClasses(Args args)
Returns a collection of class configurations for a deployment server.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of server class configurations.

getDeploymentTenants

public EntityCollection<DeploymentTenant> getDeploymentTenants()
Returns a collection of multi-tenant configurations.

Returns:
A collection of multi-tenant configurations.

getDeploymentTenants

public EntityCollection<DeploymentTenant> getDeploymentTenants(Args args)
Returns a collection of multi-tenant configurations.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of multi-tenant configurations.

getDistributedConfiguration

public DistributedConfiguration getDistributedConfiguration()
Returns information about distributed search options.

Returns:
Distributed search information.

getDistributedPeers

public EntityCollection<DistributedPeer> getDistributedPeers()
Returns a collection of distributed search peers. A search peer is a Splunk server to which another Splunk server distributes searches. The Splunk server where the search originates is referred to as the search head.

Returns:
A collection of search peers.

getDistributedPeers

public EntityCollection<DistributedPeer> getDistributedPeers(Args args)
Returns a collection of distributed search peers. A search peer is a Splunk server to which another Splunk server distributes searches. The Splunk server where the search originates is referred to as the search head.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of search peers.

getEventTypes

public EventTypeCollection getEventTypes()
Returns a collection of saved event types.

Returns:
A collection of saved event types.

getEventTypes

public EventTypeCollection getEventTypes(Args args)
Returns a collection of saved event types.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of saved event types.

getFiredAlertGroups

public FiredAlertGroupCollection getFiredAlertGroups()
Returns a collection of alerts that have been fired by the service.

Returns:
A collection of fired alerts.

getFiredAlertsGroups

public FiredAlertGroupCollection getFiredAlertsGroups(Args args)
Returns a collection of alerts that have been fired by the service.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of fired alerts.

getIndexes

public IndexCollection getIndexes()
Returns a collection of Splunk indexes.

Returns:
A collection of indexes.

getIndexes

public IndexCollection getIndexes(IndexCollectionArgs args)
Returns a collection of Splunk indexes.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See IndexCollectionArgs.
Returns:
A collection of indexes.

getIndexes

public IndexCollection getIndexes(Args args)
Returns a collection of Splunk indexes.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See IndexCollectionArgs.
Returns:
A collection of indexes.

getInfo

public ServiceInfo getInfo()
Returns information about the Splunk service.

Returns:
Splunk service information.

getInputs

public InputCollection getInputs()
Returns a collection of configured inputs.

Returns:
A collection of inputs.

getInputs

public InputCollection getInputs(Args args)
Returns a collection of configured inputs.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of inputs.

getJobs

public JobCollection getJobs()
Returns a collection of current search jobs.

Returns:
A collection of search jobs.

getJobs

public JobCollection getJobs(CollectionArgs args)
Returns a collection of current search jobs.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of search jobs.

getJobs

public JobCollection getJobs(Args args)
Returns a collection of current search jobs.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of search jobs.

getLicenseGroups

public EntityCollection<LicenseGroup> getLicenseGroups()
Returns a collection of license group configurations.

Returns:
A collection of license group configurations.

getLicenseGroups

public EntityCollection<LicenseGroup> getLicenseGroups(Args args)
Returns a collection of license group configurations.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of license group configurations.

getLicenseMessages

public EntityCollection<LicenseMessage> getLicenseMessages()
Returns a collection of messages from the licenser.

Returns:
A collection of licenser messages.

getLicenseMessages

public EntityCollection<LicenseMessage> getLicenseMessages(Args args)
Returns a collection of messages from the licenser.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of licenser messages.

getOwner

public java.lang.String getOwner()
Returns the current owner context for this Service instance. A value of "-" indicates a wildcard, and a null value indicates no owner context.

Returns:
The current owner context.

getLicensePools

public LicensePoolCollection getLicensePools()
Returns a collection of licenser pool configurations.

Returns:
A collection of licenser pool configurations.

getLicensePools

public LicensePoolCollection getLicensePools(Args args)
Returns a collection of licenser pool configurations.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of licenser pool configurations.

getLicenseSlaves

public EntityCollection<LicenseSlave> getLicenseSlaves()
Returns a collection of slaves reporting to this license master.

Returns:
A collection of licenser slaves.

getLicenseSlaves

public EntityCollection<LicenseSlave> getLicenseSlaves(Args args)
Returns a collection of slaves reporting to this license master.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of licenser slaves.

getLicenseStacks

public EntityCollection<LicenseStack> getLicenseStacks()
Returns a collection of license stack configurations.

Returns:
A collection of license stack configurations.

getLicenseStacks

public EntityCollection<LicenseStack> getLicenseStacks(Args args)
Returns a collection of license stack configurations.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of license stack configurations.

getLicenses

public EntityCollection<License> getLicenses()
Returns a collection of licenses for this service.

Returns:
A collection of licenses.

getLicenses

public EntityCollection<License> getLicenses(Args args)
Returns a collection of licenses for this service.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of licenses.

getLoggers

public EntityCollection<Logger> getLoggers()
Returns a collection of service logging categories and their status.

Returns:
A collection of logging categories.

getLoggers

public EntityCollection<Logger> getLoggers(Args args)
Returns a collection of service logging categories and their status.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of logging categories.

getMessages

public MessageCollection getMessages()
Returns a collection of system messages.

Returns:
A collection of system messages.

getMessages

public MessageCollection getMessages(Args args)
Returns a collection of system messages.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of system messages.

getModularInputKinds

public ResourceCollection<ModularInputKind> getModularInputKinds()
Returns a collection of modular inputs.

Returns:
A collection of modular inputs.

getModularInputKinds

public ResourceCollection<ModularInputKind> getModularInputKinds(Args args)
Returns a collection of modular inputs.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of modular inputs.

getOutputDefault

public OutputDefault getOutputDefault()
Returns global TCP output properties.

Returns:
Global TCP output properties.

getOutputGroups

public EntityCollection<OutputGroup> getOutputGroups()
Returns a collection of output group configurations.

Returns:
A collection of output group configurations.

getOutputGroups

public EntityCollection<OutputGroup> getOutputGroups(Args args)
Returns a collection of output group configurations.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of output group configurations.

getOutputServers

public EntityCollection<OutputServer> getOutputServers()
Returns a collection of data-forwarding configurations.

Returns:
A collection of data-forwarding configurations.

getOutputServers

public EntityCollection<OutputServer> getOutputServers(Args args)
Returns a collection of data-forwarding configurations.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of data-forwarding configurations.

getOutputSyslogs

public EntityCollection<OutputSyslog> getOutputSyslogs()
Returns a collection of configurations for forwarding data in standard syslog format.

Returns:
A collection of syslog forwarders.

getOutputSyslogs

public EntityCollection<OutputSyslog> getOutputSyslogs(Args args)
Returns a collection of configurations for forwarding data in standard syslog format.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of syslog forwarders.

getPassword

public java.lang.String getPassword()
Returns the current password that was used to authenticate the session.

Returns:
The current password.

getPasswords

public PasswordCollection getPasswords()
Returns a collection of passwords. This collection is used for managing secure credentials.

Returns:
A collection of passwords.

getPasswords

public PasswordCollection getPasswords(Args args)
Returns a collection of passwords. This collection is used for managing secure credentials.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of passwords.

getReceiver

public Receiver getReceiver()
Returns the receiver object for the Splunk service.

Returns:
A Splunk receiver object.

getRoles

public EntityCollection<Role> getRoles()
Returns a collection of Splunk user roles.

Returns:
A collection of user roles.

getRoles

public EntityCollection<Role> getRoles(Args args)
Returns a collection of Splunk user roles.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of user roles.

getSavedSearches

public SavedSearchCollection getSavedSearches()
Returns a collection of saved searches.

Returns:
A collection of saved searches.

getSavedSearches

public SavedSearchCollection getSavedSearches(SavedSearchCollectionArgs args)
Returns a collection of saved searches.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See SavedSearchCollectionArgs.
Returns:
A collection of saved searches.

getSavedSearches

public SavedSearchCollection getSavedSearches(Args args)
Returns a collection of saved searches.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of saved searches.

getSettings

public Settings getSettings()
Returns service configuration information for an instance of Splunk.

Returns:
Service configuration information.

getToken

public java.lang.String getToken()
Returns the current session token. Session tokens can be shared across multiple Service instances.

Returns:
The session token.

getUploads

public EntityCollection<Upload> getUploads()
Returns a collection of in-progress oneshot uploads.

Returns:
A collection of in-progress oneshot uploads

getUploads

public EntityCollection<Upload> getUploads(Args namespace)
Returns a collection of in-progress oneshot uploads.

Parameters:
namespace - This collection's namespace; there are no other optional arguments for this endpoint.
Returns:
A collection of in-progress oneshot uploads

getUsername

public java.lang.String getUsername()
Returns the Splunk account username that was used to authenticate the current session.

Returns:
The current username.

getUsers

public UserCollection getUsers()
Returns a collection of Splunk users.

Returns:
A collection of users.

getUsers

public UserCollection getUsers(Args args)
Returns a collection of Splunk users.

Parameters:
args - Collection arguments that specify the number of entities to return and how to sort them. See CollectionArgs.
Returns:
A collection of users.

login

public Service login()
Authenticates the Service instance with the username and password that were specified when the instance was created.

Returns:
The current Service instance.

login

public Service login(java.lang.String username,
                     java.lang.String password)
Authenticates the Service instance with a specified username and password. Note that these values override any previously-set values for username and password.

Parameters:
username - The Splunk account username.
password - The password for the username.
Returns:
The current Service instance.

logout

public Service logout()
Forgets the current session token.

Returns:
The current Service instance.

oneshotSearch

public java.io.InputStream oneshotSearch(java.lang.String query)
Creates a oneshot synchronous search.

Parameters:
query - The search query.
Returns:
The search results.

oneshotSearch

public java.io.InputStream oneshotSearch(java.lang.String query,
                                         java.util.Map args)
Creates a oneshot synchronous search using search arguments.

Parameters:
query - The search query.
args - The search arguments:
  • "output_mode": Specifies the output format of the results (XML, JSON, or CSV).
  • "earliest_time": Specifies the earliest time in the time range to search. The time string can be a UTC time (with fractional seconds), a relative time specifier (to now), or a formatted time string.
  • "latest_time": Specifies the latest time in the time range to search. The time string can be a UTC time (with fractional seconds), a relative time specifier (to now), or a formatted time string.
  • "rf": Specifies one or more fields to add to the search.
Returns:
The search results.

oneshotSearch

public java.io.InputStream oneshotSearch(java.lang.String query,
                                         Args args)
Creates a oneshot synchronous search using search arguments.

Parameters:
query - The search query.
args - The search arguments:
  • "output_mode": Specifies the output format of the results (XML, JSON, or CSV).
  • "earliest_time": Specifies the earliest time in the time range to search. The time string can be a UTC time (with fractional seconds), a relative time specifier (to now), or a formatted time string.
  • "latest_time": Specifies the latest time in the time range to search. The time string can be a UTC time (with fractional seconds), a relative time specifier (to now), or a formatted time string.
  • "rf": Specifies one or more fields to add to the search.
Returns:
The search results.

open

public java.net.Socket open(int port)
                     throws java.io.IOException
Opens a raw socket to this service.

Parameters:
port - The port to open. This port must already have been created as an allowable TCP input to the service.
Returns:
The socket.
Throws:
java.io.IOException

parse

public ResponseMessage parse(java.lang.String query)
Parses a search query and returns a semantic map for the search in JSON format.

Parameters:
query - The search query.
Returns:
The parse response message.

parse

public ResponseMessage parse(java.lang.String query,
                             java.util.Map args)
Parses a search query with additional arguments and returns a semantic map for the search in JSON format.

Parameters:
query - The search query.
args - Additional parse arguments.
Returns:
The parse response message.

restart

public ResponseMessage restart()
Restarts the service. The service will be unavailable until it has sucessfully restarted.

Returns:
The restart response message.

search

public Job search(java.lang.String query)
Creates an asynchronous search using the given query. Use this method for simple searches.

Parameters:
query - The search query.
Returns:
The search job.

search

public Job search(java.lang.String query,
                  java.util.Map<java.lang.String,java.lang.Object> args)
Creates an asynchronous search job using the given query and search arguments.

Parameters:
query - The search query.
args - The search arguments.
Returns:
The search job.

send

public ResponseMessage send(java.lang.String path,
                            RequestMessage request)
Issues an HTTP request against the service using a request path and message. This method overrides the base HttpService.send method and applies the Splunk authorization header, which is required for authenticated interactions with the Splunk service.

Overrides:
send in class HttpService
Parameters:
path - The request path.
request - The request message.
Returns:
The HTTP response.

setToken

public void setToken(java.lang.String value)
Provides a session token for use by this Service instance. Session tokens can be shared across multiple Service instances.

Parameters:
value - The session token, which is a basic authorization header in the format "Basic sessiontoken", where sessiontoken is the Base64-encoded "username:password" string.

versionCompare

public int versionCompare(java.lang.String otherVersion)
Returns a value indicating how the version of this Splunk instance compares to a given version:

Parameters:
otherVersion - The other version to compare to.
Returns:
-1 if this version is less than, 0 if this version is equal to, or 1 if this version is greater than the given version.