Skip to content

Commit 008d4c7

Browse files
committed
new components
1 parent dbbb3b0 commit 008d4c7

File tree

9 files changed

+243
-530
lines changed

9 files changed

+243
-530
lines changed

components/splunk/actions/get-search-job-status/get-search-job-status.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export default {
1414
"selfSigned",
1515
],
1616
},
17-
searchId: {
17+
jobId: {
1818
propDefinition: [
1919
splunk,
20-
"searchId",
20+
"jobId",
2121
(c) => ({
2222
selfSigned: c.selfSigned,
2323
}),
@@ -28,9 +28,9 @@ export default {
2828
const response = await this.splunk.getSearchJobStatus({
2929
$,
3030
selfSigned: this.selfSigned,
31-
searchId: this.searchId,
31+
jobId: this.jobId,
3232
});
33-
$.export("$summary", `Successfully retrieved status for job ID ${this.searchId}`);
33+
$.export("$summary", `Successfully retrieved status for job ID ${this.jobId}`);
3434
return response;
3535
},
3636
};

components/splunk/actions/run-search/run-search.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ export default {
1515
],
1616
},
1717
query: {
18-
type: "string",
19-
label: "Search Query",
20-
description: "The Splunk search query. Example: `search *`. [See the documentation](https://docs.splunk.com/Documentation/Splunk/9.4.1/SearchReference/Search) for more information about search command sytax.",
18+
propDefinition: [
19+
splunk,
20+
"query",
21+
],
2122
},
2223
earliestTime: {
2324
type: "string",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import splunk from "../../splunk.app.mjs";
2+
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
3+
4+
export default {
5+
props: {
6+
splunk,
7+
timer: {
8+
type: "$.interface.timer",
9+
default: {
10+
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
11+
},
12+
},
13+
db: "$.service.db",
14+
selfSigned: {
15+
propDefinition: [
16+
splunk,
17+
"selfSigned",
18+
],
19+
},
20+
},
21+
methods: {
22+
async getRecentJobIds() {
23+
const results = this.splunk.paginate({
24+
resourceFn: this.splunk.listJobs,
25+
args: {
26+
selfSigned: this.selfSigned,
27+
},
28+
});
29+
const jobIds = [];
30+
for await (const job of results) {
31+
jobIds.push(job.content.sid);
32+
}
33+
return jobIds;
34+
},
35+
},
36+
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import common from "../common/base.mjs";
2+
3+
export default {
4+
...common,
5+
key: "splunk-new-alert-fired",
6+
name: "New Alert Fired",
7+
description: "Emit new event when a new alert is triggered in Splunk. [See the documentation](https://docs.splunk.com/Documentation/Splunk/9.4.1/RESTREF/RESTsearch#alerts.2Ffired_alerts)",
8+
version: "0.0.1",
9+
type: "source",
10+
dedupe: "unique",
11+
methods: {
12+
...common.methods,
13+
generateMeta(alert) {
14+
return {
15+
id: alert.id,
16+
summary: `New Alert Fired: ${alert.name}`,
17+
ts: Date.now(),
18+
};
19+
},
20+
},
21+
async run() {
22+
const results = this.splunk.paginate({
23+
resourceFn: this.splunk.listFiredAlerts,
24+
args: {
25+
selfSigned: this.selfSigned,
26+
},
27+
});
28+
29+
const alerts = [];
30+
for await (const item of results) {
31+
alerts.push(item);
32+
}
33+
34+
alerts.forEach((alert) => {
35+
const meta = this.generateMeta(alert);
36+
this.$emit(alert, meta);
37+
});
38+
},
39+
};

components/splunk/sources/new-alert-instant/new-alert-instant.mjs

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)