From 1f70f49ce5784baba7fd779b23209bae4f6b039a Mon Sep 17 00:00:00 2001 From: qg-horie <36725144+qg-horie@users.noreply.github.com> Date: Mon, 24 Jul 2023 23:01:49 +0900 Subject: [PATCH] feat(Rundeck Node): Add support for node filters (#5633) --- .../nodes-base/nodes/Rundeck/Rundeck.node.ts | 18 +++++++++++++++++- .../nodes-base/nodes/Rundeck/RundeckApi.ts | 9 +++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/packages/nodes-base/nodes/Rundeck/Rundeck.node.ts b/packages/nodes-base/nodes/Rundeck/Rundeck.node.ts index 1ad253620f..1f9d76c53c 100644 --- a/packages/nodes-base/nodes/Rundeck/Rundeck.node.ts +++ b/packages/nodes-base/nodes/Rundeck/Rundeck.node.ts @@ -119,6 +119,21 @@ export class Rundeck implements INodeType { }, ], }, + { + displayName: 'Filter', + name: 'filter', + type: 'string', + displayOptions: { + show: { + operation: ['execute'], + resource: ['job'], + }, + }, + default: '', + placeholder: 'Add Filters', + required: false, + description: 'Filter Rundeck nodes by name', + }, // ---------------------------------- // job:getMetadata @@ -161,7 +176,8 @@ export class Rundeck implements INodeType { const jobid = this.getNodeParameter('jobid', i) as string; const rundeckArguments = (this.getNodeParameter('arguments', i) as IDataObject) .arguments as IDataObject[]; - const response = await rundeckApi.executeJob(jobid, rundeckArguments); + const filter = this.getNodeParameter('filter', i) as string; + const response = await rundeckApi.executeJob(jobid, rundeckArguments, filter); returnData.push(response); } else if (operation === 'getMetadata') { diff --git a/packages/nodes-base/nodes/Rundeck/RundeckApi.ts b/packages/nodes-base/nodes/Rundeck/RundeckApi.ts index fe85acde4e..ff2cb11e6f 100644 --- a/packages/nodes-base/nodes/Rundeck/RundeckApi.ts +++ b/packages/nodes-base/nodes/Rundeck/RundeckApi.ts @@ -49,7 +49,7 @@ export class RundeckApi { this.credentials = credentials as unknown as RundeckCredentials; } - async executeJob(jobId: string, args: IDataObject[]): Promise { + async executeJob(jobId: string, args: IDataObject[], filter?: string): Promise { let params = ''; if (args) { @@ -62,7 +62,12 @@ export class RundeckApi { argString: params, }; - return this.request('POST', `/api/14/job/${jobId}/run`, body, {}); + const query: IDataObject = {}; + if (filter) { + query.filter = filter; + } + + return this.request('POST', `/api/14/job/${jobId}/run`, body, query); } async getJobMetadata(jobId: string): Promise {