splunk_rest_client.py
This module proxy all REST call to splunklib SDK, it handles proxy, certs etc in this centralized location.
All clients should use SplunkRestProxy to do REST call instead of calling splunklib SDK directly in business logic code.
MAX_REQUEST_RETRIES = 5
module-attribute
¶
__all__ = ['SplunkRestClient']
module-attribute
¶
SplunkRestClient
¶
Bases: client.Service
Splunk REST client.
Source code in solnlib/splunk_rest_client.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|
__init__(session_key, app, owner='nobody', scheme=None, host=None, port=None, **context)
¶
Initializes SplunkRestClient.
Arguments scheme
, host
and port
are optional in the Splunk
environment (when environment variable SPLUNK_HOME is set). In this
situation get_splunkd_access_info
will be used to set scheme
,
host
and port
. In case of using SplunkRestClient
outside of
Splunk environment - scheme
, host
and port
should be provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session_key |
str
|
Splunk access token. |
required |
app |
str
|
App name of namespace. |
required |
owner |
str
|
Owner of namespace, default is |
'nobody'
|
scheme |
str
|
The access scheme, default is None. |
None
|
host |
str
|
The host name, default is None. |
None
|
port |
int
|
The port number, default is None. |
None
|
context |
dict
|
Other configurations, it can contain |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
if scheme, host or port are invalid. |
Source code in solnlib/splunk_rest_client.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|