Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed examples and it's references from the SDK #450

Merged
merged 3 commits into from May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions .gitignore
Expand Up @@ -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/
Expand Down
39 changes: 8 additions & 31 deletions README.md
Expand Up @@ -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.

Expand All @@ -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

Expand All @@ -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`:

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -115,29 +113,9 @@ here is an example of .env file:
# Session key for authentication
#sessionKey=<Session-Key>

#### 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=<value>

Using Session key

python examplename.py --sessionKey="<value>"
#### 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

Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
10 changes: 0 additions & 10 deletions docker-compose.yml
Expand Up @@ -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
Expand Down
24 changes: 0 additions & 24 deletions examples/abc/README.md

This file was deleted.

70 changes: 0 additions & 70 deletions examples/abc/a.py

This file was deleted.

46 changes: 0 additions & 46 deletions examples/abc/b.py

This file was deleted.

35 changes: 0 additions & 35 deletions examples/abc/c.py

This file was deleted.