当前位置: 首页>>代码示例>>Python>>正文


Python client.Entity方法代码示例

本文整理汇总了Python中splunklib.client.Entity方法的典型用法代码示例。如果您正苦于以下问题:Python client.Entity方法的具体用法?Python client.Entity怎么用?Python client.Entity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在splunklib.client的用法示例。


在下文中一共展示了client.Entity方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __eq__

# 需要导入模块: from splunklib import client [as 别名]
# 或者: from splunklib.client import Entity [as 别名]
def __eq__(self, other):
        """Raises IncomparableException.

        Since Entity objects are snapshots of times on the server, no
        simple definition of equality will suffice beyond instance
        equality, and instance equality leads to strange situations
        such as::

            import splunklib.client as client
            c = client.connect(...)
            saved_searches = c.saved_searches
            x = saved_searches['asearch']

        but then ``x != saved_searches['asearch']``.

        whether or not there was a change on the server. Rather than
        try to do something fancy, we simple declare that equality is
        undefined for Entities.

        Makes no roundtrips to the server.
        """
        raise IncomparableException(
            "Equality is undefined for objects of class %s" % \
                self.__class__.__name__) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:26,代码来源:client.py

示例2: create

# 需要导入模块: from splunklib import client [as 别名]
# 或者: from splunklib.client import Entity [as 别名]
def create(self, name):
        """ Creates a configuration file named *name*.

        If there is already a configuration file with that name,
        the existing file is returned.

        :param name: The name of the configuration file.
        :type name: ``string``

        :return: The :class:`ConfigurationFile` object.
        """
        # This has to be overridden to handle the plumbing of creating
        # a ConfigurationFile (which is a Collection) instead of some
        # Entity.
        if not isinstance(name, six.string_types):
            raise ValueError("Invalid name: %s" % repr(name))
        response = self.post(__conf=name)
        if response.status == 303:
            return self[name]
        elif response.status == 201:
            return ConfigurationFile(self.service, PATH_CONF % name, item=Stanza, state={'title': name})
        else:
            raise ValueError("Unexpected status code %s returned from creating a stanza" % response.status) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:25,代码来源:client.py

示例3: __init__

# 需要导入模块: from splunklib import client [as 别名]
# 或者: from splunklib.client import Entity [as 别名]
def __init__(self, service, path, kind=None, **kwargs):
        # kind can be omitted (in which case it is inferred from the path)
        # Otherwise, valid values are the paths from data/inputs ("udp",
        # "monitor", "tcp/raw"), or two special cases: "tcp" (which is "tcp/raw")
        # and "splunktcp" (which is "tcp/cooked").
        Entity.__init__(self, service, path, **kwargs)
        if kind is None:
            path_segments = path.split('/')
            i = path_segments.index('inputs') + 1
            if path_segments[i] == 'tcp':
                self.kind = path_segments[i] + '/' + path_segments[i+1]
            else:
                self.kind = path_segments[i]
        else:
            self.kind = kind

        # Handle old input kind names.
        if self.kind == 'tcp':
            self.kind = 'tcp/raw'
        if self.kind == 'splunktcp':
            self.kind = 'tcp/cooked' 
开发者ID:remg427,项目名称:misp42splunk,代码行数:23,代码来源:client.py

示例4: update

# 需要导入模块: from splunklib import client [as 别名]
# 或者: from splunklib.client import Entity [as 别名]
def update(self, search=None, **kwargs):
        """Updates the server with any changes you've made to the current saved
        search along with any additional arguments you specify.

        :param `search`: The search query (optional).
        :type search: ``string``
        :param `kwargs`: Additional arguments (optional). For a list of available
            parameters, see `Saved search parameters
            <http://dev.splunk.com/view/SP-CAAAEE5#savedsearchparams>`_
            on Splunk Developer Portal.
        :type kwargs: ``dict``

        :return: The :class:`SavedSearch`.
        """
        # Updates to a saved search *require* that the search string be
        # passed, so we pass the current search string if a value wasn't
        # provided by the caller.
        if search is None: search = self.content.search
        Entity.update(self, search=search, **kwargs)
        return self 
开发者ID:remg427,项目名称:misp42splunk,代码行数:22,代码来源:client.py

示例5: event_types

# 需要导入模块: from splunklib import client [as 别名]
# 或者: from splunklib.client import Entity [as 别名]
def event_types(self):
        """Returns the collection of event types defined in this Splunk instance.

        :return: An :class:`Entity` containing the event types.
        """
        return Collection(self, PATH_EVENT_TYPES) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:8,代码来源:client.py

示例6: _run_action

# 需要导入模块: from splunklib import client [as 别名]
# 或者: from splunklib.client import Entity [as 别名]
def _run_action(self, path_segment, **kwargs):
        """Run a method and return the content Record from the returned XML.

        A method is a relative path from an Entity that is not itself
        an Entity. _run_action assumes that the returned XML is an
        Atom field containing one Entry, and the contents of Entry is
        what should be the return value. This is right in enough cases
        to make this method useful.
        """
        response = self.get(path_segment, **kwargs)
        data = self._load_atom_entry(response)
        rec = _parse_atom_entry(data)
        return rec.content 
开发者ID:remg427,项目名称:misp42splunk,代码行数:15,代码来源:client.py

示例7: get

# 需要导入模块: from splunklib import client [as 别名]
# 或者: from splunklib.client import Entity [as 别名]
def get(self, path_segment="", owner=None, app=None, sharing=None, **query):
        owner, app, sharing = self._proper_namespace(owner, app, sharing)
        return super(Entity, self).get(path_segment, owner=owner, app=app, sharing=sharing, **query) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:5,代码来源:client.py

示例8: post

# 需要导入模块: from splunklib import client [as 别名]
# 或者: from splunklib.client import Entity [as 别名]
def post(self, path_segment="", owner=None, app=None, sharing=None, **query):
        owner, app, sharing = self._proper_namespace(owner, app, sharing)
        return super(Entity, self).post(path_segment, owner=owner, app=app, sharing=sharing, **query) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:5,代码来源:client.py

示例9: __contains__

# 需要导入模块: from splunklib import client [as 别名]
# 或者: from splunklib.client import Entity [as 别名]
def __contains__(self, name):
        args = self.state.content['endpoints']['args']
        if name in args:
            return True
        else:
            return Entity.__contains__(self, name) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:8,代码来源:client.py

示例10: __getitem__

# 需要导入模块: from splunklib import client [as 别名]
# 或者: from splunklib.client import Entity [as 别名]
def __getitem__(self, name):
        args = self.state.content['endpoint']['args']
        if name in args:
            return args['item']
        else:
            return Entity.__getitem__(self, name) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:8,代码来源:client.py


注:本文中的splunklib.client.Entity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。