first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import moment from 'moment-timezone';
|
||||
import {
|
||||
type IPollFunctions,
|
||||
type IDataObject,
|
||||
type INodeExecutionData,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
NodeConnectionTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { venafiApiRequest } from './GenericFunctions';
|
||||
|
||||
export class VenafiTlsProtectDatacenterTrigger implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Venafi TLS Protect Datacenter Trigger',
|
||||
name: 'venafiTlsProtectDatacenterTrigger',
|
||||
icon: 'file:../venafi.svg',
|
||||
group: ['trigger'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["triggerOn"]}}',
|
||||
description: 'Starts the workflow when Venafi events occur',
|
||||
defaults: {
|
||||
name: 'Venafi TLS Protect Datacenter',
|
||||
},
|
||||
credentials: [
|
||||
{
|
||||
name: 'venafiTlsProtectDatacenterApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
polling: true,
|
||||
inputs: [],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Trigger On',
|
||||
name: 'triggerOn',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Certificate Expired',
|
||||
value: 'certificateExpired',
|
||||
},
|
||||
],
|
||||
required: true,
|
||||
default: 'certificateExpired',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
async poll(this: IPollFunctions): Promise<INodeExecutionData[][] | null> {
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
|
||||
const qs: IDataObject = {};
|
||||
|
||||
const now = moment().format();
|
||||
|
||||
qs.ValidToGreater = webhookData.lastTimeChecked || now;
|
||||
|
||||
qs.ValidToLess = now;
|
||||
|
||||
const { Certificates: certificates } = await venafiApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/vedsdk/certificates',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
webhookData.lastTimeChecked = qs.ValidToLess;
|
||||
|
||||
if (Array.isArray(certificates) && certificates.length !== 0) {
|
||||
return [this.helpers.returnJsonArray(certificates)];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user