|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.splunk.HttpService
com.splunk.Service
public class Service
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 | |
---|---|
protected java.lang.String |
app
The current app context. |
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. |
protected java.lang.String |
owner
The current owner context. |
protected java.lang.String |
password
The password, which is used to authenticate the Splunk instance. |
protected java.lang.String |
token
The current session token. |
protected java.lang.String |
username
The Splunk account username, which is used to authenticate the Splunk instance. |
Fields inherited from class com.splunk.HttpService |
---|
host, port, scheme |
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 ). |
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 a search using the search/jobs/export endpoint, which streams
results back in an input stream. |
java.io.InputStream |
export(java.lang.String search,
java.util.Map args)
Runs a search with arguments using the search/jobs/export endpoint,
which streams results back in an input stream. |
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. |
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<DeploymentServer> |
getDeploymentServers()
Returns the configuration of all deployment servers. |
EntityCollection<DeploymentTenant> |
getDeploymentTenants()
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. |
EventTypeCollection |
getEventTypes()
Returns a collection of saved event types. |
EntityCollection<FiredAlert> |
getFiredAlerts()
Returns a collection of alerts that have been fired by this Service
instance. |
EntityCollection<Index> |
getIndexes()
Returns a collection of Splunk indexes. |
ServiceInfo |
getInfo()
Returns information about the Splunk service. |
InputCollection |
getInputs()
Returns a collection of configured inputs. |
JobCollection |
getJobs()
Returns a collection of current search jobs. |
EntityCollection<LicenseGroup> |
getLicenseGroups()
Returns a collection of license group configurations. |
EntityCollection<LicenseMessage> |
getLicenseMessages()
Returns a collection of messages from the licenser. |
LicensePoolCollection |
getLicensePools()
Returns a collection of licenser pool configurations. |
EntityCollection<License> |
getLicenses()
Returns a collection of licenses for this service. |
EntityCollection<LicenseSlave> |
getLicenseSlaves()
Returns a collection of licenser slaves that report to the license master. |
EntityCollection<LicenseStack> |
getLicenseStacks()
Returns a collection of license stack configurations. |
EntityCollection<Logger> |
getLoggers()
Returns a collection of logging categories and their status. |
MessageCollection |
getMessages()
Returns a collection of system messages. |
OutputDefault |
getOutputDefault()
Returns global TCP output properties. |
EntityCollection<OutputGroup> |
getOutputGroups()
Returns a collection of output group configurations. |
EntityCollection<OutputServer> |
getOutputServers()
Returns a collection of data-forwarding configurations. |
EntityCollection<OutputSyslog> |
getOutputSyslogs()
Returns a collection of configurations for forwarding data in standard syslog format. |
java.lang.String |
getOwner()
Returns the current owner context. |
java.lang.String |
getPassword()
Returns the current password that was used to authenticate the session. |
PasswordCollection |
getPasswords()
Return a collection of passwords. |
EntityCollection<Role> |
getRoles()
Returns a collection of Splunk user roles. |
SavedSearchCollection |
getSavedSearches()
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. |
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. |
Service |
login(java.lang.String username,
java.lang.String password)
Authenticates the Service instance with a username and password. |
Service |
logout()
Forgets the current session token. |
java.io.InputStream |
oneshot(java.lang.String query)
Creates a oneshot synchronous search. |
java.io.InputStream |
oneshot(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. |
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. |
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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String app
protected java.lang.String token
protected java.lang.String owner
protected java.lang.String username
protected java.lang.String password
public static java.lang.String DEFAULT_HOST
public static int DEFAULT_PORT
public static java.lang.String DEFAULT_SCHEME
Constructor Detail |
---|
public Service(java.lang.String host)
Service
instance using a host.
host
- The host name.public Service(java.lang.String host, int port)
Service
instance using a host and port.
host
- The host name.port
- The port number.public Service(java.lang.String host, int port, java.lang.String scheme)
Service
instance using a host, port, and
scheme for accessing the service (http
or https
).
host
- The host name.port
- The port number.scheme
- The scheme (http
or https
).public Service(ServiceArgs args)
Service
instance using a collection of arguments.
args
- The ServiceArgs
to initialize the service.public Service(java.util.Map<java.lang.String,java.lang.Object> args)
Service
instance using a map of arguments.
args
- A Map
of arguments to initialize the service.Method Detail |
---|
public static Service connect(java.util.Map<java.lang.String,java.lang.Object> args)
Service
instance and authenticates
the session using credentials passed in from the args
map.
args
- The args
map.
Service
instance.public java.io.InputStream export(java.lang.String search)
search/jobs/export
endpoint, which streams
results back in an input stream.
search
- The search query to run.
InputStream
object that contains the search results.public java.io.InputStream export(java.lang.String search, java.util.Map args)
search/jobs/export
endpoint,
which streams results back in an input stream.
search
- The search query to run.args
- Additional search arguments.
InputStream
object that contains the search results.public java.lang.String getApp()
Service
instance.
A null
value indicates no app context, and a value of
"-"
indicates an app wildcard.
public EntityCollection<Application> getApplications()
public ConfCollection getConfs()
public java.lang.String[] getCapabilities()
public DeploymentClient getDeploymentClient()
public EntityCollection<DeploymentServer> getDeploymentServers()
public EntityCollection<DeploymentServerClass> getDeploymentServerClasses()
public EntityCollection<DeploymentTenant> getDeploymentTenants()
public DistributedConfiguration getDistributedConfiguration()
public EntityCollection<DistributedPeer> getDistributedPeers()
public EventTypeCollection getEventTypes()
public EntityCollection<FiredAlert> getFiredAlerts()
Service
instance.
public EntityCollection<Index> getIndexes()
public ServiceInfo getInfo()
public InputCollection getInputs()
public JobCollection getJobs()
public EntityCollection<LicenseGroup> getLicenseGroups()
public EntityCollection<LicenseMessage> getLicenseMessages()
public java.lang.String getOwner()
"-"
indicates a wildcard, and a null
value indicates
no owner context.
public LicensePoolCollection getLicensePools()
public EntityCollection<LicenseSlave> getLicenseSlaves()
public EntityCollection<LicenseStack> getLicenseStacks()
public EntityCollection<License> getLicenses()
public EntityCollection<Logger> getLoggers()
public MessageCollection getMessages()
public OutputDefault getOutputDefault()
public EntityCollection<OutputGroup> getOutputGroups()
public EntityCollection<OutputServer> getOutputServers()
public EntityCollection<OutputSyslog> getOutputSyslogs()
public java.lang.String getPassword()
public PasswordCollection getPasswords()
public EntityCollection<Role> getRoles()
public SavedSearchCollection getSavedSearches()
public Settings getSettings()
public java.lang.String getToken()
Service
instances.
public java.lang.String getUsername()
public UserCollection getUsers()
public Service login(java.lang.String username, java.lang.String password)
Service
instance with a username and password.
username
- The Splunk account username.password
- The password for the username.
Service
instance.public Service logout()
Service
instance.public java.io.InputStream oneshot(java.lang.String query)
query
- The search query.
public java.io.InputStream oneshot(java.lang.String query, java.util.Map args)
query
- The search query.args
- The search arguments.
public java.net.Socket open(int port) throws java.io.IOException
port
- The port to open. This port must already have been
created as an allowable TCP input to the service.
java.io.IOException
public ResponseMessage parse(java.lang.String query)
query
- The search query.
public ResponseMessage parse(java.lang.String query, java.util.Map args)
query
- The search query.args
- Additional parse arguments.
public ResponseMessage restart()
public ResponseMessage send(java.lang.String path, RequestMessage request)
HttpService.send
method
and applies the Splunk authorization header, which is required for authenticated
interactions with the Splunk service.
send
in class HttpService
path
- The request path.request
- The request message.
public void setToken(java.lang.String value)
Service
instance.
Session tokens can be shared across multiple Service
instances.
value
- The session token.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |