From 9f94984926391391e4e632e9797eb4d3f7914b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Thu, 24 Jun 2021 22:21:13 +0200 Subject: [PATCH] :zap: Add bucket:delete operation to AWS S3 Node (#1936) --- .../nodes-base/nodes/Aws/S3/AwsS3.node.ts | 9 ++++++ .../nodes/Aws/S3/BucketDescription.ts | 28 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/packages/nodes-base/nodes/Aws/S3/AwsS3.node.ts b/packages/nodes-base/nodes/Aws/S3/AwsS3.node.ts index c71fc67e53..c20a37da2c 100644 --- a/packages/nodes-base/nodes/Aws/S3/AwsS3.node.ts +++ b/packages/nodes-base/nodes/Aws/S3/AwsS3.node.ts @@ -163,6 +163,15 @@ export class AwsS3 implements INodeType { returnData.push({ success: true }); } + + // https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html + if (operation === 'delete') { + const name = this.getNodeParameter('name', i) as string; + + responseData = await awsApiRequestSOAP.call(this, `${name}.s3`, 'DELETE', '', '', {}, headers); + returnData.push({ success: true }); + } + //https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html if (operation === 'getAll') { const returnAll = this.getNodeParameter('returnAll', 0) as boolean; diff --git a/packages/nodes-base/nodes/Aws/S3/BucketDescription.ts b/packages/nodes-base/nodes/Aws/S3/BucketDescription.ts index a6c8d67cd1..eb75893fbf 100644 --- a/packages/nodes-base/nodes/Aws/S3/BucketDescription.ts +++ b/packages/nodes-base/nodes/Aws/S3/BucketDescription.ts @@ -20,6 +20,11 @@ export const bucketOperations = [ value: 'create', description: 'Create a bucket', }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a bucket', + }, { name: 'Get All', value: 'getAll', @@ -152,6 +157,29 @@ export const bucketFields = [ }, ], }, + +/* -------------------------------------------------------------------------- */ +/* bucket:delete */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Name', + name: 'name', + type: 'string', + required: true, + default: '', + displayOptions: { + show: { + resource: [ + 'bucket', + ], + operation: [ + 'delete', + ], + }, + }, + description: 'Name of the AWS S3 bucket to delete.', + }, + /* -------------------------------------------------------------------------- */ /* bucket:getAll */ /* -------------------------------------------------------------------------- */