From d3a35440457237bd3cb0a5faf25769f0964dea61 Mon Sep 17 00:00:00 2001 From: Alex Kazorian Date: Tue, 19 Aug 2025 22:22:24 -0700 Subject: [PATCH 1/4] updating data orchestrator endpoints --- out/notebooks/splunk.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/out/notebooks/splunk.ts b/out/notebooks/splunk.ts index b3fb1f8..b545a93 100644 --- a/out/notebooks/splunk.ts +++ b/out/notebooks/splunk.ts @@ -99,7 +99,7 @@ export function getSearchHeadClusterMemberClient(service: any): Promise { } /** - * Update a module by calling the PUT /services/spl2/modules/. + * Update a module by calling the PUT /services/orchestrator/v1/spl2/modules/. * @param service Instance of the Javascript SDK Service * @param moduleName Name of the module to append to the namespace to form the request path * @param namespace Full namespace to be used directly to form the request path @@ -110,7 +110,7 @@ export function updateSpl2Module(service: any, moduleName: string, namespace: st // The Splunk SDK for Javascript doesn't currently support the spl2/modules endpoints // nor does it support sending requests in JSON format (only receiving responses), so // for now use the underlying needle library that the SDK uses for requests/responses - console.log(`Request: [PUT] to ${service.prefix}/services/spl2/modules/${encodeURIComponent(namespace)}.${encodeURIComponent(moduleName)}`); + console.log(`Request: [PUT] to ${service.prefix}/services/orchestrator/v1/spl2/modules/${encodeURIComponent(namespace)}.${encodeURIComponent(moduleName)}`); console.log(`Request Body: \n'${JSON.stringify({ 'name': moduleName, 'namespace': namespace, @@ -119,8 +119,8 @@ export function updateSpl2Module(service: any, moduleName: string, namespace: st console.log(`Request Headers: ${JSON.stringify(makeHeaders(service))}`); return needle( 'PUT', - // example: https://myhost.splunkcloud.com:8089/services/spl2/modules/apps.search._default - `${service.prefix}/services/spl2/modules/${encodeURIComponent(namespace)}.${encodeURIComponent(moduleName)}`, + // example: https://myhost.splunkcloud.com:8089/services/orchestrator/v1/spl2/modules/apps.search._default + `${service.prefix}/services/orchestrator/v1/spl2/modules/${encodeURIComponent(namespace)}.${encodeURIComponent(moduleName)}`, { 'name': moduleName, 'namespace': namespace, @@ -194,7 +194,7 @@ export function dispatchSpl2Module(service: any, spl2Module: string, app: string // The Splunk SDK for Javascript doesn't currently support the spl2-module-dispatch endpoint // nor does it support sending requests in JSON format (only receiving responses), so // for now use the underlying needle library that the SDK uses for requests/responses - console.log(`Request: [POST] to ${service.prefix}/servicesNS/-/${encodeURIComponent(app)}/search/spl2-module-dispatch`); + console.log(`Request: [POST] to ${service.prefix}/services/orchestrator/v1/spl2/modules/dispatch`); console.log(`Request Body: \n'${JSON.stringify({ 'module': spl2Module, 'namespace': namespace, @@ -205,7 +205,7 @@ export function dispatchSpl2Module(service: any, spl2Module: string, app: string console.log(`Request Headers: ${JSON.stringify(makeHeaders(service))}`); return needle( 'POST', - `${service.prefix}/servicesNS/-/${encodeURIComponent(app)}/search/spl2-module-dispatch`, + `${service.prefix}/services/orchestrator/v1/spl2/modules/dispatch`, { 'module': spl2Module, 'namespace': namespace, From d82fe2d49e3a3d80573e301145bc80916a60ceaa Mon Sep 17 00:00:00 2001 From: Tim Pavlik Date: Wed, 3 Sep 2025 12:33:13 -0700 Subject: [PATCH 2/4] Fix needle to follow redirects and fix new response format for spl2 dispatch --- out/notebooks/splunk.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/out/notebooks/splunk.ts b/out/notebooks/splunk.ts index b545a93..e81ee8b 100644 --- a/out/notebooks/splunk.ts +++ b/out/notebooks/splunk.ts @@ -60,7 +60,7 @@ export function getSearchHeadClusterMemberClient(service: any): Promise { shcUrl, { 'headers': makeHeaders(service), - 'followAllRedirects': true, + 'follow_max': 5, 'timeout': 0, 'strictSSL': false, 'rejectUnauthorized' : false, @@ -128,7 +128,7 @@ export function updateSpl2Module(service: any, moduleName: string, namespace: st }, { 'headers': makeHeaders(service), - 'followAllRedirects': true, + 'follow_max': 5, 'timeout': 0, 'strictSSL': false, 'rejectUnauthorized' : false, @@ -153,10 +153,10 @@ export function updateSpl2Module(service: any, moduleName: string, namespace: st } /** - * Dispatch a module to create a job using the POST /servicesNS/-//search/spl2-module-dispatch endpoint + * Dispatch a module to create a job using the POST /services/orchestrator/v1/spl2/modules/dispatch endpoint * @param service Instance of the Javascript SDK Service * @param spl2Module Full text of the SPL2 module to run (contents of a SPL2 notebook cell, for example) - * @param app App namespace to run within, this will determine /servicesNS/-//search/spl2-module-dispatch endpoint + * @param app App namespace to run within, this will determine /services/orchestrator/v1/spl2/modules/dispatch endpoint * @param namespace Namespace _within_ the apps. to run, this will be used directly in the body of the request * @param earliest Earliest time to be included in the body of the request * @param latest Latest time to be included in the body of the request @@ -215,7 +215,7 @@ export function dispatchSpl2Module(service: any, spl2Module: string, app: string }, { 'headers': makeHeaders(service), - 'followAllRedirects': true, + 'follow_max': 5, 'timeout': 0, 'strictSSL': false, 'rejectUnauthorized': false, @@ -225,12 +225,12 @@ export function dispatchSpl2Module(service: any, spl2Module: string, app: string console.log(`Response body: \n'${JSON.stringify(response.body)}'`); console.log(`Response headers: \n'${JSON.stringify(response.headers)}'`); const data = response.body; - if (response.statusCode >= 400 || !Array.prototype.isPrototypeOf(data) || data.length < 1) { + if ((response.statusCode >= 400) || !Object.prototype.isPrototypeOf(data) || !Object.prototype.isPrototypeOf(data.queryParameters) || !Object.prototype.isPrototypeOf(data.queryParameters[statementIdentifier])) { handleErrorPayloads(data, response.statusCode); return; } // This is in the expected successful response format - const sid = data[0]['sid']; + const sid = data.queryParameters[statementIdentifier]['sid']; return getSearchJobBySid(service, sid); }); } From 28bad0348b957bffca2d3d2f6bfa49a2560231e1 Mon Sep 17 00:00:00 2001 From: Tim Pavlik Date: Wed, 3 Sep 2025 14:44:36 -0700 Subject: [PATCH 3/4] Create pre-release package --- .github/workflows/package-acceptance-test.yaml | 1 + package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/package-acceptance-test.yaml b/.github/workflows/package-acceptance-test.yaml index 1665487..9d23157 100644 --- a/.github/workflows/package-acceptance-test.yaml +++ b/.github/workflows/package-acceptance-test.yaml @@ -7,6 +7,7 @@ on: branches: - main - master + - tpavlik/stage-v0.3.5-beta1 jobs: package: diff --git a/package-lock.json b/package-lock.json index 18921e6..ddb5917 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "splunk", - "version": "0.3.3", + "version": "0.3.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "splunk", - "version": "0.3.3", + "version": "0.3.4", "license": "MIT", "dependencies": { "@babel/core": "^7.22.8", diff --git a/package.json b/package.json index dea9443..dcdf118 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "splunk", - "version": "0.3.4", + "version": "0.3.5-beta1", "publisher": "Splunk", "engines": { "vscode": "^1.75.0", From 34317d967c7ff913e86a8bbfb2f63fdcb2d9511d Mon Sep 17 00:00:00 2001 From: Tim Pavlik Date: Wed, 3 Sep 2025 15:00:56 -0700 Subject: [PATCH 4/4] Use node v22 --- .github/workflows/build-test.yaml | 4 ++-- .github/workflows/package-acceptance-test.yaml | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 9cb11ae..10500ca 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -22,7 +22,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 - run: npm install - run: xvfb-run -a npm test if: runner.os == 'Linux' @@ -41,7 +41,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 - run: npm install - run: npm run compile-tests - run: echo "Run acceptance tests" && node ./out/test/runFunctionalTests.js diff --git a/.github/workflows/package-acceptance-test.yaml b/.github/workflows/package-acceptance-test.yaml index 9d23157..7fd4222 100644 --- a/.github/workflows/package-acceptance-test.yaml +++ b/.github/workflows/package-acceptance-test.yaml @@ -18,7 +18,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 - run: npm --version - run: node --version - run: npm install @@ -55,7 +55,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 - run: npm --version - run: node --version - run: npm install diff --git a/package-lock.json b/package-lock.json index ddb5917..4aab6a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "splunk", - "version": "0.3.4", + "version": "0.3.5-beta1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "splunk", - "version": "0.3.4", + "version": "0.3.5-beta1", "license": "MIT", "dependencies": { "@babel/core": "^7.22.8", diff --git a/package.json b/package.json index dcdf118..ba3de29 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "publisher": "Splunk", "engines": { "vscode": "^1.75.0", - "node": "18.x" + "node": "22.x" }, "license": "MIT", "displayName": "Splunk Extension",