diff --git a/packages/nodes-base/nodes/Aws/ELB/AwsElb.node.json b/packages/nodes-base/nodes/Aws/ELB/AwsElb.node.json new file mode 100644 index 0000000000..347e577a28 --- /dev/null +++ b/packages/nodes-base/nodes/Aws/ELB/AwsElb.node.json @@ -0,0 +1,18 @@ +{ + "node": "n8n-nodes-base.awsElb", + "nodeVersion": "1.0", + "codexVersion": "1.0", + "categories": ["Development"], + "resources": { + "credentialDocumentation": [ + { + "url": "https://docs.n8n.io/credentials/aws" + } + ], + "primaryDocumentation": [ + { + "url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.awsElb/" + } + ] + } +} diff --git a/packages/nodes-base/nodes/Aws/ELB/AwsElb.node.ts b/packages/nodes-base/nodes/Aws/ELB/AwsElb.node.ts new file mode 100644 index 0000000000..0753d321f4 --- /dev/null +++ b/packages/nodes-base/nodes/Aws/ELB/AwsElb.node.ts @@ -0,0 +1,463 @@ +import { IExecuteFunctions } from 'n8n-core'; + +import { + IDataObject, + ILoadOptionsFunctions, + INodeExecutionData, + INodePropertyOptions, + INodeType, + INodeTypeDescription, + JsonObject, +} from 'n8n-workflow'; + +import { awsApiRequestSOAP, awsApiRequestSOAPAllItems } from './GenericFunctions'; + +import { loadBalancerFields, loadBalancerOperations } from './LoadBalancerDescription'; + +import { + listenerCertificateFields, + listenerCertificateOperations, +} from './ListenerCertificateDescription'; + +export class AwsElb implements INodeType { + description: INodeTypeDescription = { + displayName: 'AWS ELB', + name: 'awsElb', + icon: 'file:elb.svg', + 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', + noDataExpression: true, + options: [ + { + name: 'Listener Certificate', + value: 'listenerCertificate', + }, + { + name: 'Load Balancer', + value: 'loadBalancer', + }, + ], + default: 'loadBalancer', + }, + ...loadBalancerOperations, + ...loadBalancerFields, + + ...listenerCertificateOperations, + ...listenerCertificateFields, + ], + }; + + methods = { + loadOptions: { + async getLoadBalancers(this: ILoadOptionsFunctions): Promise { + 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 { + 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 { + 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 { + 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 { + const items = this.getInputData(); + const returnData: 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++) { + try { + 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 === 'getMany') { + 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/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html + if (operation === 'getMany') { + 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/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.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; + } + } + + returnData.push( + ...this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { + itemData: { item: i }, + }), + ); + } catch (error) { + if (this.continueOnFail()) { + returnData.push({ error: (error as JsonObject).toString() }); + continue; + } + + throw error; + } + } + + return [returnData as INodeExecutionData[]]; + } +} diff --git a/packages/nodes-base/nodes/Aws/ELB/GenericFunctions.ts b/packages/nodes-base/nodes/Aws/ELB/GenericFunctions.ts new file mode 100644 index 0000000000..655af70b1a --- /dev/null +++ b/packages/nodes-base/nodes/Aws/ELB/GenericFunctions.ts @@ -0,0 +1,95 @@ +import { + get, +} from 'lodash'; + +import { + parseString, +} from 'xml2js'; + +import { + IExecuteFunctions, + IHookFunctions, + ILoadOptionsFunctions, + IWebhookFunctions, +} from 'n8n-core'; + +import { + IDataObject, IHttpRequestOptions, JsonObject, NodeApiError, +} 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 { // tslint:disable-line:no-any + + const credentials = await this.getCredentials('aws'); + + const requestOptions = { + qs: { + ...query, + service, + path, + }, + headers, + method, + url: '', + body, + region: credentials?.region as string, + } as IHttpRequestOptions; + + try { + return await this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions); + } catch (error) { + throw new NodeApiError(this.getNode(), error as JsonObject); + } +} + +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 { // 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 { // 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 { // 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; +} diff --git a/packages/nodes-base/nodes/Aws/ELB/ListenerCertificateDescription.ts b/packages/nodes-base/nodes/Aws/ELB/ListenerCertificateDescription.ts new file mode 100644 index 0000000000..32d5a5d44b --- /dev/null +++ b/packages/nodes-base/nodes/Aws/ELB/ListenerCertificateDescription.ts @@ -0,0 +1,269 @@ +import { + INodeProperties, +} from 'n8n-workflow'; + +export const listenerCertificateOperations: INodeProperties[] = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + noDataExpression: true, + 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', + action: 'Add a listener certificate', + }, + { + name: 'Get Many', + value: 'getMany', + description: 'Get many listener certificates', + action: 'Get many listener certificates', + }, + { + name: 'Remove', + value: 'remove', + description: 'Remove the specified certificate from the certificate list for the specified HTTPS or TLS listener', + action: 'Remove a listener certificate', + }, + ], + default: 'add', + }, +]; + +export const listenerCertificateFields: INodeProperties[] = [ + + /* -------------------------------------------------------------------------- */ + /* listenerCertificate:add */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Load Balancer ARN Name or ID', + name: 'loadBalancerId', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getLoadBalancers', + }, + required: true, + displayOptions: { + show: { + resource: [ + 'listenerCertificate', + ], + operation: [ + 'add', + ], + }, + }, + default: '', + description: 'Unique identifier for a particular loadBalancer. Choose from the list, or specify an ID using an expression.', + }, + { + displayName: 'Listener ARN Name or ID', + 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. Choose from the list, or specify an ID using an expression.', + }, + { + displayName: 'Certificate ARN', + name: 'certificateId', + type: 'string', + required: true, + displayOptions: { + show: { + resource: [ + 'listenerCertificate', + ], + operation: [ + 'add', + ], + }, + }, + default: '', + description: 'Unique identifier for a particular loadBalancer', + }, + + /* -------------------------------------------------------------------------- */ + /* listenerCertificate:getMany */ + /* -------------------------------------------------------------------------- */ + + { + displayName: 'Load Balancer ARN Name or ID', + name: 'loadBalancerId', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getLoadBalancers', + }, + required: true, + displayOptions: { + show: { + resource: [ + 'listenerCertificate', + ], + operation: [ + 'getMany', + ], + }, + }, + default: '', + description: 'Unique identifier for a particular loadBalancer. Choose from the list, or specify an ID using an expression.', + }, + { + displayName: 'Listener ARN Name or ID', + name: 'listenerId', + type: 'options', + required: true, + typeOptions: { + loadOptionsMethod: 'getLoadBalancerListeners', + loadOptionsDependsOn: [ + 'loadBalancerId', + ], + }, + displayOptions: { + show: { + resource: [ + 'listenerCertificate', + ], + operation: [ + 'getMany', + ], + }, + }, + default: '', + description: 'Unique identifier for a particular loadBalancer. Choose from the list, or specify an ID using an expression.', + }, + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + resource: [ + 'listenerCertificate', + ], + operation: [ + 'getMany', + ], + }, + }, + default: false, + description: 'Whether to return all results or only up to a given limit', + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + description: 'Max number of results to return', + default: 100, + typeOptions: { + maxValue: 400, + minValue: 1, + }, + displayOptions: { + show: { + resource: [ + 'listenerCertificate', + ], + operation: [ + 'getMany', + ], + returnAll: [ + false, + ], + }, + }, + }, + + /* -------------------------------------------------------------------------- */ + /* listenerCertificate:remove */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Load Balancer ARN Name or ID', + name: 'loadBalancerId', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getLoadBalancers', + }, + required: true, + displayOptions: { + show: { + resource: [ + 'listenerCertificate', + ], + operation: [ + 'remove', + ], + }, + }, + default: '', + description: 'Unique identifier for a particular loadBalancer. Choose from the list, or specify an ID using an expression.', + }, + { + displayName: 'Listener ARN Name or ID', + 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. Choose from the list, or specify an ID using an expression.', + }, + { + displayName: 'Certificate ARN', + name: 'certificateId', + type: 'string', + required: true, + displayOptions: { + show: { + resource: [ + 'listenerCertificate', + ], + operation: [ + 'remove', + ], + }, + }, + default: '', + description: 'Unique identifier for a particular loadBalancer', + }, + +]; diff --git a/packages/nodes-base/nodes/Aws/ELB/LoadBalancerDescription.ts b/packages/nodes-base/nodes/Aws/ELB/LoadBalancerDescription.ts new file mode 100644 index 0000000000..d9e3629a2b --- /dev/null +++ b/packages/nodes-base/nodes/Aws/ELB/LoadBalancerDescription.ts @@ -0,0 +1,353 @@ +import { + INodeProperties, +} from 'n8n-workflow'; + +export const loadBalancerOperations: INodeProperties[] = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + noDataExpression: true, + displayOptions: { + show: { + resource: [ + 'loadBalancer', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a load balancer', + action: 'Create a load balancer', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a load balancer', + action: 'Delete a load balancer', + }, + { + name: 'Get', + value: 'get', + description: 'Get a load balancer', + action: 'Get a load balancer', + }, + { + name: 'Get Many', + value: 'getMany', + description: 'Get many load balancers', + action: 'Get many load balancers', + }, + ], + default: 'create', + }, +]; + +export const loadBalancerFields: INodeProperties[] = [ + + /* -------------------------------------------------------------------------- */ + /* 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 ID Names or IDs', + name: 'subnets', + type: 'multiOptions', + description: 'Choose from the list, or specify IDs using an expression', + 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', + description: 'Choose from the list, or specify IDs using an expression', + 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:getMany */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + resource: [ + 'loadBalancer', + ], + operation: [ + 'getMany', + ], + }, + }, + default: false, + description: 'Whether to return all results or only up to a given limit', + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + description: 'Max number of results to return', + default: 100, + typeOptions: { + maxValue: 400, + minValue: 1, + }, + displayOptions: { + show: { + resource: [ + 'loadBalancer', + ], + operation: [ + 'getMany', + ], + returnAll: [ + false, + ], + }, + }, + }, + { + displayName: 'Filters', + name: 'filters', + type: 'collection', + placeholder: 'Add Filter', + displayOptions: { + show: { + operation: [ + 'getMany', + ], + 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', + }, +]; diff --git a/packages/nodes-base/nodes/Aws/ELB/elb.svg b/packages/nodes-base/nodes/Aws/ELB/elb.svg new file mode 100644 index 0000000000..d6bcabcb0d --- /dev/null +++ b/packages/nodes-base/nodes/Aws/ELB/elb.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/nodes-base/package.json b/packages/nodes-base/package.json index 668d4c891d..f2db52bec0 100644 --- a/packages/nodes-base/package.json +++ b/packages/nodes-base/package.json @@ -362,6 +362,7 @@ "dist/nodes/Aws/AwsSnsTrigger.node.js", "dist/nodes/Aws/Comprehend/AwsComprehend.node.js", "dist/nodes/Aws/DynamoDB/AwsDynamoDB.node.js", + "dist/nodes/Aws/ELB/AwsElb.node.js", "dist/nodes/Aws/Rekognition/AwsRekognition.node.js", "dist/nodes/Aws/S3/AwsS3.node.js", "dist/nodes/Aws/SES/AwsSes.node.js",