@cumulus/aws-client 18.2.1 → 18.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CloudFormationGateway.d.ts +3 -2
- package/CloudFormationGateway.js +1 -1
- package/Lambda.d.ts +10 -8
- package/Lambda.js +14 -10
- package/README.md +125 -103
- package/S3.d.ts +40 -31
- package/S3.js +69 -44
- package/SNS.d.ts +13 -4
- package/SNS.js +27 -9
- package/SQS.d.ts +13 -33
- package/SQS.js +43 -50
- package/STS.d.ts +5 -0
- package/STS.js +6 -0
- package/SecretsManager.js +1 -1
- package/StepFunctions.d.ts +17 -17
- package/StepFunctions.js +15 -14
- package/client.d.ts +1 -3
- package/client.js +1 -12
- package/lib/S3MultipartUploads.d.ts +3 -3
- package/package.json +17 -9
- package/services.d.ts +18 -16
- package/services.js +19 -40
- package/test-utils.d.ts +6 -8
- package/test-utils.js +6 -8
- package/types.d.ts +7 -2
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { CloudFormation } from '@aws-sdk/client-cloudformation';
|
|
1
2
|
declare class CloudFormationGateway {
|
|
2
3
|
private cloudFormationService;
|
|
3
|
-
constructor(cloudFormationService:
|
|
4
|
+
constructor(cloudFormationService: CloudFormation);
|
|
4
5
|
/**
|
|
5
6
|
* Get the status of a CloudFormation stack
|
|
6
7
|
*
|
|
7
8
|
* @param {string} StackName
|
|
8
9
|
* @returns {string} the stack status
|
|
9
10
|
*/
|
|
10
|
-
getStackStatus(StackName: string): Promise<
|
|
11
|
+
getStackStatus(StackName: string): Promise<import("@aws-sdk/client-cloudformation").StackStatus | undefined>;
|
|
11
12
|
}
|
|
12
13
|
export = CloudFormationGateway;
|
|
13
14
|
//# sourceMappingURL=CloudFormationGateway.d.ts.map
|
package/CloudFormationGateway.js
CHANGED
package/Lambda.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Lambda
|
|
3
3
|
*/
|
|
4
|
-
import { InvocationType } from '@aws-sdk/client-lambda';
|
|
4
|
+
import { InvocationType, InvokeCommandOutput } from '@aws-sdk/client-lambda';
|
|
5
|
+
import { EventBridgeEvent } from 'aws-lambda';
|
|
6
|
+
export declare type StepFunctionEventBridgeEvent = EventBridgeEvent<'Step Functions Execution Status Change', {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Bare check for EventBridge shape
|
|
11
|
+
*/
|
|
12
|
+
export declare const isEventBridgeEvent: (event: Object) => event is StepFunctionEventBridgeEvent;
|
|
5
13
|
/**
|
|
6
14
|
* Invoke a Lambda function
|
|
7
|
-
*
|
|
8
|
-
* @param {string} name - Lambda function name
|
|
9
|
-
* @param {any} payload - the payload to the Lambda function
|
|
10
|
-
* @param {string} type - the invocation type
|
|
11
|
-
* @returns {Promise<InvokeCommandOutput>}
|
|
12
|
-
* @alias module:Lambda.invoke
|
|
13
15
|
*/
|
|
14
|
-
export declare const invoke: (name: string, payload: unknown, type?: InvocationType) => Promise<
|
|
16
|
+
export declare const invoke: (name: string, payload: unknown, type?: InvocationType) => Promise<InvokeCommandOutput | undefined>;
|
|
15
17
|
//# sourceMappingURL=Lambda.d.ts.map
|
package/Lambda.js
CHANGED
|
@@ -3,33 +3,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.invoke = void 0;
|
|
6
|
+
exports.invoke = exports.isEventBridgeEvent = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* @module Lambda
|
|
9
|
+
*/
|
|
10
|
+
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
7
11
|
const logger_1 = __importDefault(require("@cumulus/logger"));
|
|
8
12
|
const services_1 = require("./services");
|
|
9
13
|
const test_utils_1 = require("./test-utils");
|
|
10
14
|
const log = new logger_1.default({ sender: 'aws-client/Lambda' });
|
|
15
|
+
/**
|
|
16
|
+
* Bare check for EventBridge shape
|
|
17
|
+
*/
|
|
18
|
+
const isEventBridgeEvent = (event) => (event instanceof Object
|
|
19
|
+
&& 'detail' in event);
|
|
20
|
+
exports.isEventBridgeEvent = isEventBridgeEvent;
|
|
11
21
|
/**
|
|
12
22
|
* Invoke a Lambda function
|
|
13
|
-
*
|
|
14
|
-
* @param {string} name - Lambda function name
|
|
15
|
-
* @param {any} payload - the payload to the Lambda function
|
|
16
|
-
* @param {string} type - the invocation type
|
|
17
|
-
* @returns {Promise<InvokeCommandOutput>}
|
|
18
|
-
* @alias module:Lambda.invoke
|
|
19
23
|
*/
|
|
20
24
|
const invoke = async (name, payload, type = 'Event') => {
|
|
21
25
|
if (process.env.IS_LOCAL || (0, test_utils_1.inTestMode)()) {
|
|
22
26
|
log.info(`Faking Lambda invocation for ${name}`);
|
|
23
|
-
return
|
|
27
|
+
return undefined;
|
|
24
28
|
}
|
|
25
29
|
log.info(`Invoking ${name}`);
|
|
26
30
|
let response;
|
|
27
31
|
try {
|
|
28
|
-
response = await (0, services_1.lambda)().
|
|
32
|
+
response = await (0, services_1.lambda)().send(new client_lambda_1.InvokeCommand({
|
|
29
33
|
FunctionName: name,
|
|
30
34
|
Payload: new TextEncoder().encode(JSON.stringify(payload)),
|
|
31
35
|
InvocationType: type,
|
|
32
|
-
});
|
|
36
|
+
}));
|
|
33
37
|
}
|
|
34
38
|
catch (error) {
|
|
35
39
|
log.error(`Error invoking ${name}`, error);
|
package/README.md
CHANGED
|
@@ -37,6 +37,8 @@ NODE_ENV=test
|
|
|
37
37
|
<dd></dd>
|
|
38
38
|
<dt><a href="#module_Kinesis">Kinesis</a></dt>
|
|
39
39
|
<dd></dd>
|
|
40
|
+
<dt><a href="#module_Lambda">Lambda</a></dt>
|
|
41
|
+
<dd></dd>
|
|
40
42
|
<dt><a href="#module_S3">S3</a></dt>
|
|
41
43
|
<dd></dd>
|
|
42
44
|
<dt><a href="#module_SNS">SNS</a></dt>
|
|
@@ -259,6 +261,26 @@ Describe a Kinesis stream.
|
|
|
259
261
|
| params.StreamName | <code>string</code> | A Kinesis stream name |
|
|
260
262
|
| retryOptions | <code>Object</code> | Options passed to p-retry module |
|
|
261
263
|
|
|
264
|
+
<a name="module_Lambda"></a>
|
|
265
|
+
|
|
266
|
+
## Lambda
|
|
267
|
+
|
|
268
|
+
* [Lambda](#module_Lambda)
|
|
269
|
+
* [~isEventBridgeEvent()](#module_Lambda..isEventBridgeEvent)
|
|
270
|
+
* [~invoke()](#module_Lambda..invoke)
|
|
271
|
+
|
|
272
|
+
<a name="module_Lambda..isEventBridgeEvent"></a>
|
|
273
|
+
|
|
274
|
+
### Lambda~isEventBridgeEvent()
|
|
275
|
+
Bare check for EventBridge shape
|
|
276
|
+
|
|
277
|
+
**Kind**: inner method of [<code>Lambda</code>](#module_Lambda)
|
|
278
|
+
<a name="module_Lambda..invoke"></a>
|
|
279
|
+
|
|
280
|
+
### Lambda~invoke()
|
|
281
|
+
Invoke a Lambda function
|
|
282
|
+
|
|
283
|
+
**Kind**: inner method of [<code>Lambda</code>](#module_Lambda)
|
|
262
284
|
<a name="module_S3"></a>
|
|
263
285
|
|
|
264
286
|
## S3
|
|
@@ -266,15 +288,16 @@ Describe a Kinesis stream.
|
|
|
266
288
|
* [S3](#module_S3)
|
|
267
289
|
* _static_
|
|
268
290
|
* ~~[.getS3Object](#module_S3.getS3Object) ⇒ <code>Promise</code>~~
|
|
269
|
-
* [.recursivelyDeleteS3Bucket](#module_S3.recursivelyDeleteS3Bucket) ⇒
|
|
291
|
+
* [.recursivelyDeleteS3Bucket](#module_S3.recursivelyDeleteS3Bucket) ⇒
|
|
270
292
|
* [.listS3ObjectsV2(params)](#module_S3.listS3ObjectsV2) ⇒ <code>Promise.<Array></code>
|
|
293
|
+
* [.listS3ObjectsV2Batch(params)](#module_S3.listS3ObjectsV2Batch)
|
|
271
294
|
* _inner_
|
|
272
295
|
* [~s3Join(...args)](#module_S3..s3Join) ⇒ <code>string</code>
|
|
273
296
|
* [~parseS3Uri(uri)](#module_S3..parseS3Uri) ⇒ <code>Object</code>
|
|
274
297
|
* [~buildS3Uri(bucket, key)](#module_S3..buildS3Uri) ⇒ <code>string</code>
|
|
275
298
|
* [~s3TagSetToQueryString(tagset)](#module_S3..s3TagSetToQueryString) ⇒ <code>string</code>
|
|
276
299
|
* [~deleteS3Object(bucket, key)](#module_S3..deleteS3Object) ⇒ <code>Promise</code>
|
|
277
|
-
* [~headObject(Bucket, Key, retryOptions)](#module_S3..headObject) ⇒
|
|
300
|
+
* [~headObject(Bucket, Key, retryOptions)](#module_S3..headObject) ⇒
|
|
278
301
|
* [~s3ObjectExists(params)](#module_S3..s3ObjectExists) ⇒ <code>Promise.<boolean></code>
|
|
279
302
|
* [~waitForObjectToExist(params)](#module_S3..waitForObjectToExist) ⇒ <code>Promise.<undefined></code>
|
|
280
303
|
* [~s3PutObject(params)](#module_S3..s3PutObject) ⇒ <code>Promise</code>
|
|
@@ -294,9 +317,9 @@ Describe a Kinesis stream.
|
|
|
294
317
|
* [~getJsonS3Object(bucket, key)](#module_S3..getJsonS3Object) ⇒ <code>Promise.<\*></code>
|
|
295
318
|
* [~fileExists(bucket, key)](#module_S3..fileExists) ⇒ <code>Promise</code>
|
|
296
319
|
* [~deleteS3Files(s3Objs)](#module_S3..deleteS3Files) ⇒ <code>Promise</code>
|
|
297
|
-
* [~deleteS3Buckets(buckets)](#module_S3..deleteS3Buckets) ⇒ <code>Promise</code>
|
|
298
320
|
* [~uploadS3FileStream(fileStream, bucket, key, s3opts)](#module_S3..uploadS3FileStream) ⇒ <code>Promise</code>
|
|
299
|
-
* [~listS3Objects(
|
|
321
|
+
* [~listS3Objects()](#module_S3..listS3Objects)
|
|
322
|
+
* [~deleteS3Buckets(buckets)](#module_S3..deleteS3Buckets) ⇒ <code>Promise</code>
|
|
300
323
|
* [~calculateObjectHash(params)](#module_S3..calculateObjectHash)
|
|
301
324
|
* [~validateS3ObjectChecksum(params)](#module_S3..validateS3ObjectChecksum) ⇒ <code>Promise.<boolean></code>
|
|
302
325
|
* [~getFileBucketAndKey(pathParams)](#module_S3..getFileBucketAndKey) ⇒ <code>Array.<string></code>
|
|
@@ -323,15 +346,15 @@ Gets an object from S3.
|
|
|
323
346
|
|
|
324
347
|
<a name="module_S3.recursivelyDeleteS3Bucket"></a>
|
|
325
348
|
|
|
326
|
-
### S3.recursivelyDeleteS3Bucket ⇒
|
|
349
|
+
### S3.recursivelyDeleteS3Bucket ⇒
|
|
327
350
|
Delete a bucket and all of its objects from S3
|
|
328
351
|
|
|
329
352
|
**Kind**: static property of [<code>S3</code>](#module_S3)
|
|
330
|
-
**Returns**:
|
|
353
|
+
**Returns**: the promised result of `S3.deleteBucket`
|
|
331
354
|
|
|
332
|
-
| Param |
|
|
333
|
-
| --- | --- |
|
|
334
|
-
| bucket |
|
|
355
|
+
| Param | Description |
|
|
356
|
+
| --- | --- |
|
|
357
|
+
| bucket | name of the bucket |
|
|
335
358
|
|
|
336
359
|
<a name="module_S3.listS3ObjectsV2"></a>
|
|
337
360
|
|
|
@@ -353,6 +376,24 @@ https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#listObjectsV2-pr
|
|
|
353
376
|
| --- | --- | --- |
|
|
354
377
|
| params | <code>Object</code> | params for the s3.listObjectsV2 call |
|
|
355
378
|
|
|
379
|
+
<a name="module_S3.listS3ObjectsV2Batch"></a>
|
|
380
|
+
|
|
381
|
+
### S3.listS3ObjectsV2Batch(params)
|
|
382
|
+
Fetch lazy list of S3 objects
|
|
383
|
+
|
|
384
|
+
listObjectsV2 is limited to 1,000 results per call. This function continues
|
|
385
|
+
listing objects until there are no more to be fetched.
|
|
386
|
+
|
|
387
|
+
The passed params must be compatible with the listObjectsV2 call.
|
|
388
|
+
|
|
389
|
+
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#listObjectsV2-property
|
|
390
|
+
|
|
391
|
+
**Kind**: static method of [<code>S3</code>](#module_S3)
|
|
392
|
+
|
|
393
|
+
| Param | Description |
|
|
394
|
+
| --- | --- |
|
|
395
|
+
| params | params for the s3.listObjectsV2 call |
|
|
396
|
+
|
|
356
397
|
<a name="module_S3..s3Join"></a>
|
|
357
398
|
|
|
358
399
|
### S3~s3Join(...args) ⇒ <code>string</code>
|
|
@@ -418,17 +459,17 @@ Delete an object from S3
|
|
|
418
459
|
|
|
419
460
|
<a name="module_S3..headObject"></a>
|
|
420
461
|
|
|
421
|
-
### S3~headObject(Bucket, Key, retryOptions) ⇒
|
|
462
|
+
### S3~headObject(Bucket, Key, retryOptions) ⇒
|
|
422
463
|
Get an object header from S3
|
|
423
464
|
|
|
424
465
|
**Kind**: inner method of [<code>S3</code>](#module_S3)
|
|
425
|
-
**Returns**:
|
|
466
|
+
**Returns**: returns response from `S3.headObject` as a promise
|
|
426
467
|
|
|
427
|
-
| Param |
|
|
428
|
-
| --- | --- |
|
|
429
|
-
| Bucket |
|
|
430
|
-
| Key |
|
|
431
|
-
| retryOptions |
|
|
468
|
+
| Param | Description |
|
|
469
|
+
| --- | --- |
|
|
470
|
+
| Bucket | name of bucket |
|
|
471
|
+
| Key | key for object (filepath + filename) |
|
|
472
|
+
| retryOptions | options to control retry behavior when an object does not exist. See https://github.com/tim-kos/node-retry#retryoperationoptions By default, retries will not be performed |
|
|
432
473
|
|
|
433
474
|
<a name="module_S3..s3ObjectExists"></a>
|
|
434
475
|
|
|
@@ -685,18 +726,6 @@ Delete files from S3
|
|
|
685
726
|
| --- | --- | --- |
|
|
686
727
|
| s3Objs | <code>Array</code> | An array of objects containing keys 'Bucket' and 'Key' |
|
|
687
728
|
|
|
688
|
-
<a name="module_S3..deleteS3Buckets"></a>
|
|
689
|
-
|
|
690
|
-
### S3~deleteS3Buckets(buckets) ⇒ <code>Promise</code>
|
|
691
|
-
Delete a list of buckets and all of their objects from S3
|
|
692
|
-
|
|
693
|
-
**Kind**: inner method of [<code>S3</code>](#module_S3)
|
|
694
|
-
**Returns**: <code>Promise</code> - the promised result of `S3.deleteBucket`
|
|
695
|
-
|
|
696
|
-
| Param | Type | Description |
|
|
697
|
-
| --- | --- | --- |
|
|
698
|
-
| buckets | <code>Array</code> | list of bucket names |
|
|
699
|
-
|
|
700
729
|
<a name="module_S3..uploadS3FileStream"></a>
|
|
701
730
|
|
|
702
731
|
### S3~uploadS3FileStream(fileStream, bucket, key, s3opts) ⇒ <code>Promise</code>
|
|
@@ -714,19 +743,21 @@ Upload the file associated with the given stream to an S3 bucket
|
|
|
714
743
|
|
|
715
744
|
<a name="module_S3..listS3Objects"></a>
|
|
716
745
|
|
|
717
|
-
### S3~listS3Objects(
|
|
746
|
+
### S3~listS3Objects()
|
|
718
747
|
List the objects in an S3 bucket
|
|
719
748
|
|
|
720
749
|
**Kind**: inner method of [<code>S3</code>](#module_S3)
|
|
721
|
-
|
|
722
|
-
object is represented as a JS object with the following attributes: `Key`,
|
|
723
|
-
`ETag`, `LastModified`, `Owner`, `Size`, `StorageClass`.
|
|
750
|
+
<a name="module_S3..deleteS3Buckets"></a>
|
|
724
751
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
752
|
+
### S3~deleteS3Buckets(buckets) ⇒ <code>Promise</code>
|
|
753
|
+
Delete a list of buckets and all of their objects from S3
|
|
754
|
+
|
|
755
|
+
**Kind**: inner method of [<code>S3</code>](#module_S3)
|
|
756
|
+
**Returns**: <code>Promise</code> - the promised result of `S3.deleteBucket`
|
|
757
|
+
|
|
758
|
+
| Param | Type | Description |
|
|
759
|
+
| --- | --- | --- |
|
|
760
|
+
| buckets | <code>Array</code> | list of bucket names |
|
|
730
761
|
|
|
731
762
|
<a name="module_S3..calculateObjectHash"></a>
|
|
732
763
|
|
|
@@ -842,102 +873,93 @@ Move an S3 object to another location in S3
|
|
|
842
873
|
<a name="module_SNS"></a>
|
|
843
874
|
|
|
844
875
|
## SNS
|
|
845
|
-
<a name="module_SNS..publishSnsMessage"></a>
|
|
846
876
|
|
|
847
|
-
|
|
877
|
+
* [SNS](#module_SNS)
|
|
878
|
+
* [~publishSnsMessageWithRetry(snsTopicArn, message, retryOptions)](#module_SNS..publishSnsMessageWithRetry) ⇒ <code>Promise.<undefined></code>
|
|
879
|
+
* [~createSnsTopic(snsTopicName)](#module_SNS..createSnsTopic) ⇒
|
|
880
|
+
|
|
881
|
+
<a name="module_SNS..publishSnsMessageWithRetry"></a>
|
|
882
|
+
|
|
883
|
+
### SNS~publishSnsMessageWithRetry(snsTopicArn, message, retryOptions) ⇒ <code>Promise.<undefined></code>
|
|
848
884
|
Publish a message to an SNS topic. Does not catch
|
|
849
885
|
errors, to allow more specific handling by the caller.
|
|
850
886
|
|
|
851
887
|
**Kind**: inner method of [<code>SNS</code>](#module_SNS)
|
|
852
888
|
|
|
853
|
-
| Param |
|
|
854
|
-
| --- | --- |
|
|
855
|
-
| snsTopicArn |
|
|
856
|
-
| message |
|
|
857
|
-
| retryOptions |
|
|
889
|
+
| Param | Description |
|
|
890
|
+
| --- | --- |
|
|
891
|
+
| snsTopicArn | SNS topic ARN |
|
|
892
|
+
| message | Message object |
|
|
893
|
+
| retryOptions | options to control retry behavior when publishing a message fails. See https://github.com/tim-kos/node-retry#retryoperationoptions |
|
|
894
|
+
|
|
895
|
+
<a name="module_SNS..createSnsTopic"></a>
|
|
896
|
+
|
|
897
|
+
### SNS~createSnsTopic(snsTopicName) ⇒
|
|
898
|
+
Create an SNS topic with a given name.
|
|
899
|
+
|
|
900
|
+
**Kind**: inner method of [<code>SNS</code>](#module_SNS)
|
|
901
|
+
**Returns**: - ARN of the created SNS topic
|
|
902
|
+
|
|
903
|
+
| Param | Description |
|
|
904
|
+
| --- | --- |
|
|
905
|
+
| snsTopicName | Name of the SNS topic |
|
|
858
906
|
|
|
859
907
|
<a name="module_SQS"></a>
|
|
860
908
|
|
|
861
909
|
## SQS
|
|
862
910
|
|
|
863
911
|
* [SQS](#module_SQS)
|
|
864
|
-
*
|
|
865
|
-
|
|
866
|
-
*
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
912
|
+
* [~createQueue()](#module_SQS..createQueue)
|
|
913
|
+
* [~sendSQSMessage()](#module_SQS..sendSQSMessage)
|
|
914
|
+
* [~receiveSQSMessages()](#module_SQS..receiveSQSMessages)
|
|
915
|
+
* [~isSQSRecordLike()](#module_SQS..isSQSRecordLike)
|
|
916
|
+
* [~parseSQSMessageBody()](#module_SQS..parseSQSMessageBody)
|
|
917
|
+
* [~deleteSQSMessage()](#module_SQS..deleteSQSMessage)
|
|
918
|
+
* [~sqsQueueExists()](#module_SQS..sqsQueueExists)
|
|
871
919
|
|
|
872
|
-
<a name="module_SQS
|
|
920
|
+
<a name="module_SQS..createQueue"></a>
|
|
873
921
|
|
|
874
|
-
### SQS
|
|
922
|
+
### SQS~createQueue()
|
|
875
923
|
Create an SQS Queue. Properly handles localstack queue URLs
|
|
876
924
|
|
|
877
|
-
**Kind**:
|
|
878
|
-
**Returns**: <code>Promise.<string></code> - the Queue URL
|
|
879
|
-
|
|
880
|
-
| Param | Type | Description |
|
|
881
|
-
| --- | --- | --- |
|
|
882
|
-
| QueueName | <code>string</code> | queue name |
|
|
883
|
-
|
|
925
|
+
**Kind**: inner method of [<code>SQS</code>](#module_SQS)
|
|
884
926
|
<a name="module_SQS..sendSQSMessage"></a>
|
|
885
927
|
|
|
886
|
-
### SQS~sendSQSMessage(
|
|
928
|
+
### SQS~sendSQSMessage()
|
|
887
929
|
Send a message to AWS SQS
|
|
888
930
|
|
|
889
931
|
**Kind**: inner method of [<code>SQS</code>](#module_SQS)
|
|
890
|
-
**Returns**: <code>Promise</code> - resolves when the messsage has been sent
|
|
891
|
-
|
|
892
|
-
| Param | Type | Description |
|
|
893
|
-
| --- | --- | --- |
|
|
894
|
-
| queueUrl | <code>string</code> | url of the SQS queue |
|
|
895
|
-
| message | <code>string</code> \| <code>Object</code> | either string or object message. If an object it will be serialized into a JSON string. |
|
|
896
|
-
| [logOverride] | <code>Logger</code> | optional Logger passed in for testing |
|
|
897
|
-
|
|
898
932
|
<a name="module_SQS..receiveSQSMessages"></a>
|
|
899
933
|
|
|
900
|
-
### SQS~receiveSQSMessages(
|
|
934
|
+
### SQS~receiveSQSMessages()
|
|
901
935
|
Receives SQS messages from a given queue. The number of messages received
|
|
902
936
|
can be set and the timeout is also adjustable.
|
|
903
937
|
|
|
904
938
|
**Kind**: inner method of [<code>SQS</code>](#module_SQS)
|
|
905
|
-
|
|
939
|
+
<a name="module_SQS..isSQSRecordLike"></a>
|
|
906
940
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
| queueUrl | <code>string</code> | | url of the SQS queue |
|
|
910
|
-
| options | <code>Object</code> | | options object |
|
|
911
|
-
| [options.numOfMessages] | <code>integer</code> | <code>1</code> | number of messages to read from the queue |
|
|
912
|
-
| [options.visibilityTimeout] | <code>integer</code> | <code>30</code> | number of seconds a message is invisible after read |
|
|
913
|
-
| [options.waitTimeSeconds] | <code>integer</code> | <code>0</code> | number of seconds to poll SQS queue (long polling) |
|
|
941
|
+
### SQS~isSQSRecordLike()
|
|
942
|
+
Bare check for SQS message Shape
|
|
914
943
|
|
|
915
|
-
<
|
|
944
|
+
**Kind**: inner method of [<code>SQS</code>](#module_SQS)
|
|
945
|
+
<a name="module_SQS..parseSQSMessageBody"></a>
|
|
916
946
|
|
|
917
|
-
### SQS~
|
|
918
|
-
|
|
947
|
+
### SQS~parseSQSMessageBody()
|
|
948
|
+
Extract SQS message body
|
|
919
949
|
|
|
920
950
|
**Kind**: inner method of [<code>SQS</code>](#module_SQS)
|
|
921
|
-
|
|
951
|
+
<a name="module_SQS..deleteSQSMessage"></a>
|
|
922
952
|
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
| queueUrl | <code>string</code> | url of the SQS queue |
|
|
926
|
-
| receiptHandle | <code>integer</code> | the unique identifier of the sQS message |
|
|
953
|
+
### SQS~deleteSQSMessage()
|
|
954
|
+
Delete a given SQS message from a given queue.
|
|
927
955
|
|
|
956
|
+
**Kind**: inner method of [<code>SQS</code>](#module_SQS)
|
|
928
957
|
<a name="module_SQS..sqsQueueExists"></a>
|
|
929
958
|
|
|
930
|
-
### SQS~sqsQueueExists(
|
|
959
|
+
### SQS~sqsQueueExists()
|
|
931
960
|
Test if an SQS queue exists
|
|
932
961
|
|
|
933
962
|
**Kind**: inner method of [<code>SQS</code>](#module_SQS)
|
|
934
|
-
**Returns**: <code>Promise.<boolean></code> - - a Promise that will resolve to a boolean indicating
|
|
935
|
-
if the queue exists
|
|
936
|
-
|
|
937
|
-
| Param | Type | Description |
|
|
938
|
-
| --- | --- | --- |
|
|
939
|
-
| queueUrl | <code>Object</code> | queue url |
|
|
940
|
-
|
|
941
963
|
<a name="module_STS"></a>
|
|
942
964
|
|
|
943
965
|
## STS
|
|
@@ -950,16 +972,16 @@ Test if an SQS queue exists
|
|
|
950
972
|
|
|
951
973
|
* [StepFunctions](#module_StepFunctions)
|
|
952
974
|
* _static_
|
|
953
|
-
* [.describeExecution(params)](#module_StepFunctions.describeExecution) ⇒ <code>Promise.<
|
|
954
|
-
* [.describeStateMachine(params)](#module_StepFunctions.describeStateMachine) ⇒ <code>Promise.<
|
|
955
|
-
* [.getExecutionHistory(params)](#module_StepFunctions.getExecutionHistory) ⇒ <code>Promise.<
|
|
975
|
+
* [.describeExecution(params)](#module_StepFunctions.describeExecution) ⇒ <code>Promise.<DescribeExecutionOutput></code>
|
|
976
|
+
* [.describeStateMachine(params)](#module_StepFunctions.describeStateMachine) ⇒ <code>Promise.<DescribeStateMachineOutput></code>
|
|
977
|
+
* [.getExecutionHistory(params)](#module_StepFunctions.getExecutionHistory) ⇒ <code>Promise.<GetExecutionHistoryOutput></code>
|
|
956
978
|
* [.listExecutions(params)](#module_StepFunctions.listExecutions) ⇒ <code>Promise.<Object></code>
|
|
957
979
|
* _inner_
|
|
958
980
|
* [~executionExists(executionArn)](#module_StepFunctions..executionExists) ⇒ <code>Promise.<boolean></code>
|
|
959
981
|
|
|
960
982
|
<a name="module_StepFunctions.describeExecution"></a>
|
|
961
983
|
|
|
962
|
-
### StepFunctions.describeExecution(params) ⇒ <code>Promise.<
|
|
984
|
+
### StepFunctions.describeExecution(params) ⇒ <code>Promise.<DescribeExecutionOutput></code>
|
|
963
985
|
Call StepFunctions DescribeExecution
|
|
964
986
|
|
|
965
987
|
See [StepFunctions.describeExecution()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/StepFunctions.html#describeExecution-property)
|
|
@@ -972,11 +994,11 @@ exponential backoff.
|
|
|
972
994
|
|
|
973
995
|
| Param | Type |
|
|
974
996
|
| --- | --- |
|
|
975
|
-
| params | <code>
|
|
997
|
+
| params | <code>DescribeExecutionInput</code> |
|
|
976
998
|
|
|
977
999
|
<a name="module_StepFunctions.describeStateMachine"></a>
|
|
978
1000
|
|
|
979
|
-
### StepFunctions.describeStateMachine(params) ⇒ <code>Promise.<
|
|
1001
|
+
### StepFunctions.describeStateMachine(params) ⇒ <code>Promise.<DescribeStateMachineOutput></code>
|
|
980
1002
|
Call StepFunctions DescribeStateMachine
|
|
981
1003
|
|
|
982
1004
|
See [StepFunctions.describeStateMachine()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/StepFunctions.html#describeStateMachine-property)
|
|
@@ -989,11 +1011,11 @@ exponential backoff.
|
|
|
989
1011
|
|
|
990
1012
|
| Param | Type |
|
|
991
1013
|
| --- | --- |
|
|
992
|
-
| params | <code>
|
|
1014
|
+
| params | <code>DescribeStateMachineInput</code> |
|
|
993
1015
|
|
|
994
1016
|
<a name="module_StepFunctions.getExecutionHistory"></a>
|
|
995
1017
|
|
|
996
|
-
### StepFunctions.getExecutionHistory(params) ⇒ <code>Promise.<
|
|
1018
|
+
### StepFunctions.getExecutionHistory(params) ⇒ <code>Promise.<GetExecutionHistoryOutput></code>
|
|
997
1019
|
Call StepFunctions GetExecutionHistory
|
|
998
1020
|
|
|
999
1021
|
See [StepFunctions.getExecutionHistory()](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/StepFunctions.html#getExecutionHistory-property)
|
|
@@ -1006,7 +1028,7 @@ exponential backoff.
|
|
|
1006
1028
|
|
|
1007
1029
|
| Param | Type |
|
|
1008
1030
|
| --- | --- |
|
|
1009
|
-
| params | <code>
|
|
1031
|
+
| params | <code>GetExecutionHistoryInput</code> |
|
|
1010
1032
|
|
|
1011
1033
|
<a name="module_StepFunctions.listExecutions"></a>
|
|
1012
1034
|
|
package/S3.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/// <reference types="node" />
|
|
5
5
|
import pRetry from 'p-retry';
|
|
6
6
|
import { Readable, TransformOptions } from 'stream';
|
|
7
|
-
import { CopyObjectCommandInput, DeleteObjectRequest, GetObjectCommandInput, GetObjectOutput, HeadObjectOutput,
|
|
7
|
+
import { CopyObjectCommandInput, DeleteObjectRequest, DeleteBucketCommandOutput, GetObjectCommandInput, GetObjectOutput, HeadObjectOutput, ListObjectsV2Request, ObjectCannedACL, PutObjectCommandInput, PutObjectRequest, S3, Tagging, ListObjectsCommandOutput } from '@aws-sdk/client-s3';
|
|
8
8
|
import { Options as UploadOptions } from '@aws-sdk/lib-storage';
|
|
9
9
|
import { s3 } from './services';
|
|
10
10
|
export declare type GetObjectMethod = (params: GetObjectCommandInput) => Promise<GetObjectOutput>;
|
|
@@ -57,14 +57,14 @@ export declare const deleteS3Objects: (params: {
|
|
|
57
57
|
/**
|
|
58
58
|
* Get an object header from S3
|
|
59
59
|
*
|
|
60
|
-
* @param
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
60
|
+
* @param Bucket - name of bucket
|
|
61
|
+
* @param Key - key for object (filepath + filename)
|
|
62
|
+
* @param retryOptions - options to control retry behavior when an
|
|
63
63
|
* object does not exist. See https://github.com/tim-kos/node-retry#retryoperationoptions
|
|
64
64
|
* By default, retries will not be performed
|
|
65
|
-
* @returns
|
|
65
|
+
* @returns returns response from `S3.headObject` as a promise
|
|
66
66
|
**/
|
|
67
|
-
export declare const headObject: (Bucket: string, Key: string, retryOptions?: pRetry.Options) => Promise<
|
|
67
|
+
export declare const headObject: (Bucket: string, Key: string, retryOptions?: pRetry.Options) => Promise<HeadObjectOutput>;
|
|
68
68
|
/**
|
|
69
69
|
* Test if an object exists in S3
|
|
70
70
|
*
|
|
@@ -268,20 +268,6 @@ export declare const fileExists: (bucket: string, key: string) => Promise<false
|
|
|
268
268
|
* from the deletion operations
|
|
269
269
|
*/
|
|
270
270
|
export declare const deleteS3Files: (s3Objs: DeleteObjectRequest[]) => Promise<import("@aws-sdk/client-s3").DeleteObjectCommandOutput[]>;
|
|
271
|
-
/**
|
|
272
|
-
* Delete a bucket and all of its objects from S3
|
|
273
|
-
*
|
|
274
|
-
* @param {string} bucket - name of the bucket
|
|
275
|
-
* @returns {Promise} the promised result of `S3.deleteBucket`
|
|
276
|
-
**/
|
|
277
|
-
export declare const recursivelyDeleteS3Bucket: (bucket: string) => Promise<import("@aws-sdk/client-s3").DeleteBucketCommandOutput>;
|
|
278
|
-
/**
|
|
279
|
-
* Delete a list of buckets and all of their objects from S3
|
|
280
|
-
*
|
|
281
|
-
* @param {Array} buckets - list of bucket names
|
|
282
|
-
* @returns {Promise} the promised result of `S3.deleteBucket`
|
|
283
|
-
**/
|
|
284
|
-
export declare const deleteS3Buckets: (buckets: Array<string>) => Promise<any>;
|
|
285
271
|
declare type FileInfo = {
|
|
286
272
|
filename: string;
|
|
287
273
|
key: string;
|
|
@@ -306,17 +292,8 @@ export declare const uploadS3FileStream: (fileStream: Readable, bucket: string,
|
|
|
306
292
|
}>;
|
|
307
293
|
/**
|
|
308
294
|
* List the objects in an S3 bucket
|
|
309
|
-
*
|
|
310
|
-
* @param {string} bucket - The name of the bucket
|
|
311
|
-
* @param {string} prefix - Only objects with keys starting with this prefix
|
|
312
|
-
* will be included (useful for searching folders in buckets, e.g., '/PDR')
|
|
313
|
-
* @param {boolean} skipFolders - If true don't return objects that are folders
|
|
314
|
-
* (defaults to true)
|
|
315
|
-
* @returns {Promise} A promise that resolves to the list of objects. Each S3
|
|
316
|
-
* object is represented as a JS object with the following attributes: `Key`,
|
|
317
|
-
* `ETag`, `LastModified`, `Owner`, `Size`, `StorageClass`.
|
|
318
295
|
*/
|
|
319
|
-
export declare const listS3Objects: (bucket: string, prefix?: string, skipFolders?: boolean) => Promise<
|
|
296
|
+
export declare const listS3Objects: (bucket: string, prefix?: string, skipFolders?: boolean) => Promise<ListObjectsCommandOutput['Contents']>;
|
|
320
297
|
/**
|
|
321
298
|
* Fetch complete list of S3 objects
|
|
322
299
|
*
|
|
@@ -333,7 +310,39 @@ export declare const listS3Objects: (bucket: string, prefix?: string, skipFolder
|
|
|
333
310
|
*
|
|
334
311
|
* @static
|
|
335
312
|
*/
|
|
336
|
-
export declare const listS3ObjectsV2: (params: ListObjectsV2Request) => Promise<
|
|
313
|
+
export declare const listS3ObjectsV2: (params: ListObjectsV2Request) => Promise<ListObjectsCommandOutput['Contents']>;
|
|
314
|
+
/**
|
|
315
|
+
* Fetch lazy list of S3 objects
|
|
316
|
+
*
|
|
317
|
+
* listObjectsV2 is limited to 1,000 results per call. This function continues
|
|
318
|
+
* listing objects until there are no more to be fetched.
|
|
319
|
+
*
|
|
320
|
+
* The passed params must be compatible with the listObjectsV2 call.
|
|
321
|
+
*
|
|
322
|
+
* https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#listObjectsV2-property
|
|
323
|
+
*
|
|
324
|
+
* @param params - params for the s3.listObjectsV2 call
|
|
325
|
+
* @yields a series of objects corresponding to
|
|
326
|
+
* the Contents property of the listObjectsV2 response
|
|
327
|
+
* batched to allow processing of one chunk at a time
|
|
328
|
+
*
|
|
329
|
+
* @static
|
|
330
|
+
*/
|
|
331
|
+
export declare function listS3ObjectsV2Batch(params: ListObjectsV2Request): AsyncIterable<ListObjectsCommandOutput['Contents']>;
|
|
332
|
+
/**
|
|
333
|
+
* Delete a bucket and all of its objects from S3
|
|
334
|
+
*
|
|
335
|
+
* @param bucket - name of the bucket
|
|
336
|
+
* @returns the promised result of `S3.deleteBucket`
|
|
337
|
+
**/
|
|
338
|
+
export declare const recursivelyDeleteS3Bucket: (bucket: string) => Promise<DeleteBucketCommandOutput>;
|
|
339
|
+
/**
|
|
340
|
+
* Delete a list of buckets and all of their objects from S3
|
|
341
|
+
*
|
|
342
|
+
* @param {Array} buckets - list of bucket names
|
|
343
|
+
* @returns {Promise} the promised result of `S3.deleteBucket`
|
|
344
|
+
**/
|
|
345
|
+
export declare const deleteS3Buckets: (buckets: Array<string>) => Promise<any>;
|
|
337
346
|
/**
|
|
338
347
|
* Calculate the cryptographic hash of an S3 object
|
|
339
348
|
*
|