Skip to content

Release/1.11.0 #147

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

Merged
merged 63 commits into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
234773e
Add pagination support to history calls
luke-gumbley Mar 31, 2020
3e25776
Add create-react-app example and fix process.env assignment issue,
fantavlik Jun 30, 2020
851aac6
Make query input from user
fantavlik Jul 4, 2020
b96f50c
Rename Login to Inputs
fantavlik Jul 4, 2020
2f4a336
Ignore create-react-app example for jshint
fantavlik Jul 5, 2020
5293343
Add demo gif and rename to create-splunk-react-app
fantavlik Jul 8, 2020
fd1aba7
Updated HighCharts License.
rmaheshwari-splunk Jun 14, 2021
e31827b
Merge pull request #134 from splunk/master
vmalaviya-splunk Aug 5, 2021
5553034
Changes for sdk-app-collection and apps/local
vmalaviya-splunk Aug 10, 2021
c9f2e45
Updated docker-compose.yml and test.yml
vmalaviya-splunk Aug 10, 2021
5ba2ef9
Merge pull request #135 from splunk/DVPL-9708
vmalaviya-splunk Aug 11, 2021
9dec4e8
package-lock.json updated
ashah-splunk Aug 19, 2021
caa3d04
Update package-lock.json
ashah-splunk Aug 19, 2021
984fdf4
node 8 compatible mocha version
ashah-splunk Aug 19, 2021
b9eca50
Merge pull request #137 from splunk/DVPL-9896
ashah-splunk Aug 20, 2021
e0fa167
login example added
vmalaviya-splunk Aug 20, 2021
467400a
Update README.md
vmalaviya-splunk Aug 20, 2021
8a9b586
Update README.md
vmalaviya-splunk Aug 20, 2021
d4f2997
Change: admin -> username for token creation
vmalaviya-splunk Aug 23, 2021
697c0ad
Merge pull request #138 from splunk/DVPL-9897
ashah-splunk Aug 23, 2021
8ce8c39
Changes for savedsearch history pagination
vmalaviya-splunk Aug 30, 2021
971d655
Update service.js
vmalaviya-splunk Aug 31, 2021
1fcd003
Merge pull request #95 from luke-gumbley/patch-1
fantavlik Aug 31, 2021
fc69de2
Merge pull request #139 from splunk/DVPL-9933
vmalaviya-splunk Sep 1, 2021
d468ab3
Support added for output_mode for oneShotSearch
vmalaviya-splunk Sep 1, 2021
efd2a80
Add create-react-app example and fix process.env assignment issue,
fantavlik Jun 30, 2020
dede966
Make query input from user
fantavlik Jul 4, 2020
90089fb
Rename Login to Inputs
fantavlik Jul 4, 2020
68d7614
Ignore create-react-app example for jshint
fantavlik Jul 5, 2020
84df587
Add demo gif and rename to create-splunk-react-app
fantavlik Jul 8, 2020
43c4000
Update package.json
vmalaviya-splunk Sep 3, 2021
5e29e4f
Merge branch 'create-react-app' of https://github.com/splunk/splunk-s…
vmalaviya-splunk Sep 3, 2021
3614f83
Update SplunkJsExample.js
vmalaviya-splunk Sep 3, 2021
2dc3db3
Merge pull request #99 from splunk/create-react-app
fantavlik Sep 9, 2021
a24ab5f
oneShotSearch resolved
vmalaviya-splunk Sep 14, 2021
9206171
Modification for oneShotSearch:output_mode
vmalaviya-splunk Sep 15, 2021
d427999
Merge pull request #140 from splunk/DVPL-9898
vmalaviya-splunk Sep 15, 2021
c9b4f8e
Update
ashah-splunk Sep 21, 2021
b520a42
Rebase with develop
ashah-splunk Sep 21, 2021
70d87aa
Update README.md
ashah-splunk Sep 21, 2021
389dd8b
Update README.md
ashah-splunk Sep 21, 2021
71f4699
Updated HighCharts License.
rmaheshwari-splunk Jun 14, 2021
85d70ba
Update
ashah-splunk Sep 21, 2021
045343b
Update CREDITS.md
ashah-splunk Sep 21, 2021
4cef9d9
Merge branch 'DVPL-7223' of https://github.com/splunk/splunk-sdk-java…
ashah-splunk Sep 21, 2021
337f75e
Update README.md
ashah-splunk Sep 21, 2021
f6647ad
Merge pull request #119 from splunk/DVPL-7223
ashah-splunk Sep 24, 2021
b67c1c6
.conf CRUD support added
vmalaviya-splunk Nov 19, 2021
fee7c72
remove .cache files
vmalaviya-splunk Nov 19, 2021
18b07e8
Updated null check
vmalaviya-splunk Nov 19, 2021
26ce0c3
Refactored
vmalaviya-splunk Dec 1, 2021
b3fd917
Update context.js
vmalaviya-splunk Dec 1, 2021
b00bef3
Refactored
vmalaviya-splunk Dec 2, 2021
034e411
Structural changes for .conf CRUD functionality
vmalaviya-splunk Jan 5, 2022
422d4d6
Update README.md
vmalaviya-splunk Jan 5, 2022
7b54651
Refactoring
vmalaviya-splunk Jan 5, 2022
5fa52e6
README and test updated
vmalaviya-splunk Jan 7, 2022
381f8aa
Doc string added for new methods
vmalaviya-splunk Jan 7, 2022
5014298
Merge pull request #141 from splunk/DVPL-7124
vmalaviya-splunk Jan 10, 2022
4978bd3
Dependency updates
ashah-splunk Mar 3, 2022
c15c80b
package-lock.json updates
ashah-splunk Mar 3, 2022
8ad2273
Merge pull request #145 from splunk/dependency-updates
ashah-splunk Mar 4, 2022
050f39a
release/1.11.0 changes
vmalaviya-splunk Mar 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os:
Expand All @@ -15,29 +15,29 @@ jobs:
- 8.17.0
splunk-version:
- "8.0"
- "latest"
- "latest"

services:
splunk:
image: splunk/splunk:${{matrix.splunk-version}}
env:
SPLUNK_START_ARGS: --accept-license
SPLUNK_HEC_TOKEN: 11111111-1111-1111-1111-1111111111113
SPLUNK_PASSWORD: changed!
SPLUNK_APPS_URL: https://github.com/splunk/sdk-app-collection/releases/download/v1.0.0/sdk-app-collection.tgz
SPLUNK_APPS_URL: https://github.com/splunk/sdk-app-collection/releases/download/v1.1.0/sdkappcollection.tgz
ports:
- 8000:8000
- 8088:8088
- 8089:8089

steps:
- uses: actions/checkout@v2

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Create .splunkrc file
run: |
cd ~
Expand All @@ -47,10 +47,10 @@ jobs:
echo password=changed! >> .splunkrc
echo scheme=https >> .splunkrc
echo version=${{ matrix.splunk }} >> .splunkrc

- name: Run npm install
run: npm install
run: npm install

- name: Run make test
run: make test
env:
Expand Down
2 changes: 2 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ node_modules
build
client
external
examples/browser/create-react-app
examples/browser/minisplunk
examples/browser/resources
examples\\browser\\create-react-app
examples\\browser\\minisplunk
examples\\browser\\resources
old_english
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Splunk Enterprise SDK for JavaScript Changelog

## v1.11.0

### Major changes
* DVPL-9708 apps/local support ([PR#135](https://github.com/splunk/splunk-sdk-javascript/pull/135))
* .conf CRUD functionality added ([PR#141](https://github.com/splunk/splunk-sdk-javascript/pull/141))
### Minor changes
* NodeUnit to Mocha Transition for Browser Test Cases ([PR#127](https://github.com/splunk/splunk-sdk-javascript/pull/127))
* Login example and README.md change ([PR#138](https://github.com/splunk/splunk-sdk-javascript/pull/138))
* Add pagination support to history calls ([PR#95](https://github.com/splunk/splunk-sdk-javascript/pull/95))
* Changes for savedsearch history pagination ([PR#139](https://github.com/splunk/splunk-sdk-javascript/pull/139))
* Add create-react-app browser example ([PR#99](https://github.com/splunk/splunk-sdk-javascript/pull/99))
* Support added for output_mode for oneShotSearch ([PR#140](https://github.com/splunk/splunk-sdk-javascript/pull/140))
* Updated Highcharts License. ([PR#119](https://github.com/splunk/splunk-sdk-javascript/pull/119))
* package-lock.json updated ([PR#137](https://github.com/splunk/splunk-sdk-javascript/pull/137))
* WIP: Stabilize CI/CD ([PR#115](https://github.com/splunk/splunk-sdk-javascript/pull/115))
* Dependency updates ([PR#145](https://github.com/splunk/splunk-sdk-javascript/pull/145))

## v1.10.0

### Major changes
Expand Down
3 changes: 2 additions & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ Some of the components included in the Splunk Enterprise SDK for JavaScript are
| [dotenv](https://github.com/motdotla/dotenv) | Loads environment varibles from .env file | [BSD 2-Clause](https://github.com/splunk/splunk-sdk-javascript/blob/master/licenses/LICENSE-DOTENV) |
| [cookie](https://github.com/jshttp/cookie) | HTTP cookie parser and serializer for HTTP servers | [MIT](https://github.com/splunk/splunk-sdk-javascript/blob/master/licenses/LICENSE-COOKIE) |
| [elementtree](https://github.com/racker/node-elementtree) | Node.js XML parserer and serializer | [Apache-2.0](https://github.com/splunk/splunk-sdk-javascript/blob/master/licenses/LICENSE-ELEMENTTREE) |
| [needle](https://github.com/tomas/needle) | Node.js http client | [MIT](https://github.com/splunk/splunk-sdk-javascript/blob/master/licenses/LICENSE-NEEDLE) |
| [needle](https://github.com/tomas/needle) | Node.js http client | [MIT](https://github.com/splunk/splunk-sdk-javascript/blob/master/licenses/LICENSE-NEEDLE) |
| [Highcharts](https://github.com/highcharts/highcharts) | Interactive JavaScript charts |
97 changes: 96 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Build Status](https://travis-ci.org/splunk/splunk-sdk-javascript.svg?branch=master)](https://travis-ci.org/splunk/splunk-sdk-javascript)
# The Splunk Enterprise Software Development Kit for JavaScript

#### Version 1.10.0
#### Version 1.11.0

The Splunk Enterprise Software Development Kit (SDK) for JavaScript contains library code and examples designed to enable developers to build applications using the Splunk platform and JavaScript. This SDK supports server-side and client-side JavaScript.

Expand Down Expand Up @@ -89,6 +89,8 @@ This HTML example uses the Splunk Enterprise SDK for JavaScript to list all jobs

This example shows how to use the Splunk Enterprise SDK for JavaScript and Node.js to list all jobs:

##### Login with username and password

```javascript
var splunkjs = require('splunk-sdk');

Expand All @@ -107,6 +109,73 @@ This example shows how to use the Splunk Enterprise SDK for JavaScript and Node.
});
});
```
##### Login with sessionKey

```shell
# Create a sessionKey
curl -k -u <username>:<password> <scheme>://<host>:<port>/services/auth/login -d username=<username> -d password=<password>
```

```javascript
var serviceWithSessionKey = new splunkjs.Service(
{
// Replace the host if you are accessing remote host
scheme: 'https',
host: 'localhost',
port: '8089',
sessionKey: SESSION_KEY, // Add your sessionKey here
version: '8',
});

serviceWithSessionKey.get("search/jobs", { count: 1 }, function (err, res) {
if (err) {
console.log(err);
} else }
console.log("Login successful with sessionKey");
}
});
```

##### Login with token

```shell
#### From shell ####
# Enable token authetication
curl -k -u <username>:<password> -X POST <scheme>://<host>:<port>/services/admin/token-auth/tokens_auth -d disabled=false

# Create a token
curl -k -u <username>:<password> -X POST <scheme>://<host>:<port>/services/authorization/tokens?output_mode=json --data name=<username> --data audience=Users --data-urlencode expires_on=+30d
```

```shell
#### From web ####
# Enable token authentication
Go to settings > Tokens and click on 'Enable Token Authentication'

# Create a token
1. Go to settings > Token and click on 'New Token'
2. Enter the relevant information
3. Copy the created token and save it somewhere safe.
```

```javascript
var serviceWithBearerToken = new splunkjs.Service(
{
// Replace the host if you are accessing remote host
scheme: 'https',
host: 'localhost',
port: '8089',
sessionKey: TOKEN, // Add your token here
version: '8',
});

serviceWithBearerToken.get("search/jobs", { count: 2 }, function (err, res) {
if (err)
console.log(err);
else
console.log("Login successful with bearer token");
});
```

## SDK examples

Expand Down Expand Up @@ -150,6 +219,32 @@ Save the file as **.splunkrc** in the current user's home directory.

Click **Yes**, then continue creating the file.

### Create/Update a .conf file
```javascript

Async.chain([
function (done) {
// Fetch configurations
var configs = svc.configurations(namespace);
configs.fetch(done);
},
async function (configs, done) {
// Create a key-value map to store under a stanza
const filename = "app.conf";
const stanzaName = "install";
var keyValueMap = {}
keyValueMap["state"] = "enabled";
keyValueMap["python.version"] = "python3";

// If file/stanza doesn't exist, it will be created
// else it will be updated.
configs.createAsync(filename, stanzaName, keyValueMap, done);
}
],
function (err) {
done();
});
```

### Client-side examples

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- SPLUNK_START_ARGS=--accept-license
- SPLUNK_HEC_TOKEN=11111111-1111-1111-1111-1111111111113
- SPLUNK_PASSWORD=changed!
- SPLUNK_APPS_URL=https://github.com/splunk/sdk-app-collection/releases/download/v1.0.0/sdk-app-collection.tgz
- SPLUNK_APPS_URL=https://github.com/splunk/sdk-app-collection/releases/download/v1.1.0/sdkappcollection.tgz
ports:
- 8000:8000
- 8088:8088
Expand Down
25 changes: 25 additions & 0 deletions examples/browser/create-splunk-react-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

package-lock.json

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
74 changes: 74 additions & 0 deletions examples/browser/create-splunk-react-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# create-splunk-react-app

Enter this directory and run `yarn start` to view the app:

![create-splunk-react-app demo](create-splunk-react-app.gif)

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.<br />
Open [https://localhost:3000](https://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `yarn build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions examples/browser/create-splunk-react-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "splunk-create-react-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"assert": "^2.0.0",
"jquery": "^3.6.0",
"nodeunit": "^0.11.3",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1",
"splunk-sdk": "^1.10.0"
},
"scripts": {
"start": "HTTPS=true react-scripts start --no-cache",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file not shown.
Loading