@@ -288,6 +288,7 @@ def connect(**kwargs):
288288 """
289289 return Service (** kwargs ).login ()
290290
291+
291292# In preparation for adding Storm support, we added an
292293# intermediary class between Service and Context. Storm's
293294# API is not going to be the same as enterprise Splunk's
@@ -297,6 +298,7 @@ def connect(**kwargs):
297298class _BaseService (Context ):
298299 pass
299300
301+
300302class Service (_BaseService ):
301303 """A Pythonic binding to Splunk instances.
302304
@@ -609,6 +611,7 @@ def users(self):
609611 """
610612 return Users (self )
611613
614+
612615class Endpoint (object ):
613616 """This class represents individual Splunk resources in the Splunk REST API.
614617
@@ -742,6 +745,7 @@ def post(self, path_segment="", owner=None, app=None, sharing=None, **query):
742745 owner = owner , app = app , sharing = sharing ,
743746 ** query )
744747
748+
745749# kwargs: path, app, owner, sharing, state
746750class Entity (Endpoint ):
747751 """This class is a base class for Splunk entities in the REST API, such as
@@ -1074,6 +1078,7 @@ def update(self, **kwargs):
10741078 self .post (** kwargs )
10751079 return self
10761080
1081+
10771082class ReadOnlyCollection (Endpoint ):
10781083 """This class represents a read-only collection of entities in the Splunk
10791084 instance.
@@ -1394,6 +1399,7 @@ def list(self, count=None, **kwargs):
13941399 # return self._load_list(response)
13951400 return list (self .iter (count = count , ** kwargs ))
13961401
1402+
13971403class Collection (ReadOnlyCollection ):
13981404 """A collection of entities.
13991405
@@ -1530,6 +1536,7 @@ def delete(self, name, **params):
15301536 raise
15311537 return self
15321538
1539+
15331540class ConfigurationFile (Collection ):
15341541 """This class contains all of the stanzas from one configuration file.
15351542 """
@@ -1540,6 +1547,7 @@ def __init__(self, service, path, **kwargs):
15401547 Collection .__init__ (self , service , path , item = Stanza )
15411548 self .name = kwargs ['state' ]['title' ]
15421549
1550+
15431551class Configurations (Collection ):
15441552 """This class provides access to the configuration files from this Splunk
15451553 instance. Retrieve this collection using :meth:`Service.confs`.
@@ -1639,6 +1647,7 @@ def __len__(self):
16391647 return len ([x for x in self ._state .content .keys ()
16401648 if not x .startswith ('eai' ) and x != 'disabled' ])
16411649
1650+
16421651class AlertGroup (Entity ):
16431652 """This class represents a group of fired alerts for a saved search. Access
16441653 it using the :meth:`alerts` property."""
@@ -1665,6 +1674,7 @@ def count(self):
16651674 """
16661675 return int (self .content .get ('triggered_alert_count' , 0 ))
16671676
1677+
16681678class Indexes (Collection ):
16691679 """This class contains the collection of indexes in this Splunk instance.
16701680 Retrieve this collection using :meth:`Service.indexes`.
@@ -2814,6 +2824,7 @@ def itemmeta(self):
28142824 """
28152825 raise NotSupportedError ()
28162826
2827+
28172828class Message (Entity ):
28182829 def __init__ (self , service , path , ** kwargs ):
28192830 Entity .__init__ (self , service , path , ** kwargs )
@@ -2826,6 +2837,7 @@ def value(self):
28262837 """
28272838 return self [self .name ]
28282839
2840+
28292841class ModularInputKind (Entity ):
28302842 """This class contains the different types of modular inputs. Retrieve this
28312843 collection using :meth:`Service.modular_input_kinds`.
@@ -3040,6 +3052,7 @@ def create(self, name, search, **kwargs):
30403052 """
30413053 return Collection .create (self , name , search = search , ** kwargs )
30423054
3055+
30433056class Settings (Entity ):
30443057 """This class represents configuration settings for a Splunk service.
30453058 Retrieve this collection using :meth:`Service.settings`."""
@@ -3060,6 +3073,7 @@ def update(self, **kwargs):
30603073 self .service .post ("server/settings/settings" , ** kwargs )
30613074 return self
30623075
3076+
30633077class User (Entity ):
30643078 """This class represents a Splunk user.
30653079 """
@@ -3072,6 +3086,7 @@ def role_entities(self):
30723086 """
30733087 return [self .service .roles [name ] for name in self .content .roles ]
30743088
3089+
30753090# Splunk automatically lowercases new user names so we need to match that
30763091# behavior here to ensure that the subsequent member lookup works correctly.
30773092class Users (Collection ):
@@ -3203,7 +3218,6 @@ def revoke(self, *capabilities_to_revoke):
32033218 return self
32043219
32053220
3206-
32073221class Roles (Collection ):
32083222 """This class represents the collection of roles in the Splunk instance.
32093223 Retrieve this collection using :meth:`Service.roles`."""
@@ -3284,7 +3298,3 @@ def package(self):
32843298 def updateInfo (self ):
32853299 """Returns any update information that is available for the app."""
32863300 return self ._run_action ("update" )
3287-
3288-
3289-
3290-
0 commit comments