From 8816b6053b89acaa19807fbc43a1f4fefd8203d2 Mon Sep 17 00:00:00 2001 From: akaila-splunk Date: Mon, 2 May 2022 13:38:27 +0530 Subject: [PATCH] updated README.md file and removed example references --- .gitignore | 5 ----- README.md | 39 ++++++++------------------------------- docker-compose.yml | 10 ---------- tests/test_utils.py | 2 +- tests/testlib.py | 3 +-- utils/__init__.py | 2 +- 6 files changed, 11 insertions(+), 50 deletions(-) diff --git a/.gitignore b/.gitignore index 2346d353a..05505fe74 100644 --- a/.gitignore +++ b/.gitignore @@ -15,17 +15,12 @@ proxy.log MANIFEST coverage_report test.log -examples/*/local -examples/**/local.meta -examples/**/*.log tests/searchcommands_data/log/ tests/searchcommands_data/output/ -examples/searchcommands_app/searchcommand_app.log Test Results*.html tests/searchcommands/data/app/app.log splunk_sdk.egg-info/ dist/ -examples/searchcommands_app/package/lib/splunklib tests/searchcommands/apps/app_with_logging_configuration/*.log *.observed venv/ diff --git a/README.md b/README.md index 77dedf876..5fde93107 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ #### Version 1.6.19 -The Splunk Enterprise Software Development Kit (SDK) for Python contains library code and examples designed to enable developers to build applications using the Splunk platform. +The Splunk Enterprise Software Development Kit (SDK) for Python contains library code designed to enable developers to build applications using the Splunk platform. The Splunk platform is a search engine and analytic environment that uses a distributed map-reduce architecture to efficiently index, search, and process large time-varying data sets. @@ -18,7 +18,7 @@ The Splunk developer platform enables developers to take advantage of the same t ## Get started with the Splunk Enterprise SDK for Python -The Splunk Enterprise SDK for Python contains library code and examples that show how to programmatically interact with the Splunk platform for a variety of scenarios including searching, saved searches, data inputs, and many more, along with building complete applications. +The Splunk Enterprise SDK for Python contains library code, and it's examples are located in the [splunk-app-examples](https://github.com/splunk/splunk-app-examples) repository, that show how to programmatically interact with the Splunk platform for a variety of scenarios including searching, saved searches, data inputs, and many more, along with building complete applications. ### Requirements @@ -39,7 +39,7 @@ Here's what you need to get going with the Splunk Enterprise SDK for Python. ### Install the SDK -Use the following commands to install the Splunk Enterprise SDK for Python libraries. However, it's not necessary to install the libraries to run the examples and unit tests from the SDK. +Use the following commands to install the Splunk Enterprise SDK for Python libraries. However, it's not necessary to install the libraries to run the unit tests from the SDK. Use `pip`: @@ -68,8 +68,6 @@ To run the examples and unit tests, you must put the root of the SDK on your PYT export PYTHONPATH=~/splunk-sdk-python -The SDK command-line examples require a common set of arguments that specify the host, port, and login credentials for Splunk Enterprise. For a full list of command-line arguments, include `--help` as an argument to any of the examples. - ### Following are the different ways to connect to Splunk Enterprise #### Using username/password ```python @@ -115,29 +113,9 @@ here is an example of .env file: # Session key for authentication #sessionKey= -#### Run the examples - -Examples are located in the **/splunk-sdk-python/examples** directory. To run the examples at the command line, use the Python interpreter and include any arguments that are required by the example. In the commands below, replace "examplename" with the name of the specific example in the directory that you want to run: - -Using username and Password - - python examplename.py --username="admin" --password="changeme" - -Using Bearer token - - python examplename.py --bearerToken= - -Using Session key - - python examplename.py --sessionKey="" +#### SDK examples -If you saved your login credentials in the **.env** file, you can omit those arguments: - - python examplename.py - -To get help for an example, use the `--help` argument with an example: - - python examplename.py --help +Examples for the Splunk Enterprise SDK for Python are located in the [splunk-app-examples](https://github.com/splunk/splunk-app-examples) repository. For details, see the [Examples using the Splunk Enterprise SDK for Python](https://dev.splunk.com/enterprise/docs/devtools/python/sdk-python/examplespython) on the Splunk Developer Portal. #### Run the unit tests @@ -162,10 +140,9 @@ The test suite uses Python's standard library, the built-in `unittest` library, | Directory | Description | |:--------- |:---------------------------------------------------------- | |/docs | Source for Sphinx-based docs and build | -|/examples | Examples demonstrating various SDK features | |/splunklib | Source for the Splunk library modules | |/tests | Source for unit tests | -|/utils | Source for utilities shared by the examples and unit tests | +|/utils | Source for utilities shared by the unit tests | ### Customization * When working with custom search commands such as Custom Streaming Commands or Custom Generating Commands, We may need to add new fields to the records based on certain conditions. @@ -216,7 +193,7 @@ class GeneratorTest(GeneratingCommand): ### Access metadata of modular inputs app * In stream_events() method we can access modular input app metadata from InputDefinition object -* See [GitHub Commit](https://github.com/splunk/splunk-sdk-python/blob/develop/examples/github_commits/bin/github_commits.py) Modular input App example for reference. +* See [GitHub Commit](https://github.com/splunk/splunk-app-examples/blob/master/modularinputs/python/github_commits/bin/github_commits.py) Modular input App example for reference. ```python def stream_events(self, inputs, ew): # other code @@ -262,7 +239,7 @@ To learn about our branching model, see [Branching Model](https://github.com/spl | [REST API Reference Manual](https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTprolog) | Splunk REST API reference documentation | | [Splunk>Docs](https://docs.splunk.com/Documentation) | General documentation for the Splunk platform | | [GitHub Wiki](https://github.com/splunk/splunk-sdk-python/wiki/) | Documentation for this SDK's repository on GitHub | - +| [Splunk Enterprise SDK for Python Examples](https://github.com/splunk/splunk-app-examples) | Examples for this SDK's repository | ## Community diff --git a/docker-compose.yml b/docker-compose.yml index 84c427072..0527a30bd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,16 +9,6 @@ services: - SPLUNK_HEC_TOKEN=11111111-1111-1111-1111-1111111111113 - SPLUNK_PASSWORD=changed! - SPLUNK_APPS_URL=https://github.com/splunk/sdk-app-collection/releases/download/v1.1.0/sdkappcollection.tgz - volumes: - - ./examples/github_forks:/opt/splunk/etc/apps/github_forks - - ./splunklib:/opt/splunk/etc/apps/github_forks/lib/splunklib - - ./examples/random_numbers:/opt/splunk/etc/apps/random_numbers - - ./splunklib:/opt/splunk/etc/apps/random_numbers/lib/splunklib - - ./examples/github_commits:/opt/splunk/etc/apps/github_commits - - ./splunklib:/opt/splunk/etc/apps/github_commits/lib/splunklib - - ./examples/searchcommands_app/package:/opt/splunk/etc/apps/searchcommands_app - - ./splunklib:/opt/splunk/etc/apps/searchcommands_app/lib/splunklib - - ./examples/twitted/twitted:/opt/splunk/etc/apps/twitted ports: - 8000:8000 - 8088:8088 diff --git a/tests/test_utils.py b/tests/test_utils.py index 51080a29d..5b6b712ca 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -4,7 +4,7 @@ try: from utils import * except ImportError: - raise Exception("Add the SDK repository to your PYTHONPATH to run the examples " + raise Exception("Add the SDK repository to your PYTHONPATH to run the test cases " "(e.g., export PYTHONPATH=~/splunk-sdk-python.") diff --git a/tests/testlib.py b/tests/testlib.py index ae3246a21..4a99e026a 100644 --- a/tests/testlib.py +++ b/tests/testlib.py @@ -24,7 +24,6 @@ # Run the test suite on the SDK without installing it. sys.path.insert(0, '../') -sys.path.insert(0, '../examples') import splunklib.client as client from time import sleep @@ -38,7 +37,7 @@ try: from utils import parse except ImportError: - raise Exception("Add the SDK repository to your PYTHONPATH to run the examples " + raise Exception("Add the SDK repository to your PYTHONPATH to run the test cases " "(e.g., export PYTHONPATH=~/splunk-sdk-python.") import os diff --git a/utils/__init__.py b/utils/__init__.py index b1bb77a50..bd0900c3d 100644 --- a/utils/__init__.py +++ b/utils/__init__.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -"""Utility module shared by the SDK examples & unit tests.""" +"""Utility module shared by the SDK unit tests.""" from __future__ import absolute_import from utils.cmdopts import *