mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 16:44:07 -08:00
✨ AWS ELB Node
This commit is contained in:
parent
b4e6f240f2
commit
5238ef282e
428
packages/nodes-base/nodes/Aws/ELB/AwsElb.node.ts
Normal file
428
packages/nodes-base/nodes/Aws/ELB/AwsElb.node.ts
Normal file
|
@ -0,0 +1,428 @@
|
|||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
INodeTypeDescription,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodePropertyOptions,
|
||||
ILoadOptionsFunctions,
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
awsApiRequestSOAP,
|
||||
awsApiRequestSOAPAllItems,
|
||||
} from './GenericFunctions';
|
||||
|
||||
import {
|
||||
loadBalancerFields,
|
||||
loadBalancerOperations,
|
||||
} from './LoadBalancerDescription';
|
||||
|
||||
import {
|
||||
listenerCertificateFields,
|
||||
listenerCertificateOperations,
|
||||
} from './ListenerCertificateDescription';
|
||||
import { response } from 'express';
|
||||
|
||||
export class AwsElb implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'AWS ELB',
|
||||
name: 'awsElb',
|
||||
icon: 'file:elb.png',
|
||||
group: ['output'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Sends data to AWS ELB API',
|
||||
defaults: {
|
||||
name: 'AWS ELB',
|
||||
color: '#FF9900',
|
||||
},
|
||||
inputs: ['main'],
|
||||
outputs: ['main'],
|
||||
credentials: [
|
||||
{
|
||||
name: 'aws',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Listener Certificate',
|
||||
value: 'listenerCertificate',
|
||||
},
|
||||
{
|
||||
name: 'Load Balancer',
|
||||
value: 'loadBalancer',
|
||||
},
|
||||
],
|
||||
default: 'loadBalancer',
|
||||
},
|
||||
...loadBalancerOperations,
|
||||
...loadBalancerFields,
|
||||
|
||||
...listenerCertificateOperations,
|
||||
...listenerCertificateFields,
|
||||
],
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
|
||||
async getLoadBalancers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
|
||||
const params = [
|
||||
'Version=2015-12-01',
|
||||
];
|
||||
|
||||
const data = await awsApiRequestSOAP.call(this, 'elasticloadbalancing', 'GET', '/?Action=DescribeLoadBalancers&' + params.join('&'));
|
||||
|
||||
let loadBalancers = data.DescribeLoadBalancersResponse.DescribeLoadBalancersResult.LoadBalancers.member;
|
||||
|
||||
if (!Array.isArray(loadBalancers)) {
|
||||
loadBalancers = [loadBalancers];
|
||||
}
|
||||
|
||||
for (const loadBalancer of loadBalancers) {
|
||||
|
||||
const loadBalancerArn = loadBalancer.LoadBalancerArn as string;
|
||||
|
||||
const loadBalancerName = loadBalancer.LoadBalancerName as string;
|
||||
|
||||
returnData.push({
|
||||
name: loadBalancerName,
|
||||
value: loadBalancerArn,
|
||||
});
|
||||
}
|
||||
|
||||
return returnData;
|
||||
},
|
||||
|
||||
async getLoadBalancerListeners(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
|
||||
const loadBalancerId = this.getCurrentNodeParameter('loadBalancerId') as string;
|
||||
|
||||
const params = [
|
||||
'Version=2015-12-01',
|
||||
'LoadBalancerArn=' + loadBalancerId,
|
||||
];
|
||||
|
||||
const data = await awsApiRequestSOAP.call(this, 'elasticloadbalancing', 'GET', '/?Action=DescribeListeners&' + params.join('&'));
|
||||
|
||||
let listeners = data.DescribeListenersResponse.DescribeListenersResult.Listeners.member;
|
||||
|
||||
if (!Array.isArray(listeners)) {
|
||||
listeners = [listeners];
|
||||
}
|
||||
|
||||
for (const listener of listeners) {
|
||||
|
||||
const listenerArn = listener.ListenerArn as string;
|
||||
|
||||
const listenerName = listener.ListenerArn as string;
|
||||
|
||||
returnData.push({
|
||||
name: listenerArn,
|
||||
value: listenerName,
|
||||
});
|
||||
}
|
||||
|
||||
return returnData;
|
||||
},
|
||||
|
||||
async getSecurityGroups(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
|
||||
const body = [
|
||||
'Version=2016-11-15',
|
||||
'Action=DescribeSecurityGroups'
|
||||
].join('&');
|
||||
|
||||
const data = await awsApiRequestSOAP.call(this, 'ec2', 'POST', '/', body, {}, { 'Content-Type': 'application/x-www-form-urlencoded', 'charset': 'utf-8', 'User-Agent': 'aws-cli/1.18.124' });
|
||||
|
||||
let securityGroups = data.DescribeSecurityGroupsResponse.securityGroupInfo.item;
|
||||
|
||||
if (!Array.isArray(securityGroups)) {
|
||||
securityGroups = [securityGroups];
|
||||
}
|
||||
|
||||
for (const securityGroup of securityGroups) {
|
||||
|
||||
const securityGroupId = securityGroup.groupId as string;
|
||||
|
||||
const securityGroupName = securityGroup.groupName as string;
|
||||
|
||||
returnData.push({
|
||||
name: securityGroupName,
|
||||
value: securityGroupId,
|
||||
});
|
||||
}
|
||||
|
||||
return returnData;
|
||||
},
|
||||
|
||||
async getSubnets(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
|
||||
const body = [
|
||||
'Version=2016-11-15',
|
||||
'Action=DescribeSubnets'
|
||||
].join('&');
|
||||
|
||||
const data = await awsApiRequestSOAP.call(this, 'ec2', 'POST', '/', body, {}, { 'Content-Type': 'application/x-www-form-urlencoded', 'charset': 'utf-8', 'User-Agent': 'aws-cli/1.18.124' });
|
||||
|
||||
let subnets = data.DescribeSubnetsResponse.subnetSet.item;
|
||||
|
||||
if (!Array.isArray(subnets)) {
|
||||
subnets = [subnets];
|
||||
}
|
||||
|
||||
for (const subnet of subnets) {
|
||||
|
||||
const subnetId = subnet.subnetId as string;
|
||||
|
||||
const subnetName = subnet.subnetId as string;
|
||||
|
||||
returnData.push({
|
||||
name: subnetName,
|
||||
value: subnetId,
|
||||
});
|
||||
}
|
||||
|
||||
return returnData;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const qs: IDataObject = {};
|
||||
const headers: IDataObject = {};
|
||||
let responseData;
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
|
||||
if (resource === 'listenerCertificate') {
|
||||
|
||||
//https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_AddListenerCertificates.html
|
||||
if (operation === 'add') {
|
||||
|
||||
const params = [
|
||||
'Version=2015-12-01',
|
||||
];
|
||||
|
||||
params.push('Certificates.member.1.CertificateArn=' + this.getNodeParameter('certificateId', i) as string);
|
||||
|
||||
params.push('ListenerArn=' + this.getNodeParameter('listenerId', i) as string);
|
||||
|
||||
responseData = await awsApiRequestSOAP.call(this, 'elasticloadbalancing', 'GET', '/?Action=AddListenerCertificates&' + params.join('&'));
|
||||
|
||||
responseData = responseData.AddListenerCertificatesResponse.AddListenerCertificatesResult.Certificates.member;
|
||||
|
||||
}
|
||||
|
||||
//https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeListenerCertificates.html
|
||||
if (operation === 'getAll') {
|
||||
|
||||
const params = [
|
||||
'Version=2015-12-01',
|
||||
];
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
|
||||
|
||||
const listenerId = this.getNodeParameter('listenerId', i) as string;
|
||||
|
||||
params.push(`ListenerArn=${listenerId}`);
|
||||
|
||||
if (returnAll) {
|
||||
|
||||
responseData = await awsApiRequestSOAPAllItems.call(this, 'DescribeListenerCertificatesResponse.DescribeListenerCertificatesResult.Certificates.member', 'elasticloadbalancing', 'GET', '/?Action=DescribeListenerCertificates&' + params.join('&'));
|
||||
|
||||
} else {
|
||||
|
||||
params.push('PageSize=' + this.getNodeParameter('limit', 0) as string);
|
||||
|
||||
responseData = await awsApiRequestSOAP.call(this, 'elasticloadbalancing', 'GET', '/?Action=DescribeListenerCertificates&' + params.join('&'));
|
||||
|
||||
responseData = responseData.DescribeListenerCertificatesResponse.DescribeListenerCertificatesResult.Certificates.member;
|
||||
}
|
||||
}
|
||||
|
||||
//https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_RemoveListenerCertificates.html
|
||||
if (operation === 'remove') {
|
||||
|
||||
const params = [
|
||||
'Version=2015-12-01',
|
||||
];
|
||||
|
||||
params.push('Certificates.member.1.CertificateArn=' + this.getNodeParameter('certificateId', i) as string);
|
||||
|
||||
params.push('ListenerArn=' + this.getNodeParameter('listenerId', i) as string);
|
||||
|
||||
responseData = await awsApiRequestSOAP.call(this, 'elasticloadbalancing', 'GET', '/?Action=RemoveListenerCertificates&' + params.join('&'));
|
||||
|
||||
responseData = { sucess: true };
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (resource === 'loadBalancer') {
|
||||
|
||||
//https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateLoadBalancer.html
|
||||
if (operation === 'create') {
|
||||
|
||||
const ipAddressType = this.getNodeParameter('ipAddressType', i) as string;
|
||||
|
||||
const name = this.getNodeParameter('name', i) as string;
|
||||
|
||||
const schema = this.getNodeParameter('schema', i) as string;
|
||||
|
||||
const type = this.getNodeParameter('type', i) as string;
|
||||
|
||||
const subnets = this.getNodeParameter('subnets', i) as string[];
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
|
||||
const params = [
|
||||
'Version=2015-12-01',
|
||||
];
|
||||
|
||||
params.push(`IpAddressType=${ipAddressType}`);
|
||||
|
||||
params.push(`Name=${name}`);
|
||||
|
||||
params.push(`Scheme=${schema}`);
|
||||
|
||||
params.push(`Type=${type}`);
|
||||
|
||||
for (let i = 1; i <= subnets.length; i++) {
|
||||
|
||||
params.push(`Subnets.member.${i}=${subnets[i - 1]}`);
|
||||
}
|
||||
|
||||
if (additionalFields.securityGroups) {
|
||||
|
||||
const securityGroups = additionalFields.securityGroups as string[];
|
||||
|
||||
for (let i = 1; i <= securityGroups.length; i++) {
|
||||
|
||||
params.push(`SecurityGroups.member.${i}=${securityGroups[i - 1]}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (additionalFields.tagsUi) {
|
||||
|
||||
const tags = (additionalFields.tagsUi as IDataObject).tagValues as IDataObject[];
|
||||
|
||||
if (tags) {
|
||||
|
||||
for (let i = 1; i <= tags.length; i++) {
|
||||
|
||||
params.push(`Tags.member.${i}.Key=${tags[i - 1].key}`);
|
||||
|
||||
params.push(`Tags.member.${i}.Value=${tags[i - 1].value}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
responseData = await awsApiRequestSOAP.call(this, 'elasticloadbalancing', 'GET', '/?Action=CreateLoadBalancer&' + params.join('&'));
|
||||
|
||||
responseData = responseData.CreateLoadBalancerResponse.CreateLoadBalancerResult.LoadBalancers.member;
|
||||
|
||||
}
|
||||
|
||||
//https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DeleteLoadBalancer.html
|
||||
if (operation === 'delete') {
|
||||
|
||||
const params = [
|
||||
'Version=2015-12-01',
|
||||
];
|
||||
|
||||
params.push('LoadBalancerArn=' + this.getNodeParameter('loadBalancerId', i) as string);
|
||||
|
||||
responseData = await awsApiRequestSOAP.call(this, 'elasticloadbalancing', 'GET', '/?Action=DeleteLoadBalancer&' + params.join('&'));
|
||||
|
||||
responseData = { success: true };
|
||||
}
|
||||
|
||||
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html
|
||||
if (operation === 'getAll') {
|
||||
|
||||
const params = [
|
||||
'Version=2015-12-01',
|
||||
];
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
|
||||
|
||||
if (returnAll) {
|
||||
|
||||
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
||||
|
||||
if (filters.names) {
|
||||
|
||||
const names = (filters.names as string).split(',');
|
||||
|
||||
for (let i = 1; i <= names.length; i++) {
|
||||
|
||||
params.push(`Names.member.${i}=${names[i - 1]}`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
responseData = await awsApiRequestSOAPAllItems.call(this, 'DescribeLoadBalancersResponse.DescribeLoadBalancersResult.LoadBalancers.member', 'elasticloadbalancing', 'GET', '/?Action=DescribeLoadBalancers&' + params.join('&'));
|
||||
|
||||
} else {
|
||||
|
||||
params.push('PageSize=' + this.getNodeParameter('limit', 0) as string);
|
||||
|
||||
responseData = await awsApiRequestSOAP.call(this, 'elasticloadbalancing', 'GET', '/?Action=DescribeLoadBalancers&' + params.join('&'));
|
||||
|
||||
responseData = responseData.DescribeLoadBalancersResponse.DescribeLoadBalancersResult.LoadBalancers.member;
|
||||
}
|
||||
}
|
||||
|
||||
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html
|
||||
if (operation === 'get') {
|
||||
|
||||
const params = [
|
||||
'Version=2015-12-01',
|
||||
];
|
||||
|
||||
params.push('LoadBalancerArns.member.1=' + this.getNodeParameter('loadBalancerId', i) as string);
|
||||
|
||||
responseData = await awsApiRequestSOAP.call(this, 'elasticloadbalancing', 'GET', '/?Action=DescribeLoadBalancers&' + params.join('&'));
|
||||
|
||||
responseData = responseData.DescribeLoadBalancersResponse.DescribeLoadBalancersResult.LoadBalancers.member;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
} else {
|
||||
|
||||
returnData.push(responseData);
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
}
|
131
packages/nodes-base/nodes/Aws/ELB/GenericFunctions.ts
Normal file
131
packages/nodes-base/nodes/Aws/ELB/GenericFunctions.ts
Normal file
|
@ -0,0 +1,131 @@
|
|||
import {
|
||||
sign,
|
||||
} from 'aws4';
|
||||
|
||||
import {
|
||||
get,
|
||||
} from 'lodash';
|
||||
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
parseString,
|
||||
} from 'xml2js';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IWebhookFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string | Buffer, query: IDataObject = {}, headers?: object, option: IDataObject = {}, region?: string): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const credentials = this.getCredentials('aws');
|
||||
|
||||
if (credentials === undefined) {
|
||||
throw new Error('No credentials got returned!');
|
||||
}
|
||||
|
||||
const endpoint = `${service}.${credentials.region}.amazonaws.com`;
|
||||
|
||||
// Sign AWS API request with the user credentials
|
||||
const signOpts = { headers: headers || {}, host: endpoint, method, path, body };
|
||||
|
||||
if (Object.keys(query).length > 0) {
|
||||
signOpts.path = `${signOpts.path}&${queryToString(query)}`;
|
||||
}
|
||||
|
||||
sign(signOpts, { accessKeyId: `${credentials.accessKeyId}`, secretAccessKey: `${credentials.secretAccessKey}`});
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
headers: signOpts.headers,
|
||||
method,
|
||||
uri: `https://${endpoint}${signOpts.path}`,
|
||||
body,
|
||||
};
|
||||
|
||||
if (Object.keys(option).length !== 0) {
|
||||
Object.assign(options, option);
|
||||
}
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
} catch (error) {
|
||||
|
||||
const errorMessage = error.response.body.message || error.response.body.Message || error.message;
|
||||
|
||||
if (error.statusCode === 403) {
|
||||
if (errorMessage === 'The security token included in the request is invalid.') {
|
||||
throw new Error('The AWS credentials are not valid!');
|
||||
} else if (errorMessage.startsWith('The request signature we calculated does not match the signature you provided')) {
|
||||
throw new Error('The AWS credentials are not valid!');
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`AWS error response [${error.statusCode}]: ${errorMessage}`);
|
||||
}
|
||||
}
|
||||
|
||||
export async function awsApiRequestREST(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, service: string, method: string, path: string, body?: string, query: IDataObject = {}, headers?: object, options: IDataObject = {}, region?: string): Promise<any> { // tslint:disable-line:no-any
|
||||
const response = await awsApiRequest.call(this, service, method, path, body, query, headers, options, region);
|
||||
try {
|
||||
return JSON.parse(response);
|
||||
} catch (e) {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
export async function awsApiRequestSOAP(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string | Buffer, query: IDataObject = {}, headers?: object, option: IDataObject = {}, region?: string): Promise<any> { // tslint:disable-line:no-any
|
||||
const response = await awsApiRequest.call(this, service, method, path, body, query, headers, option, region);
|
||||
try {
|
||||
return await new Promise((resolve, reject) => {
|
||||
parseString(response, { explicitArray: false }, (err, data) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
export async function awsApiRequestSOAPAllItems(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, propertyName: string, service: string, method: string, path: string, body?: string, query: IDataObject = {}, headers: IDataObject = {}, option: IDataObject = {}, region?: string): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
|
||||
const propertyNameArray = propertyName.split('.');
|
||||
|
||||
do {
|
||||
responseData = await awsApiRequestSOAP.call(this, service, method, path, body, query, headers, option, region);
|
||||
|
||||
if (get(responseData, `${propertyNameArray[0]}.${propertyNameArray[1]}.NextMarker`)) {
|
||||
query['Marker'] = get(responseData, `${propertyNameArray[0]}.${propertyNameArray[1]}.NextMarker`);
|
||||
}
|
||||
if (get(responseData, propertyName)) {
|
||||
if (Array.isArray(get(responseData, propertyName))) {
|
||||
returnData.push.apply(returnData, get(responseData, propertyName));
|
||||
} else {
|
||||
returnData.push(get(responseData, propertyName));
|
||||
}
|
||||
}
|
||||
} while (
|
||||
get(responseData, `${propertyNameArray[0]}.${propertyNameArray[1]}.NextMarker`) !== undefined
|
||||
);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
function queryToString(params: IDataObject) {
|
||||
return Object.keys(params).map(key => key + '=' + params[key]).join('&');
|
||||
}
|
||||
|
|
@ -0,0 +1,265 @@
|
|||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const listenerCertificateOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'listenerCertificate',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Add',
|
||||
value: 'add',
|
||||
description: 'Add the specified SSL server certificate to the certificate list for the specified HTTPS or TLS listener',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get all listener certificates',
|
||||
},
|
||||
{
|
||||
name: 'Remove',
|
||||
value: 'remove',
|
||||
description: 'Remove the specified certificate from the certificate list for the specified HTTPS or TLS listener',
|
||||
},
|
||||
],
|
||||
default: 'add',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
||||
export const listenerCertificateFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* listenerCertificate:add */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Load Balancer ARN',
|
||||
name: 'loadBalancerId',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getLoadBalancers',
|
||||
},
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'listenerCertificate',
|
||||
],
|
||||
operation: [
|
||||
'add',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Unique identifier for a particular loadBalancer',
|
||||
},
|
||||
{
|
||||
displayName: 'Listener ARN',
|
||||
name: 'listenerId',
|
||||
type: 'options',
|
||||
required: true,
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getLoadBalancerListeners',
|
||||
loadOptionsDependsOn: [
|
||||
'loadBalancerId',
|
||||
],
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'listenerCertificate',
|
||||
],
|
||||
operation: [
|
||||
'add',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Unique identifier for a particular loadBalancer',
|
||||
},
|
||||
{
|
||||
displayName: 'Certificate ARN',
|
||||
name: 'certificateId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'listenerCertificate',
|
||||
],
|
||||
operation: [
|
||||
'add',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Unique identifier for a particular loadBalancer',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* listenerCertificate:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
{
|
||||
displayName: 'Load Balancer ARN',
|
||||
name: 'loadBalancerId',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getLoadBalancers',
|
||||
},
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'listenerCertificate',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Unique identifier for a particular loadBalancer',
|
||||
},
|
||||
{
|
||||
displayName: 'Listener ARN',
|
||||
name: 'listenerId',
|
||||
type: 'options',
|
||||
required: true,
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getLoadBalancerListeners',
|
||||
loadOptionsDependsOn: [
|
||||
'loadBalancerId',
|
||||
],
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'listenerCertificate',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Unique identifier for a particular loadBalancer',
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'listenerCertificate',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'If all results should be returned or only up to a given limit.',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 100,
|
||||
typeOptions: {
|
||||
maxValue: 400,
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'listenerCertificate',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* listenerCertificate:remove */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Load Balancer ARN',
|
||||
name: 'loadBalancerId',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getLoadBalancers',
|
||||
},
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'listenerCertificate',
|
||||
],
|
||||
operation: [
|
||||
'remove',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Unique identifier for a particular loadBalancer',
|
||||
},
|
||||
{
|
||||
displayName: 'Listener ARN',
|
||||
name: 'listenerId',
|
||||
type: 'options',
|
||||
required: true,
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getLoadBalancerListeners',
|
||||
loadOptionsDependsOn: [
|
||||
'loadBalancerId',
|
||||
],
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'listenerCertificate',
|
||||
],
|
||||
operation: [
|
||||
'remove',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Unique identifier for a particular loadBalancer',
|
||||
},
|
||||
{
|
||||
displayName: 'Certificate ARN',
|
||||
name: 'certificateId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'listenerCertificate',
|
||||
],
|
||||
operation: [
|
||||
'remove',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Unique identifier for a particular loadBalancer',
|
||||
},
|
||||
|
||||
] as INodeProperties[];
|
346
packages/nodes-base/nodes/Aws/ELB/LoadBalancerDescription.ts
Normal file
346
packages/nodes-base/nodes/Aws/ELB/LoadBalancerDescription.ts
Normal file
|
@ -0,0 +1,346 @@
|
|||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const loadBalancerOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'loadBalancer',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a load balancer',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a load balancer',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a load balancer',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get all load balancers',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
||||
export const loadBalancerFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* loadBalancer:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'IP Address Type',
|
||||
name: 'ipAddressType',
|
||||
type: 'options',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'loadBalancer',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'ipv4',
|
||||
value: 'ipv4',
|
||||
},
|
||||
{
|
||||
name: 'dualstack',
|
||||
value: 'dualstack',
|
||||
},
|
||||
],
|
||||
default: 'ipv4',
|
||||
description: 'The type of IP addresses used by the subnets for your load balancer',
|
||||
},
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'loadBalancer',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'This name must be unique per region per account, can have a maximum of 32 characters',
|
||||
},
|
||||
{
|
||||
displayName: 'Schema',
|
||||
name: 'schema',
|
||||
type: 'options',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'loadBalancer',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Internal',
|
||||
value: 'internal',
|
||||
},
|
||||
{
|
||||
name: 'Internet Facing',
|
||||
value: 'internet-facing',
|
||||
},
|
||||
],
|
||||
default: 'internet-facing',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'loadBalancer',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Application',
|
||||
value: 'application',
|
||||
},
|
||||
{
|
||||
name: 'Network',
|
||||
value: 'network',
|
||||
},
|
||||
],
|
||||
default: 'application',
|
||||
},
|
||||
{
|
||||
displayName: 'Subnet IDs',
|
||||
name: 'subnets',
|
||||
type: 'multiOptions',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'loadBalancer',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getSubnets',
|
||||
},
|
||||
required: true,
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'loadBalancer',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Security Group IDs',
|
||||
name: 'securityGroups',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getSecurityGroups',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Tags',
|
||||
name: 'tagsUi',
|
||||
placeholder: 'Add Tag',
|
||||
type: 'fixedCollection',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'tagValues',
|
||||
displayName: 'Tag',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Key',
|
||||
name: 'key',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The key of the tag',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The value of the tag',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* loadBalancer:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Load Balancer ARN',
|
||||
name: 'loadBalancerId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'loadBalancer',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Unique identifier for a particular loadBalancer',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* loadBalancer:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'loadBalancer',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'If all results should be returned or only up to a given limit.',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 100,
|
||||
typeOptions: {
|
||||
maxValue: 400,
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'loadBalancer',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'loadBalancer',
|
||||
],
|
||||
returnAll: [
|
||||
true,
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Names',
|
||||
name: 'names',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The names of the load balancers. Multiples can be defined separated by comma.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* loadBalancer:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Load Balancer ARN',
|
||||
name: 'loadBalancerId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'loadBalancer',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'ID of loadBalancer to delete',
|
||||
},
|
||||
] as INodeProperties[];
|
BIN
packages/nodes-base/nodes/Aws/ELB/elb.png
Normal file
BIN
packages/nodes-base/nodes/Aws/ELB/elb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
|
@ -185,6 +185,7 @@
|
|||
"dist/nodes/Affinity/Affinity.node.js",
|
||||
"dist/nodes/Affinity/AffinityTrigger.node.js",
|
||||
"dist/nodes/Aws/AwsLambda.node.js",
|
||||
"dist/nodes/Aws/ELB/AwsElb.node.js",
|
||||
"dist/nodes/Aws/S3/AwsS3.node.js",
|
||||
"dist/nodes/Aws/AwsSes.node.js",
|
||||
"dist/nodes/Aws/AwsSns.node.js",
|
||||
|
|
Loading…
Reference in a new issue